Feature request 85: Enable .save within subcircuits

inp.c: Add .save to wl_first only after subcircuit expansion
subckt.c: treat .save like .ic
This commit is contained in:
Holger Vogt 2021-10-19 11:44:47 +02:00
parent f9b743aa2a
commit bd0113ea9a
2 changed files with 11 additions and 2 deletions

View File

@ -721,7 +721,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
ciprefix(".four", s) ||
eq(s, ".plot") ||
eq(s, ".print") ||
eq(s, ".save") ||
/* eq(s, ".save") || add .save only after subcircuit expansion */
eq(s, ".op") ||
ciprefix(".meas", s) ||
eq(s, ".tf")) {
@ -838,6 +838,15 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
return 1;
}
/* Scan the deck again, now also adding .save commands to wl_first */
for (dd = deck->nextcard; dd; dd = dd->nextcard) {
char* curr_line = dd->line;
if (ciprefix(".save", curr_line)) {
wl_append_word(&wl_first, &end, copy(dd->line));
*curr_line = '*';
}
}
/* Now handle translation of spice2c6 POLYs. */
#ifdef XSPICE
/* Translate all SPICE 2G6 polynomial type sources */

View File

@ -1176,7 +1176,7 @@ translate(struct card *deck, char *formal, char *actual, char *scname, const cha
switch (dev_type) {
case '.':
if (ciprefix(".ic", s) || ciprefix(".nodeset", s)) {
if (ciprefix(".ic", s) || ciprefix(".nodeset", s) || ciprefix(".save", s)) {
while ((paren_ptr = strchr(s, '(')) != NULL) {
name = paren_ptr + 1;