Jspice3
optprse.c File Reference
#include "spice.h"
#include "ftedefs.h"
#include "inpdefs.h"
#include "inpmacs.h"
#include "misc.h"
Include dependency graph for optprse.c:

Go to the source code of this file.

Functions

int OPTparse (GENERIC *ckt, INPtables *tab, int which, GENERIC *currentp, char **line, GENERIC *task, GENERIC *gnode)
 

Function Documentation

int OPTparse ( GENERIC ckt,
INPtables tab,
int  which,
GENERIC currentp,
char **  line,
GENERIC task,
GENERIC gnode 
)

Definition at line 16 of file optprse.c.

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
#define LITERR(text)
Definition: inpmacs.h:35
Definition: fteinp.h:14
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 dataType
Definition: outdata.h:20
int INPgetTok()