Add low level function xschem reset_symbol, changed defaults in xschem: now toolbar and tabbed interface (more robust than multi-window) is enabled by default, doc updates, improved fix_symbols for setting/removing path compoents from symbol references, now uses low-level xschem reset_symbol (faster)

This commit is contained in:
stefan schippers 2023-06-08 00:03:25 +02:00
parent 828975c19f
commit edaf4ccce9
4 changed files with 40 additions and 13 deletions

View File

@ -970,10 +970,15 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Internal command: remove all symbol definitions </pre>
<li><kbd> replace_symbol inst new_symbol [fast]</kbd></li><pre>
Replace 'inst' symbol with 'new_symbol'
If doing multiple substitutions set 'fast' to 0
on first call and non zero on next calls
for faster operation
If doing multiple substitutions set 'fast' to {}
on first call and 'fast' on next calls
for faster operation.
do a 'xschem redraw' at end to update screen
Example: xschem replace_symbol R3 capa.sym </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> resolved_net [net]</kbd></li><pre>
@ -1200,6 +1205,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>
<!-- TCL global variables -->

View File

@ -2819,7 +2819,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{
remove_symbols();
link_symbols_to_instances(-1);
draw();
Tcl_ResetResult(interp);
}
@ -2909,6 +2908,26 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* 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
* afterward */
else if(!strcmp(argv[1], "reset_symbol"))
{
int inst;
if(argc!=4) {
Tcl_SetResult(interp, "xschem reset_symbol needs 2 additional arguments", TCL_STATIC);
return TCL_ERROR;
}
if((inst = get_instance(argv[2])) < 0 ) {
Tcl_SetResult(interp, "xschem reset_symbol: instance not found", TCL_STATIC);
return TCL_ERROR;
} else {
my_strdup(_ALLOC_ID_, &xctx->inst[inst].name, argv[3]);
}
Tcl_ResetResult(interp);
}
/* reset_flags
* Reset cached instance and symbol cached flags (inst->flags, sym->flags) */
else if(!strcmp(argv[1], "reset_flags"))

View File

@ -4613,16 +4613,18 @@ proc get_directory {f} {
# set 'n' last directory components to every symbol
proc fix_symbols {n} {
set fast {}
xschem push_undo
xschem remove_symbols
foreach {i s t} [xschem instance_list] {
set sympath [find_file_first [file tail $s]]
if { $sympath ne {}} {
set new_sym_ref [get_cell $sympath $n]
puts "$i: $s --> $new_sym_ref"
xschem replace_symbol $i $new_sym_ref $fast
set fast fast
xschem reset_symbol $i $new_sym_ref
}
}
xschem reload_symbols
xschem set_modify 1
xschem redraw
}
@ -5080,7 +5082,7 @@ proc context_menu { } {
#
proc setup_toolbar {} {
global toolbar_visible toolbar_horiz toolbar_list XSCHEM_SHAREDIR
set_ne toolbar_visible 0
set_ne toolbar_visible 1
set_ne toolbar_horiz 1
set_ne toolbar_list {
FileOpen
@ -6589,7 +6591,7 @@ set_ne tclstop 0
set_ne undo_type disk
## show tab bar (tabbed interface)
set_ne tabbed_interface 0
set_ne tabbed_interface 1
## case insensitive symbol lookup (on case insensitive filesystems only!)
set_ne case_insensitive 0

View File

@ -374,16 +374,16 @@
###########################################################################
#### XSCHEM TOOLBAR
###########################################################################
#### default: not enabled.
# set toolbar_visible 1
#### default: enabled, horizontal
# set toolbar_visible 0
# set toolbar_horiz 1
###########################################################################
#### TABBED WINDOWS
###########################################################################
#### default: not enabled. Interface can be changed runtime if only one window
#### default: enabled. Interface can be changed runtime if only one window
#### or tab is open.
# set tabbed_interface 1
# set tabbed_interface 0
###########################################################################
#### CASE INSENSITIVE SYMBOL LOOKUP