Jspice3
Main Page
Data Structures
Files
File List
Globals
inpgval.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: 1985 Thomas L. Quarles
5
1992 Stephen R. Whiteley
6
****************************************************************************/
7
8
#include "
spice.h
"
9
#include "
inpdefs.h
"
10
#include "
misc.h
"
11
12
13
IFvalue
*
14
INPgetValue
(ckt,
line
,
type
,
tab
)
15
16
GENERIC
*ckt;
17
char
**
line
;
18
int
type
;
19
INPtables
*
tab
;
20
{
21
double
*
list
;
22
double
tmp;
23
char
*word;
24
int
error;
25
static
IFvalue
temp;
26
INPparseTree
*pt;
27
28
/* make sure we get rid of extra bits in type */
29
type &=
IF_VARTYPES
;
30
if
(type ==
IF_INTEGER
) {
31
temp.
iValue
=
INPevaluate
(line,&error,1);
32
/*printf(" returning integer value %d\n",temp.iValue);*/
33
}
34
else
if
(type ==
IF_REAL
) {
35
temp.
rValue
=
INPevaluate
(line,&error,1);
36
/*printf(" returning real value %e\n",temp.rValue);*/
37
}
38
else
if
(type ==
IF_REALVEC
) {
39
temp.
v
.
numValue
= 0;
40
list = (
double
*)
tmalloc
(
sizeof
(
double
));
41
tmp =
INPevaluate
(line,&error,1);
42
while
(error == 0) {
43
/*printf(" returning vector value %g\n",tmp); */
44
temp.
v
.
numValue
++;
45
list = (
double
*)
46
trealloc
((
char
*)list,temp.
v
.
numValue
*
sizeof
(double));
47
*(list+temp.
v
.
numValue
-1) = tmp;
48
tmp =
INPevaluate
(line,&error,1);
49
}
50
temp.
v
.
vec
.rVec=list;
51
}
52
else
if
(type ==
IF_FLAG
) {
53
temp.
iValue
= 1;
54
}
55
else
if
(type ==
IF_NODE
) {
56
INPgetTok
(line,&word,1);
57
INPtermInsert
(ckt,&word,tab,&(temp.
nValue
));
58
}
59
else
if
(type ==
IF_INSTANCE
) {
60
INPgetTok
(line,&word,1);
61
INPinsert
(&word,tab);
62
temp.
nValue
= word;
63
}
64
else
if
(type ==
IF_STRING
) {
65
INPgetTok
(line,&word,1);
66
temp.
sValue
= word;
67
}
68
else
if
(type ==
IF_PARSETREE
) {
69
INPgetTree
(line, &pt, ckt, tab);
70
if
(!pt)
71
return
((
IFvalue
*)
NULL
);
72
temp.
tValue
= (
IFparseTree
*) pt;
73
/*INPptPrint("Parse tree is: ", temp.tValue);*/
74
}
75
else
{
/* don't know what type of parameter caller is talking about! */
76
return
((
IFvalue
*)
NULL
);
77
}
78
return
(&temp);
79
}
uIFvalue::numValue
int numValue
Definition:
ifsim.h:240
INPparseTree
Definition:
inpptree.h:30
misc.h
INPtermInsert
int INPtermInsert()
INPgetTree
void INPgetTree()
uIFvalue::vec
union uIFvalue::@13::@14 vec
INPevaluate
double INPevaluate()
tab
Definition:
subckt.c:51
IF_INSTANCE
#define IF_INSTANCE
Definition:
ifsim.h:112
uIFvalue::iValue
int iValue
Definition:
ifsim.h:232
uIFvalue::rValue
double rValue
Definition:
ifsim.h:233
INPinsert
int INPinsert()
tmalloc
char * tmalloc()
sIFparseTree
Definition:
ifsim.h:158
line
Definition:
fteinp.h:14
NULL
#define NULL
Definition:
spdefs.h:121
type
Definition:
types.c:18
inpdefs.h
uIFvalue::nValue
IFnode nValue
Definition:
ifsim.h:237
IF_INTEGER
#define IF_INTEGER
Definition:
ifsim.h:107
spice.h
IF_REAL
#define IF_REAL
Definition:
ifsim.h:108
uIFvalue::tValue
IFparseTree * tValue
Definition:
ifsim.h:238
IF_FLAG
#define IF_FLAG
Definition:
ifsim.h:106
IF_REALVEC
#define IF_REALVEC
Definition:
ifsim.h:125
IF_VARTYPES
#define IF_VARTYPES
Definition:
ifsim.h:133
uIFvalue
Definition:
ifsim.h:231
list
Definition:
dir.c:53
uIFvalue::v
struct uIFvalue::@13 v
uIFvalue::sValue
char * sValue
Definition:
ifsim.h:235
IF_STRING
#define IF_STRING
Definition:
ifsim.h:111
IF_NODE
#define IF_NODE
Definition:
ifsim.h:110
sINPtables
Definition:
inpdefs.h:30
INPgetValue
IFvalue * INPgetValue(GENERIC *ckt, char **line, int type, INPtables *tab)
Definition:
inpgval.c:14
trealloc
char * trealloc()
GENERIC
char GENERIC
Definition:
ifsim.h:27
IF_PARSETREE
#define IF_PARSETREE
Definition:
ifsim.h:113
INPgetTok
int INPgetTok()
src
lib
inp
inpgval.c
Generated by
1.8.11