1 /**********
2 Copyright 1990 Regents of the University of California.  All rights reserved.
3 Author: 1985 Thomas L. Quarles
4 **********/
5 /*
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 "ngspice/ngspice.h"
14 #include "ngspice/ifsim.h"
15 #include "ngspice/sperror.h"
16 #include "ngspice/cktdefs.h"
17 
18 
19 
20 /* ARGSUSED *//* fixme abandoned */
21 int
CKTmapNode(CKTcircuit * ckt,CKTnode ** node,IFuid name)22 CKTmapNode(CKTcircuit *ckt, CKTnode **node, IFuid name)
23 {
24     CKTnode *here;
25     int error;
26     IFuid uid;
27     CKTnode *mynode;
28 
29     for (here = ckt->CKTnodes; here; here = here->next)  {
30         if(here->name == name) {
31             if(node) *node = here;
32             return(E_EXISTS);
33         }
34     }
35     /* not found, so must be a new one */
36     error = CKTmkNode(ckt,&mynode); /*allocate the node*/
37     if(error) return(error);
38     /* get a uid for it */
39     error = SPfrontEnd->IFnewUid (ckt, &uid, NULL, name, UID_SIGNAL, &mynode);
40     if(error) return(error);
41     mynode->name = uid;     /* set the info we have */
42     mynode->type = SP_VOLTAGE;
43     error = CKTlinkEq(ckt,mynode); /* and link it in */
44     if(node) *node = mynode; /* and finally, return it */
45     return(OK);
46 }
47