Date:2016-08-23 03:42:52 (7 years 3 months ago)
Author:Werner Almesberger
Commit:1a4c62da314be46691f6f4ff1ab8ea33ba81ef16
Message:eshow/main.c: support using project file as leader (instead of top sheet)

Files: eeshow/main.c (5 diffs)

Change Details

eeshow/main.c
3131#include "kicad/pl.h"
3232#include "kicad/lib.h"
3333#include "kicad/sch.h"
34#include "kicad/pro.h"
3435#include "gui/fmt-pango.h"
3536#include "file/git-hist.h"
3637#include "gui/gui.h"
...... 
7576" %s gdb ...\n"
7677"\n"
7778" kicad_file [rev:]file.ext\n"
78" ext .lib, .sch, or .kicad_wks\n"
79" ext .pro, .lib, .sch, or .kicad_wks\n"
7980" rev git revision\n"
8081"\n"
8182" -r recurse into sub-sheets\n"
...... 
120121{
121122    struct lib lib;
122123    struct sch_ctx sch_ctx;
123    struct file sch_file;
124    struct file pro_file, sch_file;
124125    bool recurse = 0;
125126    const char *cat = NULL;
126127    const char *history = NULL;
...... 
132133    unsigned i;
133134    bool have_dashdash = 0;
134135    struct file_names file_names;
136    struct file_names *fn = &file_names;
135137    int gfx_argc;
136138    char **gfx_argv;
137139    const struct gfx_ops **ops = ops_list;
...... 
221223        usage(*argv);
222224
223225    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");
226228
227229    if (!have_dashdash) {
228230        optind = 0; /* reset getopt */
229231        return gui(&file_names, recurse, limit);
230232    }
231233
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
232240    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))
234242        return 1;
235243
236244    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))
239247            return 1;
240248
241    if (file_names.pl) {
249    if (fn->pl) {
242250        struct file file;
243251
244        if (!file_open(&file, file_names.pl, &sch_file))
252        if (!file_open(&file, fn->pl, &sch_file))
245253            return 1;
246254        pl = pl_parse(&file);
247255        file_close(&file);

Archive Download the corresponding diff file

Branches:
master



interactive