/*************************************************************************** JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992 Copyright 1990 Regents of the University of California. All rights reserved. Authors: 1987 Thomas L. Quarles 1993 Stephen R. Whiteley ****************************************************************************/ #include "spice.h" #include "ftedefs.h" #include "inpdefs.h" #include "inpmacs.h" #include "misc.h" /* ARGSUSED */ int NOISEparse(ckt,tab,which,currentp,line,task,gnode) /* .noise V(OUTPUT) SRC {DEC OCT LIN} NP FSTART FSTOP [PTSPRSUM] [ dc SRC1NAME Vstart1 [Vstop1 [Vinc1]] [SRC2NAME Vstart2 [Vstop2 [Vinc2]]] ] */ GENERIC *ckt; INPtables *tab; int which; GENERIC *currentp; char **line; GENERIC *task; GENERIC *gnode; { char *token; /* a token from the line */ GENERIC *foo; /* pointer to analysis */ IFvalue ptemp; /* a value structure to package stuff into */ IFvalue *parm; /* a pointer to a value struct for function returns */ int error; /* error code temporary */ card *current = (card *)currentp; IFC(newAnalysis, (ckt,which,"noise",&foo,task)) INPgetTok(line,&token,1); /* Make sure the ".noise" command is followed by V(xxxx). * If it is, extract 'xxxx'. If not, report an error. */ if ((*token == 'v' || *token == 'V') && strlen(token) == 1) { txfree(token); if (**line != '(' /* match) */) { LITERR("Syntax error: '(' expected after 'v'"); return (0); } INPgetTok(line,&token,0); /* don't gobble */ ptemp.sValue = token; GCA(INPapName,(ckt,which,foo,"output",&ptemp)) /* See if an output reference node is specified, ie the */ /* command of the form V(xxxx), or of the form V(xxxx,yyyy) */ if (**line != /* match ( */ ')') { parm = INPgetValue(ckt,line,IF_STRING,tab); GCA(INPapName,(ckt,which,foo,"outputref",parm)) } else { ptemp.sValue = (char*)NULL; GCA(INPapName,(ckt,which,foo,"outputref",&ptemp)) } INPgetTok(line,&token,1); strtolower(token); INPinsert(&token,tab); ptemp.uValue = token; GCA(INPapName,(ckt,which,foo,"input",&ptemp)) GCA(ParseAC,(ckt,line,current,which,foo,tab)) if (**line) { ptemp.iValue = INPevaluate(line,&error,1); /* ptspersum? */ if (error == 0) { GCA(INPapName,(ckt,which,foo,"ptspersum",&ptemp)) } if (**line) { INPgetTok(line, &token, 1); strtolower(token); if (!strcmp(token,"dc")) { txfree(token); GCA(ParseDC,(ckt,line,current,which,foo,tab,1)) if (**line) GCA(ParseDC,(ckt,line,current,which,foo,tab,2)) } } } } else { txfree(token); LITERR("Unknown parameter on .noise - ignored.") } return (0); }