Jspice3
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 }
#define BSIZE_SP
Definition: misc.h:19
IFsimulator * ft_sim
Definition: main.c:111
IFvalue * INPgetValue()
char * ci_curOpt
Definition: ftedefs.h:46
Definition: inpdefs.h:62
Definition: subckt.c:51
#define LITERR(text)
Definition: inpmacs.h:35
Definition: fteinp.h:14
int OPTparse(GENERIC *ckt, INPtables *tab, int which, GENERIC *currentp, char **line, GENERIC *task, GENERIC *gnode)
Definition: optprse.c:16
int id
Definition: ifsim.h:56
int numParms
Definition: ifsim.h:339
#define IF_SET
Definition: ifsim.h:135
void txfree()
#define NULL
Definition: spdefs.h:121
IFparm * analysisParms
Definition: ifsim.h:340
struct circ * ft_curckt
Definition: main.c:184
Definition: ifsim.h:54
#define IF_VARTYPES
Definition: ifsim.h:133
#define IF_UNIMP_MASK
Definition: ifsim.h:141
IFanalysis ** analyses
Definition: ifsim.h:464
char GENERIC
Definition: ifsim.h:27
int INPgetTok()