Jspice3
srcmdel.c File Reference
#include "spice.h"
#include <stdio.h>
#include "srcdefs.h"
#include "util.h"
#include "sperror.h"
Include dependency graph for srcmdel.c:

Go to the source code of this file.

Functions

int SRCmDelete (GENmodel **modList, IFuid modname, GENmodel *killModel)
 

Function Documentation

int SRCmDelete ( GENmodel **  modList,
IFuid  modname,
GENmodel killModel 
)

Definition at line 17 of file srcmdel.c.

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
#define OK
Definition: iferrmsg.h:17
#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