mhx: introduce INPaSpecName()
This commit is contained in:
parent
05211bbb15
commit
51fca39bc9
|
|
@ -175,6 +175,7 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
|
|||
run->type = copy(analName);
|
||||
run->windowed = windowed;
|
||||
run->numData = 0;
|
||||
run->spindex = -1; // mhx
|
||||
|
||||
an_name = spice_analysis_get_name(analysisPtr->JOBtype);
|
||||
ft_curckt->ci_last_an = an_name;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ struct runDesc {
|
|||
int pointCount;
|
||||
int isComplex;
|
||||
int windowCount;
|
||||
int spindex; /* mhx */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ int IFnewUid(CKTcircuit *, IFuid *, IFuid, char *, int, CKTnode **);
|
|||
int IFdelUid(CKTcircuit *, IFuid, int);
|
||||
int INPaName(char *, IFvalue *, CKTcircuit *, int *, char *, GENinstance **, IFsimulator *, int *,
|
||||
IFvalue *);
|
||||
int INPaSpecName(char *, IFvalue *, CKTcircuit *, int *, char *, GENinstance **, IFsimulator *, int *, IFvalue *, int *);
|
||||
int INPapName(CKTcircuit *, int, JOB *, char *, IFvalue *);
|
||||
void INPcaseFix(char *);
|
||||
char *INPdevParse(char **, CKTcircuit *, int, GENinstance *, double *, int *, INPtables *);
|
||||
|
|
|
|||
|
|
@ -69,3 +69,62 @@ INPaName(char *parm, IFvalue * val, CKTcircuit *ckt, int *dev, char *devnam,
|
|||
}
|
||||
return (E_BADPARM);
|
||||
}
|
||||
|
||||
|
||||
// mhx: specialized (faster) version that directly returns/uses the index of the parameter we seek
|
||||
int INPaSpecName (
|
||||
char *parm, // the name of the parameter to set,
|
||||
IFvalue *val, // the parameter union containing the value to set,
|
||||
CKTcircuit *ckt, // the circuit this device is a member of,
|
||||
int *dev, // the device type code to the device being parsed,
|
||||
char *devnam, // the name of the device,
|
||||
GENinstance **fast, // direct pointer to device being parsed,
|
||||
IFsimulator *sim, // the simulator data structure,
|
||||
int *dataType, // the datatype of the returned value structure,
|
||||
IFvalue *selector, // data sub-selector for questions.
|
||||
int *spindex) // special index
|
||||
{
|
||||
int error; // int to store evaluate error return codes in
|
||||
int i;
|
||||
|
||||
/*
|
||||
* find the instance - don't know about model, so use null there,
|
||||
* otherwise pass on as much info as we have about the device
|
||||
* (name, type, direct pointer) - the type and direct pointer
|
||||
* WILL be set on return unless error is not OK
|
||||
*/
|
||||
if (*fast == NULL)
|
||||
*fast = sim->findInstance(ckt, devnam);
|
||||
if (*fast == NULL)
|
||||
return (E_NODEV);
|
||||
|
||||
*dev = (*fast)->GENmodPtr->GENmodType;
|
||||
|
||||
/* now find the parameter - hunt through the parameter tables for
|
||||
* this device type and look for a name match of an 'ask'able
|
||||
* parameter.
|
||||
*/
|
||||
if (*spindex != -1) { // mhx: shortcut for repeated question
|
||||
error = sim->askInstanceQuest(ckt, *fast, sim->devices[*dev]->instanceParms[*spindex].id, val, selector);
|
||||
if (dataType)
|
||||
*dataType = sim->devices[*dev]->instanceParms[*spindex].dataType;
|
||||
return error;
|
||||
}
|
||||
|
||||
for (i = 0; i < *(sim->devices[*dev]->numInstanceParms); i++) {
|
||||
if (strcmp(parm, sim->devices[*dev]->instanceParms[i].keyword) == 0
|
||||
&& (sim->devices[*dev]->instanceParms[i].dataType & IF_ASK)) {
|
||||
/*
|
||||
* found it, so we ask the question using the device info we got
|
||||
* above and put the results in the IFvalue structure our caller gave us originally
|
||||
*/
|
||||
*spindex = i; /* mhx: shortcut for repeated questioning */
|
||||
error = sim->askInstanceQuest(ckt, *fast, sim->devices[*dev]->instanceParms[i].id, val, selector);
|
||||
if (dataType)
|
||||
*dataType = sim->devices[*dev]->instanceParms[i].dataType; // probably double
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
return E_BADPARM;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue