Browse Source

INPparseNumMod(), #12/14, use 'info' instead of 'lastType'

to signify having read a cardName
pre-master-46
rlar 10 years ago
parent
commit
aa5afccf15
  1. 16
      src/spicelib/parser/inpgmod.c

16
src/spicelib/parser/inpgmod.c

@ -327,12 +327,11 @@ INPparseNumMod( CKTcircuit* ckt, INPmodel *model, INPtables *tab, char **errMess
{ {
card *txtCard; /* Text description of a card */ card *txtCard; /* Text description of a card */
GENcard *tmpCard; /* Processed description of a card */ GENcard *tmpCard; /* Processed description of a card */
IFcardInfo *info; /* Info about the type of card located */
IFcardInfo *info = NULL; /* Info about the type of card located */
char *line; char *line;
char *cardName = NULL; /* name of a card */ char *cardName = NULL; /* name of a card */
char *parm; /* name of a parameter */ char *parm; /* name of a parameter */
int cardNum = 0; /* number of this card in the overall line */ int cardNum = 0; /* number of this card in the overall line */
int lastType = E_MISSING; /* type of previous card */
char *err = NULL, *tmp; /* Strings for error messages */ char *err = NULL, *tmp; /* Strings for error messages */
IFvalue *value; IFvalue *value;
int error, idx, invert; int error, idx, invert;
@ -361,30 +360,29 @@ INPparseNumMod( CKTcircuit* ckt, INPmodel *model, INPtables *tab, char **errMess
case '\0': case '\0':
case '\n': case '\n':
/* comment or empty cards */ /* comment or empty cards */
lastType = E_MISSING;
info = NULL;
continue; continue;
case '+': case '+':
/* continuation card */ /* continuation card */
if (lastType < 0) {
if (!info) {
tmp = tprintf("Error on card %d : illegal continuation \'+\' - ignored", tmp = tprintf("Error on card %d : illegal continuation \'+\' - ignored",
cardNum); cardNum);
err = INPerrCat(err,tmp); err = INPerrCat(err,tmp);
lastType = E_MISSING;
continue; continue;
} }
while (*line == '+') line++; /* Skip leading '+'s */ while (*line == '+') line++; /* Skip leading '+'s */
break; break;
default: default:
lastType = E_MISSING;
info = NULL;
break; break;
} }
if (lastType == E_MISSING) {
if (!info) {
/* new command card */ /* new command card */
if (cardName) FREE(cardName); /* get rid of old card name */ if (cardName) FREE(cardName); /* get rid of old card name */
INPgetTok(&line,&cardName,1); /* get new card name */ INPgetTok(&line,&cardName,1); /* get new card name */
if (*cardName) { /* Found a name? */ if (*cardName) { /* Found a name? */
lastType = INPfindCard(cardName,INPcardTab,INPnumCards);
int lastType = INPfindCard(cardName,INPcardTab,INPnumCards);
if (lastType >= 0) { if (lastType >= 0) {
/* Add card structure to model */ /* Add card structure to model */
info = INPcardTab[lastType]; info = INPcardTab[lastType];
@ -407,7 +405,7 @@ INPparseNumMod( CKTcircuit* ckt, INPmodel *model, INPtables *tab, char **errMess
} }
} }
} }
if (lastType >= 0) { /* parse the rest of this line */
if (info) { /* parse the rest of this line */
while (*line) { while (*line) {
/* Strip leading carat from booleans */ /* Strip leading carat from booleans */
if (*line == '^') { if (*line == '^') {

Loading…
Cancel
Save