CKTfndMod(), dont pass the `type' argument by reference any more
This commit is contained in:
parent
494ef3f628
commit
b32c15d85f
|
|
@ -623,7 +623,7 @@ finddev_special(
|
|||
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
*modptr = ft_sim->findModel (ckt, &type, modptr, name);
|
||||
*modptr = ft_sim->findModel (ckt, type, modptr, name);
|
||||
if (*modptr) {
|
||||
*device_or_model = 1;
|
||||
return (*modptr)->GENmodType;
|
||||
|
|
@ -1221,7 +1221,7 @@ finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr)
|
|||
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
*modptr = ft_sim->findModel (ckt, &type, modptr, name);
|
||||
*modptr = ft_sim->findModel (ckt, type, modptr, name);
|
||||
if (*modptr)
|
||||
return (*modptr)->GENmodType;
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ extern void CKTncDump(CKTcircuit *);
|
|||
extern int CKTfndAnal(CKTcircuit *, int *, JOB **, IFuid , TSKtask *, IFuid);
|
||||
extern int CKTfndBranch(CKTcircuit *, IFuid);
|
||||
extern GENinstance *CKTfndDev(CKTcircuit *, IFuid);
|
||||
extern GENmodel *CKTfndMod(CKTcircuit *, int *, GENmodel **, IFuid);
|
||||
extern GENmodel *CKTfndMod(CKTcircuit *, int, GENmodel **, IFuid);
|
||||
extern int CKTfndNode(CKTcircuit *, CKTnode **, IFuid);
|
||||
extern int CKTfndTask(CKTcircuit *, TSKtask **, IFuid );
|
||||
extern int CKTground(CKTcircuit *, CKTnode **, IFuid);
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ struct IFsimulator {
|
|||
/* set a parameter on a model */
|
||||
int (*askModelQuest) (CKTcircuit *, GENmodel *, int, IFvalue *, IFvalue *);
|
||||
/* ask a questions about a model */
|
||||
GENmodel *(*findModel) (CKTcircuit *, int *, GENmodel **, IFuid);
|
||||
GENmodel *(*findModel) (CKTcircuit *, int, GENmodel **, IFuid);
|
||||
/* find a specific model */
|
||||
int (*deleteModel) (CKTcircuit *, GENmodel *);
|
||||
/* delete a model from the circuit*/
|
||||
|
|
|
|||
|
|
@ -14,33 +14,32 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
GENmodel *
|
||||
CKTfndMod(CKTcircuit *ckt, int *type, GENmodel **modfast, IFuid modname)
|
||||
CKTfndMod(CKTcircuit *ckt, int type, GENmodel **modfast, IFuid modname)
|
||||
{
|
||||
GENmodel *mods;
|
||||
|
||||
if(*type >=0 && *type < DEVmaxnum) {
|
||||
if(type >=0 && type < DEVmaxnum) {
|
||||
/* have device type, need to find model */
|
||||
/* look through all models */
|
||||
for(mods=ckt->CKThead[*type]; mods != NULL ;
|
||||
for(mods=ckt->CKThead[type]; mods != NULL ;
|
||||
mods = mods->GENnextModel) {
|
||||
if(mods->GENmodName == modname) {
|
||||
return mods;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
} else if(*type == -1) {
|
||||
} else if(type == -1) {
|
||||
/* look through all types (UGH - worst case - take forever) */
|
||||
for(*type = 0;*type <DEVmaxnum;(*type)++) {
|
||||
for(type = 0;type <DEVmaxnum;(type)++) {
|
||||
/* need to find model & device */
|
||||
/* look through all models */
|
||||
for(mods=ckt->CKThead[*type];mods!=NULL;
|
||||
for(mods=ckt->CKThead[type];mods!=NULL;
|
||||
mods = mods->GENnextModel) {
|
||||
if(mods->GENmodName == modname) {
|
||||
return mods;
|
||||
}
|
||||
}
|
||||
}
|
||||
*type = -1;
|
||||
return NULL;
|
||||
} else return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ CKTmodCrt(CKTcircuit *ckt, int type, GENmodel **modfast, IFuid name)
|
|||
|
||||
// assert(second)
|
||||
// assert(third && *third == NULL)
|
||||
mymodfast = CKTfndMod(ckt, &type, &mymodfast, name);
|
||||
mymodfast = CKTfndMod(ckt, type, &mymodfast, name);
|
||||
if(!mymodfast) {
|
||||
mymodfast = (GENmodel *) tmalloc((size_t) *(DEVices[type]->DEVmodSize));
|
||||
if(mymodfast == NULL) return(E_NOMEM);
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
|||
type = -1;
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
modfast = CKTfndMod(ckt, &type, &modfast, varUid);
|
||||
modfast = CKTfndMod(ckt, type, &modfast, varUid);
|
||||
if (!modfast)
|
||||
return E_NOMOD;
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
|||
type = -1;
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
modfast = CKTfndMod(ckt, &type, &modfast, varUid);
|
||||
modfast = CKTfndMod(ckt, type, &modfast, varUid);
|
||||
if (!modfast)
|
||||
return E_NOMOD;
|
||||
CKTdltMod(ckt, modfast);
|
||||
|
|
|
|||
|
|
@ -1399,7 +1399,7 @@ get_mod_param TCL_CMDPROCARGS(clientData, interp, argc, argv)
|
|||
typecode = -1;
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
modptr = ft_sim->findModel (ft_curckt->ci_ckt, &typecode, &modptr, name);
|
||||
modptr = ft_sim->findModel (ft_curckt->ci_ckt, typecode, &modptr, name);
|
||||
err = modptr ? OK : E_NOMOD;
|
||||
if (modptr)
|
||||
typecode = modptr->GENmodType;
|
||||
|
|
|
|||
Loading…
Reference in New Issue