Fix a bug when reading a list of type ( 2 4 6 ): If ')' was not

the last token, an error message was generated.
This commit is contained in:
Holger Vogt 2020-09-09 20:21:15 +02:00
parent 64e5e13c4e
commit 110a853ce5
1 changed files with 14 additions and 9 deletions

View File

@ -34,8 +34,9 @@ INPgetValue(CKTcircuit *ckt, char **line, int type, INPtables *tab)
temp.rValue = INPevaluate(line, &error, 1);
/* printf(" returning real value %e\n",temp.rValue); */
} else if (type == IF_REALVEC) {
/* read until error occurs. If first token is already
in error, return NULL */
/* read until error occurs. If error, and first
character of remaining line is ')', everything is o.k.
If first token is already in error, return NULL.*/
temp.v.numValue = 0;
list = TMALLOC(double, 1);
tmp = INPevaluate(line, &error, 1);
@ -50,13 +51,15 @@ INPgetValue(CKTcircuit *ckt, char **line, int type, INPtables *tab)
list[temp.v.numValue - 1] = tmp;
tmp = INPevaluate(line, &error, 1);
}
if (error && ft_ngdebug && !eq(*line, "") && !eq(*line, ")"))
/* in rare cases false warnings may occur */
fprintf(stderr, "Warning: Could not read parameter from %s at %s\n", compline, *line);
if (error && !eq(*line, "") && !prefix(")", *line)) {
fprintf(stderr, "\nWarning: Could not read parameter from \n%s\nat\n", compline);
fprintf(stderr, "%*s%s\n", *line - compline," ", *line);
}
temp.v.vec.rVec = list;
} else if (type == IF_INTVEC) {
/* read until error occurs. If first token is already
in error, return NULL */
/* read until error occurs. If error, and first
character of remaining line is ')', everything is o.k.
If first token is already in error, return NULL.*/
temp.v.numValue = 0;
ilist = TMALLOC(int, 1);
tmp = INPevaluate(line, &error, 1);
@ -71,8 +74,10 @@ INPgetValue(CKTcircuit *ckt, char **line, int type, INPtables *tab)
ilist[temp.v.numValue - 1] = (int) floor(0.5 + tmp);
tmp = INPevaluate(line, &error, 1);
}
if (error && ft_ngdebug && !eq(*line, "") && !eq(*line, ")"))
fprintf(stderr, "Warning: Could not read parameter from %s at %s\n", compline, *line);
if (error && !eq(*line, "") && !prefix(")", *line)) {
fprintf(stderr, "\nWarning: Could not read parameter from \n%s\nat\n", compline);
fprintf(stderr, "%*s%s\n", *line - compline, " ", *line);
}
temp.v.vec.iVec = ilist;
} else if (type == IF_FLAG) {
temp.iValue = 1;