Jspice3
Main Page
Data Structures
Files
File List
Globals
optprse.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
1992 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
/* ARGSUSED */
15
int
16
OPTparse
(ckt,
tab
,which,currentp,
line
,task,gnode)
17
18
/* .options parm=xxx ... */
19
GENERIC
*ckt;
20
INPtables
*
tab
;
21
int
which;
22
GENERIC
*currentp;
23
char
**
line
;
24
GENERIC
*task;
25
GENERIC
*gnode;
26
{
27
GENERIC
*foo;
/* pointer to analysis */
28
IFparm
*prm;
/* pointer to parameter to search through array */
29
char
*token;
/* a token from the line */
30
IFvalue
*parm;
/* a pointer to a value struct for function returns */
31
int
error;
/* error code temporary */
32
int
i;
/* generic loop variable */
33
char
errbuf[
BSIZE_SP
];
34
card
*current = (
card
*)currentp;
35
36
prm =
ft_sim
->
analyses
[which]->
analysisParms
;
37
while
(**line) {
38
INPgetTok
(line,&token,1);
39
for
(i = 0; i <
ft_sim
->
analyses
[which]->
numParms
; i++) {
40
if
(strcmp(token,prm[i].keyword))
41
continue
;
42
43
if
(!(prm[i].dataType &
IF_UNIMP_MASK
)) {
44
/*
45
(void) sprintf(errbuf,
46
"%s not yet implemented - ignored",token);
47
LITERR(errbuf)
48
*/
49
parm =
INPgetValue
(ckt,line, prm[i].dataType, tab);
50
break
;
51
}
52
if
(prm[i].dataType &
IF_SET
) {
53
parm =
INPgetValue
(ckt,line,
54
prm[i].dataType &
IF_VARTYPES
, tab);
55
error = (*(
ft_sim
->setAnalysisParm))(ckt,
56
ft_curckt
->
ci_curOpt
,prm[i].
id
,parm,(
IFvalue
*)
NULL
);
57
if
(error) {
58
(void) sprintf(errbuf,
"Can't set option %s"
, token);
59
LITERR
(errbuf)
60
}
61
break
;
62
}
63
}
64
if
(i ==
ft_sim
->
analyses
[which]->
numParms
) {
65
(void) sprintf(errbuf,
"Unknown option %s - ignored"
,token);
66
LITERR
(errbuf)
67
}
68
txfree
(token);
69
}
70
return
(0);
71
}
BSIZE_SP
#define BSIZE_SP
Definition:
misc.h:19
ft_sim
IFsimulator * ft_sim
Definition:
main.c:111
misc.h
INPgetValue
IFvalue * INPgetValue()
circ::ci_curOpt
char * ci_curOpt
Definition:
ftedefs.h:46
card
Definition:
inpdefs.h:62
tab
Definition:
subckt.c:51
LITERR
#define LITERR(text)
Definition:
inpmacs.h:35
line
Definition:
fteinp.h:14
OPTparse
int OPTparse(GENERIC *ckt, INPtables *tab, int which, GENERIC *currentp, char **line, GENERIC *task, GENERIC *gnode)
Definition:
optprse.c:16
sIFparm::id
int id
Definition:
ifsim.h:56
sIFanalysis::numParms
int numParms
Definition:
ifsim.h:339
IF_SET
#define IF_SET
Definition:
ifsim.h:135
txfree
void txfree()
NULL
#define NULL
Definition:
spdefs.h:121
inpdefs.h
sIFanalysis::analysisParms
IFparm * analysisParms
Definition:
ifsim.h:340
ft_curckt
struct circ * ft_curckt
Definition:
main.c:184
spice.h
sIFparm
Definition:
ifsim.h:54
ftedefs.h
inpmacs.h
IF_VARTYPES
#define IF_VARTYPES
Definition:
ifsim.h:133
uIFvalue
Definition:
ifsim.h:231
IF_UNIMP_MASK
#define IF_UNIMP_MASK
Definition:
ifsim.h:141
sIFsimulator::analyses
IFanalysis ** analyses
Definition:
ifsim.h:464
sINPtables
Definition:
inpdefs.h:30
GENERIC
char GENERIC
Definition:
ifsim.h:27
INPgetTok
int INPgetTok()
src
lib
analysis
optprse.c
Generated by
1.8.11