Jspice3
Main Page
Data Structures
Files
File List
Globals
cktbindn.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
/* CKTbindNode
9
* bind a node of the specified device of the given type to its place
10
* in the specified circuit.
11
*/
12
13
#include "
spice.h
"
14
#include <stdio.h>
15
#include "
devdefs.h
"
16
#include "
sperror.h
"
17
#include "
util.h
"
18
#include "
cktext.h
"
19
20
extern
SPICEdev
*
DEVices
[];
21
22
/*ARGSUSED*/
23
int
24
CKTbindNode
(ckt,fast,term,node)
25
26
GENERIC
*ckt;
27
GENERIC
*fast;
28
int
term;
29
GENERIC
*node;
30
{
31
int
i, mappednode;
32
int
type
= ((
GENinstance
*)fast)->GENmodPtr->GENmodType;
33
char
key = *(
char
*)((
GENinstance
*)fast)->GENname;
34
IFkeys
*keys = DEVices[
type
]->
DEVpublic
.
keys
;
35
36
for
(i = 0; i < *DEVices[
type
]->
DEVpublic
.
numKeys
; i++) {
37
if
(keys[i].key == key)
38
break
;
39
}
40
if
(i == *DEVices[type]->DEVpublic.numKeys)
41
return
(
E_NOTERM
);
42
43
mappednode = ((
CKTnode
*)node)->number;
44
45
if
(keys[i].numTerms >= term && term > 0) {
46
switch
(term) {
47
default
:
48
return
(
E_NOTERM
);
49
case
1:
50
((
GENinstance
*)fast)->GENnode1 = mappednode;
51
break
;
52
case
2:
53
((
GENinstance
*)fast)->GENnode2 = mappednode;
54
break
;
55
case
3:
56
((
GENinstance
*)fast)->GENnode3 = mappednode;
57
break
;
58
case
4:
59
((
GENinstance
*)fast)->GENnode4 = mappednode;
60
break
;
61
case
5:
62
((
GENinstance
*)fast)->GENnode5 = mappednode;
63
break
;
64
}
65
return
(
OK
);
66
}
67
return
(
E_NOTERM
);
68
}
sIFdevice::keys
IFkeys * keys
Definition:
ifsim.h:297
sCKTnode
Definition:
cktdefs.h:30
SPICEdev::DEVpublic
IFdevice DEVpublic
Definition:
devdefs.h:44
DEVices
SPICEdev * DEVices[]
Definition:
sconfig.c:109
OK
#define OK
Definition:
iferrmsg.h:17
sperror.h
type
Definition:
types.c:18
util.h
spice.h
sIFkeys
Definition:
ifsim.h:267
E_NOTERM
#define E_NOTERM
Definition:
iferrmsg.h:25
cktext.h
SPICEdev
Definition:
devdefs.h:43
sCKTmodHead::type
int type
Definition:
cktdefs.h:56
sIFdevice::numKeys
int * numKeys
Definition:
ifsim.h:296
CKTbindNode
int CKTbindNode(GENERIC *ckt, GENERIC *fast, int term, GENERIC *node)
Definition:
cktbindn.c:24
sGENinstance
Definition:
gendefs.h:24
devdefs.h
GENERIC
char GENERIC
Definition:
ifsim.h:27
src
lib
ckt
cktbindn.c
Generated by
1.8.11