complete previous `xschem load_symbol` command

This commit is contained in:
stefan schippers 2025-02-15 01:33:13 +01:00
parent 279d24288d
commit cefd320ef6
2 changed files with 15 additions and 3 deletions

View File

@ -1029,7 +1029,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
if 'f' is not given and a file log is open, close log
file and resume logging to stderr </pre>
<li><kbd> load_symbol [symbol_file]</kbd></li><pre>
Load specified symbol_file </pre>
Load specified symbol_file
Returns:
&gt;= 0: symbol is already loaded or has been loaded
&lt; 0: symbol was not loaded</pre>
<li><kbd> log_write text</kbd></li><pre>
write given string to log file, so tcl can write messages on the log file</pre>
<li><kbd> logic_get_net net_name</kbd></li><pre>

View File

@ -3025,10 +3025,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
/* load_symbol [symbol_file]
* Load specified symbol_file */
* Load specified symbol_file
* Returns:
* >= 0: symbol is already loaded or has been loaded
* < 0: symbol was not loaded
*/
else if(!strcmp(argv[1], "load_symbol") )
{
int res = -1;
int res = -2;
struct stat buf;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 2) {
@ -3036,7 +3040,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(i < 0 ) {
if(!stat(argv[2], &buf)) { /* file exists */
res = load_sym_def(rel_sym_path(argv[2]), NULL);
if(res == 0) res = -1;
} else {
res = -3;
}
} else {
res = 1;
}
}
Tcl_SetResult(interp, my_itoa(res), TCL_VOLATILE);