Jspice3
indparse.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 void
14 INDparse(type,ckt,tabp,currentp)
15 
16 int type;
17 GENERIC *ckt;
18 GENERIC *tabp;
19 GENERIC *currentp;
20 {
21  /* inductor parser */
22 
23  /* Lname <node> <node> <val> [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  IFuid uid; /* uid for default model */
40 
41  line = current->line;
42  INPgetTok(&line,&name,1);
43  INPinsert(&name,tab);
44 
45  INPgetTok(&line,&nname1,1);
46  INPtermInsert(ckt,&nname1,tab,&node1);
47 
48  INPgetTok(&line,&nname2,1);
49  INPtermInsert(ckt,&nname2,tab,&node2);
50 
51  if (!tab->defLmod) {
52  /* create default L model */
53  IFnewUid(ckt,&uid,(IFuid)NULL,"L",UID_MODEL,(GENERIC**)NULL);
54  IFC(newModel,(ckt,type,&(tab->defLmod),uid))
55  }
56  IFC(newInstance,(ckt,tab->defLmod,&fast,name))
57  IFC(bindNode,(ckt,fast,1,node1))
58  IFC(bindNode,(ckt,fast,2,node2))
59  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
60  if (waslead) {
61  ptemp.rValue = leadval;
62  GCA(INPpName,("inductance",&ptemp,ckt,type,fast))
63  }
64 }
int INPpName()
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
void INDparse(int type, GENERIC *ckt, GENERIC *tabp, GENERIC *currentp)
Definition: indparse.c:14
double rValue
Definition: ifsim.h:233
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
#define PARSECALL(args)
Definition: inpmacs.h:42
GENERIC * defLmod
Definition: inpdefs.h:46
char GENERIC
Definition: ifsim.h:27
int INPgetTok()