2 |
7u83 |
1 |
# Crown Copyright (c) 1997
|
|
|
2 |
#
|
|
|
3 |
# This TenDRA(r) Computer Program is subject to Copyright
|
|
|
4 |
# owned by the United Kingdom Secretary of State for Defence
|
|
|
5 |
# acting through the Defence Evaluation and Research Agency
|
|
|
6 |
# (DERA). It is made available to Recipients with a
|
|
|
7 |
# royalty-free licence for its use, reproduction, transfer
|
|
|
8 |
# to other parties and amendment for any purpose not excluding
|
|
|
9 |
# product development provided that any such use et cetera
|
|
|
10 |
# shall be deemed to be acceptance of the following conditions:-
|
|
|
11 |
#
|
|
|
12 |
# (1) Its Recipients shall ensure that this Notice is
|
|
|
13 |
# reproduced upon any copies or amended versions of it;
|
|
|
14 |
#
|
|
|
15 |
# (2) Any amended version of it shall be clearly marked to
|
|
|
16 |
# show both the nature of and the organisation responsible
|
|
|
17 |
# for the relevant amendment or amendments;
|
|
|
18 |
#
|
|
|
19 |
# (3) Its onward transfer from a recipient to another
|
|
|
20 |
# party shall be deemed to be that party's acceptance of
|
|
|
21 |
# these conditions;
|
|
|
22 |
#
|
|
|
23 |
# (4) DERA gives no warranty or assurance as to its
|
|
|
24 |
# quality or suitability for any purpose and DERA accepts
|
|
|
25 |
# no liability whatsoever in relation to any use to which
|
|
|
26 |
# it may be put.
|
|
|
27 |
#
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
$LINKAGE = "C++" ;
|
|
|
31 |
$NAMESPACE = "" ;
|
|
|
32 |
|
|
|
33 |
+USE "cpp", "cstdlib" ;
|
|
|
34 |
+USE "cpp", "exception" ;
|
|
|
35 |
|
|
|
36 |
+SUBSET "bad_alloc" := {
|
|
|
37 |
# This is done as a subset because it is in the std namespace
|
|
|
38 |
$LINKAGE = "C++" ;
|
|
|
39 |
$NAMESPACE = "std" ;
|
|
|
40 |
%%
|
|
|
41 |
// EXCEPTION THROWN BY BAD NEW OPERATION
|
|
|
42 |
class bad_alloc : public exception {
|
|
|
43 |
// Implementation dependent details
|
|
|
44 |
public :
|
|
|
45 |
bad_alloc () throw () ;
|
|
|
46 |
bad_alloc ( const bad_alloc & ) throw () ;
|
|
|
47 |
bad_alloc &operator= ( const bad_alloc & ) throw () ;
|
|
|
48 |
virtual ~bad_alloc () throw () ;
|
|
|
49 |
virtual const char *what () const throw () ;
|
|
|
50 |
} ;
|
|
|
51 |
|
|
|
52 |
// SURROGATE NO-EXCEPTION CLASS
|
|
|
53 |
struct nothrow_t {} ;
|
|
|
54 |
extern const nothrow_t nothrow ;
|
|
|
55 |
|
|
|
56 |
// NEW HANDLERS
|
|
|
57 |
typedef void ( *new_handler ) () ;
|
|
|
58 |
new_handler set_new_handler ( new_handler ) throw () ;
|
|
|
59 |
%%
|
|
|
60 |
} ;
|
|
|
61 |
|
|
|
62 |
%%
|
|
|
63 |
// STANDARD ALLOCATION OPERATORS
|
|
|
64 |
void *operator new ( std::size_t ) throw ( std::bad_alloc ) ;
|
|
|
65 |
void *operator new [] ( std::size_t ) throw ( std::bad_alloc ) ;
|
|
|
66 |
void operator delete ( void * ) throw () ;
|
|
|
67 |
void operator delete [] ( void * ) throw () ;
|
|
|
68 |
|
|
|
69 |
// NO-EXCEPTION ALLOCATION OPERATORS
|
|
|
70 |
void *operator new ( std::size_t, const std::nothrow_t & ) throw () ;
|
|
|
71 |
void *operator new [] ( std::size_t, const std::nothrow_t & ) throw () ;
|
|
|
72 |
void operator delete ( void *, const std::nothrow_t & ) throw () ;
|
|
|
73 |
void operator delete [] ( void *, const std::nothrow_t & ) throw () ;
|
|
|
74 |
|
|
|
75 |
// PLACEMENT ALLOCATION OPERATORS
|
|
|
76 |
inline void *operator new ( std::size_t, void *p ) throw () { return ( p ) ; }
|
|
|
77 |
inline void *operator new [] ( std::size_t, void *p ) throw () { return ( p ) ; }
|
|
|
78 |
inline void operator delete ( void *, void * ) throw () { return ; }
|
|
|
79 |
inline void operator delete [] ( void *, void * ) throw () { return ; }
|
|
|
80 |
%%
|