Jspice3
inpnrefs.c File Reference
#include "spice.h"
#include "inpdefs.h"
Include dependency graph for inpnrefs.c:

Go to the source code of this file.

Functions

int INPnumRefs (int c, int *terms, int *devs, int *soft, int *hasmod)
 

Function Documentation

int INPnumRefs ( int  c,
int *  terms,
int *  devs,
int *  soft,
int *  hasmod 
)

Definition at line 11 of file inpnrefs.c.

21 {
22  int i, j;
23  IFdevice *dev;
24 
25  if (isalpha(c)) {
26  if (isupper(c)) c = tolower(c);
27 
28  for (i = 0; i < ft_sim->numDevices; i++) {
29  dev = ft_sim->devices[i];
30  for (j = 0; j < *dev->numKeys; j++) {
31  if (dev->keys[j].key == c)
32  break;
33  }
34  if (j < *dev->numKeys) {
35  if (terms) *terms = dev->keys[j].numTerms;
36  if (devs) *devs = dev->keys[j].numDevs;
37  if (soft) *soft = dev->keys[j].soft;
38  if (hasmod) *hasmod = (dev->modelKeys ? 1 : 0);
39  return (1);
40  }
41  }
42  }
43  if (terms) *terms = 0;
44  if (devs) *devs = 0;
45  if (soft) *soft = 0;
46  if (hasmod) *hasmod = 0;
47  return (0);
48 }
IFkeys * keys
Definition: ifsim.h:297
IFsimulator * ft_sim
Definition: main.c:111
int soft
Definition: ifsim.h:271
int numTerms
Definition: ifsim.h:269
IFdevice ** devices
Definition: ifsim.h:461
char ** modelKeys
Definition: ifsim.h:305
char key
Definition: ifsim.h:268
Definition: cddefs.h:177
int numDevs
Definition: ifsim.h:272
int * numKeys
Definition: ifsim.h:296
int numDevices
Definition: ifsim.h:460