Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 55... Line 85...
55
#include "name.h"
85
#include "name.h"
56
 
86
 
57
/*--------------------------------------------------------------------------*/
87
/*--------------------------------------------------------------------------*/
58
 
88
 
59
NameP
89
NameP
60
name_create PROTO_Z ()
90
name_create(void)
61
{
91
{
62
    NameP name = ALLOCATE (NameT);
92
    NameP name = ALLOCATE(NameT);
63
 
93
 
64
    name->clash    = FALSE;
94
    name->clash    = FALSE;
65
    name->used     = FALSE;
95
    name->used     = FALSE;
66
    name->labelled = FALSE;
96
    name->labelled = FALSE;
67
    return (name);
97
    return(name);
68
}
98
}
69
 
99
 
70
BoolT
100
BoolT
71
name_test_and_set_clash PROTO_N ((name))
101
name_test_and_set_clash(NameP name)
72
			PROTO_T (NameP name)
-
 
73
{
102
{
74
    BoolT clash = name->clash;
103
    BoolT clash = name->clash;
75
 
104
 
76
    name->clash = TRUE;
105
    name->clash = TRUE;
77
    return (clash);
106
    return(clash);
78
}
107
}
79
 
108
 
80
#ifdef FS_FAST
109
#ifdef FS_FAST
81
#undef name_reset_clash
110
#undef name_reset_clash
82
#endif /* defined (FS_FAST) */
111
#endif /* defined (FS_FAST) */
83
void
112
void
84
name_reset_clash PROTO_N ((name))
113
name_reset_clash(NameP name)
85
		 PROTO_T (NameP name)
-
 
86
{
114
{
87
    name->clash = FALSE;
115
    name->clash = FALSE;
88
}
116
}
89
#ifdef FS_FAST
117
#ifdef FS_FAST
90
#define name_reset_clash(n) ((n)->clash = FALSE)
118
#define name_reset_clash(n)	((n)->clash = FALSE)
91
#endif /* defined (FS_FAST) */
119
#endif /* defined (FS_FAST) */
92
 
120
 
93
#ifdef FS_FAST
121
#ifdef FS_FAST
94
#undef name_is_used
122
#undef name_is_used
95
#endif /* defined (FS_FAST) */
123
#endif /* defined (FS_FAST) */
96
BoolT
124
BoolT
97
name_is_used PROTO_N ((name))
125
name_is_used(NameP name)
98
	     PROTO_T (NameP name)
-
 
99
{
126
{
100
    return (name->used);
127
    return(name->used);
101
}
128
}
102
#ifdef FS_FAST
129
#ifdef FS_FAST
103
#define name_is_used(n) ((n)->used)
130
#define name_is_used(n)	((n)->used)
104
#endif /* defined (FS_FAST) */
131
#endif /* defined (FS_FAST) */
105
 
132
 
106
#ifdef FS_FAST
133
#ifdef FS_FAST
107
#undef name_used
134
#undef name_used
108
#endif /* defined (FS_FAST) */
135
#endif /* defined (FS_FAST) */
109
void
136
void
110
name_used PROTO_N ((name))
137
name_used(NameP name)
111
	  PROTO_T (NameP name)
-
 
112
{
138
{
113
    name->used = TRUE;
139
    name->used = TRUE;
114
}
140
}
115
#ifdef FS_FAST
141
#ifdef FS_FAST
116
#define name_used(n) ((n)->used = TRUE)
142
#define name_used(n)	((n)->used = TRUE)
117
#endif /* defined (FS_FAST) */
143
#endif /* defined (FS_FAST) */
118
 
144
 
119
#ifdef FS_FAST
145
#ifdef FS_FAST
120
#undef name_not_used
146
#undef name_not_used
121
#endif /* defined (FS_FAST) */
147
#endif /* defined (FS_FAST) */
122
void
148
void
123
name_not_used PROTO_N ((name))
149
name_not_used(NameP name)
124
	      PROTO_T (NameP name)
-
 
125
{
150
{
126
    name->used = FALSE;
151
    name->used = FALSE;
127
}
152
}
128
#ifdef FS_FAST
153
#ifdef FS_FAST
129
#define name_not_used(n) ((n)->used = FALSE)
154
#define name_not_used(n)	((n)->used = FALSE)
130
#endif /* defined (FS_FAST) */
155
#endif /* defined (FS_FAST) */
131
 
156
 
132
#ifdef FS_FAST
157
#ifdef FS_FAST
133
#undef name_get_label
158
#undef name_get_label
134
#endif /* defined (FS_FAST) */
159
#endif /* defined (FS_FAST) */
135
unsigned
160
unsigned
136
name_get_label PROTO_N ((name))
161
name_get_label(NameP name)
137
	       PROTO_T (NameP name)
-
 
138
{
162
{
139
    ASSERT (name->labelled);
163
    ASSERT(name->labelled);
140
    return (name->label);
164
    return(name->label);
141
}
165
}
142
#ifdef FS_FAST
166
#ifdef FS_FAST
143
#define name_get_label(n) ((n)->label)
167
#define name_get_label(n)	((n)->label)
144
#endif /* defined (FS_FAST) */
168
#endif /* defined (FS_FAST) */
145
 
169
 
146
void
170
void
147
name_set_label PROTO_N ((name, label))
171
name_set_label(NameP name, unsigned label)
148
	       PROTO_T (NameP    name X
-
 
149
			unsigned label)
-
 
150
{
172
{
151
    name->labelled = TRUE;
173
    name->labelled = TRUE;
152
    name->label    = label;
174
    name->label    = label;
153
}
175
}
154
 
176
 
155
#ifdef FS_FAST
177
#ifdef FS_FAST
156
#undef name_reset_label
178
#undef name_reset_label
157
#endif /* defined (FS_FAST) */
179
#endif /* defined (FS_FAST) */
158
void
180
void
159
name_reset_label PROTO_N ((name))
181
name_reset_label(NameP name)
160
		 PROTO_T (NameP name)
-
 
161
{
182
{
162
    name->labelled = FALSE;
183
    name->labelled = FALSE;
163
}
184
}
164
#ifdef FS_FAST
185
#ifdef FS_FAST
165
#define name_reset_label(n) ((n)->labelled = FALSE)
186
#define name_reset_label(n)	((n)->labelled = FALSE)
166
#endif /* defined (FS_FAST) */
187
#endif /* defined (FS_FAST) */
167
 
188
 
168
#ifdef FS_FAST
189
#ifdef FS_FAST
169
#undef name_has_label
190
#undef name_has_label
170
#endif /* defined (FS_FAST) */
191
#endif /* defined (FS_FAST) */
171
BoolT
192
BoolT
172
name_has_label PROTO_N ((name))
193
name_has_label(NameP name)
173
	       PROTO_T (NameP name)
-
 
174
{
194
{
175
    return (name->labelled);
195
    return(name->labelled);
176
}
196
}
177
#ifdef FS_FAST
197
#ifdef FS_FAST
178
#define name_has_label(n) ((n)->labelled)
198
#define name_has_label(n)	((n)->labelled)
179
#endif /* defined (FS_FAST) */
199
#endif /* defined (FS_FAST) */
180

200

181
/*
201
/*
182
 * Local variables(smf):
202
 * Local variables(smf):
183
 * eval: (include::add-path-entry "../os-interface" "../library")
203
 * eval: (include::add-path-entry "../os-interface" "../library")