Jspice3
cktpname.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: 1985 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8  /*
9  * CKTpName()
10  *
11  * Take a parameter by Name and set it on the specified device
12  */
13 
14 #include "spice.h"
15 #include <stdio.h>
16 #include "devdefs.h"
17 #include "sperror.h"
18 #include "util.h"
19 #include "cktext.h"
20 
21 
22 extern SPICEdev *DEVices[];
23 
24 /* ARGSUSED */
25 int
26 CKTpName(parm,val,ckt,dev,name,fast)
27 
28 char *parm; /* the name of the parameter to set */
29 IFvalue *val; /* the parameter union containing the value to set */
30 CKTcircuit *ckt;/* the circuit this device is a member of */
31 int dev; /* the device type code to the device being parsed */
32 char *name; /* the name of the device being parsed */
33 GENinstance **fast; /* direct pointer to device being parsed */
34 {
35  int error; /* int to store evaluate error return codes in */
36  int i;
37 
38  for (i = 0; i < *DEVices[dev]->DEVpublic.numInstanceParms; i++) {
39  if (!strcmp(parm,DEVices[dev]->DEVpublic.instanceParms[i].keyword)) {
40  error = CKTparam((GENERIC*)ckt,(GENERIC *)*fast,
41  DEVices[dev]->DEVpublic.instanceParms[i].id,val,
42  (IFvalue *)NULL);
43  if (error) return (error);
44  break;
45  }
46  }
47  if (i == *DEVices[dev]->DEVpublic.numInstanceParms) {
48  return (E_BADPARM);
49  }
50  return (OK);
51 }
int * numInstanceParms
Definition: ifsim.h:312
#define E_BADPARM
Definition: iferrmsg.h:26
IFdevice DEVpublic
Definition: devdefs.h:44
SPICEdev * DEVices[]
Definition: sconfig.c:109
#define OK
Definition: iferrmsg.h:17
#define NULL
Definition: spdefs.h:121
int CKTpName(char *parm, IFvalue *val, CKTcircuit *ckt, int dev, char *name, GENinstance **fast)
Definition: cktpname.c:26
int CKTparam()
char GENERIC
Definition: ifsim.h:27