remove instname and symname parameters to tclpropeval2 as they are no more necessary

This commit is contained in:
Stefan Schippers 2020-10-14 23:44:53 +02:00
parent e82f270f61
commit 8e5bfe2a13
4 changed files with 8 additions and 13 deletions

View File

@ -392,8 +392,6 @@ void set_inst_prop(int i)
char *tmp = NULL;
my_strdup(104, &ptr, (xctx.inst[i].ptr+ xctx.sym)->templ);
/* my_strdup(104, &ptr, translate(i, (xctx.inst[i].ptr+ xctx.sym)->templ)); */
/* tcl_hook(&ptr, i); */
dbg(1, "set_inst_prop(): i=%d, name=%s, prop_ptr = %s, template=%s\n",
i, xctx.inst[i].name, xctx.inst[i].prop_ptr, ptr);
my_strdup(69, &xctx.inst[i].prop_ptr, ptr);

View File

@ -156,15 +156,11 @@ void hash_all_names(int n)
}
void tcl_hook(char **res, int inst)
void tcl_hook(char **res)
{
char * result = *res;
if(result && strstr(result, "tcleval(")== result) {
dbg(1, "tcl_hook(): %s %s %s\n", result, xctx.inst[inst].instname,
get_cell((xctx.inst[inst].ptr + xctx.sym)->name, 0));
Tcl_VarEval(interp,
"tclpropeval2 {", result, "} {", xctx.inst[inst].instname, "} {",
get_cell((xctx.inst[inst].ptr + xctx.sym)->name, 0), "}", NULL);
Tcl_VarEval(interp, "tclpropeval2 {", result, "}" , NULL);
my_strdup2(1198, res, tclresult());
}
}
@ -1425,8 +1421,6 @@ void print_spice_element(FILE *fd, int inst)
result[0] = '\0';
my_strdup(483, &template, (xctx.inst[inst].ptr+ xctx.sym)->templ);
/* my_strdup(483, &template, translate(inst, (xctx.inst[inst].ptr+ xctx.sym)->templ) ); */
/* tcl_hook(&template, inst); */
my_strdup(484, &name,xctx.inst[inst].instname);
if (!name) my_strdup(43, &name, get_tok_value(template, "name", 0));
@ -2771,7 +2765,7 @@ const char *translate(int inst, const char* s)
/* if result is like: 'tcleval(some_string)' pass it thru tcl evaluation so expressions
* can be calculated */
tcl_hook(&result, inst);
tcl_hook(&result);
return result;
}
@ -2878,6 +2872,9 @@ const char *translate2(struct Lcc *lcc, int level, char* s)
break;
}
}
if(result && strstr(result, "tcleval(")== result) {
tcl_hook(&result);
}
my_free(1070, &token);
my_free(1071, &value1);
my_free(1072, &value2);

View File

@ -902,7 +902,7 @@ extern const char *tcleval(const char str[]);
extern const char *tclresult(void);
extern const char *tclgetvar(const char *s);
extern void tclsetvar(const char *s, const char *value);
extern void tcl_hook(char **res, int inst);
extern void tcl_hook(char **res);
extern void statusmsg(char str[],int n);
extern void place_text(int draw_text, double mx, double my);
extern void init_inst_iterator(double x1, double y1, double x2, double y2);

View File

@ -1861,7 +1861,7 @@ proc tclpropeval {s instname symname} {
}
# this hook is called in translate() if whole string is contained in a tcleval(...) construct
proc tclpropeval2 {s instname symname} {
proc tclpropeval2 {s} {
# puts "tclpropeval2: $s $instname $symname"
regsub {^tcleval\(} $s {} s
regsub {\)([ \n\t]*)$} $s {\1} s