Browse Source

CKTfndMod(), cleanup

pre-master-46
rlar 13 years ago
parent
commit
59309e196b
  1. 12
      src/frontend/spiceif.c
  2. 2
      src/spicelib/analysis/cktmcrt.c
  3. 9
      src/spicelib/devices/urc/urcsetup.c
  4. 4
      src/tclspice.c

12
src/frontend/spiceif.c

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

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, NULL, name);
if(!mymodfast) {
mymodfast = (GENmodel *) tmalloc((size_t) *(DEVices[type]->DEVmodSize));
if(mymodfast == NULL) return(E_NOMEM);

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

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

4
src/tclspice.c

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