vsource.sym and ammeter.sym no more use tcleval() to handle @savecurrent attribute (calling tcleval() is overkill for such a trivial task and may expose to side effects if $ (and other) characters are used )
This commit is contained in:
parent
26fbb82f6b
commit
fdc3ceefeb
17
src/token.c
17
src/token.c
|
|
@ -2032,6 +2032,11 @@ int print_spice_element(FILE *fd, int inst)
|
|||
|
||||
if (!xctx->tok_size) value=get_tok_value(template, token+1, 0);
|
||||
token_exists = xctx->tok_size;
|
||||
|
||||
if(!strcmp("@savecurrent", token)) {
|
||||
token_exists = 0; /* processed later */
|
||||
value = NULL;
|
||||
}
|
||||
/*
|
||||
if (!strncmp(value,"tcleval(", 8)) {
|
||||
dbg(1, "print_spice_element(): value=%s\n", value);
|
||||
|
|
@ -2124,6 +2129,18 @@ int print_spice_element(FILE *fd, int inst)
|
|||
result_pos += my_snprintf(result + result_pos, tmp, "%s", xctx->current_name);
|
||||
/* fputs(xctx->current_name, fd); */
|
||||
}
|
||||
else if(strcmp(token,"@savecurrent")==0)
|
||||
{
|
||||
char *instname = xctx->inst[inst].instname;
|
||||
|
||||
const char *sc = get_tok_value(xctx->inst[inst].prop_ptr, "savecurrent", 0);
|
||||
if(!sc[0]) sc = get_tok_value(template, "savecurrent", 0);
|
||||
if(!strboolcmp(sc , "true")) {
|
||||
tmp = strlen(instname) + 25;
|
||||
STR_ALLOC(&result, tmp + result_pos, &size);
|
||||
result_pos += my_snprintf(result + result_pos, tmp, "\n.save I( ?1 %s )", instname);
|
||||
}
|
||||
}
|
||||
else if(strcmp(token,"@schname")==0) /* of course schname must not be present in attributes */
|
||||
{
|
||||
const char *schname = get_cell(xctx->current_name, 0);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=3.4.4 file_version=1.2
|
||||
v {xschem version=3.4.5 file_version=1.2
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
|
|
@ -21,8 +21,7 @@ v {xschem version=3.4.4 file_version=1.2
|
|||
}
|
||||
G {}
|
||||
K {type=ammeter
|
||||
format="tcleval([expr \{@savecurrent ? \\"@name @pinlist 0
|
||||
.save I( ?1 @name )\\" : \\"@name @pinlist 0\\"\}])"
|
||||
format="@name @pinlist 0@savecurrent"
|
||||
template="name=Vmeas savecurrent=true"
|
||||
}
|
||||
V {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=3.4.4 file_version=1.2
|
||||
v {xschem version=3.4.5 file_version=1.2
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
|
|
@ -21,8 +21,7 @@ v {xschem version=3.4.4 file_version=1.2
|
|||
}
|
||||
G {}
|
||||
K {type=vsource
|
||||
format="tcleval([expr \{@savecurrent ? \\"@name @pinlist @value
|
||||
.save I( ?1 @name )\\" : \\"@name @pinlist @value \\"\}])"
|
||||
format="@name @pinlist @value@savecurrent"
|
||||
template="name=V1 value=3 savecurrent=false"
|
||||
}
|
||||
V {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue