diff --git a/ChangeLog b/ChangeLog index f3ef54261..2e1b8b72b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-05-22 Holger Vogt + * inpfindl.c: bugfix 3004317 allow level value number given by scientific + notation + 2010-05-21 Holger Vogt * inpcom.c: bugfix 2936702 correct handling of ternary fcn in numparam diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 108752dbb..6e864f43a 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -227,36 +227,6 @@ inp_pathopen(char *name, char *mode) return (NULL); } - -/* replace " gnd " by " 0 " - and then remove excessive white spaces */ -/* -static void -inp_fix_gnd_name( struct line *deck ) { - struct line *c = deck; - char *gnd; - bool found_gnd = FALSE; - - while ( c != NULL ) { - gnd = c->li_line; - if ( *gnd == '*' ) { c = c->li_next; continue; } - // replace " gnd " by " 0 " - while ( (gnd = strstr( gnd, "gnd " ) ) ) { - if ( isspace(*(gnd-1)) ) { - memcpy( gnd, "0 ", 4 ); - } - gnd += 4; - found_gnd = TRUE; - } - // remove white spaces after replacement, retain " 0 " - if (found_gnd) - c->li_line = inp_remove_ws(c->li_line); - c = c->li_next; - found_gnd = FALSE; - } -} -*/ - /* replace "gnd" by " 0 " Delimiters of gnd may be ' ' or ',' or '(' or ')' */ static void @@ -1347,22 +1317,6 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name) } } - /* removed because code changes .global to *global before it will be - expanded by inp_subcktexpand() in subckt.c */ - /* if ( ciprefix( ".global", buffer ) ) { - for ( s = buffer; *s && !isspace(*s); s++ ); - - if ( global == NULL ) { - global = strdup(buffer); - } else { - global_copy = tmalloc( strlen(global) + strlen(s) + 1 ); - sprintf( global_copy, "%s%s", global, s ); - tfree(global); - global = global_copy; - } - *buffer = '*'; - } -*/ if ( shell_eol_continuation ) { char *new_buffer = tmalloc( strlen(buffer) + 2); sprintf( new_buffer, "+%s", buffer ); diff --git a/src/spicelib/parser/inpfindl.c b/src/spicelib/parser/inpfindl.c index f3b688553..e6de6897f 100644 --- a/src/spicelib/parser/inpfindl.c +++ b/src/spicelib/parser/inpfindl.c @@ -17,6 +17,7 @@ Modified: 1999 Paolo Nenzi - Now we can use a two digits level code - char *INPfindLev(char *line, int *level) { char *where; + int error1; /* *where = line; @@ -26,42 +27,44 @@ char *INPfindLev(char *line, int *level) if (where != NULL) { /* found a level keyword on the line */ - where += 5; /* skip the level keyword */ - while ((*where == ' ') || (*where == '\t') || (*where == '=') || - (*where == ',') || (*where == '(') || (*where == ')') || - (*where == '+')) { /* legal white space - ignore */ - where++; - } + where += 5; /* skip the level keyword */ + while ((*where == ' ') || (*where == '\t') || (*where == '=') || + (*where == ',') || (*where == '(') || (*where == ')') || + (*where == '+')) + { /* legal white space - ignore */ + where++; + } + /* now the magic number, + allow scientific notation of level, e.g. 4.900e1, + offers only limited error checking. + */ + *level = (int)INPevaluate(&where, &error1, 0); - /* now the magic number */ - sscanf(where, "%2d", level); /* We get the level number */ - if (*level < 0) { - *level = 1; - fprintf(stderr,"Illegal value for level.\n"); - fprintf(stderr,"Level must be >0 (Setting level to 1)\n"); - return (INPmkTemp - (" illegal (negative) argument to level parameter - level=1 assumed")); - } + if (*level < 0) { + *level = 1; + fprintf(stderr,"Illegal value for level.\n"); + fprintf(stderr,"Level must be >0 (Setting level to 1)\n"); + return (INPmkTemp + (" illegal (negative) argument to level parameter - level=1 assumed")); + } - if (*level > 99) { /* Limit to change in the future */ - *level = 1; - fprintf(stderr,"Illegal value for level.\n"); - fprintf(stderr,"Level must be < 99 (Setting Level to 1)\n"); - return (INPmkTemp - (" illegal (too high) argument to level parameter - level=1 assumed")); - } + if (*level > 99) { /* Limit to change in the future */ + *level = 1; + fprintf(stderr,"Illegal value for level.\n"); + fprintf(stderr,"Level must be < 99 (Setting Level to 1)\n"); + return (INPmkTemp + (" illegal (too high) argument to level parameter - level=1 assumed")); + } - return ((char *) NULL); + return ((char *) NULL); } else { /* no level on the line => default */ - *level = 1; + *level = 1; #ifdef TRACE /* this is annoying for bjt's */ - fprintf(stderr,"Warning -- Level not specified on line \"%s\"\nUsing level 1.\n", line); + fprintf(stderr,"Warning -- Level not specified on line \"%s\"\nUsing level 1.\n", line); #endif - return ((char *) NULL); + return ((char *) NULL); } - - }