Browse Source

Fix Bug #792 - "N device instance line not parsed correct".

Code added by 83d3890490 failed with a single parameter with no speces.
pre-master-46
Giles Atkinson 10 months ago
committed by Holger Vogt
parent
commit
ed80400661
  1. 9
      src/spicelib/parser/inp2n.c

9
src/spicelib/parser/inp2n.c

@ -34,7 +34,7 @@ void INP2N(CKTcircuit *ckt, INPtables *tab, struct card *current) {
GENmodel *mdfast; /* Pointer to the actual model. */ GENmodel *mdfast; /* Pointer to the actual model. */
IFdevice *dev; IFdevice *dev;
CKTnode *node; CKTnode *node;
char *c, *token = NULL, *prev = NULL, *pprev = NULL;
char *c, *token = NULL, *prev = NULL, *pprev = NULL, *eqp;
int i; int i;
line = current->line; line = current->line;
@ -44,15 +44,16 @@ void INP2N(CKTcircuit *ckt, INPtables *tab, struct card *current) {
/* Find the last non-parameter token in the line. */ /* Find the last non-parameter token in the line. */
c = line; c = line;
for (i = 0; *c != '\0'; ++i) {
for (i = 0, eqp = NULL; *c != '\0'; ++i) {
tfree(pprev); tfree(pprev);
pprev = prev; pprev = prev;
prev = token; prev = token;
token = gettok_instance(&c); token = gettok_instance(&c);
if (strchr(token, '='))
eqp = strchr(token, '=');
if (eqp)
break; break;
} }
if (*c) {
if (eqp) {
tfree(token); // A parameter or starts with '='. tfree(token); // A parameter or starts with '='.
if (*c == '=') { if (*c == '=') {
/* Now prev points to a parameter pprev is the model. */ /* Now prev points to a parameter pprev is the model. */

Loading…
Cancel
Save