You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.2 KiB

/**********
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/* CKTdltMod
* delete the specified model - not yet supported in spice
*/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "ngspice/ifsim.h"
#include "ngspice/sperror.h"
/* ARGSUSED */
int
CKTdltMod(CKTcircuit *ckt, GENmodel *m)
{
GENmodel *mod, **prevp;
GENinstance *h, *next_i;
int error;
prevp = &ckt->CKThead[m->GENmodType];
for (mod = *prevp; m && mod != m; mod = mod->GENnextModel)
prevp = &mod->GENnextModel;
if (!mod)
return OK;
*prevp = m->GENnextModel;
for (h = m->GENinstances; h; h = next_i) {
next_i = h->GENnextInstance;
if (h != nghash_delete(ckt->DEVnameHash, h->GENname))
fprintf(stderr, "ERROR, ouch nasal daemons ...\n");
error = SPfrontEnd->IFdelUid (ckt, h->GENname,
UID_INSTANCE);
tfree(h);
}
if (m != nghash_delete(ckt->MODnameHash, m->GENmodName))
fprintf(stderr, "ERROR, ouch nasal daemons ...\n");
error = SPfrontEnd->IFdelUid (ckt, m->GENmodName, UID_MODEL);
tfree(m);
return(OK);
}