Skip to content

Commit

Permalink
add optional "-messages" in "xschem netlist" comand to return ERC mes…
Browse files Browse the repository at this point in the history
…sages instead of fail(1)/good(0) code
  • Loading branch information
StefanSchippers committed Aug 27, 2023
1 parent b521994 commit 519fb2f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
8 changes: 5 additions & 3 deletions doc/xschem_man/developer_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ <h1>XSCHEM <a id="cmdref">COMMAND REFERENCE</a> DOCUMENTATION</h1><br>






<li><kbd> abort_operation</kbd></li><pre>
Expand Down Expand Up @@ -876,15 +877,17 @@ <h1>XSCHEM <a id="cmdref">COMMAND REFERENCE</a> DOCUMENTATION</h1><br>
<li><kbd> net_pin_mismatch</kbd></li><pre>
Highlight nets attached to selected symbols with
a different name than symbol pin </pre>
<li><kbd> netlist [filename]</kbd></li><pre>
<li><kbd> netlist [-messages] [filename]</kbd></li><pre>
do a netlist of current schematic in currently defined netlist format
if 'filename'is given use specified name for the netlist
if 'filename' contains path components place the file in specified path location.
if only a name is given and no path ('/') components are given use the
default netlisting directory.
This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice'
will create the netlist in different places.
netlisting directory is reset to previous setting after completing this command </pre>
netlisting directory is reset to previous setting after completing this command
If -messages is given return the ERC messages instead of just a fail (1)
or no fail (0) code. </pre>
<li><kbd> new_process [f]</kbd></li><pre>
Start a new xschem process for a schematic.
If 'f' is given load specified schematic. </pre>
Expand Down Expand Up @@ -1263,7 +1266,6 @@ <h1>XSCHEM <a id="cmdref">COMMAND REFERENCE</a> DOCUMENTATION</h1><br>





</ul>

Expand Down
32 changes: 24 additions & 8 deletions src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,28 +2267,40 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
hilight_net_pin_mismatches();
}

/* netlist [filename]
/* netlist [-messages] [filename]
* do a netlist of current schematic in currently defined netlist format
* if 'filename'is given use specified name for the netlist
* if 'filename' contains path components place the file in specified path location.
* if only a name is given and no path ('/') components are given use the
* default netlisting directory.
* This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice'
* will create the netlist in different places.
* netlisting directory is reset to previous setting after completing this command */
* netlisting directory is reset to previous setting after completing this command
* If -messages is given return the ERC messages instead of just a fail (1)
* or no fail (0) code. */
else if(!strcmp(argv[1], "netlist") )
{
int err = 0;
int messages = 0;
char save[PATH_MAX];
const char *fname = NULL;
const char *path;
yyparse_error = 0;
my_strncpy(save, tclgetvar("netlist_dir"), S(save));
if(argc > 2) {
my_strncpy(xctx->netlist_name, get_cell_w_ext(argv[2], 0), S(xctx->netlist_name));
tclvareval("file dirname ", argv[2], NULL);
path = tclresult();
if(strchr(argv[2], '/')) {
set_netlist_dir(1, path);
if(!strcmp(argv[2], "-messages")) {
messages = 1;
if(argc > 3) fname = argv[3];
} else {
fname = argv[2];
}
if(fname) {
my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
tclvareval("file dirname ", fname, NULL);
path = tclresult();
if(strchr(fname, '/')) {
set_netlist_dir(1, path);
}
}
}
if(set_netlist_dir(0, NULL) ) {
Expand All @@ -2307,7 +2319,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name));
set_netlist_dir(1, save);
}
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
if(messages) {
Tcl_SetResult(interp, (char *)tcleval(".infotext.f1.text get 1.0 end"), TCL_VOLATILE);
} else {
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
}
}
}

Expand Down

0 comments on commit 519fb2f

Please sign in to comment.