Jspice3
tranprse.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - 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 "ftedefs.h"
10 #include "inpdefs.h"
11 #include "inpmacs.h"
12 #include "misc.h"
13 
14 
15 /* ARGSUSED */
16 int
17 TRANparse(ckt,tab,which,currentp,line,task,gnode)
18 
19 /*
20  .tran Tstep Tstop [Tstart] [Tmax] [UIC]
21  [ dc SRC1NAME Vstart1 [Vstop1 [Vinc1]]
22  [SRC2NAME Vstart2 [Vstop2 [Vinc2]]] ]
23 */
24 GENERIC *ckt;
25 INPtables *tab;
26 int which;
27 GENERIC *currentp;
28 char **line;
29 GENERIC *task;
30 GENERIC *gnode;
31 {
32  GENERIC *foo; /* pointer to analysis */
33  IFvalue ptemp; /* a value structure to package stuff into */
34  int error; /* error code temporary */
35  char *token; /* a token from the line */
36  card *current = (card *)currentp;
37 
38  IFC(newAnalysis,(ckt,which,"transient",&foo,task))
39  GCA(ParseTRAN,(ckt,line,current,which,foo,tab))
40  while (**line) {
41  INPgetTok(line, &token, 1);
42  strtolower(token);
43  if (!strcmp(token,"dc")) {
44  txfree(token);
45  GCA(ParseDC,(ckt,line,current,which,foo,tab,1))
46  if (**line)
47  GCA(ParseDC,(ckt,line,current,which,foo,tab,2))
48  continue;
49  }
50  if (!strcmp(token,"uic")) {
51  txfree(token);
52  ptemp.iValue = 1;
53  GCA(INPapName,(ckt,which,foo,"uic",&ptemp))
54  continue;
55  }
56  LITERR("Unknown parameter on .tran - ignored.")
57  txfree(token);
58  }
59 
60  return (0);
61 }
62 
63 
64 int
65 ParseTRAN(ckt,line,current,which,aptr,tab)
66 
67 GENERIC *ckt;
68 char **line;
69 card *current;
70 int which;
71 GENERIC *aptr;
72 INPtables *tab;
73 {
74  IFvalue ptemp; /* a value structure to package stuff into */
75  IFvalue *parm; /* a pointer to a value struct for function returns */
76  double dtemp; /* random double precision temporary */
77  int error; /* error code temporary */
78 
79  parm = INPgetValue(ckt,line,IF_REAL,tab); /* Tstep */
80  GCA(INPapName,(ckt,which,aptr,"tstep",parm))
81 
82  parm = INPgetValue(ckt,line,IF_REAL,tab); /* Tstop */
83  GCA(INPapName,(ckt,which,aptr,"tstop",parm))
84 
85  if (**line) {
86  dtemp = INPevaluate(line,&error,1); /* tstart? */
87  if (error == 0) {
88  ptemp.rValue = dtemp;
89  GCA(INPapName,(ckt,which,aptr,"tstart",&ptemp))
90  dtemp = INPevaluate(line,&error,1); /* tmax? */
91  if (error == 0) {
92  ptemp.rValue = dtemp;
93  GCA(INPapName,(ckt,which,aptr,"tmax",&ptemp))
94  }
95  }
96  }
97  return (0);
98 }
IFvalue * INPgetValue()
Definition: inpdefs.h:62
double INPevaluate()
Definition: subckt.c:51
int iValue
Definition: ifsim.h:232
double rValue
Definition: ifsim.h:233
#define LITERR(text)
Definition: inpmacs.h:35
Definition: fteinp.h:14
void txfree()
void strtolower()
int TRANparse(GENERIC *ckt, INPtables *tab, int which, GENERIC *currentp, char **line, GENERIC *task, GENERIC *gnode)
Definition: tranprse.c:17
#define GCA(func, args)
Definition: inpmacs.h:27
#define IFC(func, args)
Definition: inpmacs.h:19
int ParseDC()
#define IF_REAL
Definition: ifsim.h:108
int INPapName()
int ParseTRAN(GENERIC *ckt, char **line, card *current, int which, GENERIC *aptr, INPtables *tab)
Definition: tranprse.c:65
char GENERIC
Definition: ifsim.h:27
int INPgetTok()