enhance spice_sym_def used in instances (with schematic=...) by substituting @param with values defined in instance if any (param=xxx)

This commit is contained in:
stefan schippers 2024-06-14 08:55:35 +02:00
parent f267077e99
commit fa4d4a0970
2 changed files with 11 additions and 1 deletions

View File

@ -1957,6 +1957,8 @@ void get_additional_symbols(int what)
if(xctx->tok_size && xctx->inst[i].ptr>= 0) { /* token exists and instance points to valid symbol */
int j;
char *sym = NULL;
char *templ = NULL;
char *symname_attr = NULL;
int ignore_schematic = 0;
xSymbol *symptr = xctx->inst[i].ptr + xctx->sym;
my_strdup2(_ALLOC_ID_, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0));
@ -1973,6 +1975,14 @@ void get_additional_symbols(int what)
my_strdup2(_ALLOC_ID_, &sym, add_ext(rel_sym_path(sch), ".sym"));
}
my_strdup2(_ALLOC_ID_, &templ, get_tok_value(symptr->prop_ptr, "template", 0));
my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(sym, 0), NULL);
my_strdup(_ALLOC_ID_, &spice_sym_def,
translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr,
templ,
symname_attr));
my_free(_ALLOC_ID_, &templ);
my_free(_ALLOC_ID_, &symname_attr);
/* if instance symbol has default_schematic set to ignore copy the symbol anyway, since
* the base symbol will not be netlisted by *_block_netlist() */
found = ignore_schematic ? NULL : int_hash_lookup(&sym_table, sym, 0, XLOOKUP);

View File

@ -1845,7 +1845,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result)
my_strdup2(_ALLOC_ID_, &symname, xctx->sym[symbol].name);
}
my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(symname, 0), NULL);
translated_sym_def = translate3(spice_sym_def, 1, "",
translated_sym_def = translate3(spice_sym_def, 1, xctx->inst[inst].prop_ptr,
templ,
symname_attr);
strtolower(symname);