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

Go to the source code of this file.

Functions

int LTRAmDelete (GENmodel **model, IFuid modname, GENmodel *modfast)
 

Function Documentation

int LTRAmDelete ( GENmodel **  model,
IFuid  modname,
GENmodel modfast 
)

Definition at line 21 of file ltramdel.c.

26 {
27  GENinstance *here, *next;
28  GENmodel **oldmod;
29 
30  oldmod = model;
31  for ( ; *model; model = &((*model)->GENnextModel)) {
32  if ((*model)->GENmodName == modname ||
33  (modfast && *model == modfast)) break;
34  oldmod = model;
35  }
36  if (!*model) return(E_NOMOD);
37 
38  /* cut deleted device out of list */
39  *oldmod = (*model)->GENnextModel;
40 
41  for (here = (*model)->GENinstances; here; here = next) {
42  next = here->GENnextInstance;
43  FREE(((LTRAinstance*)here)->LTRAv1);
44  FREE(((LTRAinstance*)here)->LTRAi1);
45  FREE(((LTRAinstance*)here)->LTRAv2);
46  FREE(((LTRAinstance*)here)->LTRAi2);
47  FREE(here);
48  }
49  FREE(((LTRAmodel*)(*model))->LTRAh1dashCoeffs);
50  FREE(((LTRAmodel*)(*model))->LTRAh2Coeffs);
51  FREE(((LTRAmodel*)(*model))->LTRAh3dashCoeffs);
52  FREE(*model);
53  return (OK);
54 }
struct sGENinstance * GENnextInstance
Definition: gendefs.h:26
struct sGENmodel * GENnextModel
Definition: gendefs.h:41
#define FREE(ptr)
Definition: spdefs.h:436
#define OK
Definition: iferrmsg.h:17
#define E_NOMOD
Definition: iferrmsg.h:23
static char model[32]
Definition: subckt.c:76