execute tcleval(...) wrapped attributes in global tcl context, fix a bug (chopped newlines) in tclpropeval2 tcl proc
This commit is contained in:
parent
46f5f9356a
commit
f9ef05eabe
16
src/token.c
16
src/token.c
|
|
@ -1638,7 +1638,7 @@ void print_spice_element(FILE *fd, int inst)
|
|||
int tok_val_len;
|
||||
|
||||
dbg(1, "print_spice_element(): token: |%s|\n", token);
|
||||
value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0);
|
||||
value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 2);
|
||||
tok_val_len = strlen(value);
|
||||
|
||||
if(!strcmp(token, "@spiceprefix")) {
|
||||
|
|
@ -1650,12 +1650,14 @@ void print_spice_element(FILE *fd, int inst)
|
|||
|
||||
if (!xctx->get_tok_size) value=get_tok_value(template, token+1, 0);
|
||||
token_exists = xctx->get_tok_size;
|
||||
if (!strncmp(value,"tcleval(", 8)) {
|
||||
dbg(1, "print_spice_element(): value=%s\n", value);
|
||||
my_strdup2(466, &translatedvalue, value);
|
||||
my_strdup2(456, &translatedvalue, translate(inst, translatedvalue));
|
||||
value = translatedvalue;
|
||||
}
|
||||
/*
|
||||
if (!strncmp(value,"tcleval(", 8)) {
|
||||
dbg(1, "print_spice_element(): value=%s\n", value);
|
||||
my_strdup2(466, &translatedvalue, value);
|
||||
my_strdup2(456, &translatedvalue, translate(inst, translatedvalue));
|
||||
value = translatedvalue;
|
||||
}
|
||||
*/
|
||||
}
|
||||
if(!token_exists && token[0] =='$') {
|
||||
|
||||
|
|
|
|||
|
|
@ -2178,6 +2178,7 @@ proc tclpropeval {s instname symname} {
|
|||
# this hook is called in translate() if whole string is contained in a tcleval(...) construct
|
||||
proc tclpropeval2 {s} {
|
||||
global tcl_debug env netlist_type
|
||||
# puts "tclpropeval2: s=|$s|"
|
||||
if {$tcl_debug <=-1} {puts "tclpropeval2: $s"}
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
if { $netlist_type eq {spice} } {
|
||||
|
|
@ -2187,10 +2188,13 @@ proc tclpropeval2 {s} {
|
|||
# puts "---> path=$path"
|
||||
regsub {^tcleval\(} $s {} s
|
||||
regsub {\)([ \n\t]*)$} $s {\1} s
|
||||
if { [catch {subst $s} res] } {
|
||||
# puts "tclpropeval2: s=|$s|"
|
||||
# puts "tclpropeval2: subst $s=|[subst $s]|"
|
||||
if { [catch {uplevel #0 "subst \{$s\}"} res] } {
|
||||
if { $tcl_debug<=-1 } { puts "tclpropeval2 warning: $res"}
|
||||
set res ?\n
|
||||
}
|
||||
# puts "tclpropeval2: res=|$res|"
|
||||
return $res
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue