summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-29 12:18:13 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-29 12:19:39 -0300
commit78862dd12143f561305069deae96e5f6e978ab8c (patch)
treec4aba973e48655977844144bb60c8d695e7e0969
parentfe3fc5e83bb99ddfabfeec7ecfdb6bb4ab482655 (diff)
downloadeeshow-78862dd12143f561305069deae96e5f6e978ab8c.tar.gz
eeshow-78862dd12143f561305069deae96e5f6e978ab8c.tar.bz2
eeshow-78862dd12143f561305069deae96e5f6e978ab8c.zip
remove option -r; option -1 to disable recursing
-1 is also implied if the graphics driver does not support multiple sheets.
-rw-r--r--DEMO6
-rw-r--r--Makefile2
-rw-r--r--README14
-rw-r--r--main.c87
4 files changed, 54 insertions, 55 deletions
diff --git a/DEMO b/DEMO
index 13291ec..2414491 100644
--- a/DEMO
+++ b/DEMO
@@ -28,7 +28,7 @@ qiv -t diff.png old.png new.png
# Interactively view the schematics
-eda-tools/eeshow/eeshow -r $LIBS neo900.sch
+eda-tools/eeshow/eeshow $LIBS neo900.sch
# Other projects: c4puter
@@ -39,10 +39,10 @@ git clone https://github.com/c4puter/motherboard.git
cd motherboard
git submodule init
git submodule update
-eeshow -r schlib/library/*.lib *.lib motherboard.sch
+eeshow schlib/library/*.lib *.lib motherboard.sch
# Other projects: Olimex A64-OLinuXino
git clone https://github.com/OLIMEX/OLINUXINO.git
cd OLINUXINO/HARDWARE/A64-OLinuXino/A64-OlinuXino_Rev_A
-eeshow -r A64-OlinuXino_Rev_A-cache.lib A64-OlinuXino_Rev_A.sch
+eeshow A64-OlinuXino_Rev_A-cache.lib A64-OlinuXino_Rev_A.sch
diff --git a/Makefile b/Makefile
index 71e13c6..cd58c0a 100644
--- a/Makefile
+++ b/Makefile
@@ -134,7 +134,7 @@ neo900.pdf: $(NAME) sch2pdf neo900-template.fig
$(NEO900_HW)/neo900.sch
pdf: $(NAME)
- ./eeshow -r $(NEO900_HW)/neo900.pro -- pdf -o neo900.pdf
+ ./eeshow $(NEO900_HW)/neo900.pro -- pdf -o neo900.pdf
#----- Regression test based on Neo900 schematics -----------------------------
diff --git a/README b/README
index 298c196..2bd978c 100644
--- a/README
+++ b/README
@@ -63,11 +63,11 @@ Invocation
The general form of invocation for rendering is as follows:
-eeshow [-r] [-e] file.lib ... file.sch -- format [options]
+eeshow [-1] [-e] file.lib ... file.sch -- format [options]
-Common if using PDF, the option -r can be used (after "eeshow") to
-recursively process sub-sheets. -e enables the rendering of additional
-information, e.g., pin types.
+Common if using PDF, the option -1 can be used (after "eeshow") to
+process only one sheet, not recursing into sub-sheets. -e enables
+the rendering of additional information, e.g., pin types.
For PDF and PNG, the options -s scale and -o output-file can be used to
control the size of the output and the output file. By default, eeshow
@@ -77,7 +77,7 @@ Examples:
eeshow test.lib test.sch -- png -s 2 -o test.png
-eeshow -r neo900.lib kicad-libs/components/powered.lib neo900.sch \
+eeshow neo900.lib kicad-libs/components/powered.lib neo900.sch \
-- pdf -o neo900.pdf
More details on the above example can be found in the file DEMO.
@@ -156,15 +156,13 @@ The basic invocation of GUI mode is as follows:
eeshow file.lib ... file.sch
-Add the option -r to recursively load sub-sheets of file.sch
-
If file.sch is in a git repository, eeshow automatically loads the
revision history. The depth of the history can be limited with the
option -N number-of-commits
Examples:
-eeshow -N 30 -r neo900.lib kicad-libs/components/powered.lib neo900.sch
+eeshow -N 30 neo900.lib kicad-libs/components/powered.lib neo900.sch
eeshow `sed -n '/pcbnew/q;/^LibName[0-9]*=/{s///;s/$/.lib/p;};d' anelok.pro` \
anelok.sch
diff --git a/main.c b/main.c
index cc56156..c0f7931 100644
--- a/main.c
+++ b/main.c
@@ -67,8 +67,8 @@ static void sexpr(void)
void usage(const char *name)
{
fprintf(stderr,
-"usage: %s [gtk_flags] [-r] [-N n] kicad_file ...\n"
-" %s [-r] [-e] [-v ...] kicad_file ...\n"
+"usage: %s [gtk_flags] [-1] [-N n] kicad_file ...\n"
+" %s [-1] [-e] [-v ...] kicad_file ...\n"
" %*s[-- driver_spec]\n"
" %s [-v ...] -C [rev:]file\n"
" %s [-v ...] -H path_into_repo\n"
@@ -80,8 +80,8 @@ void usage(const char *name)
" ext .pro, .lib, .sch, or .kicad_wks\n"
" rev git revision\n"
"\n"
+" -1 show only one sheet - do not recurse into sub-sheets\n"
" -e show extra information (e.g., pin types)\n"
-" -r recurse into sub-sheets\n"
" -v increase verbosity of diagnostic output\n"
" -C 'cat' the file to standard output\n"
" -H show history of repository on standard output\n"
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
struct sch_ctx sch_ctx;
struct file pro_file, sch_file;
bool extra = 0;
- bool recurse = 0;
+ bool one_sheet = 0;
const char *cat = NULL;
const char *history = NULL;
const char *fmt = NULL;
@@ -167,14 +167,14 @@ int main(int argc, char **argv)
if (!have_dashdash)
gtk_init(&argc, &argv);
- while ((c = getopt(dashdash, argv, "ervC:F:H:LN:OPSV")) != EOF)
+ while ((c = getopt(dashdash, argv, "1evC:F:H:LN:OPSV")) != EOF)
switch (c) {
+ case '1':
+ one_sheet = 1;
+ break;
case 'e':
extra = 1;
break;
- case 'r':
- recurse = 1;
- break;
case 'v':
verbose++;
break;
@@ -244,7 +244,28 @@ int main(int argc, char **argv)
if (!have_dashdash) {
optind = 0; /* reset getopt */
- return run_gui(&file_names, recurse, limit);
+ return run_gui(&file_names, !one_sheet, limit);
+ }
+
+ if (dashdash == argc) {
+ gfx_argc = 1;
+ gfx_argv = alloc_type_n(char *, 2);
+ gfx_argv[0] = (char *) (*ops)->name;
+ gfx_argv[1] = NULL;
+ } else {
+ gfx_argc = argc - dashdash - 1;
+ if (!gfx_argc)
+ usage(*argv);
+ gfx_argv = alloc_type_n(char *, gfx_argc + 1);
+ memcpy(gfx_argv, argv + dashdash + 1,
+ sizeof(const char *) * (gfx_argc + 1));
+
+ for (ops = ops_list; ops != ARRAY_END(ops_list); ops++)
+ if (!strcmp((*ops)->name, *gfx_argv))
+ goto found;
+ fatal("graphics backend \"%s\" not found\n", *gfx_argv);
+found:
+ ;
}
if (file_names.pro) {
@@ -253,7 +274,13 @@ int main(int argc, char **argv)
fn = pro_parse_file(&pro_file, &file_names);
}
- sch_init(&sch_ctx, recurse);
+ gfx = gfx_init(*ops);
+ if (!gfx_args(gfx, gfx_argc, gfx_argv))
+ return 1;
+ if (!gfx_multi_sheet(gfx))
+ one_sheet = 1;
+
+ sch_init(&sch_ctx, !one_sheet);
if (!file_open(&sch_file, fn->sch, file_names.pro ? &pro_file : NULL))
return 1;
@@ -283,39 +310,19 @@ int main(int argc, char **argv)
}
free_file_names(&file_names);
- if (dashdash == argc) {
- gfx_argc = 1;
- gfx_argv = alloc_type_n(char *, 2);
- gfx_argv[0] = (char *) (*ops)->name;
- gfx_argv[1] = NULL;
- } else {
- gfx_argc = argc - dashdash - 1;
- if (!gfx_argc)
- usage(*argv);
- gfx_argv = alloc_type_n(char *, gfx_argc + 1);
- memcpy(gfx_argv, argv + dashdash + 1,
- sizeof(const char *) * (gfx_argc + 1));
-
- for (ops = ops_list; ops != ARRAY_END(ops_list); ops++)
- if (!strcmp((*ops)->name, *gfx_argv))
- goto found;
- fatal("graphics backend \"%s\" not found\n", *gfx_argv);
-found:
- ;
- }
-
if (!sch_parse(&sch_ctx, &sch_file, &lib, NULL))
return 1;
file_close(&sch_file);
- gfx = gfx_init(*ops);
- if (!gfx_args(gfx, gfx_argc, gfx_argv))
- return 1;
- if (recurse) {
+ if (one_sheet) {
+ sch_render(sch_ctx.sheets, gfx);
+ if (extra)
+ sch_render_extra(sch_ctx.sheets, gfx);
+ if (pl)
+ pl_render(pl, gfx, sch_ctx.sheets, sch_ctx.sheets);
+ } else {
const struct sheet *sheet;
- if (!gfx_multi_sheet(gfx))
- fatal("graphics backend only supports single sheet\n");
for (sheet = sch_ctx.sheets; sheet; sheet = sheet->next) {
gfx_sheet_name(gfx, sheet->title);
sch_render(sheet, gfx);
@@ -326,12 +333,6 @@ found:
if (sheet->next)
gfx_new_sheet(gfx);
}
- } else {
- sch_render(sch_ctx.sheets, gfx);
- if (extra)
- sch_render_extra(sch_ctx.sheets, gfx);
- if (pl)
- pl_render(pl, gfx, sch_ctx.sheets, sch_ctx.sheets);
}
retval = gfx_end(gfx);