1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-04 23:37:33 +02:00
fped/fped.c
werner 9c68c0de34 - File>Save now saves to a file if a second name is given on the command line,
to stdout if not
- there's no reason anymore to disallow editing the offset in new-style
  measurements
- struct inst_ops is no longer opaque, so we can avoid adding even more silly
  little access functions and open-code straightforward callbacks
- (re)stuctured hover/click/drag logic in gui_tool.c
- added optional debugging output to gui_canvas.c
- don't let a vector's base be dragged onto the vector's own end or onto one
  of its children
- measurements can now be properly changed by dragging



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5414 99fdad57-331a-0410-800a-d7fa5415bdb3
2009-08-10 13:51:51 +00:00

84 lines
1.4 KiB
C

/*
* fped.c - Footprint editor, main function
*
* Written 2009 by Werner Almesberger
* Copyright 2009 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <stdio.h>
#include "cpp.h"
#include "util.h"
#include "error.h"
#include "obj.h"
#include "inst.h"
#include "gui.h"
extern void scan_empty(void);
extern int yyparse(void);
char *save_file = NULL;
static void load_file(const char *name)
{
reporter = report_parse_error;
run_cpp_on_file(name);
(void) yyparse();
}
static void usage(const char *name)
{
fprintf(stderr, "usage: %s [in_file [out_file]]\n", name);
exit(1);
}
int main(int argc, char **argv)
{
const char *name = *argv;
int error;
error = gui_init(&argc, &argv);
if (error)
return error;
switch (argc) {
case 1:
scan_empty();
(void) yyparse();
break;
case 3:
save_file = argv[2];
/* fall through */
case 2:
load_file(argv[1]);
break;
default:
usage(name);
}
if (!part_name)
part_name = stralloc("_");
reporter = report_to_stderr;
if (!instantiate())
return 1;
// inst_debug();
error = gui_main();
if (error)
return error;
// dump(stdout);
return 0;
}