Jspice3
b2mdel.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 Hong June Park, Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "bsim2def.h"
11 #include "sperror.h"
12 #include "util.h"
13 
14 
15 int
16 B2mDelete(inModel,modname,kill)
17  GENmodel **inModel;
18  IFuid modname;
19  GENmodel *kill;
20 
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 }
46 
struct sBSIM2instance * B2nextInstance
Definition: bsim2def.h:19
int B2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
Definition: b2mdel.c:16
#define FREE(ptr)
Definition: spdefs.h:436
#define OK
Definition: iferrmsg.h:17
GENERIC * IFuid
Definition: ifsim.h:72
#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