spicelib/devcies/*dest.c, rewrite DEVdestroy() functions

This commit is contained in:
rlar 2016-07-29 22:22:16 +02:00
parent d9e0ae3504
commit 4d79617cf1
56 changed files with 873 additions and 1201 deletions

View File

@ -10,28 +10,25 @@ Author: 1987 Kanwar Jit Singh
void
ASRCdestroy(GENmodel **model)
ASRCdestroy(GENmodel **inModel)
{
ASRCmodel **start = (ASRCmodel**) model; /* starting model */
ASRCinstance *here; /* current instance */
ASRCinstance *next;
ASRCmodel *mod = *start; /* current model */
ASRCmodel *nextmod;
ASRCmodel *mod = *(ASRCmodel**) inModel;
for (; mod ; mod = nextmod) {
for (here = mod->ASRCinstances; here; here = next) {
next = here->ASRCnextInstance;
FREE(here->ASRCacValues);
INPfreeTree(here->ASRCtree);
if (here->ASRCposptr)
free(here->ASRCposptr);
if (here->ASRCvars)
free(here->ASRCvars);
FREE(here);
while (mod) {
ASRCmodel *next_mod = mod->ASRCnextModel;
ASRCinstance *inst = mod->ASRCinstances;
while (inst) {
ASRCinstance *next_inst = inst->ASRCnextInstance;
INPfreeTree(inst->ASRCtree);
FREE(inst->ASRCacValues);
FREE(inst->ASRCposptr);
FREE(inst->ASRCvars);
FREE(inst);
inst = next_inst;
}
nextmod = mod->ASRCnextModel;
FREE(mod);
mod = next_mod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
/*
* This routine deletes all BJTs from the circuit and frees
@ -17,31 +15,21 @@ Author: 1985 Thomas L. Quarles
void
BJTdestroy(GENmodel **inModel)
{
BJTmodel *mod = *(BJTmodel**) inModel;
BJTmodel **model = (BJTmodel**)inModel;
BJTinstance *here;
BJTinstance *prev = NULL;
BJTmodel *mod = *model;
BJTmodel *oldmod = NULL;
for( ; mod ; mod = mod->BJTnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->BJTinstances ; here ; here = here->BJTnextInstance) {
if(prev){
if(prev->BJTsens) FREE(prev->BJTsens);
FREE(prev);
}
prev = here;
}
if(prev){
if(prev->BJTsens) FREE(prev->BJTsens);
FREE(prev);
while (mod) {
BJTmodel *next_mod = mod->BJTnextModel;
BJTinstance *inst = mod->BJTinstances;
while (inst) {
BJTinstance *next_inst = inst->BJTnextInstance;
FREE(inst->BJTsens);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "bsim1def.h"
@ -13,23 +11,19 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
void
B1destroy(GENmodel **inModel)
{
B1model *mod = *(B1model**) inModel;
B1model **model = (B1model**)inModel;
B1instance *here;
B1instance *prev = NULL;
B1model *mod = *model;
B1model *oldmod = NULL;
for( ; mod ; mod = mod->B1nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->B1instances ; here ; here = here->B1nextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
B1model *next_mod = mod->B1nextModel;
B1instance *inst = mod->B1instances;
while (inst) {
B1instance *next_inst = inst->B1nextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "bsim2def.h"
@ -13,24 +11,19 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
void
B2destroy(GENmodel **inModel)
{
B2model *mod = *(B2model**) inModel;
B2model **model = (B2model**)inModel;
B2instance *here;
B2instance *prev = NULL;
B2model *mod = *model;
B2model *oldmod = NULL;
for( ; mod ; mod = mod->B2nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->B2instances ; here ; here = here->B2nextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
B2model *next_mod = mod->B2nextModel;
B2instance *inst = mod->B2instances;
while (inst) {
B2instance *next_inst = inst->B2nextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
}
*inModel = NULL;
}

View File

@ -12,53 +12,41 @@
#include "bsim3def.h"
#include "ngspice/suffix.h"
void
BSIM3destroy(
GENmodel **inModel)
BSIM3destroy(GENmodel **inModel)
{
BSIM3model **model = (BSIM3model**)inModel;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model *mod = *model;
BSIM3model *oldmod = NULL;
BSIM3model *mod = *(BSIM3model**) inModel;
for (; mod ; mod = mod->BSIM3nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM3version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3instances; here; here = here->BSIM3nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM3InstanceArray);
#endif
/* oldmod->BSIM3modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM3version);
FREE(oldmod);
FREE(mod->BSIM3InstanceArray);
#endif
while (mod) {
BSIM3model *next_mod = mod->BSIM3nextModel;
BSIM3instance *inst = mod->BSIM3instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim3SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM3instance *next_inst = inst->BSIM3nextInstance;
FREE(inst);
inst = next_inst;
}
/* mod->BSIM3modName to be freed in INPtabEnd() */
FREE(mod->BSIM3version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/
/*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMDD2.1 release
*/
@ -14,29 +14,23 @@ Modified by Paolo Nenzi 2002
#include "b3soidddef.h"
#include "ngspice/suffix.h"
void
B3SOIDDdestroy(GENmodel **inModel)
{
B3SOIDDmodel **model = (B3SOIDDmodel**)inModel;
B3SOIDDinstance *here;
B3SOIDDinstance *prev = NULL;
B3SOIDDmodel *mod = *model;
B3SOIDDmodel *oldmod = NULL;
B3SOIDDmodel *mod = *(B3SOIDDmodel**) inModel;
for (; mod ; mod = mod->B3SOIDDnextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->B3SOIDDinstances; here; here = here->B3SOIDDnextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
B3SOIDDmodel *next_mod = mod->B3SOIDDnextModel;
B3SOIDDinstance *inst = mod->B3SOIDDinstances;
while (inst) {
B3SOIDDinstance *next_inst = inst->B3SOIDDnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -6,7 +6,7 @@ File: b3soifddest.c 98/5/01
**********/
/*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMFD2.1 release
*/
@ -14,29 +14,23 @@ File: b3soifddest.c 98/5/01
#include "b3soifddef.h"
#include "ngspice/suffix.h"
void
B3SOIFDdestroy(GENmodel **inModel)
{
B3SOIFDmodel **model = (B3SOIFDmodel**)inModel;
B3SOIFDinstance *here;
B3SOIFDinstance *prev = NULL;
B3SOIFDmodel *mod = *model;
B3SOIFDmodel *oldmod = NULL;
B3SOIFDmodel *mod = *(B3SOIFDmodel**) inModel;
for (; mod ; mod = mod->B3SOIFDnextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->B3SOIFDinstances; here; here = here->B3SOIFDnextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
B3SOIFDmodel *next_mod = mod->B3SOIFDnextModel;
B3SOIFDinstance *inst = mod->B3SOIFDinstances;
while (inst) {
B3SOIFDinstance *next_inst = inst->B3SOIFDnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/
/*
* Revision 2.2.3 02/3/5 Pin Su
* Revision 2.2.3 02/3/5 Pin Su
* BSIMPD2.2.3 release
*/
@ -14,29 +14,23 @@ Modified by Paolo Nenzi 2002
#include "b3soipddef.h"
#include "ngspice/suffix.h"
void
B3SOIPDdestroy(GENmodel **inModel)
{
B3SOIPDmodel **model = (B3SOIPDmodel**)inModel;
B3SOIPDinstance *here;
B3SOIPDinstance *prev = NULL;
B3SOIPDmodel *mod = *model;
B3SOIPDmodel *oldmod = NULL;
B3SOIPDmodel *mod = *(B3SOIPDmodel**) inModel;
for (; mod ; mod = mod->B3SOIPDnextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->B3SOIPDinstances; here; here = here->B3SOIPDnextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
B3SOIPDmodel *next_mod = mod->B3SOIPDnextModel;
B3SOIPDinstance *inst = mod->B3SOIPDinstances;
while (inst) {
B3SOIPDinstance *next_inst = inst->B3SOIPDnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -8,29 +8,23 @@ File: b3v0dest.c
#include "bsim3v0def.h"
#include "ngspice/suffix.h"
void
BSIM3v0destroy(GENmodel **inModel)
{
BSIM3v0model **model = (BSIM3v0model**)inModel;
BSIM3v0instance *here;
BSIM3v0instance *prev = NULL;
BSIM3v0model *mod = *model;
BSIM3v0model *oldmod = NULL;
BSIM3v0model *mod = *(BSIM3v0model**) inModel;
for (; mod ; mod = mod->BSIM3v0nextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3v0instances; here; here = here->BSIM3v0nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
BSIM3v0model *next_mod = mod->BSIM3v0nextModel;
BSIM3v0instance *inst = mod->BSIM3v0instances;
while (inst) {
BSIM3v0instance *next_inst = inst->BSIM3v0nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -1,12 +1,12 @@
/**********
* Copyright 1990 Regents of the University of California. All rights reserved.
* File: b3v1dest.c
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Modified by Paolo Nenzi 2002
**********/
/*
* Release Notes:
/*
* Release Notes:
* BSIM3v3.1, Released by yuhua 96/12/08
*/
@ -14,29 +14,23 @@
#include "bsim3v1def.h"
#include "ngspice/suffix.h"
void
BSIM3v1destroy(GENmodel **inModel)
{
BSIM3v1model **model = (BSIM3v1model**)inModel;
BSIM3v1instance *here;
BSIM3v1instance *prev = NULL;
BSIM3v1model *mod = *model;
BSIM3v1model *oldmod = NULL;
BSIM3v1model *mod = *(BSIM3v1model**) inModel;
for (; mod ; mod = mod->BSIM3v1nextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3v1instances; here; here = here->BSIM3v1nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
BSIM3v1model *next_mod = mod->BSIM3v1nextModel;
BSIM3v1instance *inst = mod->BSIM3v1instances;
while (inst) {
BSIM3v1instance *next_inst = inst->BSIM3v1nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -13,48 +13,37 @@
#include "bsim3v32def.h"
#include "ngspice/suffix.h"
void
BSIM3v32destroy (GENmodel **inModel)
{
BSIM3v32model **model = (BSIM3v32model**)inModel;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model *mod = *model;
BSIM3v32model *oldmod = NULL;
BSIM3v32model *mod = *(BSIM3v32model**) inModel;
for (; mod ; mod = mod->BSIM3v32nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3v32SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM3v32version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM3v32InstanceArray);
/* free just once for all models */
FREE(mod->BSIM3v32InstanceArray);
#endif
FREE(oldmod->BSIM3v32version);
FREE(oldmod);
while (mod) {
BSIM3v32model *next_mod = mod->BSIM3v32nextModel;
BSIM3v32instance *inst = mod->BSIM3v32instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3v32SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim3v32SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM3v32instance *next_inst = inst->BSIM3v32nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM3v32version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -14,50 +14,37 @@
#include "bsim4def.h"
#include "ngspice/suffix.h"
void
BSIM4destroy(
GENmodel **inModel)
BSIM4destroy(GENmodel **inModel)
{
BSIM4model **model = (BSIM4model**)inModel;
BSIM4instance *here;
BSIM4instance *prev = NULL;
BSIM4model *mod = *model;
BSIM4model *oldmod = NULL;
BSIM4model *mod = *(BSIM4model**) inModel;
for (; mod ; mod = mod->BSIM4nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM4version);
FREE(oldmod);
}
oldmod = mod;
prev = (BSIM4instance *)NULL;
for (here = mod->BSIM4instances; here; here = here->BSIM4nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM4InstanceArray);
/* free just once for all models */
FREE(mod->BSIM4InstanceArray);
#endif
/* oldmod->BSIM4modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM4version);
FREE(oldmod);
while (mod) {
BSIM4model *next_mod = mod->BSIM4nextModel;
BSIM4instance *inst = mod->BSIM4instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4instance *next_inst = inst->BSIM4nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -12,49 +12,37 @@
#include "bsim4v5def.h"
#include "ngspice/suffix.h"
void
BSIM4v5destroy(
GENmodel **inModel)
BSIM4v5destroy(GENmodel **inModel)
{
BSIM4v5model **model = (BSIM4v5model**)inModel;
BSIM4v5instance *here;
BSIM4v5instance *prev = NULL;
BSIM4v5model *mod = *model;
BSIM4v5model *oldmod = NULL;
BSIM4v5model *mod = *(BSIM4v5model**) inModel;
for (; mod ; mod = mod->BSIM4v5nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v5SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if (oldmod) {
FREE(oldmod->BSIM4v5version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if (oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM4v5InstanceArray);
/* free just once for all models */
FREE(mod->BSIM4v5InstanceArray);
#endif
FREE(oldmod->BSIM4v5version);
FREE(oldmod);
while (mod) {
BSIM4v5model *next_mod = mod->BSIM4v5nextModel;
BSIM4v5instance *inst = mod->BSIM4v5instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v5SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4v5SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v5instance *next_inst = inst->BSIM4v5nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4v5version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -14,50 +14,37 @@
#include "bsim4v6def.h"
#include "ngspice/suffix.h"
void
BSIM4v6destroy(
GENmodel **inModel)
BSIM4v6destroy(GENmodel **inModel)
{
BSIM4v6model **model = (BSIM4v6model**)inModel;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model *mod = *model;
BSIM4v6model *oldmod = NULL;
BSIM4v6model *mod = *(BSIM4v6model**) inModel;
for (; mod ; mod = mod->BSIM4v6nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v6SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if (oldmod) {
FREE(oldmod->BSIM4v6version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM4v6InstanceArray);
/* free just once for all models */
FREE(mod->BSIM4v6InstanceArray);
#endif
FREE(oldmod->BSIM4v6version);
FREE(oldmod);
while (mod) {
BSIM4v6model *next_mod = mod->BSIM4v6nextModel;
BSIM4v6instance *inst = mod->BSIM4v6instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v6SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4v6SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v6instance *next_inst = inst->BSIM4v6nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4v6version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -14,50 +14,38 @@
#include "bsim4v7def.h"
#include "ngspice/suffix.h"
void
BSIM4v7destroy(
GENmodel **inModel)
BSIM4v7destroy(GENmodel **inModel)
{
BSIM4v7model **model = (BSIM4v7model**)inModel;
BSIM4v7instance *here;
BSIM4v7instance *prev = NULL;
BSIM4v7model *mod = *model;
BSIM4v7model *oldmod = NULL;
BSIM4v7model *mod = *(BSIM4v7model**) inModel;
for (; mod ; mod = mod->BSIM4v7nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM4v7version);
FREE(oldmod);
}
oldmod = mod;
prev = (BSIM4v7instance *)NULL;
for (here = mod->BSIM4v7instances; here; here = here->BSIM4v7nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->BSIM4v7InstanceArray);
/* free just once for all models */
FREE(mod->BSIM4v7InstanceArray);
#endif
/* oldmod->BSIM4v7modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM4v7version);
FREE(oldmod);
while (mod) {
BSIM4v7model *next_mod = mod->BSIM4v7nextModel;
BSIM4v7instance *inst = mod->BSIM4v7instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v7instance *next_inst = inst->BSIM4v7nextInstance;
FREE(inst);
inst = next_inst;
}
/* mod->BSIM4v7modName to be freed in INPtabEnd() */
FREE(mod->BSIM4v7version);
FREE(mod);
mod = next_mod;
}
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -15,35 +15,26 @@
**********/
#include "ngspice/ngspice.h"
#include "b4soidef.h"
#include "ngspice/suffix.h"
void
B4SOIdestroy(
GENmodel **inModel)
B4SOIdestroy(GENmodel **inModel)
{
B4SOImodel **model = (B4SOImodel**)inModel;
B4SOIinstance *here;
B4SOIinstance *prev = NULL;
B4SOImodel *mod = *model;
B4SOImodel *oldmod = NULL;
B4SOImodel *mod = *(B4SOImodel**) inModel;
for (; mod ; mod = mod->B4SOInextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = (B4SOIinstance *)NULL;
for (here = mod->B4SOIinstances; here; here = here->B4SOInextInstance)
{
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
while (mod) {
B4SOImodel *next_mod = mod->B4SOInextModel;
B4SOIinstance *inst = mod->B4SOIinstances;
while (inst) {
B4SOIinstance *next_inst = inst->B4SOInextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
Modified: September 2003 Paolo Nenzi
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "capdefs.h"
@ -13,25 +11,20 @@ Modified: September 2003 Paolo Nenzi
void
CAPdestroy(GENmodel **inModel)
{
CAPmodel *mod = *(CAPmodel**) inModel;
CAPmodel **model = (CAPmodel**)inModel;
CAPinstance *here;
CAPinstance *prev = NULL;
CAPmodel *mod = *model;
CAPmodel *oldmod = NULL;
for( ; mod ; mod = mod->CAPnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CAPinstances ; here ; here = here->CAPnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
CAPmodel *next_mod = mod->CAPnextModel;
CAPinstance *inst = mod->CAPinstances;
while (inst) {
CAPinstance *next_inst = inst->CAPnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "cccsdefs.h"
@ -12,24 +10,20 @@ Author: 1985 Thomas L. Quarles
void
CCCSdestroy(GENmodel **inModel)
{
CCCSmodel **model = (CCCSmodel**)inModel;
CCCSinstance *here;
CCCSinstance *prev = NULL;
CCCSmodel *mod = *model;
CCCSmodel *oldmod = NULL;
CCCSmodel *mod = *(CCCSmodel**) inModel;
for( ; mod ; mod = mod->CCCSnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CCCSinstances ; here ; here = here->CCCSnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
CCCSmodel *next_mod = mod->CCCSnextModel;
CCCSinstance *inst = mod->CCCSinstances;
while (inst) {
CCCSinstance *next_inst = inst->CCCSnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "ccvsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
CCVSdestroy(GENmodel **inModel)
{
CCVSmodel **model = (CCVSmodel**)inModel;
CCVSinstance *here;
CCVSinstance *prev = NULL;
CCVSmodel *mod = *model;
CCVSmodel *oldmod = NULL;
CCVSmodel *mod = *(CCVSmodel**) inModel;
for( ; mod ; mod = mod->CCVSnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CCVSinstances ; here ; here = here->CCVSnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
CCVSmodel *next_mod = mod->CCVSnextModel;
CCVSinstance *inst = mod->CCVSinstances;
while (inst) {
CCVSinstance *next_inst = inst->CCVSnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -8,25 +8,23 @@ Author: 1992 Charles Hough
#include "cpldefs.h"
#include "ngspice/suffix.h"
void
CPLdestroy(GENmodel **inModel)
{
CPLmodel **model = (CPLmodel **)inModel;
CPLinstance *here;
CPLinstance *prev = NULL;
CPLmodel *mod = *model;
CPLmodel *oldmod = NULL;
CPLmodel *mod = *(CPLmodel **) inModel;
for( ; mod ; mod = mod->CPLnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CPLinstances ; here ; here = here->CPLnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
CPLmodel *next_mod = mod->CPLnextModel;
CPLinstance *inst = mod->CPLinstances;
while (inst) {
CPLinstance *next_inst = inst->CPLnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "cswdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Gordon Jacobs
void
CSWdestroy(GENmodel **inModel)
{
CSWmodel **model = (CSWmodel**)inModel;
CSWinstance *here;
CSWinstance *prev = NULL;
CSWmodel *mod = *model;
CSWmodel *oldmod = NULL;
CSWmodel *mod = *(CSWmodel**) inModel;
for( ; mod ; mod = mod->CSWnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CSWinstances ; here ; here = here->CSWnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
CSWmodel *next_mod = mod->CSWnextModel;
CSWinstance *inst = mod->CSWinstances;
while (inst) {
CSWinstance *next_inst = inst->CSWnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "diodefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
DIOdestroy(GENmodel **inModel)
{
DIOmodel **model = (DIOmodel**)inModel;
DIOinstance *here;
DIOinstance *prev = NULL;
DIOmodel *mod = *model;
DIOmodel *oldmod = NULL;
DIOmodel *mod = *(DIOmodel**) inModel;
for( ; mod ; mod = mod->DIOnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->DIOinstances ; here ; here = here->DIOnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
DIOmodel *next_mod = mod->DIOnextModel;
DIOinstance *inst = mod->DIOinstances;
while (inst) {
DIOinstance *next_inst = inst->DIOnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -11,23 +11,19 @@ Modified: Paolo Nenzi
void
HFETAdestroy(GENmodel **inModel)
{
HFETAmodel **model = (HFETAmodel**)inModel;
HFETAinstance *here;
HFETAinstance *prev = NULL;
HFETAmodel *mod = *model;
HFETAmodel *oldmod = NULL;
HFETAmodel *mod = *(HFETAmodel**) inModel;
for( ; mod ; mod = mod->HFETAnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->HFETAinstances ; here ; here = here->HFETAnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
HFETAmodel *next_mod = mod->HFETAnextModel;
HFETAinstance *inst = mod->HFETAinstances;
while (inst) {
HFETAinstance *next_inst = inst->HFETAnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -8,27 +8,22 @@ Modified: Paolo Nenzi
#include "ngspice/suffix.h"
void HFET2destroy(GENmodel **inModel)
void
HFET2destroy(GENmodel **inModel)
{
HFET2model *mod = *(HFET2model**) inModel;
HFET2model **model = (HFET2model**)inModel;
HFET2instance *here;
HFET2instance *prev = NULL;
HFET2model *mod = *model;
HFET2model *oldmod = NULL;
for( ; mod ; mod = mod->HFET2nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->HFET2instances ; here ; here = here->HFET2nextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
HFET2model *next_mod = mod->HFET2nextModel;
HFET2instance *inst = mod->HFET2instances;
while (inst) {
HFET2instance *next_inst = inst->HFET2nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(prev) FREE(prev);
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -5,12 +5,12 @@
MODEL NAME : HiSIM
( VERSION : 2 SUBVERSION : 8 REVISION : 0 )
FILE : hsm2dest.c
Date : 2014.6.5
released by
released by
Hiroshima University &
Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaim all implied warranties.
@ -58,32 +58,28 @@ to others."
#include "hsm2def.h"
#include "ngspice/suffix.h"
void HSM2destroy(
GENmodel **inModel)
{
HSM2model **model = (HSM2model**)inModel;
HSM2instance *here;
HSM2instance *prev = NULL;
HSM2model *mod = *model;
HSM2model *oldmod = NULL;
for ( ;mod ;mod = mod->HSM2nextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSM2instance *)NULL;
for ( here = mod->HSM2instances ;here ;here = here->HSM2nextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->HSM2InstanceArray);
#endif
FREE(oldmod);
}
*model = NULL;
}
void
HSM2destroy(GENmodel **inModel)
{
HSM2model *mod = *(HSM2model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->HSM2InstanceArray);
#endif
while (mod) {
HSM2model *next_mod = mod->HSM2nextModel;
HSM2instance *inst = mod->HSM2instances;
while (inst) {
HSM2instance *next_inst = inst->HSM2nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2012 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
MODEL NAME : HiSIM_HV
( VERSION : 1 SUBVERSION : 2 REVISION : 4 )
Model Parameter VERSION : 1.23
FILE : hsmhvdest.c
DATE : 2013.04.30
released by
released by
Hiroshima University &
Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/
@ -19,26 +19,23 @@
#include "hsmhvdef.h"
#include "ngspice/suffix.h"
void HSMHVdestroy(
GENmodel **inModel)
{
HSMHVmodel **model = (HSMHVmodel**)inModel;
HSMHVinstance *here;
HSMHVinstance *prev = NULL;
HSMHVmodel *mod = *model;
HSMHVmodel *oldmod = NULL;
for ( ;mod ;mod = mod->HSMHVnextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSMHVinstance *)NULL;
for ( here = mod->HSMHVinstances ;here ;here = here->HSMHVnextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) FREE(oldmod);
*model = NULL;
}
void
HSMHVdestroy(GENmodel **inModel)
{
HSMHVmodel *mod = *(HSMHVmodel**) inModel;
while (mod) {
HSMHVmodel *next_mod = mod->HSMHVnextModel;
HSMHVinstance *inst = mod->HSMHVinstances;
while (inst) {
HSMHVinstance *next_inst = inst->HSMHVnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2014 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
Model Parameter 'VERSION' : 2.20
FILE : hsmhvdest.c
DATE : 2014.6.11
released by
released by
Hiroshima University &
Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaims all implied warranties.
@ -54,33 +54,30 @@ to others."
Toshimasa Asahara, President, Hiroshima University
Mitiko Miura-Mattausch, Professor, Hiroshima University
Katsuhiro Shimohigashi, President&CEO, STARC
June 2008 (revised October 2011)
June 2008 (revised October 2011)
*************************************************************************/
#include "ngspice/ngspice.h"
#include "hsmhv2def.h"
#include "ngspice/suffix.h"
void HSMHV2destroy(
GENmodel **inModel)
{
HSMHV2model **model = (HSMHV2model**)inModel;
HSMHV2instance *here;
HSMHV2instance *prev = NULL;
HSMHV2model *mod = *model;
HSMHV2model *oldmod = NULL;
for ( ;mod ;mod = mod->HSMHV2nextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSMHV2instance *)NULL;
for ( here = mod->HSMHV2instances ;here ;here = here->HSMHV2nextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) FREE(oldmod);
*model = NULL;
}
void
HSMHV2destroy(GENmodel **inModel)
{
HSMHV2model *mod = *(HSMHV2model**) inModel;
while (mod) {
HSMHV2model *next_mod = mod->HSMHV2nextModel;
HSMHV2instance *inst = mod->HSMHV2instances;
while (inst) {
HSMHV2instance *next_inst = inst->HSMHV2nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "inddefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
INDdestroy(GENmodel **inModel)
{
INDmodel **model = (INDmodel**)inModel;
INDinstance *here;
INDinstance *prev = NULL;
INDmodel *mod = *model;
INDmodel *oldmod = NULL;
INDmodel *mod = *(INDmodel**) inModel;
for( ; mod ; mod = mod->INDnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->INDinstances ; here ; here = here->INDnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
INDmodel *next_mod = mod->INDnextModel;
INDinstance *inst = mod->INDinstances;
while (inst) {
INDinstance *next_inst = inst->INDnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "inddefs.h"
@ -11,26 +9,25 @@ Author: 1985 Thomas L. Quarles
#ifdef MUTUAL
void
MUTdestroy(GENmodel **inModel)
{
MUTmodel **model = (MUTmodel**)inModel;
MUTinstance *here;
MUTinstance *prev = NULL;
MUTmodel *mod = *model;
MUTmodel *oldmod = NULL;
MUTmodel *mod = *(MUTmodel**) inModel;
for( ; mod ; mod = mod->MUTnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MUTinstances ; here ; here = here->MUTnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
MUTmodel *next_mod = mod->MUTnextModel;
MUTinstance *inst = mod->MUTinstances;
while (inst) {
MUTinstance *next_inst = inst->MUTnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}
#endif /* MUTUAL */
#endif

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "isrcdefs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void
ISRCdestroy(GENmodel **inModel)
{
ISRCmodel **model = (ISRCmodel**)inModel;
ISRCinstance *here;
ISRCinstance *prev = NULL;
ISRCmodel *mod = *model;
ISRCmodel *oldmod = NULL;
ISRCmodel *mod = *(ISRCmodel**) inModel;
for( ; mod ; mod = mod->ISRCnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->ISRCinstances ; here ; here = here->ISRCnextInstance) {
if(prev) {
tfree(prev->ISRCcoeffs);
FREE(prev);
}
prev = here;
while (mod) {
ISRCmodel *next_mod = mod->ISRCnextModel;
ISRCinstance *inst = mod->ISRCinstances;
while (inst) {
ISRCinstance *next_inst = inst->ISRCnextInstance;
FREE(inst->ISRCcoeffs);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "jfetdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
JFETdestroy(GENmodel **inModel)
{
JFETmodel **model = (JFETmodel**)inModel;
JFETinstance *here;
JFETinstance *prev = NULL;
JFETmodel *mod = *model;
JFETmodel *oldmod = NULL;
JFETmodel *mod = *(JFETmodel**) inModel;
for( ; mod ; mod = mod->JFETnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->JFETinstances ; here ; here = here->JFETnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
JFETmodel *next_mod = mod->JFETnextModel;
JFETinstance *inst = mod->JFETinstances;
while (inst) {
JFETinstance *next_inst = inst->JFETnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -6,8 +6,6 @@ Author: 1985 Thomas L. Quarles
Modified to jfet2 for PS model definition ( Anthony E. Parker )
Copyright 1994 Macquarie University, Sydney Australia.
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "jfet2defs.h"
@ -17,22 +15,19 @@ Modified to jfet2 for PS model definition ( Anthony E. Parker )
void
JFET2destroy(GENmodel **inModel)
{
JFET2model **model = (JFET2model**)inModel;
JFET2instance *here;
JFET2instance *prev = NULL;
JFET2model *mod = *model;
JFET2model *oldmod = NULL;
JFET2model *mod = *(JFET2model**) inModel;
for( ; mod ; mod = mod->JFET2nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->JFET2instances ; here ; here = here->JFET2nextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
JFET2model *next_mod = mod->JFET2nextModel;
JFET2instance *inst = mod->JFET2instances;
while (inst) {
JFET2instance *next_inst = inst->JFET2nextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -7,29 +7,23 @@ Author: 1990 Jaijeet S. Roychowdhury
#include "ltradefs.h"
#include "ngspice/suffix.h"
void
LTRAdestroy(GENmodel **inModel)
{
LTRAmodel **model = (LTRAmodel **) inModel;
LTRAinstance *here;
LTRAinstance *prev = NULL;
LTRAmodel *mod = *model;
LTRAmodel *oldmod = NULL;
LTRAmodel *mod = *(LTRAmodel **) inModel;
for (; mod; mod = mod->LTRAnextModel) {
if (oldmod)
FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->LTRAinstances; here; here = here->LTRAnextInstance) {
if (prev)
FREE(prev);
prev = here;
while (mod) {
LTRAmodel *next_mod = mod->LTRAnextModel;
LTRAinstance *inst = mod->LTRAinstances;
while (inst) {
LTRAinstance *next_inst = inst->LTRAnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if (prev)
FREE(prev);
}
if (oldmod)
FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mesdefs.h"
@ -13,22 +11,19 @@ Author: 1985 S. Hwang
void
MESdestroy(GENmodel **inModel)
{
MESmodel **model = (MESmodel**)inModel;
MESinstance *here;
MESinstance *prev = NULL;
MESmodel *mod = *model;
MESmodel *oldmod = NULL;
MESmodel *mod = *(MESmodel**) inModel;
for( ; mod ; mod = mod->MESnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MESinstances ; here ; here = here->MESnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
MESmodel *next_mod = mod->MESnextModel;
MESinstance *inst = mod->MESinstances;
while (inst) {
MESinstance *next_inst = inst->MESnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -11,23 +11,19 @@ Author: Trond Ytterdal
void
MESAdestroy(GENmodel **inModel)
{
MESAmodel **model = (MESAmodel**)inModel;
MESAinstance *here;
MESAinstance *prev = NULL;
MESAmodel *mod = *model;
MESAmodel *oldmod = NULL;
MESAmodel *mod = *(MESAmodel**) inModel;
for( ; mod ; mod = mod->MESAnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MESAinstances ; here ; here = here->MESAnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
MESAmodel *next_mod = mod->MESAnextModel;
MESAinstance *inst = mod->MESAinstances;
while (inst) {
MESAinstance *next_inst = inst->MESAnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mos1defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void
MOS1destroy(GENmodel **inModel)
{
MOS1model **model = (MOS1model**)inModel;
MOS1instance *here;
MOS1instance *prev = NULL;
MOS1model *mod = *model;
MOS1model *oldmod = NULL;
MOS1model *mod = *(MOS1model**) inModel;
for( ; mod ; mod = mod->MOS1nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MOS1instances ; here ; here = here->MOS1nextInstance) {
if(prev){
if(prev->MOS1sens) FREE(prev->MOS1sens);
FREE(prev);
}
prev = here;
while (mod) {
MOS1model *next_mod = mod->MOS1nextModel;
MOS1instance *inst = mod->MOS1instances;
while (inst) {
MOS1instance *next_inst = inst->MOS1nextInstance;
FREE(inst->MOS1sens);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mos2defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void
MOS2destroy(GENmodel **inModel)
{
MOS2model **model = (MOS2model **)inModel;
MOS2instance *here;
MOS2instance *prev = NULL;
MOS2model *mod = *model;
MOS2model *oldmod = NULL;
MOS2model *mod = *(MOS2model **) inModel;
for( ; mod ; mod = mod->MOS2nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MOS2instances ; here ; here = here->MOS2nextInstance) {
if(prev){
if(prev->MOS2sens) FREE(prev->MOS2sens);
FREE(prev);
while (mod) {
MOS2model *next_mod = mod->MOS2nextModel;
MOS2instance *inst = mod->MOS2instances;
while (inst) {
MOS2instance *next_inst = inst->MOS2nextInstance;
FREE(inst->MOS2sens);
FREE(inst);
inst = next_inst;
}
prev = here;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mos3defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void
MOS3destroy(GENmodel **inModel)
{
MOS3model **model = (MOS3model **)inModel;
MOS3instance *here;
MOS3instance *prev = NULL;
MOS3model *mod = *model;
MOS3model *oldmod = NULL;
MOS3model *mod = *(MOS3model **) inModel;
for( ; mod ; mod = mod->MOS3nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MOS3instances ; here ; here = here->MOS3nextInstance) {
if(prev){
if(prev->MOS3sens) FREE(prev->MOS3sens);
FREE(prev);
}
prev = here;
while (mod) {
MOS3model *next_mod = mod->MOS3nextModel;
MOS3instance *inst = mod->MOS3instances;
while (inst) {
MOS3instance *next_inst = inst->MOS3nextInstance;
FREE(inst->MOS3sens);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1989 Takayasu Sakurai
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mos6defs.h"
@ -13,25 +11,20 @@ Author: 1989 Takayasu Sakurai
void
MOS6destroy(GENmodel **inModel)
{
MOS6model **model = (MOS6model**)inModel;
MOS6instance *here;
MOS6instance *prev = NULL;
MOS6model *mod = *model;
MOS6model *oldmod = NULL;
MOS6model *mod = *(MOS6model**) inModel;
for( ; mod ; mod = mod->MOS6nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MOS6instances ; here ; here = here->MOS6nextInstance) {
if(prev){
if(prev->MOS6sens) FREE(prev->MOS6sens);
FREE(prev);
}
prev = here;
while (mod) {
MOS6model *next_mod = mod->MOS6nextModel;
MOS6instance *inst = mod->MOS6instances;
while (inst) {
MOS6instance *next_inst = inst->MOS6nextInstance;
FREE(inst->MOS6sens);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
Modified: Alan Gillespie
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "mos9defs.h"
@ -14,25 +12,20 @@ Modified: Alan Gillespie
void
MOS9destroy(GENmodel **inModel)
{
MOS9model **model = (MOS9model **)inModel;
MOS9instance *here;
MOS9instance *prev = NULL;
MOS9model *mod = *model;
MOS9model *oldmod = NULL;
MOS9model *mod = *(MOS9model **) inModel;
for( ; mod ; mod = mod->MOS9nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->MOS9instances ; here ; here = here->MOS9nextInstance) {
if(prev){
if(prev->MOS9sens) FREE(prev->MOS9sens);
FREE(prev);
}
prev = here;
while (mod) {
MOS9model *next_mod = mod->MOS9nextModel;
MOS9instance *inst = mod->MOS9instances;
while (inst) {
MOS9instance *next_inst = inst->MOS9nextInstance;
FREE(inst->MOS9sens);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -1,6 +1,6 @@
/**********
Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
/*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h"
#include "ngspice/suffix.h"
void
NBJTdestroy(GENmodel **inModel)
{
NBJTmodel *mod = *(NBJTmodel **) inModel;
NBJTmodel **model = (NBJTmodel **) inModel;
NBJTmodel *mod, *nextMod;
NBJTinstance *inst, *nextInst;
for (mod = *model; mod;) {
for (inst = mod->NBJTinstances; inst;) {
ONEdestroy(inst->NBJTpDevice);
nextInst = inst->NBJTnextInstance;
FREE(inst);
inst = nextInst;
while (mod) {
NBJTmodel *next_mod = mod->NBJTnextModel;
NBJTinstance *inst = mod->NBJTinstances;
while (inst) {
NBJTinstance *next_inst = inst->NBJTnextInstance;
ONEdestroy(inst->NBJTpDevice);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
nextMod = mod->NBJTnextModel;
FREE(mod);
mod = nextMod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -1,6 +1,6 @@
/**********
Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
/*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h"
#include "ngspice/suffix.h"
void
NBJT2destroy(GENmodel **inModel)
{
NBJT2model *mod = *(NBJT2model **) inModel;
NBJT2model **model = (NBJT2model **) inModel;
NBJT2model *mod, *nextMod;
NBJT2instance *inst, *nextInst;
for (mod = *model; mod;) {
for (inst = mod->NBJT2instances; inst;) {
TWOdestroy(inst->NBJT2pDevice);
nextInst = inst->NBJT2nextInstance;
FREE(inst);
inst = nextInst;
while (mod) {
NBJT2model *next_mod = mod->NBJT2nextModel;
NBJT2instance *inst = mod->NBJT2instances;
while (inst) {
NBJT2instance *next_inst = inst->NBJT2nextInstance;
TWOdestroy(inst->NBJT2pDevice);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
nextMod = mod->NBJT2nextModel;
FREE(mod);
mod = nextMod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -1,36 +1,32 @@
/**********
Permit to use it as your wish.
Author: 2007 Gong Ding, gdiso@ustc.edu
University of Science and Technology of China
Author: 2007 Gong Ding, gdiso@ustc.edu
University of Science and Technology of China
**********/
#include "ngspice/ngspice.h"
#include "ndevdefs.h"
#include "ngspice/suffix.h"
void
NDEVdestroy(GENmodel **inModel)
{
NDEVmodel **model = (NDEVmodel **)inModel;
NDEVinstance *here;
NDEVinstance *prev = NULL;
NDEVmodel *mod = *model;
NDEVmodel *oldmod = NULL;
NDEVmodel *mod = *(NDEVmodel **) inModel;
for( ; mod ; mod = mod->NDEVnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->NDEVinstances ; here ; here = here->NDEVnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
NDEVmodel *next_mod = mod->NDEVnextModel;
NDEVinstance *inst = mod->NDEVinstances;
while (inst) {
NDEVinstance *next_inst = inst->NDEVnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
close(mod->sock);
fprintf(stdout,"Disconnect to remote NDEV server %s:%d\n",mod->host,mod->port);
close(mod->sock);
printf("Disconnect to remote NDEV server %s:%d\n", mod->host, mod->port);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -1,6 +1,6 @@
/**********
Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
/*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h"
#include "ngspice/suffix.h"
void
NUMDdestroy(GENmodel **inModel)
{
NUMDmodel *mod = *(NUMDmodel **) inModel;
NUMDmodel **model = (NUMDmodel **) inModel;
NUMDmodel *mod, *nextMod;
NUMDinstance *inst, *nextInst;
for (mod = *model; mod;) {
for (inst = mod->NUMDinstances; inst;) {
ONEdestroy(inst->NUMDpDevice);
nextInst = inst->NUMDnextInstance;
FREE(inst);
inst = nextInst;
while (mod) {
NUMDmodel *next_mod = mod->NUMDnextModel;
NUMDinstance *inst = mod->NUMDinstances;
while (inst) {
NUMDinstance *next_inst = inst->NUMDnextInstance;
ONEdestroy(inst->NUMDpDevice);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
nextMod = mod->NUMDnextModel;
FREE(mod);
mod = nextMod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -1,6 +1,6 @@
/**********
Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
/*
@ -15,25 +15,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h"
#include "ngspice/suffix.h"
void
NUMD2destroy(GENmodel **inModel)
{
NUMD2model *mod = *(NUMD2model **) inModel;
NUMD2model **model = (NUMD2model **) inModel;
NUMD2model *mod, *nextMod;
NUMD2instance *inst, *nextInst;
for (mod = *model; mod;) {
for (inst = mod->NUMD2instances; inst;) {
TWOdestroy(inst->NUMD2pDevice);
nextInst = inst->NUMD2nextInstance;
FREE(inst);
inst = nextInst;
while (mod) {
NUMD2model *next_mod = mod->NUMD2nextModel;
NUMD2instance *inst = mod->NUMD2instances;
while (inst) {
NUMD2instance *next_inst = inst->NUMD2nextInstance;
TWOdestroy(inst->NUMD2pDevice);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
nextMod = mod->NUMD2nextModel;
FREE(mod);
mod = nextMod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -1,6 +1,6 @@
/**********
Copyright 1991 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
/*
@ -14,24 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h"
#include "ngspice/suffix.h"
void
NUMOSdestroy(GENmodel **inModel)
{
NUMOSmodel *mod = *(NUMOSmodel **) inModel;
NUMOSmodel **model = (NUMOSmodel **) inModel;
NUMOSmodel *mod, *nextMod;
NUMOSinstance *inst, *nextInst;
for (mod = *model; mod;) {
for (inst = mod->NUMOSinstances; inst;) {
TWOdestroy(inst->NUMOSpDevice);
nextInst = inst->NUMOSnextInstance;
FREE(inst);
inst = nextInst;
while (mod) {
NUMOSmodel *next_mod = mod->NUMOSnextModel;
NUMOSinstance *inst = mod->NUMOSinstances;
while (inst) {
NUMOSinstance *next_inst = inst->NUMOSnextInstance;
TWOdestroy(inst->NUMOSpDevice);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
nextMod = mod->NUMOSnextModel;
FREE(mod);
mod = nextMod;
}
*model = NULL;
*inModel = NULL;
}

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
Modified: Apr 2000 - Paolo Nenzi
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "resdefs.h"
@ -13,22 +11,19 @@ Modified: Apr 2000 - Paolo Nenzi
void
RESdestroy(GENmodel **inModel)
{
RESmodel **model = (RESmodel **)inModel;
RESinstance *here;
RESinstance *prev = NULL;
RESmodel *mod = *model;
RESmodel *oldmod = NULL;
RESmodel *mod = *(RESmodel **) inModel;
for( ; mod ; mod = mod->RESnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->RESinstances ; here ; here = here->RESnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
RESmodel *next_mod = mod->RESnextModel;
RESinstance *inst = mod->RESinstances;
while (inst) {
RESinstance *next_inst = inst->RESnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -15,7 +15,7 @@ With help from : Bernard Tenbroek, Bill Redman-White, Mike Uren, Chris Edwards
Acknowledgements : Rupert Howes and Pete Mole.
**********/
/**********
/**********
Modified by Paolo Nenzi 2002
ngspice integration
**********/
@ -28,25 +28,20 @@ ngspice integration
void
SOI3destroy(GENmodel **inModel)
{
SOI3model **model = (SOI3model**)inModel;
SOI3instance *here;
SOI3instance *prev = NULL;
SOI3model *mod = *model;
SOI3model *oldmod = NULL;
SOI3model *mod = *(SOI3model**) inModel;
for( ; mod ; mod = mod->SOI3nextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->SOI3instances ; here ; here = here->SOI3nextInstance) {
if(prev){
/* if(prev->SOI3sens) FREE(prev->SOI3sens); */
FREE(prev);
}
prev = here;
while (mod) {
SOI3model *next_mod = mod->SOI3nextModel;
SOI3instance *inst = mod->SOI3instances;
while (inst) {
SOI3instance *next_inst = inst->SOI3nextInstance;
/* FREE(inst->SOI3sens); */
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "swdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Gordon Jacobs
void
SWdestroy(GENmodel **inModel)
{
SWmodel **model = (SWmodel**)inModel;
SWinstance *here;
SWinstance *prev = NULL;
SWmodel *mod = *model;
SWmodel *oldmod = NULL;
SWmodel *mod = *(SWmodel**) inModel;
for( ; mod ; mod = mod->SWnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->SWinstances ; here ; here = here->SWnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
SWmodel *next_mod = mod->SWnextModel;
SWinstance *inst = mod->SWinstances;
while (inst) {
SWinstance *next_inst = inst->SWnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "tradefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
TRAdestroy(GENmodel **inModel)
{
TRAmodel **model = (TRAmodel **)inModel;
TRAinstance *here;
TRAinstance *prev = NULL;
TRAmodel *mod = *model;
TRAmodel *oldmod = NULL;
TRAmodel *mod = *(TRAmodel **) inModel;
for( ; mod ; mod = mod->TRAnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->TRAinstances ; here ; here = here->TRAnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
TRAmodel *next_mod = mod->TRAnextModel;
TRAinstance *inst = mod->TRAinstances;
while (inst) {
TRAinstance *next_inst = inst->TRAnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -4,7 +4,6 @@ reserved.
Author: 1992 Charles Hough
**********/
#include "ngspice/ngspice.h"
#include "txldefs.h"
#include "ngspice/suffix.h"
@ -13,22 +12,19 @@ Author: 1992 Charles Hough
void
TXLdestroy(GENmodel **inModel)
{
TXLmodel **model = (TXLmodel **)inModel;
TXLinstance *here;
TXLinstance *prev = NULL;
TXLmodel *mod = *model;
TXLmodel *oldmod = NULL;
TXLmodel *mod = *(TXLmodel **) inModel;
for( ; mod ; mod = mod->TXLnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->TXLinstances ; here ; here = here->TXLnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
TXLmodel *next_mod = mod->TXLnextModel;
TXLinstance *inst = mod->TXLinstances;
while (inst) {
TXLinstance *next_inst = inst->TXLnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,9 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1987 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "urcdefs.h"
@ -14,22 +11,19 @@ Author: 1987 Thomas L. Quarles
void
URCdestroy(GENmodel **inModel)
{
URCmodel **model = (URCmodel **)inModel;
URCinstance *here;
URCinstance *prev = NULL;
URCmodel *mod = *model;
URCmodel *oldmod = NULL;
URCmodel *mod = *(URCmodel **) inModel;
for( ; mod ; mod = mod->URCnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->URCinstances ; here ; here = here->URCnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
URCmodel *next_mod = mod->URCnextModel;
URCinstance *inst = mod->URCinstances;
while (inst) {
URCinstance *next_inst = inst->URCnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -18,29 +18,20 @@ Spice3 Implementation: 2003 Dietmar Warning DAnalyse GmbH
void
VBICdestroy(GENmodel **inModel)
{
VBICmodel *mod = *(VBICmodel**) inModel;
VBICmodel **model = (VBICmodel**)inModel;
VBICinstance *here;
VBICinstance *prev = NULL;
VBICmodel *mod = *model;
VBICmodel *oldmod = NULL;
for( ; mod ; mod = mod->VBICnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->VBICinstances ; here ; here = here->VBICnextInstance) {
if(prev){
if(prev->VBICsens) FREE(prev->VBICsens);
FREE(prev);
}
prev = here;
}
if(prev){
if(prev->VBICsens) FREE(prev->VBICsens);
FREE(prev);
while (mod) {
VBICmodel *next_mod = mod->VBICnextModel;
VBICinstance *inst = mod->VBICinstances;
while (inst) {
VBICinstance *next_inst = inst->VBICnextInstance;
FREE(inst->VBICsens);
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "vccsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
VCCSdestroy(GENmodel **inModel)
{
VCCSmodel **model = (VCCSmodel**)inModel;
VCCSinstance *here;
VCCSinstance *prev = NULL;
VCCSmodel *mod = *model;
VCCSmodel *oldmod = NULL;
VCCSmodel *mod = *(VCCSmodel**) inModel;
for( ; mod ; mod = mod->VCCSnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->VCCSinstances ; here ; here = here->VCCSnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
VCCSmodel *next_mod = mod->VCCSnextModel;
VCCSinstance *inst = mod->VCCSinstances;
while (inst) {
VCCSinstance *next_inst = inst->VCCSnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "vcvsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void
VCVSdestroy(GENmodel **inModel)
{
VCVSmodel **model = (VCVSmodel **)inModel;
VCVSinstance *here;
VCVSinstance *prev = NULL;
VCVSmodel *mod = *model;
VCVSmodel *oldmod = NULL;
VCVSmodel *mod = *(VCVSmodel **) inModel;
for( ; mod ; mod = mod->VCVSnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->VCVSinstances ; here ; here = here->VCVSnextInstance) {
if(prev) FREE(prev);
prev = here;
while (mod) {
VCVSmodel *next_mod = mod->VCVSnextModel;
VCVSinstance *inst = mod->VCVSinstances;
while (inst) {
VCVSinstance *next_inst = inst->VCVSnextInstance;
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
**********/
/*
*/
#include "ngspice/ngspice.h"
#include "vsrcdefs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void
VSRCdestroy(GENmodel **inModel)
{
VSRCmodel **model = (VSRCmodel**)inModel;
VSRCinstance *here;
VSRCinstance *prev = NULL;
VSRCmodel *mod = *model;
VSRCmodel *oldmod = NULL;
VSRCmodel *mod = *(VSRCmodel**) inModel;
for( ; mod ; mod = mod->VSRCnextModel) {
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->VSRCinstances ; here ; here = here->VSRCnextInstance) {
if(prev) {
tfree(prev->VSRCcoeffs);
FREE(prev);
}
prev = here;
while (mod) {
VSRCmodel *next_mod = mod->VSRCnextModel;
VSRCinstance *inst = mod->VSRCinstances;
while (inst) {
VSRCinstance *next_inst = inst->VSRCnextInstance;
FREE(inst->VSRCcoeffs);
FREE(inst);
inst = next_inst;
}
if(prev) FREE(prev);
FREE(mod);
mod = next_mod;
}
if(oldmod) FREE(oldmod);
*model = NULL;
*inModel = NULL;
}