Jspice3
ltraprse.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: 1987 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "inpdefs.h"
11 #include "inpmacs.h"
12 
13 
14 void
15 LTRAparse(type,ckt,tabp,currentp)
16 
17 int type;
18 GENERIC *ckt;
19 GENERIC *tabp;
20 GENERIC *currentp;
21 {
22  /* lossy transmission line parser */
23 
24  /* Oname <node> <node> <node> <node> [IC=<val>,<val>,<val>,<val>] */
25 
26  INPtables *tab = (INPtables*)tabp;
27  card *current = (card*)currentp;
28 
29  char *line; /* the part of the current line left to parse */
30  char *name; /* the device's name */
31  char *nname1; /* the first node's name */
32  char *nname2; /* the second node's name */
33  char *nname3; /* the third node's name */
34  char *nname4; /* the fourth node's name */
35  GENERIC *node1; /* the first node's node pointer */
36  GENERIC *node2; /* the second node's node pointer */
37  GENERIC *node3; /* the third node's node pointer */
38  GENERIC *node4; /* the fourth node's node pointer */
39  int error; /* error code temporary */
40  GENERIC *fast; /* pointer to the actual instance */
41  int waslead; /* flag to indicate that unlabeled number was found */
42  double leadval; /* actual value of unlabeled number */
43  char *model; /* the name of the model */
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 */
47 
48  line = current->line;
49  INPgetTok(&line,&name,1);
50  INPinsert(&name,tab);
51 
52  INPgetTok(&line,&nname1,1);
53  INPtermInsert(ckt,&nname1,tab,&node1);
54 
55  INPgetTok(&line,&nname2,1);
56  INPtermInsert(ckt,&nname2,tab,&node2);
57 
58  INPgetTok(&line,&nname3,1);
59  INPtermInsert(ckt,&nname3,tab,&node3);
60 
61  INPgetTok(&line,&nname4,1);
62  INPtermInsert(ckt,&nname4,tab,&node4);
63 
64  INPgetTok(&line,&model,1);
65  if ( INPlookMod(model) ) {
66  /* do nothing for now */
67  /* no action required */
68  }
69  else {
70  /*
71  nname4 = model;
72  INPtermInsert(ckt,&nname4,tab,&node4);
73  INPgetTok(&line,&model,1);
74  */
75  }
76  INPinsert(&model,tab);
77  current->error = INPgetMod(ckt,model,&thismodel,tab);
78  if (thismodel != NULL) {
79  if (type != thismodel->INPmodType) {
81  return;
82  }
83  mdfast = (thismodel->INPmodfast);
84  }
85  else {
86  if (!tab->defOmod) {
87  /* create default O model */
88  IFnewUid(ckt,&uid,(IFuid)NULL,"O",UID_MODEL,(GENERIC**)NULL);
89  IFC(newModel,(ckt,type,&(tab->defOmod),uid))
90  }
91  mdfast = tab->defOmod;
92  }
93  IFC(newInstance,(ckt,mdfast,&fast,name))
94  IFC(bindNode,(ckt,fast,1,node1))
95  IFC(bindNode,(ckt,fast,2,node2))
96  IFC(bindNode,(ckt,fast,3,node3))
97  IFC(bindNode,(ckt,fast,4,node4))
98  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
99 }
char * line
Definition: inpdefs.h:64
int INPtermInsert()
int IFnewUid()
Definition: inpdefs.h:62
#define UID_MODEL
Definition: ifsim.h:83
Definition: subckt.c:51
#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 IFC(func, args)
Definition: inpmacs.h:19
GENERIC * defOmod
Definition: inpdefs.h:49
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
void LTRAparse(int type, GENERIC *ckt, GENERIC *tabp, GENERIC *currentp)
Definition: ltraprse.c:15
char * INPdevErr()
char GENERIC
Definition: ifsim.h:27
char * INPgetMod()
int INPgetTok()