Browse Source

parser/inpgtok.c, remove unused function `INPgetU2Tok()'

INPgetU2Tok() was introduced in commit
Date:   Fri Sep 3 12:51:42 2010 +0000
    bug in B source parsing removed

and later unused in commit
Date:   Thu Apr 28 19:27:45 2011 +0000
    bug fix, (#329233)
pre-master-46
rlar 11 years ago
parent
commit
a21770aab9
  1. 6
      src/spicelib/parser/inpeval.c
  2. 138
      src/spicelib/parser/inpgtok.c

6
src/spicelib/parser/inpeval.c

@ -26,16 +26,12 @@ INPevaluate(char **line, int *error, int gobble)
/* setup */
tmpline = *line;
if (gobble == 1) {
if (gobble) {
/* MW. INPgetUTok should be called with gobble=0 or it make
* errors in v(1,2) exp */
*error = INPgetUTok(line, &token, 0);
if (*error)
return (0.0);
} else if (gobble == 2) {
*error = INPgetU2Tok(line, &token, 0);
if (*error)
return (0.0);
} else {
token = *line;
*error = 0;

138
src/spicelib/parser/inpgtok.c

@ -345,141 +345,3 @@ INPgetUTok(char **line, char **token, int gobble)
return (OK);
}
/*-------------------------------------------------------------------
* INPgetUTok plus points < > ? :, called from INPevaluate called
* from INPevaluate with gobble == 2
* fcn added to avoid unforeseeable side effects during other calls
* to INPevaluate.
*------------------------------------------------------------------*/
int
INPgetU2Tok(char **line, char **token, int gobble)
/* gobble: eat non-whitespace trash AFTER token? */
{
char *point, separator;
int signstate;
/* scan along throwing away garbage characters */
for (point = *line; *point != '\0'; point++) {
if (*point == ' ')
continue;
if (*point == '\t')
continue;
if (*point == '=')
continue;
if (*point == '(')
continue;
if (*point == ')')
continue;
if (*point == ',')
continue;
break;
}
if (*point == '"') {
separator = '"';
point++;
} else if (*point == '\'') {
separator = '\'';
point++;
} else
separator = 0;
/* mark beginning of token */
*line = point;
/* now find all good characters */
signstate = 0;
for (point = *line; *point != '\0'; point++) {
if (separator) {
if (*point == separator)
break;
else
continue;
}
if (*point == ' ')
break;
if (*point == '\t')
break;
if (*point == '=')
break;
if (*point == '(')
break;
if (*point == ')')
break;
if (*point == ',')
break;
/* This is not complex enough to catch all errors, but it will
get the "good" parses */
if (*point == '+' && (signstate == 1 || signstate == 3))
break;
if (*point == '-') {
if (signstate == 1 || signstate == 3)
break;
signstate += 1;
continue;
}
if (*point == '*')
break;
if (*point == '/')
break;
if (*point == '^')
break;
if (*point == '<')
break;
if (*point == '>')
break;
if (*point == '?')
break;
if (*point == ':')
break;
if (isdigit(*point) || *point == '.') {
if (signstate > 1)
signstate = 3;
else
signstate = 1;
} else if (tolower(*point) == 'e' && signstate == 1)
signstate = 2;
else
signstate = 3;
}
if (separator && *point == separator)
point--;
if (point == *line && *point) /* Weird items, 1 char */
point++;
*token = copy_substring(*line, point);
if (!*token)
return (E_NOMEM);
/* gobble garbage to next token */
for (; *point != '\0'; point++) {
if (*point == separator)
continue;
if (*point == ' ')
continue;
if (*point == '\t')
continue;
if ((*point == '=') && gobble)
continue;
if ((*point == ',') && gobble)
continue;
break;
}
*line = point;
#ifdef TRACE
/* SDB debug statement */
/* printf("found refdes token (%s) and rest of line (%s)\n",*token,*line); */
#endif
return (OK);
}
Loading…
Cancel
Save