Jspice3
dioparse.c File Reference
#include "spice.h"
#include <stdio.h>
#include "inpdefs.h"
#include "inpmacs.h"
Include dependency graph for dioparse.c:

Go to the source code of this file.

Functions

void DIOparse (int type, GENERIC *ckt, GENERIC *tabp, GENERIC *currentp)
 

Function Documentation

void DIOparse ( int  type,
GENERIC ckt,
GENERIC tabp,
GENERIC currentp 
)

Definition at line 14 of file dioparse.c.

20 {
21  /* pn diode parser */
22 
23  /* Dname <node> <node> <model> [<val>] [OFF] [IC=<val>] */
24 
25  INPtables *tab = (INPtables*)tabp;
26  card *current = (card*)currentp;
27 
28  char *line; /* the part of the current line left to parse */
29  char *name; /* the device's name */
30  char *nname1; /* the first node's name */
31  char *nname2; /* the second node's name */
32  GENERIC *node1; /* the first node's node pointer */
33  GENERIC *node2; /* the second node's node pointer */
34  int error; /* error code temporary */
35  GENERIC *fast; /* pointer to the actual instance */
36  IFvalue ptemp; /* a value structure to package resistance into */
37  int waslead; /* flag to indicate that unlabeled number was found */
38  double leadval; /* actual value of unlabeled number */
39  char *model; /* the name of the model */
40  INPmodel *thismodel; /* pointer to model description for user's model */
41  GENERIC *mdfast; /* pointer to the actual model */
42  IFuid uid; /* uid of default model */
43 
44  line = current->line;
45  INPgetTok(&line,&name,1);
46  INPinsert(&name,tab);
47 
48  INPgetTok(&line,&nname1,1);
49  INPtermInsert(ckt,&nname1,tab,&node1);
50 
51  INPgetTok(&line,&nname2,1);
52  INPtermInsert(ckt,&nname2,tab,&node2);
53 
54  INPgetTok(&line,&model,1);
55  INPinsert(&model,tab);
56 
57  current->error = INPgetMod(ckt,model,&thismodel,tab);
58  if (thismodel != NULL) {
59  if (type != thismodel->INPmodType) {
61  return;
62  }
63  mdfast = (thismodel->INPmodfast);
64  }
65  else {
66  if (!tab->defDmod) {
67  /* create default D model */
68  IFnewUid(ckt,&uid,(IFuid)NULL,"D",UID_MODEL,(GENERIC**)NULL);
69  IFC(newModel,(ckt,type,&(tab->defDmod),uid))
70  }
71  mdfast = tab->defDmod;
72  }
73  IFC(newInstance,(ckt,mdfast,&fast,name))
74  IFC(bindNode,(ckt,fast,1,node1))
75  IFC(bindNode,(ckt,fast,2,node2))
76  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
77  if (waslead) {
78  ptemp.rValue = leadval;
79  GCA(INPpName,("area",&ptemp,ckt,type,fast))
80  }
81 }
int INPpName()
char * line
Definition: inpdefs.h:64
int INPtermInsert()
int IFnewUid()
if(TDesc==NULL)
Definition: cd.c:1326
Definition: inpdefs.h:62
#define UID_MODEL
Definition: ifsim.h:83
Definition: subckt.c:51
double rValue
Definition: ifsim.h:233
#define LITERR(text)
Definition: inpmacs.h:35
int INPmodType
Definition: inpdefs.h:73
int INPinsert()
Definition: fteinp.h:14
GENERIC * IFuid
Definition: ifsim.h:72
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
#define GCA(func, args)
Definition: inpmacs.h:27
#define IFC(func, args)
Definition: inpmacs.h:19
char * error
Definition: inpdefs.h:65
#define PARSECALL(args)
Definition: inpmacs.h:42
static char model[32]
Definition: subckt.c:76
return(True)
GENERIC * defDmod
Definition: inpdefs.h:38
char * INPdevErr()
char GENERIC
Definition: ifsim.h:27
char * INPgetMod()
int INPgetTok()