Jspice3
srcmdel.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - 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  1987 Kanwar Jit Singh
6  1992 Stephen R. Whiteley
7 ****************************************************************************/
8 
9 #include "spice.h"
10 #include <stdio.h>
11 #include "srcdefs.h"
12 #include "util.h"
13 #include "sperror.h"
14 
15 
16 int
17 SRCmDelete(modList,modname,killModel)
18 
19 GENmodel **modList;
20 IFuid modname;
21 GENmodel *killModel;
22 {
23 
24  SRCmodel **model = (SRCmodel**)modList;
25  SRCmodel *modfast = (SRCmodel*)killModel;
26  SRCinstance *here, *next;
27  SRCmodel **oldmod;
28  oldmod = model;
29 
30  for ( ; *model; model = &((*model)->SRCnextModel)) {
31  if ( (*model)->SRCmodName == modname ||
32  (modfast && *model == modfast) ) break;
33  oldmod = model;
34  }
35  if (!*model) return (E_NOMOD);
36 
37  /* cut deleted device out of list */
38  *oldmod = (*model)->SRCnextModel;
39 
40  for (here = (*model)->SRCinstances; here; here = next) {
41  next = here->SRCnextInstance;
42  FREE(here->SRCvalues);
43  FREE(here->SRCderivs);
44  FREE(here->SRCeqns);
45  FREE(here->SRCacValues);
46  FREE(here->SRCposptr);
47  if (here->SRCtree)
48  (*here->SRCtree->IFfree)(here->SRCtree);
49  FREE(here);
50  }
51  FREE(*model);
52  return (OK);
53 
54 }
struct sSRCinstance * SRCnextInstance
Definition: srcdefs.h:26
double * SRCvalues
Definition: srcdefs.h:109
int * SRCeqns
Definition: srcdefs.h:118
#define FREE(ptr)
Definition: spdefs.h:436
int SRCmDelete(GENmodel **modList, IFuid modname, GENmodel *killModel)
Definition: srcmdel.c:17
#define OK
Definition: iferrmsg.h:17
GENERIC * IFuid
Definition: ifsim.h:72
#define E_NOMOD
Definition: iferrmsg.h:23
double ** SRCposptr
Definition: srcdefs.h:53
static char model[32]
Definition: subckt.c:76
double * SRCacValues
Definition: srcdefs.h:106
double * SRCderivs
Definition: srcdefs.h:115
IFparseTree * SRCtree
Definition: srcdefs.h:103
struct sSRCmodel * SRCnextModel
Definition: srcdefs.h:202