2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
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 OUTPUT_INCLUDED
|
|
|
32 |
#define OUTPUT_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
LOOP VARIABLES
|
|
|
37 |
|
|
|
38 |
These variables are used in the LOOP macros below as loop counters.
|
|
|
39 |
It should not be necessary to access them directly, instead the
|
|
|
40 |
CRT macros below should be used.
|
|
|
41 |
*/
|
|
|
42 |
|
|
|
43 |
extern LIST ( ECONST_P ) crt_ec ;
|
|
|
44 |
extern LIST ( ENUM_P ) crt_en ;
|
|
|
45 |
extern LIST ( IDENTITY_P ) crt_id ;
|
|
|
46 |
extern LIST ( PRIMITIVE_P ) crt_prim ;
|
|
|
47 |
extern LIST ( STRUCTURE_P ) crt_str ;
|
|
|
48 |
extern LIST ( UNION_P ) crt_union ;
|
|
|
49 |
extern LIST ( COMPONENT_P ) crt_cmp ;
|
|
|
50 |
extern LIST ( FIELD_P ) crt_fld ;
|
|
|
51 |
extern LIST ( MAP_P ) crt_map ;
|
|
|
52 |
extern LIST ( ARGUMENT_P ) crt_arg ;
|
|
|
53 |
extern LIST ( TYPE_P ) crt_type ;
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
/*
|
|
|
57 |
LOOP MACROS
|
|
|
58 |
|
|
|
59 |
The LOOP macros are used to scan over all elements of a list. The
|
|
|
60 |
CRT macros give the effective loop counters. Thus, for example,
|
|
|
61 |
LOOP_ENUM is a for statement which makes CRT_ENUM scan over all the
|
|
|
62 |
enumeration types.
|
|
|
63 |
*/
|
|
|
64 |
|
|
|
65 |
#define LOOP_LIST( X, Y )\
|
|
|
66 |
for ( ( X ) = ( Y ) ; !IS_NULL_list ( X ) ; ( X ) = TAIL_list ( X ) )
|
|
|
67 |
|
|
|
68 |
#define LOOP_ENUM\
|
|
|
69 |
LOOP_LIST ( crt_en, algebra->enumerations )
|
|
|
70 |
|
|
|
71 |
#define LOOP_IDENTITY\
|
|
|
72 |
LOOP_LIST ( crt_id, algebra->identities )
|
|
|
73 |
|
|
|
74 |
#define LOOP_PRIMITIVE\
|
|
|
75 |
LOOP_LIST ( crt_prim, algebra->primitives )
|
|
|
76 |
|
|
|
77 |
#define LOOP_STRUCTURE\
|
|
|
78 |
LOOP_LIST ( crt_str, algebra->structures )
|
|
|
79 |
|
|
|
80 |
#define LOOP_UNION\
|
|
|
81 |
LOOP_LIST ( crt_union, algebra->unions )
|
|
|
82 |
|
|
|
83 |
#define LOOP_ENUM_CONST\
|
|
|
84 |
LOOP_LIST ( crt_ec, DEREF_list ( en_consts ( CRT_ENUM ) ) )
|
|
|
85 |
|
|
|
86 |
#define LOOP_STRUCTURE_COMPONENT\
|
|
|
87 |
LOOP_LIST ( crt_cmp, DEREF_list ( str_defn ( CRT_STRUCTURE ) ) )
|
|
|
88 |
|
|
|
89 |
#define LOOP_UNION_COMPONENT\
|
|
|
90 |
LOOP_LIST ( crt_cmp, DEREF_list ( un_s_defn ( CRT_UNION ) ) )
|
|
|
91 |
|
|
|
92 |
#define LOOP_UNION_FIELD\
|
|
|
93 |
LOOP_LIST ( crt_fld, DEREF_list ( un_u_defn ( CRT_UNION ) ) )
|
|
|
94 |
|
|
|
95 |
#define LOOP_FIELD_COMPONENT\
|
|
|
96 |
LOOP_LIST ( crt_cmp, DEREF_list ( fld_defn ( CRT_FIELD ) ) )
|
|
|
97 |
|
|
|
98 |
#define LOOP_UNION_MAP\
|
|
|
99 |
LOOP_LIST ( crt_map, DEREF_list ( un_map ( CRT_UNION ) ) )
|
|
|
100 |
|
|
|
101 |
#define LOOP_MAP_ARGUMENT\
|
|
|
102 |
LOOP_LIST ( crt_arg, DEREF_list ( map_args ( CRT_MAP ) ) )
|
|
|
103 |
|
|
|
104 |
#define LOOP_TYPE\
|
|
|
105 |
LOOP_LIST ( crt_type, algebra->types )
|
|
|
106 |
|
|
|
107 |
#define CRT_ENUM DEREF_ptr ( HEAD_list ( crt_en ) )
|
|
|
108 |
#define CRT_IDENTITY DEREF_ptr ( HEAD_list ( crt_id ) )
|
|
|
109 |
#define CRT_PRIMITIVE DEREF_ptr ( HEAD_list ( crt_prim ) )
|
|
|
110 |
#define CRT_STRUCTURE DEREF_ptr ( HEAD_list ( crt_str ) )
|
|
|
111 |
#define CRT_UNION DEREF_ptr ( HEAD_list ( crt_union ) )
|
|
|
112 |
#define CRT_ECONST DEREF_ptr ( HEAD_list ( crt_ec ) )
|
|
|
113 |
#define CRT_COMPONENT DEREF_ptr ( HEAD_list ( crt_cmp ) )
|
|
|
114 |
#define CRT_FIELD DEREF_ptr ( HEAD_list ( crt_fld ) )
|
|
|
115 |
#define CRT_MAP DEREF_ptr ( HEAD_list ( crt_map ) )
|
|
|
116 |
#define CRT_ARGUMENT DEREF_ptr ( HEAD_list ( crt_arg ) )
|
|
|
117 |
#define CRT_TYPE DEREF_ptr ( HEAD_list ( crt_type ) )
|
|
|
118 |
|
|
|
119 |
#define HAVE_ENUM ( !IS_NULL_list ( crt_en ) )
|
|
|
120 |
#define HAVE_IDENTITY ( !IS_NULL_list ( crt_id ) )
|
|
|
121 |
#define HAVE_PRIMITIVE ( !IS_NULL_list ( crt_prim ) )
|
|
|
122 |
#define HAVE_STRUCTURE ( !IS_NULL_list ( crt_str ) )
|
|
|
123 |
#define HAVE_UNION ( !IS_NULL_list ( crt_union ) )
|
|
|
124 |
#define HAVE_ECONST ( !IS_NULL_list ( crt_ec ) )
|
|
|
125 |
#define HAVE_COMPONENT ( !IS_NULL_list ( crt_cmp ) )
|
|
|
126 |
#define HAVE_FIELD ( !IS_NULL_list ( crt_fld ) )
|
|
|
127 |
#define HAVE_MAP ( !IS_NULL_list ( crt_map ) )
|
|
|
128 |
#define HAVE_ARGUMENT ( !IS_NULL_list ( crt_arg ) )
|
|
|
129 |
#define HAVE_TYPE ( !IS_NULL_list ( crt_type ) )
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
/*
|
|
|
133 |
DECLARATIONS FOR BASIC OUTPUT ROUTINES
|
|
|
134 |
*/
|
|
|
135 |
|
|
|
136 |
extern int unique ;
|
|
|
137 |
extern int const_tokens ;
|
|
|
138 |
extern int have_varargs ;
|
|
|
139 |
extern int output_c_code ;
|
|
|
140 |
extern int verbose_output ;
|
|
|
141 |
extern FILE *output_file ;
|
|
|
142 |
extern void flush_output PROTO_S ( ( void ) ) ;
|
|
|
143 |
extern void open_file PROTO_S ( ( char *, char *, char * ) ) ;
|
|
|
144 |
extern void close_file PROTO_S ( ( void ) ) ;
|
|
|
145 |
extern void output_type PROTO_S ( ( TYPE_P ) ) ;
|
|
|
146 |
extern number log2 PROTO_S ( ( number ) ) ;
|
|
|
147 |
|
|
|
148 |
#if FS_STDARG
|
|
|
149 |
extern void output ( char *, ... ) ;
|
|
|
150 |
#else
|
|
|
151 |
extern void output () ;
|
|
|
152 |
#endif
|
|
|
153 |
|
|
|
154 |
#define comment( X ) output ( "/* %e */\n\n", ( X ) )
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
#endif
|