Jspice3
cktmapn.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  /* CKTmapNode(ckt,node)
9  * map the given node to the compact node numbering set of the
10  * specified circuit
11  */
12 
13 #include "spice.h"
14 #include <stdio.h>
15 #include "cktdefs.h"
16 #include "sperror.h"
17 #include "cktext.h"
18 
19 
20 /* ARGSUSED */
21 int
22 CKTmapNode(ckt,node,name)
23 
24 GENERIC *ckt;
25 GENERIC **node;
26 IFuid name;
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 CKTmapNode(GENERIC *ckt, GENERIC **node, IFuid name)
Definition: cktmapn.c:22
int CKTmkNode()
char GENERIC
Definition: ifsim.h:27