6 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997, 1998
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
#ifndef OSSG_INCLUDED
|
|
|
32 |
#define OSSG_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
OSSG STANDARD COMPILER HEADER, VERSION 1.1
|
|
|
37 |
|
|
|
38 |
This headers defines feature switch macros for various compiler
|
|
|
39 |
features. These can be 1, if the feature is allowed, or 0, otherwise.
|
|
|
40 |
These switches are used to define the PROTO macros described in the
|
|
|
41 |
OSSG C coding standard. Standard versions of the TenDRA keywords
|
|
|
42 |
are also provided.
|
|
|
43 |
*/
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
/* FS_CPLUSPLUS indicates a C++ compiler */
|
|
|
47 |
|
|
|
48 |
#ifndef FS_CPLUSPLUS
|
|
|
49 |
#ifdef __cplusplus
|
|
|
50 |
#define FS_CPLUSPLUS 1
|
|
|
51 |
#define FS_STDC 1
|
|
|
52 |
#else
|
|
|
53 |
#define FS_CPLUSPLUS 0
|
|
|
54 |
#endif
|
|
|
55 |
#endif
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
/* FS_STDC indicates an ISO C compliant compiler */
|
|
|
59 |
|
|
|
60 |
#ifndef FS_STDC
|
|
|
61 |
#ifdef __STDC__
|
|
|
62 |
#define FS_STDC 1
|
|
|
63 |
#else
|
|
|
64 |
#define FS_STDC 0
|
|
|
65 |
#endif
|
|
|
66 |
#endif
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
/* FS_TENDRA indicates the TenDRA C compiler */
|
|
|
70 |
|
|
|
71 |
#ifndef FS_TENDRA
|
|
|
72 |
#ifdef __TenDRA__
|
|
|
73 |
#define FS_TENDRA 1
|
|
|
74 |
#else
|
|
|
75 |
#define FS_TENDRA 0
|
|
|
76 |
#endif
|
|
|
77 |
#endif
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
/* FS_GNUC indicates the GNU C compiler */
|
|
|
81 |
|
|
|
82 |
#ifndef FS_GNUC
|
|
|
83 |
#ifdef __GNUC__
|
|
|
84 |
#define FS_GNUC 1
|
|
|
85 |
#else
|
|
|
86 |
#define FS_GNUC 0
|
|
|
87 |
#endif
|
|
|
88 |
#endif
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
/* FS_LINT indicates lint */
|
|
|
92 |
|
|
|
93 |
#ifndef FS_LINT
|
|
|
94 |
#if defined ( lint ) || defined ( __lint )
|
|
|
95 |
#define FS_LINT 1
|
|
|
96 |
#else
|
|
|
97 |
#define FS_LINT 0
|
|
|
98 |
#endif
|
|
|
99 |
#endif
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
/* FS_PROTOTYPES indicates whether the compiler has prototypes */
|
|
|
103 |
|
|
|
104 |
#ifndef FS_PROTOTYPES
|
|
|
105 |
#define FS_PROTOTYPES FS_STDC
|
|
|
106 |
#endif
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
/* FS_WEAK_PROTOTYPES indicates whether the compiler has weak prototypes */
|
|
|
110 |
|
|
|
111 |
#ifndef FS_WEAK_PROTOTYPES
|
|
|
112 |
#define FS_WEAK_PROTOTYPES ( FS_TENDRA && !FS_CPLUSPLUS )
|
|
|
113 |
#endif
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
/* FS_STDARG indicates whether the compiler has <stdarg.h> */
|
|
|
117 |
|
|
|
118 |
#ifndef FS_STDARG
|
|
|
119 |
#define FS_STDARG FS_STDC
|
|
|
120 |
#endif
|
|
|
121 |
|
|
|
122 |
/*
|
|
|
123 |
** Macro: PROTO_S (prototype)
|
|
|
124 |
** Exceptions:
|
|
|
125 |
*
|
|
|
126 |
* If prototypes are supported, this expands to the prototyped function
|
|
|
127 |
* argument declaration provided. If they are not supported, it expands to an
|
|
|
128 |
* empty argument list. It is necessary to use two sets of parentheses, as
|
|
|
129 |
* the prototype may contain commas. This macro should be used to declare all
|
|
|
130 |
* functions within the program (see the function declarations later on in the
|
|
|
131 |
* file for some examples of its use).
|
|
|
132 |
*
|
|
|
133 |
** Macro: PROTO_N (names)
|
|
|
134 |
** Macro: PROTO_T (types)
|
|
|
135 |
** Macro: X
|
|
|
136 |
** Macro: PROTO_Z ()
|
|
|
137 |
** Exceptions:
|
|
|
138 |
*
|
|
|
139 |
* The "PROTO_N" and "PROTO_T" macros should be used for argument
|
|
|
140 |
* specifications when defining functions. If prototypes are supported, these
|
|
|
141 |
* macros expand to a prototyped argument specification; if they are not
|
|
|
142 |
* supported, the macros expand to an unprototyped argument specification.
|
|
|
143 |
* The "PROTO_N" macro takes a comma separated list of argument names (in a
|
|
|
144 |
* similar manner to the "PROTO_S" macro). The "PROTO_T" macro takes a list
|
|
|
145 |
* of declarations for those names, separated by an "X" macro. If the
|
|
|
146 |
* function takes no parameters, then the "PROTO_Z" macro should be used
|
|
|
147 |
* instead. An example of the definition of the ``main'' function in a
|
|
|
148 |
* program is:
|
|
|
149 |
*
|
|
|
150 |
* int
|
|
|
151 |
* main PROTO_N ((argc, argv))
|
|
|
152 |
* PROTO_T (int argc X char **argv)
|
|
|
153 |
* {
|
|
|
154 |
* }
|
|
|
155 |
*
|
|
|
156 |
* An example of the definition of a function with no parameters is:
|
|
|
157 |
*
|
|
|
158 |
* void
|
|
|
159 |
* no_args_proc PROTO_Z ()
|
|
|
160 |
* {
|
|
|
161 |
* }
|
|
|
162 |
*
|
|
|
163 |
* Other functions should be defined in a similar manner.
|
|
|
164 |
*/
|
|
|
165 |
|
|
|
166 |
/* Definitions of PROTO macros for weak prototypes */
|
|
|
167 |
|
|
|
168 |
#if FS_WEAK_PROTOTYPES
|
|
|
169 |
#ifndef PROTO_S
|
|
|
170 |
#pragma TenDRA keyword KW_WEAK_PROTOTYPE for weak
|
|
|
171 |
#define PROTO_S( types ) KW_WEAK_PROTOTYPE types
|
|
|
172 |
#define PROTO_N( names ) names
|
|
|
173 |
#define PROTO_T( params ) params ;
|
|
|
174 |
#define PROTO_Z() ()
|
|
|
175 |
#define PROTO_X ;
|
|
|
176 |
#endif
|
|
|
177 |
#endif
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
/* Definitions of PROTO macros for prototypes */
|
|
|
181 |
|
|
|
182 |
#if FS_PROTOTYPES
|
|
|
183 |
#ifndef PROTO_S
|
|
|
184 |
#define PROTO_S( types ) types
|
|
|
185 |
#define PROTO_N( names )
|
|
|
186 |
#define PROTO_T( params ) ( params )
|
|
|
187 |
#define PROTO_Z() ( void )
|
|
|
188 |
#define PROTO_X ,
|
|
|
189 |
#endif
|
|
|
190 |
#endif
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
/* Definitions of PROTO macros for non-prototypes */
|
|
|
194 |
|
|
|
195 |
#ifndef PROTO_S
|
|
|
196 |
#define PROTO_S( types ) ()
|
|
|
197 |
#define PROTO_N( names ) names
|
|
|
198 |
#define PROTO_T( params ) params ;
|
|
|
199 |
#define PROTO_Z() ()
|
|
|
200 |
#define PROTO_X ;
|
|
|
201 |
#endif
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
/* Definitions of PROTO_V macros */
|
|
|
205 |
|
|
|
206 |
#if FS_STDARG
|
|
|
207 |
#define PROTO_V( params ) params
|
|
|
208 |
#define PROTO_W( types ) types
|
|
|
209 |
#else
|
|
|
210 |
#define PROTO_V( parms ) ( va_alist ) va_dcl
|
|
|
211 |
#define PROTO_W( types ) ()
|
|
|
212 |
#endif
|
|
|
213 |
|
|
|
214 |
|
|
|
215 |
/* Definition of prototype separator macro */
|
|
|
216 |
|
|
|
217 |
#ifdef X
|
|
|
218 |
#undef X
|
|
|
219 |
#endif
|
|
|
220 |
#define X PROTO_X
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
/* Definitions of TenDRA keywords */
|
|
|
224 |
|
|
|
225 |
#if FS_TENDRA
|
|
|
226 |
#pragma TenDRA keyword SET for set
|
|
|
227 |
#pragma TenDRA keyword UNUSED for discard variable
|
|
|
228 |
#pragma TenDRA keyword IGNORE for discard value
|
|
|
229 |
#pragma TenDRA keyword EXHAUSTIVE for exhaustive
|
|
|
230 |
#pragma TenDRA keyword REACHED for set reachable
|
|
|
231 |
#pragma TenDRA keyword UNREACHED for set unreachable
|
|
|
232 |
#define FALL_THROUGH
|
|
|
233 |
#endif
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
/* Definitions of TenDRA keywords for lint */
|
|
|
237 |
|
|
|
238 |
#if FS_LINT
|
|
|
239 |
#define SET( name )
|
|
|
240 |
#define UNUSED( name ) ( name ) = ( name )
|
|
|
241 |
#define IGNORE ( void )
|
|
|
242 |
#define EXHAUSTIVE
|
|
|
243 |
#define REACHED
|
|
|
244 |
#define UNREACHED
|
|
|
245 |
#define FALL_THROUGH
|
|
|
246 |
#endif
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
/* Dummy definitions for TenDRA keywords */
|
|
|
250 |
|
|
|
251 |
#if !FS_TENDRA && !FS_LINT
|
|
|
252 |
#define SET( name )
|
|
|
253 |
#define UNUSED( name )
|
|
|
254 |
#define IGNORE ( void )
|
|
|
255 |
#define EXHAUSTIVE
|
|
|
256 |
#define REACHED
|
|
|
257 |
#define UNREACHED
|
|
|
258 |
#define FALL_THROUGH
|
|
|
259 |
#endif
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
/* FS_CONST indicates whether const is supported */
|
|
|
263 |
|
|
|
264 |
#ifndef FS_CONST
|
|
|
265 |
#define FS_CONST FS_STDC
|
|
|
266 |
#endif
|
|
|
267 |
|
|
|
268 |
|
|
|
269 |
/* FS_VOLATILE indicates whether volatile is supported */
|
|
|
270 |
|
|
|
271 |
#ifndef FS_VOLATILE
|
|
|
272 |
#define FS_VOLATILE FS_STDC
|
|
|
273 |
#endif
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
/* CONST is used in place of const */
|
|
|
277 |
|
|
|
278 |
#if FS_CONST
|
|
|
279 |
#define CONST const
|
|
|
280 |
#else
|
|
|
281 |
#define CONST
|
|
|
282 |
#endif
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
/* VOLATILE is used in place of volatile */
|
|
|
286 |
|
|
|
287 |
#if FS_VOLATILE
|
|
|
288 |
#define VOLATILE volatile
|
|
|
289 |
#else
|
|
|
290 |
#define VOLATILE
|
|
|
291 |
#endif
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
/* FS_STDC_HASH indicates whether # and ## are supported */
|
|
|
295 |
|
|
|
296 |
#ifndef FS_STDC_HASH
|
|
|
297 |
#define FS_STDC_HASH FS_STDC
|
|
|
298 |
#endif
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
/* FS_STDC_IDENTIFIERS indicates __FILE__ etc. are defined */
|
|
|
302 |
|
|
|
303 |
#ifndef FS_STDC_IDENTIFIERS
|
|
|
304 |
#define FS_STDC_IDENTIFIERS FS_STDC
|
|
|
305 |
#endif
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
/* FS_TRIGRAPH indicates whether trigraphs are supported */
|
|
|
309 |
|
|
|
310 |
#ifndef FS_TRIGRAPH
|
|
|
311 |
#define FS_TRIGRAPH FS_STDC
|
|
|
312 |
#endif
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
/* FS_WIDE_STRING indicates whether wide strings are supported */
|
|
|
316 |
|
|
|
317 |
#ifndef FS_WIDE_STRING
|
|
|
318 |
#define FS_WIDE_STRING FS_STDC
|
|
|
319 |
#endif
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
/* FS_NUMBER_SUFFIX indicates whether the L, U, F suffixes are supported */
|
|
|
323 |
|
|
|
324 |
#ifndef FS_NUMBER_SUFFIX
|
|
|
325 |
#define FS_NUMBER_SUFFIX FS_STDC
|
|
|
326 |
#endif
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
/* FS_CONCAT_STRING indicates whether string concatenation is supported */
|
|
|
330 |
|
|
|
331 |
#ifndef FS_CONCAT_STRING
|
|
|
332 |
#define FS_CONCAT_STRING FS_STDC
|
|
|
333 |
#endif
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
/* FS_SIGNED indicates whether signed is supported */
|
|
|
337 |
|
|
|
338 |
#ifndef FS_SIGNED
|
|
|
339 |
#define FS_SIGNED FS_STDC
|
|
|
340 |
#endif
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
/* FS_LONG_DOUBLE indicates whether long double is supported */
|
|
|
344 |
|
|
|
345 |
#ifndef FS_LONG_DOUBLE
|
|
|
346 |
#define FS_LONG_DOUBLE FS_STDC
|
|
|
347 |
#endif
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
/* FS_ENUMERATION indicates whether enumeration types are supported */
|
|
|
351 |
|
|
|
352 |
#ifndef FS_ENUMERATION
|
|
|
353 |
#define FS_ENUMERATION FS_STDC
|
|
|
354 |
#endif
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
/* FS_TYPEDEF_VOID indicates whether typedef void is supported */
|
|
|
358 |
|
|
|
359 |
#ifndef FS_TYPEDEF_VOID
|
|
|
360 |
#define FS_TYPEDEF_VOID FS_STDC
|
|
|
361 |
#endif
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
/* FS_UNION_INIT indicates whether initialisation of unions is supported */
|
|
|
365 |
|
|
|
366 |
#ifndef FS_UNION_INIT
|
|
|
367 |
#define FS_UNION_INIT FS_STDC
|
|
|
368 |
#endif
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
/* FS_AUTO_STRUCT_INIT indicates whether initialisation of automatic
|
|
|
372 |
compound variables is allowed */
|
|
|
373 |
|
|
|
374 |
#ifndef FS_AUTO_STRUCT_INIT
|
|
|
375 |
#define FS_AUTO_STRUCT_INIT FS_STDC
|
|
|
376 |
#endif
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
#endif
|