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 IMPLEMENT_INCLUDED
|
|
|
32 |
#define IMPLEMENT_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
STANDARD HEADERS
|
|
|
37 |
|
|
|
38 |
The following standard headers are required: cstdlib for size_t and
|
|
|
39 |
new for bad_alloc. Also longjump.h is included.
|
|
|
40 |
*/
|
|
|
41 |
|
|
|
42 |
#define __CPP_NATIVE_ATEXIT
|
|
|
43 |
#include <cstdlib>
|
|
|
44 |
#include <new>
|
|
|
45 |
using namespace std ;
|
|
|
46 |
#pragma extend interface "longjump.h"
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
/*
|
|
|
50 |
IMPLEMENTATION NAMESPACE
|
|
|
51 |
|
|
|
52 |
The types and functions declared in this module describe the interface
|
|
|
53 |
between the language support library and the compiler. They are all
|
|
|
54 |
declared in the __IMPL namespace.
|
|
|
55 |
*/
|
|
|
56 |
|
|
|
57 |
namespace __IMPL {
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
/*
|
|
|
61 |
BOOLEAN TYPE
|
|
|
62 |
|
|
|
63 |
This type gives the underlying representation of bool.
|
|
|
64 |
*/
|
|
|
65 |
|
|
|
66 |
typedef int BOOLEAN ;
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
/*
|
|
|
70 |
TYPE REPRESENTING A POINTER TO MEMBER
|
|
|
71 |
|
|
|
72 |
A pointer to data member is represented by an integer giving the
|
|
|
73 |
offset of the member from the start of the structure (in bytes),
|
|
|
74 |
plus one. The one is to allow a value of zero to be used for the
|
|
|
75 |
null pointer to member.
|
|
|
76 |
*/
|
|
|
77 |
|
|
|
78 |
typedef int PTR_MEMBER ;
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
/*
|
|
|
82 |
TYPE REPRESENTING A GENERIC FUNCTION POINTER
|
|
|
83 |
|
|
|
84 |
This type is used to stand for a generic pointer to function.
|
|
|
85 |
*/
|
|
|
86 |
|
|
|
87 |
typedef void ( *FUNCTION ) () ;
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
/*
|
|
|
91 |
TYPE REPRESENTING A POINTER TO MEMBER FUNCTION
|
|
|
92 |
|
|
|
93 |
This type is used to represent a pointer to member function. It
|
|
|
94 |
consists of a base class offset, an index into the virtual function
|
|
|
95 |
table (or -1 for non-virtual functions, or 0 for null pointer to
|
|
|
96 |
member functions) and either a pointer to function or an offset
|
|
|
97 |
giving the location of the virtual function table.
|
|
|
98 |
*/
|
|
|
99 |
|
|
|
100 |
struct PTR_MEM_FUNC {
|
|
|
101 |
short delta ;
|
|
|
102 |
short index ;
|
|
|
103 |
union {
|
|
|
104 |
FUNCTION func ;
|
|
|
105 |
short off ;
|
|
|
106 |
} u ;
|
|
|
107 |
} ;
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
/*
|
|
|
111 |
TYPE REPRESENTING A VIRTUAL FUNCTION TABLE
|
|
|
112 |
|
|
|
113 |
This type is used to represent a virtual function table. This
|
|
|
114 |
consists of any array of pointers to the virtual member functions.
|
|
|
115 |
The first entry is a dummy, the space being occupied by a pointer
|
|
|
116 |
to the run-time type information and a offset back to the start
|
|
|
117 |
of the object (this extra entry corresponds to the value of
|
|
|
118 |
VIRTUAL_EXTRA in interface.h). In general there can be any number
|
|
|
119 |
of virtual functions (see vtable.p), the example implementation
|
|
|
120 |
is for a single function.
|
|
|
121 |
*/
|
|
|
122 |
|
|
|
123 |
struct TYPE_INFO ;
|
|
|
124 |
|
|
|
125 |
struct VTABLE_EXTRA {
|
|
|
126 |
TYPE_INFO *rtti ;
|
|
|
127 |
short off ;
|
|
|
128 |
} ;
|
|
|
129 |
|
|
|
130 |
union VTABLE_1 {
|
|
|
131 |
PTR_MEM_FUNC funcs [2] ;
|
|
|
132 |
VTABLE_EXTRA extra ;
|
|
|
133 |
} ;
|
|
|
134 |
|
|
|
135 |
typedef VTABLE_1 VTABLE ;
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
/*
|
|
|
139 |
TYPE REPRESENTING A RUN-TIME TYPE INFORMATION STRUCTURE
|
|
|
140 |
|
|
|
141 |
This type is used to represent the run-time type information
|
|
|
142 |
associated with a type. This consists of a string, giving the
|
|
|
143 |
type name and a list of base class information structures.
|
|
|
144 |
Because the std::type_info class has a virtual destructor
|
|
|
145 |
a virtual function containing one element is also required,
|
|
|
146 |
otherwise the elements must correspond exactly to those of
|
|
|
147 |
std::type_info.
|
|
|
148 |
*/
|
|
|
149 |
|
|
|
150 |
struct BASE_INFO {
|
|
|
151 |
TYPE_INFO *rtti ;
|
|
|
152 |
int off ;
|
|
|
153 |
BASE_INFO *next ;
|
|
|
154 |
int access ;
|
|
|
155 |
int virt ;
|
|
|
156 |
} ;
|
|
|
157 |
|
|
|
158 |
struct TYPE_INFO {
|
|
|
159 |
int code ;
|
|
|
160 |
const char *name ;
|
|
|
161 |
BASE_INFO *base ;
|
|
|
162 |
VTABLE_1 *vptr ;
|
|
|
163 |
} ;
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
/*
|
|
|
167 |
TYPE REPRESENTING A LIST OF DESTRUCTORS
|
|
|
168 |
|
|
|
169 |
This type is used to represent a list of destructor functions. It
|
|
|
170 |
consists of a pointer to the argument, a pointer to the destructor
|
|
|
171 |
function and a pointer to the next element of the list.
|
|
|
172 |
*/
|
|
|
173 |
|
|
|
174 |
struct CLASS ;
|
|
|
175 |
typedef void ( *DESTRUCTOR ) ( CLASS *, int ) ;
|
|
|
176 |
|
|
|
177 |
struct DTOR_LIST {
|
|
|
178 |
DTOR_LIST *next ;
|
|
|
179 |
CLASS *arg ;
|
|
|
180 |
DESTRUCTOR func ;
|
|
|
181 |
} ;
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
/*
|
|
|
185 |
TYPE REPRESENTING A LONG JUMP BUFFER
|
|
|
186 |
|
|
|
187 |
This type is used to represent a long jump buffer. It consists
|
|
|
188 |
of a linked list of frame pointers and code pointers (as defined
|
|
|
189 |
in longjump.h.
|
|
|
190 |
*/
|
|
|
191 |
|
|
|
192 |
struct JUMP_BUFFER {
|
|
|
193 |
JUMP_BUFFER *next ;
|
|
|
194 |
DTOR_LIST *dtors ;
|
|
|
195 |
FRAME_PTR frame ;
|
|
|
196 |
CODE_PTR label ;
|
|
|
197 |
} ;
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
/*
|
|
|
201 |
TYPE REPRESENTING AN EXCEPTION
|
|
|
202 |
|
|
|
203 |
This type is used to represent an exception. It consists of the
|
|
|
204 |
type information for the value being thrown, two pointers to the
|
|
|
205 |
value (the second of which may be changed via a base class
|
|
|
206 |
conversion when catching an exception), a pointer to the current
|
|
|
207 |
long jump buffer, and a flag which is set to true during stack
|
|
|
208 |
unwinding.
|
|
|
209 |
*/
|
|
|
210 |
|
|
|
211 |
struct EXCEPTION {
|
|
|
212 |
TYPE_INFO *type ;
|
|
|
213 |
DESTRUCTOR dtor ;
|
|
|
214 |
void *value [2] ;
|
|
|
215 |
JUMP_BUFFER *buf [3] ;
|
|
|
216 |
bool unwinding ;
|
|
|
217 |
bool allocated ;
|
|
|
218 |
} ;
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
using namespace __IMPL ;
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
/*
|
|
|
225 |
EXTERNALLY VISIBLE OBJECTS
|
|
|
226 |
|
|
|
227 |
This list gives the externally visible objects and functions used
|
|
|
228 |
in the standard token library. They are all given C linkage to avoid
|
|
|
229 |
name mangling problems. Note that the macro __TCPPLUS_ti_vtbl, which
|
|
|
230 |
represents the virtual function table of std::type_info, is dependent
|
|
|
231 |
on the name mangling conventions.
|
|
|
232 |
*/
|
|
|
233 |
|
|
|
234 |
#define __TCPPLUS_ti_vtbl __vt__Q23std9type_info
|
|
|
235 |
|
|
|
236 |
extern "C" {
|
|
|
237 |
typedef void ( *EXITER ) ( void ) ;
|
|
|
238 |
void __TCPPLUS_init () ;
|
|
|
239 |
void __TCPPLUS_term () ;
|
|
|
240 |
int __TCPPLUS_atexit ( EXITER ) ;
|
|
|
241 |
void *__TCPPLUS_new ( size_t ) throw ( bad_alloc ) ;
|
|
|
242 |
void *__TCPPLUS_new_nothrow ( size_t ) throw () ;
|
|
|
243 |
void __TCPPLUS_delete ( void * ) throw () ;
|
|
|
244 |
void __TCPPLUS_pure () ;
|
|
|
245 |
void __TCPPLUS_type_info ( VTABLE * ) ;
|
|
|
246 |
void *__TCPPLUS_dynamic_cast ( VTABLE **, TYPE_INFO * ) ;
|
|
|
247 |
void *__TCPPLUS_catch_cast ( void *, TYPE_INFO *, TYPE_INFO *, int, int ) ;
|
|
|
248 |
int __TCPPLUS_catch ( TYPE_INFO * ) ;
|
|
|
249 |
void __TCPPLUS_throw ( void *, TYPE_INFO *, DESTRUCTOR ) ;
|
|
|
250 |
void __TCPPLUS_handled () ;
|
|
|
251 |
void __TCPPLUS_unexpected ( int ) ;
|
|
|
252 |
void *__TCPPLUS_alloc_except ( size_t ) ;
|
|
|
253 |
void __TCPPLUS_assert ( const char *, int ) ;
|
|
|
254 |
extern DTOR_LIST *__TCPPLUS_dtors ;
|
|
|
255 |
extern VTABLE_1 __TCPPLUS_ti_vtbl ;
|
|
|
256 |
extern TYPE_INFO __TCPPLUS_typeid [] ;
|
|
|
257 |
extern EXCEPTION __TCPPLUS_except ;
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
/*
|
|
|
262 |
ASSERTIONS
|
|
|
263 |
|
|
|
264 |
These macros may be used in debugging mode to catch internal run-time
|
|
|
265 |
errors.
|
|
|
266 |
*/
|
|
|
267 |
|
|
|
268 |
#ifdef DEBUG
|
|
|
269 |
#define ASSERT( X ) if ( !( X ) ) __TCPPLUS_assert ( __FILE__, __LINE__ )
|
|
|
270 |
#else
|
|
|
271 |
#define ASSERT( X )
|
|
|
272 |
#endif
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
#endif
|