Jspice3
cktmapn.c File Reference
#include "spice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "sperror.h"
#include "cktext.h"
Include dependency graph for cktmapn.c:

Go to the source code of this file.

Functions

int CKTmapNode (GENERIC *ckt, GENERIC **node, IFuid name)
 

Function Documentation

int CKTmapNode ( GENERIC ckt,
GENERIC **  node,
IFuid  name 
)

Definition at line 22 of file cktmapn.c.

27 {
28  CKTnode *here;
29  int error;
30  IFuid uid;
31  CKTnode *mynode;
32 
33  for (here = ((CKTcircuit *)ckt)->CKTnodes; here; here = here->next) {
34  if (here->name == name) {
35  if (node) *node = (char *)here;
36  return (E_EXISTS);
37  }
38  }
39  /* not found, so must be a new one */
40  error = CKTmkNode((CKTcircuit*)ckt,&mynode); /*allocate the node*/
41  if (error) return (error);
42  error = (*(SPfrontEnd->IFnewUid))((GENERIC *)ckt,&uid,(IFuid*)NULL,name,
43  UID_SIGNAL,(GENERIC**)mynode); /* get a uid for it */
44  if (error) return (error);
45  mynode->name = uid; /* set the info we have */
46  mynode->type = SP_VOLTAGE;
47  error = CKTlinkEq((CKTcircuit*)ckt,mynode); /* and link it in */
48  if (node) *node = (GENERIC *)mynode; /* and finally, return it */
49  return (OK);
50 }
IFuid name
Definition: cktdefs.h:31
IFfrontEnd * SPfrontEnd
Definition: main.c:917
#define UID_SIGNAL
Definition: ifsim.h:84
#define E_EXISTS
Definition: iferrmsg.h:20
int CKTlinkEq()
#define SP_VOLTAGE
Definition: cktdefs.h:34
#define OK
Definition: iferrmsg.h:17
GENERIC * IFuid
Definition: ifsim.h:72
int type
Definition: cktdefs.h:32
#define NULL
Definition: spdefs.h:121
struct sCKTnode * next
Definition: cktdefs.h:43
int CKTmkNode()
char GENERIC
Definition: ifsim.h:27