From 171e8896b11d01d0de09569d4fecfc21caef8fb4 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Fri, 30 Dec 2011 09:32:17 +0000 Subject: [PATCH] .csparam --- ChangeLog | 3 +++ src/frontend/inp.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index a57035ae7..6abdbef23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2011-12-29 Holger Vogt * inppas3.c, cktdest.c: reduce memory leaks * inpsymt.c: beautify + * inp.c: .csparam allows to tranfer a param into a vector + for use in the .control section (yet experimental, not safe + against syntax errors) 2011-12-29 Holger Vogt * b4v6dest.c : improved removal of circuit installation, diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 3c11c48d5..0da925781 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -29,6 +29,7 @@ Author: 1985 Wayne A. Christopher #include "subckt.h" #include "spiceif.h" #include "error.h" /* controlled_exit() */ +#include "com_let.h" #ifdef XSPICE /* include new stuff */ @@ -556,6 +557,37 @@ inp_spsource(FILE *fp, bool comfile, char *filename) ; (void) fclose(fdo); } + for(dd = deck; dd != NULL; dd = dd->li_next) { + /* get csparams and create vectors */ + if ( ciprefix(".csparam", dd->li_line) ) { + wordlist *wlist = NULL; + wordlist *wl = NULL; + wordlist *cwl; + char *cstoken[3]; + int i; + s = dd->li_line; + *s='*'; + s = dd->li_line + 8; + while ( isspace(*s) ) s++; + cstoken[0]=gettok_char(&s, '=', FALSE); + cstoken[1]=gettok_char(&s, '=', TRUE); + cstoken[2]=gettok(&s); + for (i=0; i<3;i++) { + cwl = alloc(struct wordlist); + cwl->wl_prev = wl; + if (wl) + wl->wl_next = cwl; + else { + wlist = cwl; + cwl->wl_next = NULL; + } + cwl->wl_word = cstoken[i]; + wl = cwl; + } + com_let(wlist); + wl_free(wlist); + } + } /*merge the two option line structs*/ if (!options && com_options)