CKTfndMod(), cleanup
This commit is contained in:
parent
b32c15d85f
commit
59309e196b
|
|
@ -611,19 +611,15 @@ finddev_special(
|
|||
GENmodel **modptr,
|
||||
int *device_or_model)
|
||||
{
|
||||
int type = -1;
|
||||
|
||||
*devptr = ft_sim->findInstance (ckt, name);
|
||||
if (*devptr) {
|
||||
*device_or_model = 0;
|
||||
return (*devptr)->GENmodPtr->GENmodType;
|
||||
}
|
||||
|
||||
type = -1;
|
||||
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
*modptr = ft_sim->findModel (ckt, type, modptr, name);
|
||||
*modptr = ft_sim->findModel (ckt, -1, NULL, name);
|
||||
if (*modptr) {
|
||||
*device_or_model = 1;
|
||||
return (*modptr)->GENmodType;
|
||||
|
|
@ -1211,17 +1207,13 @@ doset(CKTcircuit *ckt, int typecode, GENinstance *dev, GENmodel *mod, IFparm *op
|
|||
static int
|
||||
finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr)
|
||||
{
|
||||
int type = -1;
|
||||
|
||||
*devptr = ft_sim->findInstance (ckt, name);
|
||||
if (*devptr)
|
||||
return (*devptr)->GENmodPtr->GENmodType;
|
||||
|
||||
type = -1;
|
||||
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
*modptr = ft_sim->findModel (ckt, type, modptr, name);
|
||||
*modptr = ft_sim->findModel (ckt, -1, modptr, name);
|
||||
if (*modptr)
|
||||
return (*modptr)->GENmodType;
|
||||
|
||||
|
|
|
|||
|
|
@ -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, NULL, name);
|
||||
if(!mymodfast) {
|
||||
mymodfast = (GENmodel *) tmalloc((size_t) *(DEVices[type]->DEVmodSize));
|
||||
if(mymodfast == NULL) return(E_NOMEM);
|
||||
|
|
|
|||
|
|
@ -280,7 +280,6 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
|||
URCmodel *model = (URCmodel *) inModel;
|
||||
GENinstance *in;
|
||||
GENmodel *modfast;
|
||||
int type;
|
||||
|
||||
/* Delete models, devices, and intermediate nodes; */
|
||||
|
||||
|
|
@ -306,11 +305,9 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
|||
if (error && error != E_EXISTS)
|
||||
return error;
|
||||
|
||||
modfast = NULL;
|
||||
type = -1;
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
modfast = CKTfndMod(ckt, type, &modfast, varUid);
|
||||
modfast = CKTfndMod(ckt, -1, NULL, varUid);
|
||||
if (!modfast)
|
||||
return E_NOMOD;
|
||||
|
||||
|
|
@ -325,11 +322,9 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
|||
if (error && error != E_EXISTS)
|
||||
return error;
|
||||
|
||||
modfast = NULL;
|
||||
type = -1;
|
||||
// assert(second && *second == -1)
|
||||
// assert(third && *third == NULL)
|
||||
modfast = CKTfndMod(ckt, type, &modfast, varUid);
|
||||
modfast = CKTfndMod(ckt, -1, NULL, varUid);
|
||||
if (!modfast)
|
||||
return E_NOMOD;
|
||||
CKTdltMod(ckt, modfast);
|
||||
|
|
|
|||
|
|
@ -1399,10 +1399,12 @@ 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, -1, NULL, name);
|
||||
err = modptr ? OK : E_NOMOD;
|
||||
if (modptr)
|
||||
typecode = modptr->GENmodType;
|
||||
else
|
||||
typecode = -1;
|
||||
} else {
|
||||
typecode = devptr->GENmodPtr->GENmodType;
|
||||
err = OK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue