mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 07:47:10 +02:00
genex: option -D to dump all canonical component names (for missing-in-tree)
This commit is contained in:
parent
1d47668b98
commit
7d97a749f4
24
genex/comp.c
24
genex/comp.c
@ -223,7 +223,7 @@ void set_libs(struct node *node,
|
||||
}
|
||||
|
||||
|
||||
static void dump_level(const struct node *tree, int level)
|
||||
static void dump_tree_level(const struct node *tree, int level)
|
||||
{
|
||||
const struct node *n;
|
||||
const struct line *line;
|
||||
@ -240,12 +240,30 @@ static void dump_level(const struct node *tree, int level)
|
||||
printf("\n");
|
||||
for (line = n->comment; line; line = line->next)
|
||||
printf("%*s\"%s\"\n", 4*level+2, "", line->s);
|
||||
dump_level(n->child, level+1);
|
||||
dump_tree_level(n->child, level+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dump_tree(void)
|
||||
{
|
||||
dump_level(tree, 0);
|
||||
dump_tree_level(tree, 0);
|
||||
}
|
||||
|
||||
|
||||
static void dump_comp_level(const struct node *tree)
|
||||
{
|
||||
const struct node *n;
|
||||
|
||||
for (n = tree; n; n = n->next) {
|
||||
if (n->lib)
|
||||
printf("%s\n", n->names->s);
|
||||
dump_comp_level(n->child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dump_comp(void)
|
||||
{
|
||||
dump_comp_level(tree);
|
||||
}
|
||||
|
@ -43,5 +43,6 @@ void set_libs(struct node *node,
|
||||
const char *(*find_lib)(const char *sym, const struct name **names,
|
||||
int *units));
|
||||
void dump_tree(void);
|
||||
void dump_comp(void);
|
||||
|
||||
#endif /* !COMP_H */
|
||||
|
@ -23,9 +23,10 @@
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-d] [-p] [-P] [-L libdir ...] [-l lib ...] hierarchy\n"
|
||||
"usage: %s [-d|-D] [-p] [-P] [-L libdir ...] [-l lib ...] hierarchy\n"
|
||||
" %*s [descriptions ...]\n\n"
|
||||
" -d dump the tree instead of generating a PDF\n"
|
||||
" -D dump all the canonical component names (without aliases)\n"
|
||||
" -L libdir search all libraries in the specified directory\n"
|
||||
" -l lib search the specified component library\n"
|
||||
" -p use portrait orientation; default: landscape\n"
|
||||
@ -39,13 +40,16 @@ int main(int argc, char **argv)
|
||||
{
|
||||
FILE *file;
|
||||
int c;
|
||||
int dump = 0, postscript = 0, portrait = 0;
|
||||
int opt_dump_tree = 0, opt_dump_comp = 0, postscript = 0, portrait = 0;
|
||||
char **arg;
|
||||
|
||||
while ((c = getopt(argc, argv, "dL:l:Pp")) != EOF)
|
||||
while ((c = getopt(argc, argv, "dDL:l:Pp")) != EOF)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
dump = 1;
|
||||
opt_dump_tree = 1;
|
||||
break;
|
||||
case 'D':
|
||||
opt_dump_comp = 1;
|
||||
break;
|
||||
case 'L':
|
||||
add_libdir(optarg);
|
||||
@ -63,6 +67,9 @@ int main(int argc, char **argv)
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
if (opt_dump_tree && opt_dump_comp)
|
||||
usage(*argv);
|
||||
|
||||
switch (argc-optind) {
|
||||
case 1:
|
||||
case 2:
|
||||
@ -89,8 +96,10 @@ int main(int argc, char **argv)
|
||||
read_desc(file);
|
||||
fclose(file);
|
||||
}
|
||||
if (dump)
|
||||
if (opt_dump_tree)
|
||||
dump_tree();
|
||||
else if (opt_dump_comp)
|
||||
dump_comp();
|
||||
else
|
||||
make_pdf(!postscript, portrait);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user