Jspice3
ltradel.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 an instance from the circuit and frees
10  * the storage it was using.
11  */
12 
13 #include "spice.h"
14 #include <stdio.h>
15 #include "ltradefs.h"
16 #include "util.h"
17 #include "sperror.h"
18 
19 
20 int
21 LTRAdelete(model,name,fast)
22 
24 IFuid name;
25 GENinstance **fast;
26 {
27  GENinstance **prev = NULL;
28  GENinstance *here;
29 
30  for ( ; model; model = model->GENnextModel) {
31  prev = &(model->GENinstances);
32  for (here = *prev; here; here = *prev) {
33  if (here->GENname == name || (fast && here == *fast)) {
34  *prev = here->GENnextInstance;
35  FREE(((LTRAinstance*)here)->LTRAv1);
36  FREE(((LTRAinstance*)here)->LTRAi1);
37  FREE(((LTRAinstance*)here)->LTRAv2);
38  FREE(((LTRAinstance*)here)->LTRAi2);
39  FREE(here);
40  return (OK);
41  }
42  prev = &(here->GENnextInstance);
43  }
44  }
45  return(E_NODEV);
46 }
#define E_NODEV
Definition: iferrmsg.h:22
struct sGENinstance * GENnextInstance
Definition: gendefs.h:26
#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
static char model[32]
Definition: subckt.c:76
int LTRAdelete(GENmodel *model, IFuid name, GENinstance **fast)
Definition: ltradel.c:21
IFuid GENname
Definition: gendefs.h:28