`xschem raw clear` command: allow to specify a number `n`; delete the`n-th` raw file

This commit is contained in:
stefan schippers 2025-04-14 10:00:33 +02:00
parent b7c68d6aac
commit f22307afad
4 changed files with 38 additions and 5 deletions

View File

@ -549,6 +549,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
@ -1219,6 +1222,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
xschem raw clear [rawfile [type]] xschem raw clear [rawfile [type]]
unload given file and type. If type not given delete all type sfrom rawfile unload given file and type. If type not given delete all type sfrom rawfile
If a number 'n' is given as 'rawfile' delete the 'nth' raw file
if no file is given unload all raw files. if no file is given unload all raw files.
xschem raw del name xschem raw del name
@ -1569,7 +1573,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Return the base_name field of a symbol with name or number `n` Return the base_name field of a symbol with name or number `n`
Normally this is empty. It is set for overloaded symbols, that is symbols Normally this is empty. It is set for overloaded symbols, that is symbols
derived from the base symbol due to instance based implementation selection derived from the base symbol due to instance based implementation selection
(the instance "schematic" attribute) </pre> (the instance `schematic` attribute) </pre>
<li><kbd> symbol_in_new_window [new_process]</kbd></li><pre> <li><kbd> symbol_in_new_window [new_process]</kbd></li><pre>
When a symbol is selected edit it in a new tab/window if not already open. When a symbol is selected edit it in a new tab/window if not already open.
If nothing selected open another window of the second schematic (issues a warning). If nothing selected open another window of the second schematic (issues a warning).

View File

@ -1191,7 +1191,7 @@ static int test_c23(int logdepth, int fatal, const char *cflags)
const char *test_c = const char *test_c =
NL "#include <stdio.h>" NL "#include <stdio.h>"
NL "int foo();" NL "int foo();"
NL "int foo(char *s) { puts(s); } " NL "int foo(char *s) { puts(s); return 0; } "
NL "int main()" NL "int main()"
NL "{" NL "{"
NL " foo(\"OK\");" NL " foo(\"OK\");"
@ -1229,7 +1229,7 @@ int find_cc_is_c23(const char *name, int logdepth, int fatal)
int find_cc_disable_c23(const char *name, int logdepth, int fatal) int find_cc_disable_c23(const char *name, int logdepth, int fatal)
{ {
if (require("cc/default_c23", logdepth, 0) == 0) { if (require("cc/default_c23", logdepth, 0) == 0) {
static const char *cfs[] = {"-std=c17", "-std=c99", NULL}; static const char *cfs[] = {"+-std=c17", "+-std=c99", NULL};
const char **cf; const char **cf;
/* figure a suitable workaround */ /* figure a suitable workaround */
@ -1239,8 +1239,8 @@ int find_cc_disable_c23(const char *name, int logdepth, int fatal)
for(cf = cfs; *cf != NULL; cf++) { for(cf = cfs; *cf != NULL; cf++) {
if (test_c23(logdepth, fatal, *cf) == 0) { if (test_c23(logdepth, fatal, *cf) == 0) {
put("cc/disable_c23/cflags", *cf); put("cc/disable_c23/cflags", (*cf)+1); /* +1 to remove the prefix + */
report("%s\n", *cf); report("%s\n", (*cf)+1);
return 0; return 0;
} }
} }

View File

@ -1364,6 +1364,34 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
xctx->extra_prev_idx = 0; xctx->extra_prev_idx = 0;
xctx->extra_idx = 0; xctx->extra_idx = 0;
xctx->extra_raw_n = 0; xctx->extra_raw_n = 0;
} else if(file && isonlydigit(file)) {
int n, found = 0;
tclvareval("subst {", file, "}", NULL);
my_strncpy(f, tclresult(), S(f));
n = atoi(file);
if(xctx->extra_raw_n > 0 ) {
for(i = 0; i < xctx->extra_raw_n; i++) {
if( i == n) {
free_rawfile(&xctx->extra_raw_arr[i], 0, no_warning);
found++;
continue;
}
if(found) {
xctx->extra_raw_arr[i - found] = xctx->extra_raw_arr[i];
}
}
if(found != 0) {
xctx->extra_raw_n -= found;
xctx->extra_idx = 0;
xctx->extra_prev_idx = 0;
if(xctx->extra_raw_n) {
xctx->raw = xctx->extra_raw_arr[0];
} else {
tcleval("array unset ngspice::ngspice_data");
xctx->raw = NULL;
}
} else ret = 0;
} else ret = 0;
} else { /* clear provided file if found, switch to first in remaining if any */ } else { /* clear provided file if found, switch to first in remaining if any */
int found = 0; int found = 0;
tclvareval("subst {", file, "}", NULL); tclvareval("subst {", file, "}", NULL);

View File

@ -4082,6 +4082,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* *
* xschem raw clear [rawfile [type]] * xschem raw clear [rawfile [type]]
* unload given file and type. If type not given delete all type sfrom rawfile * unload given file and type. If type not given delete all type sfrom rawfile
* If a number 'n' is given as 'rawfile' delete the 'nth' raw file
* if no file is given unload all raw files. * if no file is given unload all raw files.
* *
* xschem raw del name * xschem raw del name