Jspice3
noiprse.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - 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  1993 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 
15 /* ARGSUSED */
16 int
17 NOISEparse(ckt,tab,which,currentp,line,task,gnode)
18 
19 /*
20  .noise V(OUTPUT) SRC {DEC OCT LIN} NP FSTART FSTOP [PTSPRSUM]
21  [ dc SRC1NAME Vstart1 [Vstop1 [Vinc1]]
22  [SRC2NAME Vstart2 [Vstop2 [Vinc2]]] ]
23 */
24 GENERIC *ckt;
25 INPtables *tab;
26 int which;
27 GENERIC *currentp;
28 char **line;
29 GENERIC *task;
30 GENERIC *gnode;
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()
Definition: inpdefs.h:62
double INPevaluate()
Definition: subckt.c:51
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()
int NOISEparse(GENERIC *ckt, INPtables *tab, int which, GENERIC *currentp, char **line, GENERIC *task, GENERIC *gnode)
Definition: noiprse.c:17
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()