mirror of
git://projects.qi-hardware.com/fped.git
synced 2025-04-21 12:27:27 +03:00
- vector labels are already in a per-frame namespace, so we don't need to add
the frame name when auto-generating them - moved file I/O from gui.c to file.c - ps_line used the wrong endpoint coordinate - option -k makes fped write KiCad non-interactively - option -p makes fped write Postscript non-interactively git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5418 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
47
fped.c
47
fped.c
@@ -13,19 +13,21 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cpp.h"
|
||||
#include "util.h"
|
||||
#include "error.h"
|
||||
#include "obj.h"
|
||||
#include "inst.h"
|
||||
#include "file.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
extern void scan_empty(void);
|
||||
extern int yyparse(void);
|
||||
|
||||
char *save_file = NULL;
|
||||
char *save_file_name = NULL;
|
||||
|
||||
|
||||
static void load_file(const char *name)
|
||||
@@ -38,7 +40,9 @@ static void load_file(const char *name)
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [in_file [out_file]]\n", name);
|
||||
fprintf(stderr, "usage: %s [-k|-p] [in_file [out_file]]\n\n", name);
|
||||
fprintf(stderr, " -k write KiCad output, then exit\n");
|
||||
fprintf(stderr, " -p write Postscript output, then exit\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -47,20 +51,39 @@ int main(int argc, char **argv)
|
||||
{
|
||||
const char *name = *argv;
|
||||
int error;
|
||||
int batch_write_kicad = 0, batch_write_ps = 0;
|
||||
int c;
|
||||
|
||||
error = gui_init(&argc, &argv);
|
||||
if (error)
|
||||
return error;
|
||||
switch (argc) {
|
||||
case 1:
|
||||
|
||||
while ((c = getopt(argc, argv, "kp")) != EOF)
|
||||
switch (c) {
|
||||
case 'k':
|
||||
batch_write_kicad = 1;
|
||||
break;
|
||||
case 'p':
|
||||
batch_write_ps = 1;
|
||||
break;
|
||||
default:
|
||||
usage(name);
|
||||
}
|
||||
|
||||
switch (argc-optind) {
|
||||
case 0:
|
||||
scan_empty();
|
||||
(void) yyparse();
|
||||
break;
|
||||
case 3:
|
||||
save_file = argv[2];
|
||||
/* fall through */
|
||||
case 1:
|
||||
load_file(argv[optind]);
|
||||
save_file_name = argv[optind];
|
||||
break;
|
||||
case 2:
|
||||
load_file(argv[1]);
|
||||
load_file(argv[optind]);
|
||||
save_file_name = argv[optind+1];
|
||||
if (!strcmp(save_file_name, "-"))
|
||||
save_file_name = NULL;
|
||||
break;
|
||||
default:
|
||||
usage(name);
|
||||
@@ -72,6 +95,14 @@ int main(int argc, char **argv)
|
||||
reporter = report_to_stderr;
|
||||
if (!instantiate())
|
||||
return 1;
|
||||
|
||||
if (batch_write_kicad)
|
||||
write_kicad();
|
||||
if (batch_write_ps)
|
||||
write_ps();
|
||||
if (batch_write_kicad || batch_write_ps)
|
||||
exit(0);
|
||||
|
||||
// inst_debug();
|
||||
error = gui_main();
|
||||
if (error)
|
||||
|
||||
Reference in New Issue
Block a user