1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 04:41:32 +02:00

gencat/: make library selection variable

For future addition of other types of libraries.
This commit is contained in:
Werner Almesberger 2012-07-12 00:29:21 -03:00
parent 9c0a43e29b
commit 9cf8adf878
3 changed files with 8 additions and 7 deletions

View File

@ -43,6 +43,7 @@ static void usage(const char *name)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct lib *lib = &comp_lib;
FILE *file; FILE *file;
int c; int c;
int opt_dump_tree = 0, opt_dump_comp = 0, postscript = 0, portrait = 0; int opt_dump_tree = 0, opt_dump_comp = 0, postscript = 0, portrait = 0;
@ -57,10 +58,10 @@ int main(int argc, char **argv)
opt_dump_comp = 1; opt_dump_comp = 1;
break; break;
case 'L': case 'L':
add_libdir(&comp_lib, optarg); add_libdir(lib, optarg);
break; break;
case 'l': case 'l':
add_lib(&comp_lib, optarg); add_lib(lib, optarg);
break; break;
case 'P': case 'P':
postscript = 1; postscript = 1;
@ -93,7 +94,7 @@ int main(int argc, char **argv)
} }
read_tree(file); read_tree(file);
fclose(file); fclose(file);
set_libs(tree); set_libs(lib, tree);
for (arg = argv+optind+1; *arg; arg++) { for (arg = argv+optind+1; *arg; arg++) {
file = fopen(*arg, "r"); file = fopen(*arg, "r");

View File

@ -204,18 +204,18 @@ void read_desc(FILE *file)
} }
void set_libs(struct node *node) void set_libs(const struct lib *lib, struct node *node)
{ {
while (node) { while (node) {
if (!node->child) { if (!node->child) {
node->e = lookup_sym(&comp_lib, node->name); node->e = lookup_sym(lib, node->name);
if (!node->e) { if (!node->e) {
fprintf(stderr, "symbol %s not found\n", fprintf(stderr, "symbol %s not found\n",
node->name); node->name);
exit(1); exit(1);
} }
} }
set_libs(node->child); set_libs(lib, node->child);
node = node->next; node = node->next;
} }
} }

View File

@ -36,7 +36,7 @@ extern struct node *tree;
void read_tree(FILE *file); void read_tree(FILE *file);
void read_desc(FILE *file); void read_desc(FILE *file);
void set_libs(struct node *node); void set_libs(const struct lib *lib, struct node *node);
void dump_tree(void); void dump_tree(void);
void dump_comp(void); void dump_comp(void);