scientific notation of level parameter
This commit is contained in:
parent
2fe85974ce
commit
806227a164
|
|
@ -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
|
2010-05-21 Holger Vogt
|
||||||
* inpcom.c: bugfix 2936702 correct handling of ternary fcn in numparam
|
* inpcom.c: bugfix 2936702 correct handling of ternary fcn in numparam
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,36 +227,6 @@ inp_pathopen(char *name, char *mode)
|
||||||
return (NULL);
|
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 "
|
/* replace "gnd" by " 0 "
|
||||||
Delimiters of gnd may be ' ' or ',' or '(' or ')' */
|
Delimiters of gnd may be ' ' or ',' or '(' or ')' */
|
||||||
static void
|
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 ) {
|
if ( shell_eol_continuation ) {
|
||||||
char *new_buffer = tmalloc( strlen(buffer) + 2);
|
char *new_buffer = tmalloc( strlen(buffer) + 2);
|
||||||
sprintf( new_buffer, "+%s", buffer );
|
sprintf( new_buffer, "+%s", buffer );
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ Modified: 1999 Paolo Nenzi - Now we can use a two digits level code -
|
||||||
char *INPfindLev(char *line, int *level)
|
char *INPfindLev(char *line, int *level)
|
||||||
{
|
{
|
||||||
char *where;
|
char *where;
|
||||||
|
int error1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*where = line;
|
*where = line;
|
||||||
|
|
@ -26,42 +27,44 @@ char *INPfindLev(char *line, int *level)
|
||||||
|
|
||||||
if (where != NULL) { /* found a level keyword on the line */
|
if (where != NULL) { /* found a level keyword on the line */
|
||||||
|
|
||||||
where += 5; /* skip the level keyword */
|
where += 5; /* skip the level keyword */
|
||||||
while ((*where == ' ') || (*where == '\t') || (*where == '=') ||
|
while ((*where == ' ') || (*where == '\t') || (*where == '=') ||
|
||||||
(*where == ',') || (*where == '(') || (*where == ')') ||
|
(*where == ',') || (*where == '(') || (*where == ')') ||
|
||||||
(*where == '+')) { /* legal white space - ignore */
|
(*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 */
|
if (*level < 0) {
|
||||||
sscanf(where, "%2d", level); /* We get the level number */
|
*level = 1;
|
||||||
if (*level < 0) {
|
fprintf(stderr,"Illegal value for level.\n");
|
||||||
*level = 1;
|
fprintf(stderr,"Level must be >0 (Setting level to 1)\n");
|
||||||
fprintf(stderr,"Illegal value for level.\n");
|
return (INPmkTemp
|
||||||
fprintf(stderr,"Level must be >0 (Setting level to 1)\n");
|
(" illegal (negative) argument to level parameter - level=1 assumed"));
|
||||||
return (INPmkTemp
|
}
|
||||||
(" illegal (negative) argument to level parameter - level=1 assumed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*level > 99) { /* Limit to change in the future */
|
if (*level > 99) { /* Limit to change in the future */
|
||||||
*level = 1;
|
*level = 1;
|
||||||
fprintf(stderr,"Illegal value for level.\n");
|
fprintf(stderr,"Illegal value for level.\n");
|
||||||
fprintf(stderr,"Level must be < 99 (Setting Level to 1)\n");
|
fprintf(stderr,"Level must be < 99 (Setting Level to 1)\n");
|
||||||
return (INPmkTemp
|
return (INPmkTemp
|
||||||
(" illegal (too high) argument to level parameter - level=1 assumed"));
|
(" illegal (too high) argument to level parameter - level=1 assumed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((char *) NULL);
|
return ((char *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else { /* no level on the line => default */
|
else { /* no level on the line => default */
|
||||||
*level = 1;
|
*level = 1;
|
||||||
#ifdef TRACE /* this is annoying for bjt's */
|
#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
|
#endif
|
||||||
return ((char *) NULL);
|
return ((char *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue