refactor reset_flags() to reset_caches(). scripts that set tcl variables that go into attributes via tcleval() should call `xschem reset_caches` to get all things updated.

This commit is contained in:
stefan schippers 2023-11-12 20:53:37 +01:00
parent e7d362a7b4
commit 6360fc1700
5 changed files with 21 additions and 15 deletions

View File

@ -1102,12 +1102,12 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
for faster operation.
do a 'xschem redraw' at end to update screen
Example: xschem replace_symbol R3 capa.sym </pre>
<li><kbd> reset_caches</kbd></li><pre>
Reset cached instance and symbol cached flags (inst-&gt;flags, sym-&gt;flags) </pre>
<li><kbd> reset_symbol inst symref</kbd></li><pre>
This is a low level command, it merely changes the xctx-&gt;inst[...].name field.
It is caller responsibility to delete all symbols before and do a reload_symbols
afterward </pre>
<li><kbd> reset_flags</kbd></li><pre>
Reset cached instance and symbol cached flags (inst-&gt;flags, sym-&gt;flags) </pre>
<li><kbd> resetwin create_pixmap clear_pixmap force w h</kbd></li><pre>
internal command: calls resetwin() </pre>
<li><kbd> resolved_net [net]</kbd></li><pre>
@ -1421,6 +1421,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"

View File

@ -884,10 +884,10 @@ int set_text_flags(xText *t)
}
void reset_flags(void)
void reset_caches(void)
{
int i;
dbg(1, "reset_flags()\n");
dbg(1, "reset_caches()\n");
for(i = 0; i < xctx->instances; i++) {
set_inst_flags(&xctx->inst[i]);
}

View File

@ -1444,7 +1444,11 @@ int prepare_netlist_structs(int for_netl)
else if(!for_netlist && xctx->prep_hi_structs) return 0;
dbg(1, "prepare_netlist_structs(): extraction: %s\n", xctx->sch[xctx->currsch]);
reset_flags(); /* update cached flags: necessary if some tcleval() is used for cached attrs */
/* Don't reset caches systematically. Users should call 'xschem reset_caches'
* if they play with tcl variables that need to be updated into attributes */
/* reset_caches(); */ /* update cached flags: necessary if some tcleval() is used for cached attrs */
set_modify(-2); /* to reset floater cached values */
/* delete instance pins spatial hash, wires spatial hash, node_hash, wires and inst nodes.*/
if(for_netlist) {

View File

@ -3543,6 +3543,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* reset_caches
* Reset cached instance and symbol cached flags (inst->flags, sym->flags) */
else if(!strcmp(argv[1], "reset_caches"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
reset_caches();
Tcl_ResetResult(interp);
}
/* reset_symbol inst symref
* This is a low level command, it merely changes the xctx->inst[...].name field.
* It is caller responsibility to delete all symbols before and do a reload_symbols
@ -3564,15 +3573,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* reset_flags
* Reset cached instance and symbol cached flags (inst->flags, sym->flags) */
else if(!strcmp(argv[1], "reset_flags"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
reset_flags();
Tcl_ResetResult(interp);
}
/* resetwin create_pixmap clear_pixmap force w h
* internal command: calls resetwin() */
else if(!strcmp(argv[1], "resetwin"))

View File

@ -1220,7 +1220,7 @@ extern int set_rect_flags(xRect *r);
extern int set_text_flags(xText *t);
extern int set_inst_flags(xInstance *inst);
extern int set_sym_flags(xSymbol *sym);
extern void reset_flags(void);
extern void reset_caches(void);
extern const char *get_text_floater(int i);
extern int set_rect_extraptr(int what, xRect *drptr);
extern unsigned char *base64_decode(const char *data, const size_t input_length, size_t *output_length);