CKTfndDev(), rewrite error expressions
This commit is contained in:
parent
5daa676163
commit
390dccd44b
|
|
@ -616,8 +616,7 @@ finddev_special(
|
|||
|
||||
// assert(third && *third == NULL); for all invocations
|
||||
*devptr = ft_sim->findInstance (ckt, &type, devptr, name);
|
||||
err = *devptr ? OK : E_NODEV;
|
||||
if (err == OK) {
|
||||
if (*devptr) {
|
||||
*device_or_model = 0;
|
||||
return (type);
|
||||
}
|
||||
|
|
@ -1219,8 +1218,7 @@ finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr)
|
|||
|
||||
// assert(third && *third == NULL); for all invocations
|
||||
*devptr = ft_sim->findInstance (ckt, &type, devptr, name);
|
||||
err = *devptr ? OK : E_NODEV;
|
||||
if (err == OK)
|
||||
if (*devptr)
|
||||
return (type);
|
||||
|
||||
type = -1;
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
if (code != -1) {
|
||||
// assert(third && *third == NULL);
|
||||
inst = CKTfndDev(ckt, NULL, &inst, job->input);
|
||||
error = inst ? OK : E_NODEV;
|
||||
if (!error && !((VSRCinstance *)inst)->VSRCacGiven) {
|
||||
if (inst && !((VSRCinstance *)inst)->VSRCacGiven) {
|
||||
errMsg = TMALLOC(char, strlen(noacinput) + 1);
|
||||
strcpy(errMsg,noacinput);
|
||||
return (E_NOACINPUT);
|
||||
|
|
@ -62,8 +61,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
if (code != -1 && inst==NULL) {
|
||||
// assert(third && *third == NULL);
|
||||
inst = CKTfndDev(ckt, NULL, &inst, job->input);
|
||||
error = inst ? OK : E_NODEV;
|
||||
if (error) {
|
||||
if (!inst) {
|
||||
/* XXX ??? */
|
||||
SPfrontEnd->IFerror (ERR_WARNING,
|
||||
"Noise input source %s not in circuit",
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@ TFanal(CKTcircuit *ckt, int restart)
|
|||
if(Itype != -1) {
|
||||
// assert(third && *third == NULL);
|
||||
ptr = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc);
|
||||
error = ptr ? OK : E_NODEV;
|
||||
if(error ==0) {
|
||||
if (ptr) {
|
||||
job->TFinIsI = 1;
|
||||
job->TFinIsV = 0;
|
||||
} else {
|
||||
|
|
@ -65,10 +64,9 @@ TFanal(CKTcircuit *ckt, int restart)
|
|||
if( (Vtype != -1) && (ptr==NULL) ) {
|
||||
// assert(third && *third == NULL);
|
||||
ptr = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc);
|
||||
error = ptr ? OK : E_NODEV;
|
||||
job->TFinIsV = 1;
|
||||
job->TFinIsI = 0;
|
||||
if(error !=0) {
|
||||
if (!ptr) {
|
||||
SPfrontEnd->IFerror (ERR_WARNING,
|
||||
"Transfer function source %s not in circuit",
|
||||
&(job->TFinSrc));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ CKTcrtElt(CKTcircuit *ckt, GENmodel *modPtr, GENinstance **inInstPtr, IFuid name
|
|||
GENinstance *instPtr = NULL; /* instPtr points to the data struct for per-instance data */
|
||||
|
||||
SPICEdev **DEVices;
|
||||
int error;
|
||||
int type;
|
||||
|
||||
DEVices = devices();
|
||||
|
|
@ -31,9 +30,8 @@ CKTcrtElt(CKTcircuit *ckt, GENmodel *modPtr, GENinstance **inInstPtr, IFuid name
|
|||
|
||||
// assert(third && *third == NULL);
|
||||
instPtr = CKTfndDev(ckt, NULL, &instPtr, name);
|
||||
error = instPtr ? OK : E_NODEV;
|
||||
|
||||
if (error == OK) {
|
||||
if (instPtr) {
|
||||
if (inInstPtr)
|
||||
*inInstPtr = instPtr;
|
||||
return E_EXISTS;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||
MUTmodel *model = (MUTmodel*)inModel;
|
||||
MUTinstance *here;
|
||||
int ktype;
|
||||
int error;
|
||||
|
||||
NG_IGNORE(states);
|
||||
|
||||
|
|
@ -45,8 +44,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||
|
||||
// assert(third);
|
||||
here->MUTind1 = (INDinstance *) CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind1), here->MUTindName1);
|
||||
error = here->MUTind1 ? OK : E_NODEV;
|
||||
if(error) {
|
||||
if (!here->MUTind1) {
|
||||
IFuid namarray[2];
|
||||
namarray[0]=here->MUTname;
|
||||
namarray[1]=here->MUTindName1;
|
||||
|
|
@ -56,8 +54,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||
}
|
||||
// assert(third);
|
||||
here->MUTind2 = (INDinstance *) CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind2), here->MUTindName2);
|
||||
error = here->MUTind2 ? OK : E_NODEV;
|
||||
if(error) {
|
||||
if (!here->MUTind2) {
|
||||
IFuid namarray[2];
|
||||
namarray[0]=here->MUTname;
|
||||
namarray[1]=here->MUTindName2;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,8 @@ INPaName(char *parm, IFvalue * val, CKTcircuit *ckt, int *dev, char *devnam,
|
|||
*/
|
||||
// assert(third) for all invocations
|
||||
*fast = sim->findInstance (ckt, dev, fast, devnam);
|
||||
error = *fast ? OK : E_NODEV;
|
||||
if (error)
|
||||
return (error);
|
||||
if (*fast == NULL)
|
||||
return (E_NODEV);
|
||||
|
||||
/* now find the parameter - hunt through the parameter tables for
|
||||
* this device type and look for a name match of an 'ask'able
|
||||
|
|
|
|||
|
|
@ -1396,11 +1396,12 @@ get_mod_param TCL_CMDPROCARGS(clientData, interp, argc, argv)
|
|||
INPretrieve(&name, ft_curckt->ci_symtab);
|
||||
// assert(third && *third == NULL);
|
||||
devptr = ft_sim->findInstance (ft_curckt->ci_ckt, &typecode, &devptr, name);
|
||||
err = devptr ? OK : E_NODEV;
|
||||
if (err != OK) {
|
||||
if (!devptr) {
|
||||
typecode = -1;
|
||||
devptr = NULL;
|
||||
err = ft_sim->findModel (ft_curckt->ci_ckt, &typecode, &modptr, name);
|
||||
} else {
|
||||
err = OK;
|
||||
}
|
||||
if (err != OK) {
|
||||
sprintf(buf, "No such device or model name %s", name);
|
||||
|
|
|
|||
|
|
@ -44,9 +44,8 @@ SENstartup(CKTcircuit *ckt, int restart)
|
|||
|
||||
// assert(third && *third == NULL);
|
||||
fast = CKTfndDev(ckt, &type, &fast, ckt->CKTsenInfo->SENdevices[i]);
|
||||
err = fast ? OK : E_NODEV;
|
||||
if (err != OK)
|
||||
return err;
|
||||
if (!fast)
|
||||
return E_NODEV;
|
||||
|
||||
#ifdef SENSDEBUG
|
||||
printf("SENstartup Instance: %s Design parameter: %s\n", ckt->CKTsenInfo->SENdevices[i],
|
||||
|
|
|
|||
Loading…
Reference in New Issue