Jspice3
Main Page
Data Structures
Files
File List
Globals
cktgrnd.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
/* CKTground(ckt,node)
9
* specify the node to be the ground node of the given circuit
10
*/
11
12
#include "
spice.h
"
13
#include <stdio.h>
14
#include "
cktdefs.h
"
15
#include "
sperror.h
"
16
#include "
util.h
"
17
#include "
cktext.h
"
18
19
20
int
21
CKTground
(inCkt,node,name)
22
23
GENERIC
*inCkt;
24
GENERIC
**node;
25
IFuid
name;
26
{
27
CKTcircuit
*ckt = (
CKTcircuit
*)inCkt;
28
29
if
(ckt->
CKTnodes
) {
30
if
(ckt->
CKTnodes
->
name
) {
31
/*already exists - keep old name, but return it */
32
if
(node) *node = (
char
*)ckt->
CKTnodes
;
33
return
(
E_EXISTS
);
34
}
35
ckt->
CKTnodes
->
name
= name;
36
ckt->
CKTnodes
->
type
=
SP_VOLTAGE
;
37
ckt->
CKTnodes
->
number
= 0;
38
}
39
else
{
40
ckt->
CKTnodes
= (
CKTnode
*)
MALLOC
(
sizeof
(
CKTnode
));
41
if
(ckt->
CKTnodes
==
NULL
)
return
(
E_NOMEM
);
42
ckt->
CKTnodes
->
name
= name;
43
ckt->
CKTnodes
->
type
=
SP_VOLTAGE
;
44
ckt->
CKTnodes
->
number
= 0;
45
ckt->
CKTnodes
->
next
= (
CKTnode
*)
NULL
;
46
ckt->
CKTlastNode
= ckt->
CKTnodes
;
47
}
48
if
(node) *node = (
char
*)ckt->
CKTnodes
;
49
return
(
OK
);
50
}
cktdefs.h
sCKTnode::name
IFuid name
Definition:
cktdefs.h:31
CKTcircuit
Definition:
cktdefs.h:62
sCKTnode
Definition:
cktdefs.h:30
E_EXISTS
#define E_EXISTS
Definition:
iferrmsg.h:20
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
sperror.h
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
CKTground
int CKTground(GENERIC *inCkt, GENERIC **node, IFuid name)
Definition:
cktgrnd.c:21
cktext.h
return
return(True)
GENERIC
char GENERIC
Definition:
ifsim.h:27
src
lib
ckt
cktgrnd.c
Generated by
1.8.11