diff --git a/src/actions.c b/src/actions.c index cdbc2757..24c23ff8 100644 --- a/src/actions.c +++ b/src/actions.c @@ -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")) { diff --git a/src/spice.awk b/src/spice.awk index f0d5bb82..16da5753 100755 --- a/src/spice.awk +++ b/src/spice.awk @@ -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 = ""