From 4fd7de9e34e80c9c3419762a99c335f11b22b83f Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 5 May 2021 23:16:59 +0200 Subject: [PATCH] Partially re-introduce and improve code that has been inadvertently deleted in commit 83592c456 ("unify the evaluation of '.options scale=xx' .option in a netlist will override 'options' from spinit, .spiceinit or a script '.options scalm=xx' yields a warning, it is not supported.", 2021-04-05) The code transforms the option statements and adds them to the current circuit. --- src/frontend/inp.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 45d380e81..193794868 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -1169,6 +1169,51 @@ inp_dodeck( } noparse = cp_getvar("noparse", CP_BOOL, NULL, 0); + /* Read the options, create variables and store them + in ftcurckt->ci_vars */ + if (!noparse) { + char* s; + bool ii; + wordlist* wl; + struct card* opt_beg = options; + for (; options; options = options->nextcard) { + s = skip_non_ws(options->line); + + ii = cp_interactive; + cp_interactive = FALSE; + wl = cp_lexer(s); + cp_interactive = ii; + if (!wl || !wl->wl_word || !*wl->wl_word) + continue; + if (eev) + eev->va_next = cp_setparse(wl); + else + ct->ci_vars = eev = cp_setparse(wl); + wl_free(wl); + while (eev && (eev->va_next)) + eev = eev->va_next; + } + for (eev = ct->ci_vars; eev; eev = eev->va_next) { + switch (eev->va_type) { + case CP_BOOL: + break; + case CP_NUM: + break; + case CP_REAL: + break; + case CP_STRING: + break; + default: { + fprintf(stderr, "ERROR: wrong format in option %s!\n", eev->va_name); + fprintf(stderr, " Aborting...\n"); + controlled_exit(EXIT_FAILURE); + } + } /* switch . . . */ + } + options = opt_beg; // back to the beginning + } /* if (!noparse) . . . */ + + /*---------------------------------------------------- * Now assuming that we wanna parse this deck, we call * if_inpdeck which takes the deck and returns a