Jspice3
cktpmnam.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  * CKTpModName()
10  *
11  * Take a parameter by Name and set it on the specified model
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 CKTpModName(parm,val,ckt,type,name,modfast)
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 model is a member of */
31 int type; /* the device type code to the model being parsed */
32 IFuid name; /* the name of the model being parsed */
33 GENmodel **modfast; /* direct pointer to model being parsed */
34 {
35  int error; /* int to store evaluate error return codes in */
36  int i;
37 
38  for (i = 0; i < *DEVices[type]->DEVpublic.numModelParms; i++) {
39  if (!strcmp(parm,DEVices[type]->DEVpublic.modelParms[i].keyword)) {
40  error = CKTmodParam((GENERIC *)ckt,(GENERIC*)*modfast,
41  DEVices[type]->DEVpublic.modelParms[i].id,val,
42  (IFvalue*)NULL);
43  if (error) return (error);
44  break;
45  }
46  }
47  if (i == *DEVices[type]->DEVpublic.numModelParms) {
48  return (E_BADPARM);
49  }
50  return (OK);
51 }
int * numModelParms
Definition: ifsim.h:315
#define E_BADPARM
Definition: iferrmsg.h:26
IFdevice DEVpublic
Definition: devdefs.h:44
int CKTmodParam()
#define OK
Definition: iferrmsg.h:17
GENERIC * IFuid
Definition: ifsim.h:72
int CKTpModName(char *parm, IFvalue *val, CKTcircuit *ckt, int type, IFuid name, GENmodel **modfast)
Definition: cktpmnam.c:26
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
int type
Definition: cktdefs.h:56
SPICEdev * DEVices[]
Definition: sconfig.c:109
char GENERIC
Definition: ifsim.h:27