sqwsource.sym: better labels, various fixes, comments and more debug messages in tcleval() stuff, some fixes (error checks) in "device_model" related model_name() function

This commit is contained in:
Stefan Schippers 2020-10-25 03:03:23 +01:00
parent 679348b7f8
commit 460ebe561d
5 changed files with 27 additions and 12 deletions

View File

@ -720,7 +720,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
if(!found) {
Tcl_AppendResult(interp, "xSymbol not found", NULL);
Tcl_AppendResult(interp, "Symbol not found", NULL);
return TCL_ERROR;
}
if(argc == 4)
@ -1557,7 +1557,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
if(i<xctx->instances) {
my_snprintf(s, S(s), "xInstance: %g %g %g %g", xctx->inst[i].x1, xctx->inst[i].y1,
my_snprintf(s, S(s), "Instance: %g %g %g %g", xctx->inst[i].x1, xctx->inst[i].y1,
xctx->inst[i].x2, xctx->inst[i].y2);
Tcl_AppendResult(interp, s, NULL);
my_snprintf(s, S(s), "\nSymbol: %g %g %g %g",

View File

@ -278,13 +278,18 @@ static char *model_name(const char *m)
{
char *m_lower = NULL;
char *modelname = NULL;
int n;
int l = strlen(m) + 1;
my_strdup(255, &m_lower, m);
strtolower(m_lower);
my_realloc(256, &modelname, strlen(m) + 1);
my_realloc(257, &model_name_result, strlen(m) + 1);
sscanf(m_lower, " %s %s", model_name_result, modelname);
my_strcat(296, &model_name_result, modelname);
my_realloc(256, &modelname, l);
my_realloc(257, &model_name_result, l);
n = sscanf(m_lower, " %s %s", model_name_result, modelname);
if(n<2) my_strncpy(model_name_result, m_lower, l);
else {
/* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/
my_strcat(296, &model_name_result, modelname);
}
my_free(948, &modelname);
my_free(949, &m_lower);
return model_name_result;

View File

@ -1659,7 +1659,11 @@ void print_spice_element(FILE *fd, int inst)
/* do a second round of substitutions, but without calling tcl */
if(result && strstr(result, "eval(") == result) {
char *c = strrchr(result, ')');
if(c) *c = '\0';
if(c) while(1) { /* shift following characters back 1 char */
*c = c[1];
c++;
if(!*c) break;
}
my_strdup2(88, &result, translate(inst, result+5));
}
fprintf(fd, "%s", result);

View File

@ -1876,9 +1876,15 @@ proc property_search {} {
#
proc tclpropeval {s instname symname} {
# puts "tclpropeval: $s $instname $symname"
global env tcl_debug
if {$tcl_debug <=-1} {puts "tclpropeval: $s"}
regsub {^@tcleval\(} $s {} s
regsub {\)$} $s {} s
return [eval $s]
regsub {\)([ \t\n]*)$} $s {\1} s
if { [catch {eval $s} res] } {
if { $tcl_debug<=-1 } { puts "tclpropeval warning: $res"}
set res ?\n
}
return $res
}
# this hook is called in translate() if whole string is contained in a tcleval(...) construct

View File

@ -25,8 +25,8 @@ L 4 5 5 10 5 {}
B 5 -2.5 -32.5 2.5 -27.5 {name=p dir=inout}
B 5 -2.5 27.5 2.5 32.5 {name=m dir=inout}
A 4 0 0 15 270 360 {}
T {@vhi} 20 -6.25 0 0 0.2 0.2 {}
T {V=@vhi} 20 -6.25 0 0 0.2 0.2 {}
T {@name} 20 -18.75 0 0 0.2 0.2 {}
T {@#0:net_name} 10 -30 0 0 0.15 0.15 {layer=15}
T {@#1:net_name} 10 20 0 0 0.15 0.15 {layer=15}
T {@freq} 20 6.25 0 0 0.2 0.2 {}
T {f=@freq Hz} 20 6.25 0 0 0.2 0.2 {}