Subversion Repositories tendra.SVN

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
6 7u83 2
 * Copyright (c) 2002-2006 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
6 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
6 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
6 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
6 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
6 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
#ifndef TOK_INCLUDED
62
#define TOK_INCLUDED
63
 
64
 
65
/*
66
    TDF TOKEN ENCODING ROUTINES
67
 
68
    The routines in this module are concerned with the encoding of the
69
    tokens used in the TDF output.
70
*/
71
 
6 7u83 72
extern TOKEN make_sort(CONST char *, int);
73
extern IDENTIFIER resolve_token(IDENTIFIER, CONST char *, int);
74
extern IDENTIFIER get_special(int, int);
75
extern string special_name(int);
76
extern void set_special(int, IDENTIFIER);
77
extern int token_code(TOKEN);
78
extern int builtin_token(IDENTIFIER);
79
extern void define_special(int);
80
extern void init_tok(int);
2 7u83 81
 
82
#if TDF_OUTPUT
6 7u83 83
extern ulong special_no(int);
84
extern BITSTREAM *enc_special(BITSTREAM *, int);
85
extern BITSTREAM *enc_diag_special(BITSTREAM *, int, int);
86
extern BITSTREAM *enc_sort(BITSTREAM *, int);
87
extern BITSTREAM *enc_token(BITSTREAM *, IDENTIFIER, LIST(TOKEN));
88
extern BITSTREAM *enc_tokdef_body(BITSTREAM *, IDENTIFIER, TOKEN);
89
extern BITSTREAM *enc_asm(BITSTREAM *, EXP);
2 7u83 90
#endif
91
 
92
 
93
/*
94
    BASIC TYPE TOKEN INFORMATION
95
 
96
    The table base_token contains the token numbers associated with the
97
    basic types.
98
*/
99
 
100
typedef struct {
6 7u83 101
    int tok;
102
    unsigned no;
103
    unsigned alt;
104
} BASE_TOKEN;
2 7u83 105
 
6 7u83 106
extern BASE_TOKEN base_token[];
2 7u83 107
 
108
 
109
/*
110
    SPECIAL TOKEN NUMBERS
111
 
112
    These values correspond to the special tokens.
113
*/
114
 
115
#define TOK_char				0
116
#define TOK_signed_char				1
117
#define TOK_unsigned_char			2
118
#define TOK_signed_short			3
119
#define TOK_unsigned_short			4
120
#define TOK_signed_int				5
121
#define TOK_unsigned_int			6
122
#define TOK_signed_long				7
123
#define TOK_unsigned_long			8
124
#define TOK_signed_llong			9
125
#define TOK_unsigned_llong			10
126
 
127
#define TOK_float				11
128
#define TOK_double				12
129
#define TOK_long_double				13
130
 
131
#define TOK_bool				14
132
#define TOK_ptrdiff_t				15
133
#define TOK_size_t				16
134
#define TOK_size_t_2				17
135
#define TOK_wchar_t				18
136
 
137
#define TOK_convert				19
138
#define TOK_arith_type				20
139
#define TOK_promote				21
140
#define TOK_sign_promote			22
141
 
142
#define TOK_lit_int				23
143
#define TOK_lit_hex				24
144
#define TOK_lit_unsigned			25
145
#define TOK_lit_long				26
146
#define TOK_lit_ulong				27
147
#define TOK_lit_llong				28
148
#define TOK_lit_ullong				29
149
 
150
#define TOK_bitf_sign				30
151
 
152
#define TOK_ptr_void				31
153
#define TOK_null_pv				32
154
#define TOK_to_ptr_void				33
155
#define TOK_from_ptr_void			34
156
#define TOK_pv_test				35
157
#define TOK_pv_compare				36
158
 
159
#define TOK_ptr_to_ptr				37
160
#define TOK_f_to_pv				38
161
#define TOK_pv_to_f				39
162
#define TOK_i_to_p				40
163
#define TOK_p_to_i				41
164
#define TOK_i_to_pv				42
165
#define TOK_pv_to_i				43
166
#define TOK_ptr_rep				44
167
 
168
#define TOK_div					45
169
#define TOK_rem					46
170
 
171
#define TOK_va_t				47
172
 
173
#define TOK_pm_type				48
174
#define TOK_pm_make				49
175
#define TOK_pm_null				50
176
#define TOK_pm_offset				51
177
#define TOK_pm_cast				52
178
#define TOK_pm_uncast				53
179
#define TOK_pm_test				54
180
#define TOK_pm_compare				55
181
 
182
#define TOK_pmf_type				56
183
#define TOK_pmf_make				57
184
#define TOK_pmf_vmake				58
185
#define TOK_pmf_null				59
186
#define TOK_pmf_null2				60
187
#define TOK_pmf_delta				61
188
#define TOK_pmf_func				62
189
#define TOK_pmf_virt				63
190
#define TOK_pmf_cast				64
191
#define TOK_pmf_uncast				65
192
#define TOK_pmf_test				66
193
#define TOK_pmf_compare				67
194
 
195
#define TOK_comp_off				68
196
#define TOK_pad					69
197
#define TOK_empty_align				70
198
#define TOK_empty_shape				71
199
#define TOK_empty_offset			72
200
 
201
#define TOK_vtab_type				73
202
#define TOK_vtab_diag				74
203
#define TOK_vtab_make				75
204
#define TOK_vtab_pure				76
205
#define TOK_vtab_func				77
206
#define TOK_vtab_off				78
207
 
208
#define TOK_typeid_type				79
209
#define TOK_typeid_make				80
210
#define TOK_typeid_basic			81
211
#define TOK_typeid_ref				82
212
#define TOK_baseid_type				83
213
#define TOK_baseid_make				84
214
#define TOK_dynam_cast				85
215
 
216
#define TOK_destr_type				86
217
#define TOK_destr_global			87
218
#define TOK_destr_local				88
219
#define TOK_destr_end				89
220
#define TOK_destr_init				90
221
#define TOK_destr_null				91
222
#define TOK_destr_ptr				92
223
#define TOK_start				93
224
 
225
#define TOK_try_type				94
226
#define TOK_try_begin				95
227
#define TOK_try_end				96
228
#define TOK_except_alloc			97
229
#define TOK_except_throw			98
230
#define TOK_except_rethrow			99
231
#define TOK_except_catch			100
232
#define TOK_except_value			101
233
#define TOK_except_caught			102
234
#define TOK_except_end				103
235
#define TOK_except_bad				104
236
#define TOK_except_jump				105
237
#define TOK_ptr_code				106
238
#define TOK_ptr_frame				107
239
 
240
#define TOK_asm_sequence			108
241
#define TOK_asm					109
242
#define TOK_asm_input				110
243
#define TOK_asm_output				111
244
#define TOK_asm_address				112
245
 
246
#define TOK_char_offset				113
247
#define TOK_shape_offset			114
248
#define TOK_extra_offset			115
249
#define TOK_down_cast				116
250
#define TOK_destr_cast				117
251
#define TOK_destr_test				118
252
 
253
#define TOK_no					119
254
 
255
 
256
#endif