Jspice3
inpmkmod.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - 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  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include "inpdefs.h"
10 #include "iferrmsg.h"
11 #include "misc.h"
12 
14 
15  /* create/lookup a 'model' entry */
16 
17 int
19 
20 char *token;
21 int type;
22 card *line;
23 {
24  INPmodel **i;
25 
26  for (i = &modtab; *i != (INPmodel *)NULL; i = &((*i)->INPnextModel)) {
27  if (strcmp((*i)->INPmodName,token) == 0) {
28  return (OK);
29  }
30  }
31  *i = (INPmodel *)tmalloc(sizeof(INPmodel));
32  if (*i == NULL) return (E_NOMEM);
33  (*i)->INPmodName = token;
34  (*i)->INPmodType = type;
35  (*i)->INPnextModel = (INPmodel *)NULL;
36  (*i)->INPmodUsed = 0;
37  (*i)->INPmodLine = line;
38  (*i)->INPmodfast = NULL;
39  return (OK);
40 }
Definition: inpdefs.h:62
#define OK
Definition: iferrmsg.h:17
char * tmalloc()
Definition: fteinp.h:14
INPmodel * modtab
Definition: inpmkmod.c:13
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
#define E_NOMEM
Definition: iferrmsg.h:27
int INPmakeMod(char *token, int type, card *line)
Definition: inpmkmod.c:18