Browse Source

CKTfndMod(), dont pass the `type' argument by reference any more

pre-master-46
rlar 13 years ago
parent
commit
b32c15d85f
  1. 4
      src/frontend/spiceif.c
  2. 2
      src/include/ngspice/cktdefs.h
  3. 2
      src/include/ngspice/ifsim.h
  4. 13
      src/spicelib/analysis/cktfndm.c
  5. 2
      src/spicelib/analysis/cktmcrt.c
  6. 4
      src/spicelib/devices/urc/urcsetup.c
  7. 2
      src/tclspice.c

4
src/frontend/spiceif.c

@ -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;

2
src/include/ngspice/cktdefs.h

@ -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);

2
src/include/ngspice/ifsim.h

@ -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*/

13
src/spicelib/analysis/cktfndm.c

@ -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;
}

2
src/spicelib/analysis/cktmcrt.c

@ -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);

4
src/spicelib/devices/urc/urcsetup.c

@ -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);

2
src/tclspice.c

@ -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…
Cancel
Save