Jspice3
inpaname.c File Reference
#include "spice.h"
#include <stdio.h>
#include "inpdefs.h"
#include "iferrmsg.h"
Include dependency graph for inpaname.c:

Go to the source code of this file.

Functions

int INPaName (char *parm, IFvalue *val, GENERIC *ckt, int *dev, char *devnam, GENERIC **fast, IFsimulator *sim, int *dataType, IFvalue *selector)
 

Function Documentation

int INPaName ( char *  parm,
IFvalue val,
GENERIC ckt,
int *  dev,
char *  devnam,
GENERIC **  fast,
IFsimulator sim,
int *  dataType,
IFvalue selector 
)

Definition at line 23 of file inpaname.c.

34 {
35  int error; /* int to store evaluate error return codes in */
36  int i;
37 
38  /* find the instance - don't know about model, so use null there,
39  * otherwise pass on as much info as we have about the device
40  * (name, type, direct pointer) - the type and direct pointer
41  * WILL be set on return unless error is not OK
42  */
43  error = (*(sim->findInstance))(ckt,dev,fast,devnam,(GENERIC *)NULL,
44  (char *)NULL);
45  if (error) return (error);
46 
47  /* now find the parameter - hunt through the parameter tables for
48  * this device type and look for a name match of an 'ask'able
49  * parameter.
50  */
51  for (i = 0; i < (*(*(sim->devices)[*dev]).numInstanceParms); i++) {
52  if (strcmp(parm,
53  ((*(sim->devices)[*dev]).instanceParms[i].keyword)) == 0 &&
54  (((*(sim->devices)[*dev]).instanceParms[i].dataType)&IF_ASK)) {
55  /* found it, so we ask the question using the device info we got
56  * above and put the results in the IFvalue structure our caller
57  * gave us originally
58  */
59  error = (*(sim->askInstanceQuest))(ckt,*fast,
60  (*(sim->devices)[*dev]).instanceParms[i].id,val,
61  selector);
62  if (dataType)
63  *dataType =
64  (*(sim->devices)[*dev]).instanceParms[i].dataType;
65  return (error);
66  }
67  }
68  return (E_BADPARM);
69 }
#define IF_ASK
Definition: ifsim.h:136
#define E_BADPARM
Definition: iferrmsg.h:26
IFdevice ** devices
Definition: ifsim.h:461
#define NULL
Definition: spdefs.h:121
char GENERIC
Definition: ifsim.h:27