devices/**/XXXmdel.c, fix adms too
This commit is contained in:
parent
982ba45bab
commit
8ba1999d15
|
|
@ -40,41 +40,36 @@
|
||||||
<admst:template match="code">
|
<admst:template match="code">
|
||||||
<admst:value-of select="attribute[name='ngspicename']/value"/>
|
<admst:value-of select="attribute[name='ngspicename']/value"/>
|
||||||
<admst:variable name="module" select="%s"/>
|
<admst:variable name="module" select="%s"/>
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
#include "$(module)defs.h"
|
#include "$(module)defs.h"
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/suffix.h"
|
#include "ngspice/suffix.h"
|
||||||
|
|
||||||
int $(module)mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
|
int
|
||||||
|
$(module)mDelete(GENmodel **models, IFuid modname, GENmodel *kill)
|
||||||
{
|
{
|
||||||
register $(module)model **model = ($(module)model**)inModel;
|
GENinstance *here;
|
||||||
register $(module)model *modfast =($(module)model*)kill;
|
GENmodel **prev = models;
|
||||||
$(module)instance *here;
|
GENmodel *model = *prev;
|
||||||
$(module)instance *prev = NULL;
|
|
||||||
$(module)model **oldmod;
|
|
||||||
|
|
||||||
oldmod = model;
|
for (; model; model = model->GENnextModel) {
|
||||||
for ( ; *model ; model = &((*model)->$(module)nextModel)) {
|
if (model->GENmodName == modname || (kill && model == kill))
|
||||||
if ((*model)->$(module)modName == modname ||
|
break;
|
||||||
(modfast && *model == modfast))
|
prev = &(model->GENnextModel);
|
||||||
goto delgot;
|
|
||||||
oldmod = model;
|
|
||||||
}
|
|
||||||
return(E_NOMOD);
|
|
||||||
|
|
||||||
delgot:
|
|
||||||
*oldmod = (*model)->$(module)nextModel; /* cut deleted device out of list */
|
|
||||||
for (here = (*model)->$(module)instances; here; here = here->$(module)nextInstance)
|
|
||||||
{ if(prev) FREE(prev);
|
|
||||||
prev = here;
|
|
||||||
}
|
}
|
||||||
if(prev) FREE(prev);
|
|
||||||
FREE(*model);
|
|
||||||
return(OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!model)
|
||||||
|
return E_NOMOD;
|
||||||
|
|
||||||
|
*prev = model->GENnextModel;
|
||||||
|
for (here = model->GENinstances; here;) {
|
||||||
|
GENinstance *next_instance = here->GENnextInstance;
|
||||||
|
FREE(here);
|
||||||
|
here = next_instance;
|
||||||
|
}
|
||||||
|
FREE(model);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
</admst:template>
|
</admst:template>
|
||||||
|
|
||||||
<admst:for-each select="/module">
|
<admst:for-each select="/module">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue