From 4311ac424a55007633008ebe2710b301fe406f79 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Thu, 3 Oct 2024 13:08:32 +0200 Subject: [PATCH] handle NULL analysis type in debug messages (extra_rawfile()), recursive value substitution in symbol displayed strings: if translated text begins with @ search for recursive upper level definitions for text following @, example: @model symbol text, instance has model=@modeln, upper instance has modeln=nfet: resolve symbol text and display "@model" as "nfet", proc inutile: add optional wait argument to block xschem while dialog displayed --- src/save.c | 4 ++-- src/token.c | 9 ++++++--- src/xschem.tcl | 9 ++++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/save.c b/src/save.c index d3bcf9e9..2116a15f 100644 --- a/src/save.c +++ b/src/save.c @@ -1173,7 +1173,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d xctx->extra_prev_idx = xctx->extra_idx; xctx->extra_idx = i; } else { - dbg(1, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type); + dbg(1, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type ? type : ""); ret = 0; } } else if(file && isonlydigit(file) ) { @@ -1185,7 +1185,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d xctx->extra_prev_idx = xctx->extra_idx; xctx->extra_idx = i; } else { - dbg(0, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type); + dbg(0, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type ? type : ""); ret = 0; } } else { /* switch to next */ diff --git a/src/token.c b/src/token.c index 3c0f6d25..1049c546 100644 --- a/src/token.c +++ b/src/token.c @@ -4215,14 +4215,17 @@ const char *translate(int inst, const char* s) } else { int i = level; my_strdup2(_ALLOC_ID_, &value1, value); - /* recursive substitution of value using parent level prop_str attributes */ + /* recursive substitution of value using parent level prop_ptr attributes */ while(i > 0) { - const char *tok = get_tok_value(lcc[i-1].prop_ptr, value1, 0); + char *v = value1; + const char *tok; + if(v && v[0] == '@') v++; + tok = get_tok_value(lcc[i-1].prop_ptr, v, 0); if(xctx->tok_size && tok[0]) { dbg(1, "tok=%s\n", tok); my_strdup2(_ALLOC_ID_, &value1, tok); } else { - tok = get_tok_value(lcc[i-1].templ, value1, 0); + tok = get_tok_value(lcc[i-1].templ, v, 0); if(xctx->tok_size && tok[0]) { dbg(1, "from parent template: tok=%s\n", tok); my_strdup2(_ALLOC_ID_, &value1, tok); diff --git a/src/xschem.tcl b/src/xschem.tcl index 02094ed4..48918f5a 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -140,9 +140,12 @@ proc inutile_translate {f} { cd $savedir } -proc inutile { {filename {}}} { +proc inutile { {filename {}} {wait {}} } { global XSCHEM_SHAREDIR retval netlist_dir + if {$wait ne {}} { + xschem set semaphore [expr {[xschem get semaphore] +1}] + } if { ![string compare $filename ""] } then { tk_messageBox -type ok -message "Please give a file name as argument" return @@ -195,6 +198,10 @@ proc inutile { {filename {}}} { inutile_alias_window .inutile.tw$i [lindex $tmp 1] } } + if {$wait ne {}} { + tkwait window .inutile + xschem set semaphore [expr {[xschem get semaphore] -1}] + } } ### End INUTILE integration