Jspice3
ltradest.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 /*
9  * This routine deletes all typed models and instances from the circuit
10  * and frees the storage they were using.
11  */
12 
13 #include "spice.h"
14 #include <stdio.h>
15 #include "ltradefs.h"
16 #include "util.h"
17 
18 
19 void
21 
22 GENmodel **model;
23 {
24 
25  GENinstance *here, *next;
26  GENmodel *mod, *nextmod;
27 
28  for (mod = *model; mod; mod = nextmod) {
29  nextmod = mod->GENnextModel;
30  for (here = mod->GENinstances; here; here = next) {
31  next = here->GENnextInstance;
32  FREE(((LTRAinstance*)here)->LTRAv1);
33  FREE(((LTRAinstance*)here)->LTRAi1);
34  FREE(((LTRAinstance*)here)->LTRAv2);
35  FREE(((LTRAinstance*)here)->LTRAi2);
36  FREE(here);
37  }
38  FREE(((LTRAmodel*)mod)->LTRAh1dashCoeffs);
39  FREE(((LTRAmodel*)mod)->LTRAh2Coeffs);
40  FREE(((LTRAmodel*)mod)->LTRAh3dashCoeffs);
41  FREE(mod);
42  }
43  *model = NULL;
44 }
struct sGENinstance * GENnextInstance
Definition: gendefs.h:26
struct sGENmodel * GENnextModel
Definition: gendefs.h:41
#define FREE(ptr)
Definition: spdefs.h:436
#define NULL
Definition: spdefs.h:121
void LTRAdestroy(GENmodel **model)
Definition: ltradest.c:20
static char model[32]
Definition: subckt.c:76
GENinstance * GENinstances
Definition: gendefs.h:43