Jspice3
Main Page
Data Structures
Files
File List
Globals
cktnewn.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
/*
9
* CKTnewNode(ckt,node,name)
10
* Allocate a new circuit equation number (returned) in the specified
11
* circuit to contain a new equation or node
12
* returns -1 for failure to allocate a node number
13
*
14
*/
15
16
#include "
spice.h
"
17
#include <stdio.h>
18
#include "
cktdefs.h
"
19
#include "
iferrmsg.h
"
20
#include "
util.h
"
21
#include "
cktext.h
"
22
23
24
/* should just call CKTnewEQ and set node type afterwards */
25
int
26
CKTnewNode
(inCkt,node,name)
27
28
GENERIC
*inCkt;
29
GENERIC
**node;
30
IFuid
name;
31
{
32
CKTcircuit
*ckt = (
CKTcircuit
*)inCkt;
33
if
(!(ckt->
CKTnodes
)) {
34
/* starting the list - allocate both ground and 1 */
35
ckt->
CKTnodes
= (
CKTnode
*)
MALLOC
(
sizeof
(
CKTnode
));
36
if
(ckt->
CKTnodes
== (
CKTnode
*)
NULL
)
return
(
E_NOMEM
);
37
ckt->
CKTnodes
->
name
= (
char
*)
NULL
;
38
ckt->
CKTnodes
->
type
=
SP_VOLTAGE
;
39
ckt->
CKTnodes
->
number
= 0;
40
ckt->
CKTlastNode
= ckt->
CKTnodes
;
41
}
42
ckt->
CKTlastNode
->
next
= (
CKTnode
*)
MALLOC
(
sizeof
(
CKTnode
));
43
if
(ckt->
CKTlastNode
->
next
== (
CKTnode
*)
NULL
)
return
(
E_NOMEM
);
44
ckt->
CKTlastNode
= ckt->
CKTlastNode
->
next
;
45
ckt->
CKTlastNode
->
name
= name;
46
ckt->
CKTlastNode
->
number
= ckt->
CKTmaxEqNum
++;
47
ckt->
CKTlastNode
->
type
=
SP_VOLTAGE
;
48
ckt->
CKTlastNode
->
next
= (
CKTnode
*)
NULL
;
49
50
if
(node) *node = (
GENERIC
*)ckt->
CKTlastNode
;
51
return
(
OK
);
52
}
cktdefs.h
sCKTnode::name
IFuid name
Definition:
cktdefs.h:31
CKTcircuit
Definition:
cktdefs.h:62
sCKTnode
Definition:
cktdefs.h:30
SP_VOLTAGE
#define SP_VOLTAGE
Definition:
cktdefs.h:34
OK
#define OK
Definition:
iferrmsg.h:17
IFuid
GENERIC * IFuid
Definition:
ifsim.h:72
MALLOC
#define MALLOC(x)
Definition:
util.h:9
sCKTnode::type
int type
Definition:
cktdefs.h:32
NULL
#define NULL
Definition:
spdefs.h:121
E_NOMEM
#define E_NOMEM
Definition:
iferrmsg.h:27
sCKTnode::next
struct sCKTnode * next
Definition:
cktdefs.h:43
sCKTnode::number
int number
Definition:
cktdefs.h:39
util.h
CKTcircuit::CKTnodes
CKTnode * CKTnodes
Definition:
cktdefs.h:135
CKTcircuit::CKTlastNode
CKTnode * CKTlastNode
Definition:
cktdefs.h:136
spice.h
iferrmsg.h
CKTcircuit::CKTmaxEqNum
int CKTmaxEqNum
Definition:
cktdefs.h:129
cktext.h
return
return(True)
CKTnewNode
int CKTnewNode(GENERIC *inCkt, GENERIC **node, IFuid name)
Definition:
cktnewn.c:26
GENERIC
char GENERIC
Definition:
ifsim.h:27
src
lib
ckt
cktnewn.c
Generated by
1.8.11