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

Go to the source code of this file.

Functions

int B2mDelete (GENmodel **inModel, IFuid modname, GENmodel *kill)
 

Function Documentation

int B2mDelete ( GENmodel **  inModel,
IFuid  modname,
GENmodel kill 
)

Definition at line 16 of file b2mdel.c.

21 {
22  B2model **model = (B2model**)inModel;
23  B2model *modfast = (B2model*)kill;
24  B2instance *here;
25  B2instance *prev = NULL;
26  B2model **oldmod;
27  oldmod = model;
28  for( ; *model ; model = &((*model)->B2nextModel)) {
29  if( (*model)->B2modName == modname ||
30  (modfast && *model == modfast) ) goto delgot;
31  oldmod = model;
32  }
33  return(E_NOMOD);
34 
35 delgot:
36  *oldmod = (*model)->B2nextModel; /* cut deleted device out of list */
37  for(here = (*model)->B2instances ; here ; here = here->B2nextInstance) {
38  if(prev) FREE(prev);
39  prev = here;
40  }
41  if(prev) FREE(prev);
42  FREE(*model);
43  return(OK);
44 
45 }
struct sBSIM2instance * B2nextInstance
Definition: bsim2def.h:19
#define FREE(ptr)
Definition: spdefs.h:436
#define OK
Definition: iferrmsg.h:17
#define NULL
Definition: spdefs.h:121
#define E_NOMOD
Definition: iferrmsg.h:23
static char model[32]
Definition: subckt.c:76
struct sBSIM2model * B2nextModel
Definition: bsim2def.h:224