parser/inpdpar.c, #4/6, cleanup, use a local `IFdevice *'
This commit is contained in:
parent
36f3263727
commit
f88cfa5d55
|
|
@ -30,6 +30,8 @@ INPdevParse(char **line, CKTcircuit *ckt, int dev, GENinstance *fast,
|
||||||
/* the optional leading numeric parameter */
|
/* the optional leading numeric parameter */
|
||||||
/* flag - 1 if leading double given, 0 otherwise */
|
/* flag - 1 if leading double given, 0 otherwise */
|
||||||
{
|
{
|
||||||
|
IFdevice *device = ft_sim->devices[dev];
|
||||||
|
|
||||||
int error; /* int to store evaluate error return codes in */
|
int error; /* int to store evaluate error return codes in */
|
||||||
char *parm = NULL;
|
char *parm = NULL;
|
||||||
char *errbuf;
|
char *errbuf;
|
||||||
|
|
@ -57,27 +59,27 @@ INPdevParse(char **line, CKTcircuit *ckt, int dev, GENinstance *fast,
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < *(ft_sim->devices[dev]->numInstanceParms); i++) {
|
for (i = 0; i < *(device->numInstanceParms); i++) {
|
||||||
if (strcmp(parm, ft_sim->devices[dev]->instanceParms[i].keyword) == 0) {
|
if (strcmp(parm, device->instanceParms[i].keyword) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= *(ft_sim->devices[dev]->numInstanceParms)) {
|
if (i >= *(device->numInstanceParms)) {
|
||||||
errbuf = tprintf(" unknown parameter (%s) \n", parm);
|
errbuf = tprintf(" unknown parameter (%s) \n", parm);
|
||||||
rtn = errbuf;
|
rtn = errbuf;
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = INPgetValue(ckt, line,
|
val = INPgetValue(ckt, line,
|
||||||
ft_sim->devices[dev]->instanceParms[i].dataType,
|
device->instanceParms[i].dataType,
|
||||||
tab);
|
tab);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
rtn = INPerror(E_PARMVAL);
|
rtn = INPerror(E_PARMVAL);
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
error = ft_sim->setInstanceParm (ckt, fast,
|
error = ft_sim->setInstanceParm (ckt, fast,
|
||||||
ft_sim->devices[dev]->instanceParms[i].id,
|
device->instanceParms[i].id,
|
||||||
val, NULL);
|
val, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
rtn = INPerror(error);
|
rtn = INPerror(error);
|
||||||
|
|
@ -85,7 +87,7 @@ INPdevParse(char **line, CKTcircuit *ckt, int dev, GENinstance *fast,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete the union val */
|
/* delete the union val */
|
||||||
switch (ft_sim->devices[dev]->instanceParms[i].dataType & IF_VARTYPES) {
|
switch (device->instanceParms[i].dataType & IF_VARTYPES) {
|
||||||
case IF_REALVEC:
|
case IF_REALVEC:
|
||||||
tfree(val->v.vec.rVec);
|
tfree(val->v.vec.rVec);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue