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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 17 of file sensprse.c.

31 {
32  char *nname1; /* the first node's name */
33  char *nname2; /* the second node's name */
34  GENERIC *node; /* node pointer */
35  GENERIC *foo; /* pointer to analysis */
36  IFvalue ptemp; /* a value structure to package stuff into */
37  IFvalue *parm; /* a pointer to a value struct for function returns */
38  int error; /* error code temporary */
39  char *token; /* a token from the line */
40  card *current = (card *)currentp;
41 
42  IFC(newAnalysis,(ckt,which,"Sensitivity Analysis",&foo, task))
43 
44  /* Get the output voltage or current */
45  INPgetTok(line,&token,1);
46  /* token is now either V or I or a serious error */
47  if ((*token == 'v' || *token == 'V') && strlen(token) == 1) {
48  txfree(token);
49  if (**line != '(' /* match) */) {
50  LITERR("Syntax error: '(' expected after 'v'");
51  return (0);
52  }
53  INPgetTok(line, &nname1, 0);
54  INPtermInsert(ckt, &nname1, tab, &node);
55  ptemp.nValue = node;
56  GCA(INPapName,(ckt,which,foo,"outpos",&ptemp))
57 
58  if (**line != /* match ( */ ')') {
59  INPgetTok(line, &nname2, 1);
60  INPtermInsert(ckt, &nname2, tab, &node);
61  ptemp.nValue = node;
62  GCA(INPapName,(ckt,which,foo,"outneg",&ptemp))
63  ptemp.sValue = (char *)
64  tmalloc(sizeof(char)*(5+strlen(nname1)+strlen(nname2)));
65  (void)sprintf(ptemp.sValue,"v(%s,%s)",nname1,nname2);
66  GCA(INPapName,(ckt,which,foo,"outname",&ptemp))
67  }
68  else {
69  ptemp.nValue = gnode;
70  GCA(INPapName,(ckt,which,foo,"outneg",&ptemp))
71  ptemp.sValue = (char *)tmalloc(sizeof(char)*(4+strlen(nname1)));
72  (void)sprintf(ptemp.sValue,"v(%s)",nname1);
73  GCA(INPapName,(ckt,which,foo,"outname",&ptemp))
74  }
75  }
76  else if (*token == 'i' && strlen(token) == 1) {
77  txfree(token);
78  INPgetTok(line,&token,1);
79  strtolower(token);
80  INPinsert(&token,tab);
81  ptemp.uValue = token;
82  GCA(INPapName,(ckt,which,foo,"outsrc",&ptemp))
83  }
84  else {
85  txfree(token);
86  LITERR("Syntax error: voltage or current expected.")
87  return (0);
88  }
89 
90  INPgetTok(line,&token,1);
91  if (token && !strcmp(token, "pct")) {
92  txfree(token);
93  ptemp.iValue = 1;
94  GCA(INPapName,(ckt,which,foo,"pct",&ptemp))
95  INPgetTok(line,&token,1);
96  }
97  if (token && !strcmp(token, "ac")) {
98  txfree(token);
99  GCA(ParseAC,(ckt,line,current,which,foo,tab))
100  }
101 
102  if (token && *token && strcmp(token, "dc")) {
103  /* Bad flag */
104  LITERR("Syntax error: 'ac' or 'dc' expected.")
105  }
106  txfree(token);
107  return (0);
108 }
int INPtermInsert()
Definition: cddefs.h:119
if(TDesc==NULL)
Definition: cd.c:1326
Definition: inpdefs.h:62
int iValue
Definition: ifsim.h:232
#define LITERR(text)
Definition: inpmacs.h:35
int INPinsert()
char * tmalloc()
Definition: fteinp.h:14
void txfree()
void strtolower()
IFnode nValue
Definition: ifsim.h:237
#define GCA(func, args)
Definition: inpmacs.h:27
#define IFC(func, args)
Definition: inpmacs.h:19
int INPapName()
return(True)
int ParseAC()
char GENERIC
Definition: ifsim.h:27
IFuid uValue
Definition: ifsim.h:236
int INPgetTok()