| eeshow/main.c |
| 31 | 31 | #include "kicad/pl.h" |
| 32 | 32 | #include "kicad/lib.h" |
| 33 | 33 | #include "kicad/sch.h" |
| 34 | #include "kicad/pro.h" |
| 34 | 35 | #include "gui/fmt-pango.h" |
| 35 | 36 | #include "file/git-hist.h" |
| 36 | 37 | #include "gui/gui.h" |
| ... | ... | |
| 75 | 76 | " %s gdb ...\n" |
| 76 | 77 | "\n" |
| 77 | 78 | " kicad_file [rev:]file.ext\n" |
| 78 | | " ext .lib, .sch, or .kicad_wks\n" |
| 79 | " ext .pro, .lib, .sch, or .kicad_wks\n" |
| 79 | 80 | " rev git revision\n" |
| 80 | 81 | "\n" |
| 81 | 82 | " -r recurse into sub-sheets\n" |
| ... | ... | |
| 120 | 121 | { |
| 121 | 122 | struct lib lib; |
| 122 | 123 | struct sch_ctx sch_ctx; |
| 123 | | struct file sch_file; |
| 124 | struct file pro_file, sch_file; |
| 124 | 125 | bool recurse = 0; |
| 125 | 126 | const char *cat = NULL; |
| 126 | 127 | const char *history = NULL; |
| ... | ... | |
| 132 | 133 | unsigned i; |
| 133 | 134 | bool have_dashdash = 0; |
| 134 | 135 | struct file_names file_names; |
| 136 | struct file_names *fn = &file_names; |
| 135 | 137 | int gfx_argc; |
| 136 | 138 | char **gfx_argv; |
| 137 | 139 | const struct gfx_ops **ops = ops_list; |
| ... | ... | |
| 221 | 223 | usage(*argv); |
| 222 | 224 | |
| 223 | 225 | classify_files(&file_names, argv + optind, dashdash - optind); |
| 224 | | if (!file_names.sch) |
| 225 | | fatal("top sheet name required"); |
| 226 | if (!file_names.pro && !file_names.sch) |
| 227 | fatal("project or top sheet name required"); |
| 226 | 228 | |
| 227 | 229 | if (!have_dashdash) { |
| 228 | 230 | optind = 0; /* reset getopt */ |
| 229 | 231 | return gui(&file_names, recurse, limit); |
| 230 | 232 | } |
| 231 | 233 | |
| 234 | if (file_names.pro) { |
| 235 | if (!file_open(&pro_file, file_names.pro, NULL)) |
| 236 | return 1; |
| 237 | fn = pro_parse_file(&pro_file, &file_names); |
| 238 | } |
| 239 | |
| 232 | 240 | sch_init(&sch_ctx, recurse); |
| 233 | | if (!file_open(&sch_file, file_names.sch, NULL)) |
| 241 | if (!file_open(&sch_file, fn->sch, file_names.pro ? &pro_file : NULL)) |
| 234 | 242 | return 1; |
| 235 | 243 | |
| 236 | 244 | lib_init(&lib); |
| 237 | | for (i = 0; i != file_names.n_libs; i++) |
| 238 | | if (!lib_parse(&lib, file_names.libs[i], &sch_file)) |
| 245 | for (i = 0; i != fn->n_libs; i++) |
| 246 | if (!lib_parse(&lib, fn->libs[i], &sch_file)) |
| 239 | 247 | return 1; |
| 240 | 248 | |
| 241 | | if (file_names.pl) { |
| 249 | if (fn->pl) { |
| 242 | 250 | struct file file; |
| 243 | 251 | |
| 244 | | if (!file_open(&file, file_names.pl, &sch_file)) |
| 252 | if (!file_open(&file, fn->pl, &sch_file)) |
| 245 | 253 | return 1; |
| 246 | 254 | pl = pl_parse(&file); |
| 247 | 255 | file_close(&file); |