spice.awk: handle per-instance .model lines of vector instances

This commit is contained in:
stefan schippers 2024-02-11 15:15:46 +01:00
parent 531a9c168c
commit 5f4401258f
2 changed files with 22 additions and 20 deletions

View File

@ -2006,19 +2006,20 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
my_strncpy(filename, "", PATH_MAX);
}
if(!is_gen && filename[0]) file_exists = !stat(filename, &buf);
dbg(1, "get_sch_from_sym(): fallback=%d, file_exists=%d\n", fallback, file_exists);
if(!is_gen && filename[0] && !file_exists && fallback && has_x) {
tclvareval("ask_save {Schematic ", filename, "\ndoes not exist.\nDescend into base schematic?}", NULL);
if(strcmp(tclresult(), "yes") ) fallback = 0;
if(!strcmp(tclresult(), "") ) {
my_strncpy(filename, "", PATH_MAX);
cancel = 1;
}
if(has_x && fallback && !is_gen && filename[0]) {
file_exists = !stat(filename, &buf);
if(!file_exists) {
tclvareval("ask_save {Schematic ", filename, "\ndoes not exist.\nDescend into base schematic?}", NULL);
if(strcmp(tclresult(), "yes") ) fallback = 0;
if(!strcmp(tclresult(), "") ) {
my_strncpy(filename, "", PATH_MAX);
cancel = 1;
}
}
}
/* no schematic attr from instance or symbol */
if(!cancel && (!str_tmp[0] || (!is_gen && filename[0] && !file_exists && fallback))) {
if(!cancel && (!str_tmp[0] || (fallback && !is_gen && filename[0] && !file_exists ))) {
const char *symname_tcl = tcl_hook2(sym->name);
if(is_generator(symname_tcl)) my_strncpy(filename, symname_tcl, PATH_MAX);
else if(tclgetboolvar("search_schematic")) {

View File

@ -27,14 +27,15 @@ BEGIN{
first=1
user_code=0 #20180129
# used to handle strange xyce primitives that have a type word before the instance name
xyceydev["ymemristor"] = 1
xyceydev["ylin"] = 1
xyceydev["ydelay"] = 1
xyceydev["ytransline"] = 1
xyceydev["ypgbr"] = 1
xyceydev["ypowergridbranch"] = 1
xyceydev["yacc"] = 1
# used to handle strange primitives that have a type word before the instance name
special_devs["ymemristor"] = 1
special_devs["ylin"] = 1
special_devs["ydelay"] = 1
special_devs["ytransline"] = 1
special_devs["ypgbr"] = 1
special_devs["ypowergridbranch"] = 1
special_devs["yacc"] = 1
special_devs[".model"] = 1
while( (ARGV[1] ~ /^[-]/) || (ARGV[1] ~ /^$/) ) {
if(ARGV[1] == "-xyce") { xyce = 1}
@ -279,8 +280,8 @@ function process( i,j, iprefix, saveinstr, savetype, saveanalysis)
gsub(","," ",$0)
print $0
} else {
# handle uncommon xyce primitives that have a prefix before the device name
if(tolower($1) in xyceydev) {
# handle uncommon primitives that have a prefix before the device name
if(tolower($1) in special_devs) {
devprefix = $1
num = split($3, name, ",")
$1 = ""