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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 14 of file jfetprse.c.

20 {
21  /* JFET parser */
22 
23  /* Jname <node> <node> <node> <model> [<val>] [OFF] [IC=<val>,<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  char *nname3; /* the third node's name */
33  GENERIC *node1; /* the first node's node pointer */
34  GENERIC *node2; /* the second node's node pointer */
35  GENERIC *node3; /* the third node's node pointer */
36  int error; /* error code temporary */
37  GENERIC *fast; /* pointer to the actual instance */
38  IFvalue ptemp; /* a value structure to package resistance into */
39  int waslead; /* flag to indicate that unlabeled number was found */
40  double leadval; /* actual value of unlabeled number */
41  char *model; /* the name of the model */
42  INPmodel *thismodel; /* pointer to model description for user's model */
43  GENERIC *mdfast; /* pointer to the actual model */
44  IFuid uid; /* uid of default model */
45 
46  line = current->line;
47  INPgetTok(&line,&name,1);
48  INPinsert(&name,tab);
49 
50  INPgetTok(&line,&nname1,1);
51  INPtermInsert(ckt,&nname1,tab,&node1);
52 
53  INPgetTok(&line,&nname2,1);
54  INPtermInsert(ckt,&nname2,tab,&node2);
55 
56  INPgetTok(&line,&nname3,1);
57  INPtermInsert(ckt,&nname3,tab,&node3);
58 
59  INPgetTok(&line,&model,1);
60  INPinsert(&model,tab);
61 
62  current->error = INPgetMod(ckt,model,&thismodel,tab);
63  if (thismodel != NULL) {
64  if (type != thismodel->INPmodType) {
66  return;
67  }
68  mdfast = (thismodel->INPmodfast);
69  }
70  else {
71  if (!tab->defJmod) {
72  /* create default J model */
73  IFnewUid(ckt,&uid,(IFuid)NULL,"J",UID_MODEL,(GENERIC**)NULL);
74  IFC(newModel,(ckt,type,&(tab->defJmod),uid))
75  }
76  mdfast = tab->defJmod;
77  }
78  IFC(newInstance,(ckt,mdfast,&fast,name))
79  IFC(bindNode,(ckt,fast,1,node1))
80  IFC(bindNode,(ckt,fast,2,node2))
81  IFC(bindNode,(ckt,fast,3,node3))
82  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
83  if (waslead) {
84  ptemp.rValue = leadval;
85  GCA(INPpName,("area",&ptemp,ckt,type,fast))
86  }
87 }
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
GENERIC * defJmod
Definition: inpdefs.h:44
#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)
char * INPdevErr()
char GENERIC
Definition: ifsim.h:27
char * INPgetMod()
int INPgetTok()