diff --git a/src/actions.c b/src/actions.c index e1e48116..7dc69e76 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1212,7 +1212,8 @@ const char *get_sym_name(int inst, int ext) const char *sym, *sch; sch = get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 0); - if(xctx->tok_size) { /* token exists */ + if(!sch[0]) sch = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "schematic", 0); + if(xctx->tok_size) { /* token exists */ if(ext) sym = get_cell_w_ext(add_ext(rel_sym_path(sch), ".sym"), 0); else sym = skip_dir(add_ext(rel_sym_path(sch), ".sym")); } diff --git a/src/psprint.c b/src/psprint.c index 381e81b7..d85ef41c 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -804,7 +804,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, "/Subtype /Link " "/ANN pdfmark\n", x1, y1, x2, y2, - add_ext(get_sym_name(n, 0), ".sch")); + sanitize(get_sym_name(n, 0))); } } } @@ -1075,8 +1075,7 @@ void create_ps(char **psfile, int what) fprintf(fd, "[ " "/Dest /%s " - "/DEST pdfmark\n", get_cell_w_ext(xctx->current_name, 0)); - + "/DEST pdfmark\n", get_cell_w_ext(sanitize(xctx->current_name), 0)); scaley = scale = (pagey-2 * margin) / dy; dbg(1, "scale=%g pagex=%g pagey=%g dx=%g dy=%g\n", scale, pagex, pagey, dx, dy); if(dx * scale > (pagex - 2 * margin)) { diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 11a3821f..544964b8 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -85,12 +85,13 @@ void hier_psprint(char **res, int what) /* netlister driver */ { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); - if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) + get_sch_from_sym(filename, xctx->sym + i, -1); + if (str_hash_lookup(&subckt_table, filename, "", XLOOKUP)==NULL) { - str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); - get_sch_from_sym(filename, xctx->sym + i, -1); - if(!stat(filename, &buf)) { + str_hash_lookup(&subckt_table, filename, "", XINSERT); + if(is_generator(filename) || !stat(filename, &buf)) { /* for printing we go down to bottom regardless of spice_stop attribute */ + dbg(1, "hier_psprint(): loading file: |%s|\n", filename); load_schematic(1,filename, 0, 1); zoom_full(0, 0, 1, 0.97); if(what & 1) ps_draw(2); /* page */