Jspice3
jjparse.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: 1993 Stephen R. Whiteley
5 ****************************************************************************/
6 
7 #include "spice.h"
8 #include <stdio.h>
9 #include "inpdefs.h"
10 #include "inpmacs.h"
11 
12 void
13 JJparse(type,ckt,tabp,currentp)
14 
15 int type;
16 GENERIC *ckt;
17 GENERIC *tabp;
18 GENERIC *currentp;
19 {
20  /* Josephson junction parser */
21 
22  /* Bname <node> <node> [<node>] [<mname>]
23  * [[ic=<val>,<val>] [vj=<val>] [phi=<val>]] [area=<val>]
24  * [control=<val>]
25  */
26 
27  INPtables *tab = (INPtables*)tabp;
28  card *current = (card*)currentp;
29 
30  char *line; /* the part of the current line left to parse */
31  char *name; /* the device's name */
32  char *nname1; /* the first node's name */
33  char *nname2; /* the second node's name */
34  char *nname3; /* the third node's name */
35  char *model; /* the model name */
36  GENERIC *node1; /* the first node's node pointer */
37  GENERIC *node2; /* the second node's node pointer */
38  GENERIC *node3; /* the third node's node pointer */
39  int error; /* error code temporary */
40  GENERIC *fast; /* pointer to the actual instance */
41  IFvalue ptemp; /* a value structure to package resistance into */
42  int waslead; /* flag to indicate that unlabeled number was found */
43  double leadval; /* actual value of unlabeled number */
44  INPmodel *thismodel; /* pointer to model description for user's model */
45  GENERIC *mdfast; /* pointer to the actual model */
46  IFuid uid; /* uid for default model name */
47 
48  char *groundname = "0";
49  char *gname;
50  GENERIC *gnode;
51 
52  line = current->line;
53  INPgetTok(&line,&name,1);
54  INPinsert(&name,tab);
55 
56  INPgetTok(&line,&nname1,1);
57  INPtermInsert(ckt,&nname1,tab,&node1);
58 
59  INPgetTok(&line,&nname2,1);
60  INPtermInsert(ckt,&nname2,tab,&node2);
61 
62  INPgetTok(&line,&model,1);
63  if (!*model || INPlookMod(model)) {
64  /* only 2 nodes */
65  INPgetTok(&groundname,&gname,1);
66  INPgndInsert(ckt,&gname,tab,&node3);
67  }
68  else {
69  nname3 = model;
70  INPtermInsert(ckt,&nname3,tab,&node3);
71  INPgetTok(&line,&model,1);
72  }
73 
74  INPinsert(&model,tab);
75  current->error = INPgetMod(ckt,model,&thismodel,tab);
76  if (thismodel != NULL) {
77  if (type != thismodel->INPmodType) {
79  return;
80  }
81  mdfast = (thismodel->INPmodfast);
82  }
83  else {
84  if (!tab->defBmod) {
85  /* create default B model */
86  IFnewUid(ckt,&uid,(IFuid)NULL,"B",UID_MODEL,(GENERIC**)NULL);
87  IFC(newModel,(ckt,type,&(tab->defBmod),uid))
88  }
89  mdfast = tab->defBmod;
90  }
91  IFC(newInstance,(ckt,mdfast,&fast,name))
92  IFC(bindNode,(ckt,fast,1,node1))
93  IFC(bindNode,(ckt,fast,2,node2))
94  IFC(bindNode,(ckt,fast,3,node3))
95  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
96  if (waslead) {
97  ptemp.rValue = leadval;
98  GCA(INPpName,("area",&ptemp,ckt,type,fast))
99  }
100 }
int INPpName()
char * line
Definition: inpdefs.h:64
int INPtermInsert()
int IFnewUid()
int INPgndInsert()
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
int INPlookMod()
char * error
Definition: inpdefs.h:65
#define PARSECALL(args)
Definition: inpmacs.h:42
static char model[32]
Definition: subckt.c:76
GENERIC * INPmodfast
Definition: inpdefs.h:77
GENERIC * defBmod
Definition: inpdefs.h:36
char * INPdevErr()
void JJparse(int type, GENERIC *ckt, GENERIC *tabp, GENERIC *currentp)
Definition: jjparse.c:13
char GENERIC
Definition: ifsim.h:27
char * INPgetMod()
int INPgetTok()