Browse Source

Updated scale "option" processing.

pre-master-46
pnenzi 19 years ago
parent
commit
b2b61c0e74
  1. 5
      ChangeLog
  2. 68
      src/frontend/inp.c

5
ChangeLog

@ -1,3 +1,8 @@
2007-11-12 Paolo Nenzi <p.nenzi@ieee.org>
* src/frontend/inp.c: corrected option processing. Now "scale" option
is special and is processed before netlist parsing. The implementation
is not very clean.
2007-11-04 Dietmar Warning 2007-11-04 Dietmar Warning
* configure.in, src/Makefile.am, src/spicelib/devices/Makefile.am, * configure.in, src/Makefile.am, src/spicelib/devices/Makefile.am,
src/spicelib/parser/inpgmod.c, src/spicelib/parser/inp2m.c src/spicelib/parser/inpgmod.c, src/spicelib/parser/inp2m.c

68
src/frontend/inp.c

@ -283,7 +283,7 @@ top2:
/* /*
* Free memory used by a line. * Free memory used by a line.
* If recure is TRUE then recursivly free all lines linked via the li_next field.
* If recurse is TRUE then recursively free all lines linked via the li_next field.
* If recurse is FALSE free only this line. * If recurse is FALSE free only this line.
* All lines linked via the li_actual field are always recursivly freed. * All lines linked via the li_actual field are always recursivly freed.
* SJB - 22nd May 2001 * SJB - 22nd May 2001
@ -666,7 +666,11 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
} }
cp_getvar("noparse", VT_BOOL, (char *) &noparse); cp_getvar("noparse", VT_BOOL, (char *) &noparse);
if (!noparse) {
/* We check preliminary for the scale option. This special processing
is needed because we need the scale info BEFORE building the circuit
and seems there is no other way to do this. */
if (!noparse) {
for (; options; options = options->li_next) { for (; options; options = options->li_next) {
for (s = options->li_line; *s && !isspace(*s); s++) for (s = options->li_line; *s && !isspace(*s); s++)
; ;
@ -688,25 +692,21 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
static int one = 1; static int one = 1;
switch (eev->va_type) { switch (eev->va_type) {
case VT_BOOL: case VT_BOOL:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, &one);
break; break;
case VT_NUM: case VT_NUM:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_num);
break; break;
case VT_REAL: case VT_REAL:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_real);
if ( strcmp("scale",eev->va_name)==0 ){
cp_vset("scale", VT_REAL, (char*) &eev->va_real );
printf("Scale set\n");
}
break; break;
case VT_STRING: case VT_STRING:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, eev->va_string);
break; break;
} /* switch . . . */ } /* switch . . . */
} }
} /* if (!noparse) . . . */ } /* if (!noparse) . . . */
/*---------------------------------------------------- /*----------------------------------------------------
* Now assuming that we wanna parse this deck, we call * Now assuming that we wanna parse this deck, we call
* if_inpdeck which takes the deck and returns a * if_inpdeck which takes the deck and returns a
@ -714,7 +714,7 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
*---------------------------------------------------*/ *---------------------------------------------------*/
if (!noparse) if (!noparse)
ckt = if_inpdeck(deck, &tab); ckt = if_inpdeck(deck, &tab);
else
else
ckt = NULL; ckt = NULL;
out_init(); out_init();
@ -765,7 +765,7 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
/* output deck */ /* output deck */
out_printf( "\nProcessed Netlist\n" ); out_printf( "\nProcessed Netlist\n" );
out_printf( "=================\n" ); out_printf( "=================\n" );
print_listing = 1;
int print_listing = 1;
for (dd = deck; dd; dd = dd->li_next) { for (dd = deck; dd; dd = dd->li_next) {
if ( ciprefix(".prot", dd->li_line) ) print_listing = 0; if ( ciprefix(".prot", dd->li_line) ) print_listing = 0;
if ( print_listing == 1 ) out_printf( "%s\n", dd->li_line ); if ( print_listing == 1 ) out_printf( "%s\n", dd->li_line );
@ -804,6 +804,48 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
else else
ct->ci_filename = NULL; ct->ci_filename = NULL;
if (!noparse) {
for (; options; options = options->li_next) {
for (s = options->li_line; *s && !isspace(*s); s++)
;
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);
while (eev->va_next)
eev = eev->va_next;
}
for (eev = ct->ci_vars; eev; eev = eev->va_next) {
static int one = 1;
switch (eev->va_type) {
case VT_BOOL:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, &one);
break;
case VT_NUM:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_num);
break;
case VT_REAL:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_real);
break;
case VT_STRING:
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, eev->va_string);
break;
} /* switch . . . */
}
} /* if (!noparse) . . . */
cp_addkword(CT_CKTNAMES, tt); cp_addkword(CT_CKTNAMES, tt);
return; return;
} }

Loading…
Cancel
Save