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 TOK_INCLUDED
|
|
|
32 |
#define TOK_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
TDF TOKEN ENCODING ROUTINES
|
|
|
37 |
|
|
|
38 |
The routines in this module are concerned with the encoding of the
|
|
|
39 |
tokens used in the TDF output.
|
|
|
40 |
*/
|
|
|
41 |
|
|
|
42 |
extern TOKEN make_sort PROTO_S ( ( CONST char *, int ) ) ;
|
|
|
43 |
extern IDENTIFIER resolve_token PROTO_S ( ( IDENTIFIER, CONST char *, int ) ) ;
|
|
|
44 |
extern IDENTIFIER get_special PROTO_S ( ( int, int ) ) ;
|
|
|
45 |
extern string special_name PROTO_S ( ( int ) ) ;
|
|
|
46 |
extern void set_special PROTO_S ( ( int, IDENTIFIER ) ) ;
|
|
|
47 |
extern int token_code PROTO_S ( ( TOKEN ) ) ;
|
|
|
48 |
extern int builtin_token PROTO_S ( ( IDENTIFIER ) ) ;
|
|
|
49 |
extern void define_special PROTO_S ( ( int ) ) ;
|
|
|
50 |
extern void init_tok PROTO_S ( ( int ) ) ;
|
|
|
51 |
|
|
|
52 |
#if TDF_OUTPUT
|
|
|
53 |
extern ulong special_no PROTO_S ( ( int ) ) ;
|
|
|
54 |
extern BITSTREAM *enc_special PROTO_S ( ( BITSTREAM *, int ) ) ;
|
|
|
55 |
extern BITSTREAM *enc_diag_special PROTO_S ( ( BITSTREAM *, int, int ) ) ;
|
|
|
56 |
extern BITSTREAM *enc_sort PROTO_S ( ( BITSTREAM *, int ) ) ;
|
|
|
57 |
extern BITSTREAM *enc_token PROTO_S ( ( BITSTREAM *, IDENTIFIER, LIST ( TOKEN ) ) ) ;
|
|
|
58 |
extern BITSTREAM *enc_tokdef_body PROTO_S ( ( BITSTREAM *, IDENTIFIER, TOKEN ) ) ;
|
|
|
59 |
extern BITSTREAM *enc_asm PROTO_S ( ( BITSTREAM *, EXP ) ) ;
|
|
|
60 |
#endif
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
/*
|
|
|
64 |
BASIC TYPE TOKEN INFORMATION
|
|
|
65 |
|
|
|
66 |
The table base_token contains the token numbers associated with the
|
|
|
67 |
basic types.
|
|
|
68 |
*/
|
|
|
69 |
|
|
|
70 |
typedef struct {
|
|
|
71 |
int tok ;
|
|
|
72 |
unsigned no ;
|
|
|
73 |
unsigned alt ;
|
|
|
74 |
} BASE_TOKEN ;
|
|
|
75 |
|
|
|
76 |
extern BASE_TOKEN base_token [] ;
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
/*
|
|
|
80 |
SPECIAL TOKEN NUMBERS
|
|
|
81 |
|
|
|
82 |
These values correspond to the special tokens.
|
|
|
83 |
*/
|
|
|
84 |
|
|
|
85 |
#define TOK_char 0
|
|
|
86 |
#define TOK_signed_char 1
|
|
|
87 |
#define TOK_unsigned_char 2
|
|
|
88 |
#define TOK_signed_short 3
|
|
|
89 |
#define TOK_unsigned_short 4
|
|
|
90 |
#define TOK_signed_int 5
|
|
|
91 |
#define TOK_unsigned_int 6
|
|
|
92 |
#define TOK_signed_long 7
|
|
|
93 |
#define TOK_unsigned_long 8
|
|
|
94 |
#define TOK_signed_llong 9
|
|
|
95 |
#define TOK_unsigned_llong 10
|
|
|
96 |
|
|
|
97 |
#define TOK_float 11
|
|
|
98 |
#define TOK_double 12
|
|
|
99 |
#define TOK_long_double 13
|
|
|
100 |
|
|
|
101 |
#define TOK_bool 14
|
|
|
102 |
#define TOK_ptrdiff_t 15
|
|
|
103 |
#define TOK_size_t 16
|
|
|
104 |
#define TOK_size_t_2 17
|
|
|
105 |
#define TOK_wchar_t 18
|
|
|
106 |
|
|
|
107 |
#define TOK_convert 19
|
|
|
108 |
#define TOK_arith_type 20
|
|
|
109 |
#define TOK_promote 21
|
|
|
110 |
#define TOK_sign_promote 22
|
|
|
111 |
|
|
|
112 |
#define TOK_lit_int 23
|
|
|
113 |
#define TOK_lit_hex 24
|
|
|
114 |
#define TOK_lit_unsigned 25
|
|
|
115 |
#define TOK_lit_long 26
|
|
|
116 |
#define TOK_lit_ulong 27
|
|
|
117 |
#define TOK_lit_llong 28
|
|
|
118 |
#define TOK_lit_ullong 29
|
|
|
119 |
|
|
|
120 |
#define TOK_bitf_sign 30
|
|
|
121 |
|
|
|
122 |
#define TOK_ptr_void 31
|
|
|
123 |
#define TOK_null_pv 32
|
|
|
124 |
#define TOK_to_ptr_void 33
|
|
|
125 |
#define TOK_from_ptr_void 34
|
|
|
126 |
#define TOK_pv_test 35
|
|
|
127 |
#define TOK_pv_compare 36
|
|
|
128 |
|
|
|
129 |
#define TOK_ptr_to_ptr 37
|
|
|
130 |
#define TOK_f_to_pv 38
|
|
|
131 |
#define TOK_pv_to_f 39
|
|
|
132 |
#define TOK_i_to_p 40
|
|
|
133 |
#define TOK_p_to_i 41
|
|
|
134 |
#define TOK_i_to_pv 42
|
|
|
135 |
#define TOK_pv_to_i 43
|
|
|
136 |
#define TOK_ptr_rep 44
|
|
|
137 |
|
|
|
138 |
#define TOK_div 45
|
|
|
139 |
#define TOK_rem 46
|
|
|
140 |
|
|
|
141 |
#define TOK_va_t 47
|
|
|
142 |
|
|
|
143 |
#define TOK_pm_type 48
|
|
|
144 |
#define TOK_pm_make 49
|
|
|
145 |
#define TOK_pm_null 50
|
|
|
146 |
#define TOK_pm_offset 51
|
|
|
147 |
#define TOK_pm_cast 52
|
|
|
148 |
#define TOK_pm_uncast 53
|
|
|
149 |
#define TOK_pm_test 54
|
|
|
150 |
#define TOK_pm_compare 55
|
|
|
151 |
|
|
|
152 |
#define TOK_pmf_type 56
|
|
|
153 |
#define TOK_pmf_make 57
|
|
|
154 |
#define TOK_pmf_vmake 58
|
|
|
155 |
#define TOK_pmf_null 59
|
|
|
156 |
#define TOK_pmf_null2 60
|
|
|
157 |
#define TOK_pmf_delta 61
|
|
|
158 |
#define TOK_pmf_func 62
|
|
|
159 |
#define TOK_pmf_virt 63
|
|
|
160 |
#define TOK_pmf_cast 64
|
|
|
161 |
#define TOK_pmf_uncast 65
|
|
|
162 |
#define TOK_pmf_test 66
|
|
|
163 |
#define TOK_pmf_compare 67
|
|
|
164 |
|
|
|
165 |
#define TOK_comp_off 68
|
|
|
166 |
#define TOK_pad 69
|
|
|
167 |
#define TOK_empty_align 70
|
|
|
168 |
#define TOK_empty_shape 71
|
|
|
169 |
#define TOK_empty_offset 72
|
|
|
170 |
|
|
|
171 |
#define TOK_vtab_type 73
|
|
|
172 |
#define TOK_vtab_diag 74
|
|
|
173 |
#define TOK_vtab_make 75
|
|
|
174 |
#define TOK_vtab_pure 76
|
|
|
175 |
#define TOK_vtab_func 77
|
|
|
176 |
#define TOK_vtab_off 78
|
|
|
177 |
|
|
|
178 |
#define TOK_typeid_type 79
|
|
|
179 |
#define TOK_typeid_make 80
|
|
|
180 |
#define TOK_typeid_basic 81
|
|
|
181 |
#define TOK_typeid_ref 82
|
|
|
182 |
#define TOK_baseid_type 83
|
|
|
183 |
#define TOK_baseid_make 84
|
|
|
184 |
#define TOK_dynam_cast 85
|
|
|
185 |
|
|
|
186 |
#define TOK_destr_type 86
|
|
|
187 |
#define TOK_destr_global 87
|
|
|
188 |
#define TOK_destr_local 88
|
|
|
189 |
#define TOK_destr_end 89
|
|
|
190 |
#define TOK_destr_init 90
|
|
|
191 |
#define TOK_destr_null 91
|
|
|
192 |
#define TOK_destr_ptr 92
|
|
|
193 |
#define TOK_start 93
|
|
|
194 |
|
|
|
195 |
#define TOK_try_type 94
|
|
|
196 |
#define TOK_try_begin 95
|
|
|
197 |
#define TOK_try_end 96
|
|
|
198 |
#define TOK_except_alloc 97
|
|
|
199 |
#define TOK_except_throw 98
|
|
|
200 |
#define TOK_except_rethrow 99
|
|
|
201 |
#define TOK_except_catch 100
|
|
|
202 |
#define TOK_except_value 101
|
|
|
203 |
#define TOK_except_caught 102
|
|
|
204 |
#define TOK_except_end 103
|
|
|
205 |
#define TOK_except_bad 104
|
|
|
206 |
#define TOK_except_jump 105
|
|
|
207 |
#define TOK_ptr_code 106
|
|
|
208 |
#define TOK_ptr_frame 107
|
|
|
209 |
|
|
|
210 |
#define TOK_asm_sequence 108
|
|
|
211 |
#define TOK_asm 109
|
|
|
212 |
#define TOK_asm_input 110
|
|
|
213 |
#define TOK_asm_output 111
|
|
|
214 |
#define TOK_asm_address 112
|
|
|
215 |
|
|
|
216 |
#define TOK_char_offset 113
|
|
|
217 |
#define TOK_shape_offset 114
|
|
|
218 |
#define TOK_extra_offset 115
|
|
|
219 |
#define TOK_down_cast 116
|
|
|
220 |
#define TOK_destr_cast 117
|
|
|
221 |
#define TOK_destr_test 118
|
|
|
222 |
|
|
|
223 |
#define TOK_no 119
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
#endif
|