add new command `xschem get modified` (returns 1 if circuit needs to be saved)

This commit is contained in:
stefan schippers 2025-01-17 17:48:02 +01:00
parent ac8db614c0
commit 151241afc7
2 changed files with 8 additions and 1 deletions

View File

@ -779,6 +779,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> lastsel </kbd> number of selected objects </li>
<li><kbd> line_width </kbd> get line width </li>
<li><kbd> lines </kbd> (xschem get lines n) number of lines on layer 'n' </li>
<li><kbd> modified </kbd> schematic is in modified state (needs a save) </li>
<li><kbd> netlist_name </kbd> netlist name if set. If 'fallback' given get default name </li>
<li><kbd> netlist_type </kbd> get current netlist type (spice/vhdl/verilog/tedax) </li>
<li><kbd> no_draw </kbd> disable drawing </li>

View File

@ -1455,6 +1455,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
break;
case 'm':
if(!strcmp(argv[2], "modified")) { /* schematic is in modified state (needs a save) */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
Tcl_SetResult(interp, my_itoa(xctx->modified),TCL_VOLATILE);
}
break;
case 'n':
if(!strcmp(argv[2], "netlist_name")) { /* netlist name if set. If 'fallback' given get default name */
if(argc > 3 && !strcmp(argv[3], "fallback")) {
@ -2103,7 +2109,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc > 2 ) {
set_title = atoi(argv[2]);
}
if((xctx->semaphore == 0)) go_back(1, set_title);
if((xctx->semaphore == 0)) go_back(0, set_title);
Tcl_ResetResult(interp);
}