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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 17 of file noiprse.c.

31 {
32  char *token; /* a token from the line */
33  GENERIC *foo; /* pointer to analysis */
34  IFvalue ptemp; /* a value structure to package stuff into */
35  IFvalue *parm; /* a pointer to a value struct for function returns */
36  int error; /* error code temporary */
37  card *current = (card *)currentp;
38 
39  IFC(newAnalysis, (ckt,which,"noise",&foo,task))
40  INPgetTok(line,&token,1);
41 
42  /* Make sure the ".noise" command is followed by V(xxxx).
43  * If it is, extract 'xxxx'. If not, report an error.
44  */
45 
46  if ((*token == 'v' || *token == 'V') && strlen(token) == 1) {
47  txfree(token);
48  if (**line != '(' /* match) */) {
49  LITERR("Syntax error: '(' expected after 'v'");
50  return (0);
51  }
52  INPgetTok(line,&token,0); /* don't gobble */
53  ptemp.sValue = token;
54  GCA(INPapName,(ckt,which,foo,"output",&ptemp))
55 
56  /* See if an output reference node is specified, ie the */
57  /* command of the form V(xxxx), or of the form V(xxxx,yyyy) */
58 
59  if (**line != /* match ( */ ')') {
60  parm = INPgetValue(ckt,line,IF_STRING,tab);
61  GCA(INPapName,(ckt,which,foo,"outputref",parm))
62  }
63  else {
64  ptemp.sValue = (char*)NULL;
65  GCA(INPapName,(ckt,which,foo,"outputref",&ptemp))
66  }
67 
68  INPgetTok(line,&token,1);
69  strtolower(token);
70  INPinsert(&token,tab);
71  ptemp.uValue = token;
72  GCA(INPapName,(ckt,which,foo,"input",&ptemp))
73 
74  GCA(ParseAC,(ckt,line,current,which,foo,tab))
75 
76  if (**line) {
77  ptemp.iValue = INPevaluate(line,&error,1); /* ptspersum? */
78  if (error == 0) {
79  GCA(INPapName,(ckt,which,foo,"ptspersum",&ptemp))
80  }
81  if (**line) {
82  INPgetTok(line, &token, 1);
83  strtolower(token);
84  if (!strcmp(token,"dc")) {
85  txfree(token);
86  GCA(ParseDC,(ckt,line,current,which,foo,tab,1))
87  if (**line)
88  GCA(ParseDC,(ckt,line,current,which,foo,tab,2))
89  }
90  }
91  }
92  }
93  else {
94  txfree(token);
95  LITERR("Unknown parameter on .noise - ignored.")
96  }
97  return (0);
98 }
IFvalue * INPgetValue()
if(TDesc==NULL)
Definition: cd.c:1326
Definition: inpdefs.h:62
double INPevaluate()
int iValue
Definition: ifsim.h:232
#define LITERR(text)
Definition: inpmacs.h:35
int INPinsert()
Definition: fteinp.h:14
void txfree()
#define NULL
Definition: spdefs.h:121
void strtolower()
#define GCA(func, args)
Definition: inpmacs.h:27
#define IFC(func, args)
Definition: inpmacs.h:19
int ParseDC()
int INPapName()
char * sValue
Definition: ifsim.h:235
int ParseAC()
#define IF_STRING
Definition: ifsim.h:111
char GENERIC
Definition: ifsim.h:27
IFuid uValue
Definition: ifsim.h:236
int INPgetTok()