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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 21 of file genmdel.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(here);
44  }
45  FREE(*model);
46  return (OK);
47 }
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