home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / NEW.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  5.6 KB  |  169 lines

  1. #ifndef __NEW_H
  2. #define __NEW_H
  3. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  4. // -*- C++ -*-
  5. #if !defined(_HPACC_)
  6. #ifndef __STD_NEW
  7. #define __STD_NEW
  8.  
  9. /***************************************************************************
  10.  *
  11.  * new - declarations for the Standard Library new header
  12.  *
  13.  ***************************************************************************
  14.  *
  15.  * (c) Copyright 1994, 1998 Rogue Wave Software, Inc.
  16.  * ALL RIGHTS RESERVED
  17.  *
  18.  * The software and information contained herein are proprietary to, and
  19.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  20.  * intends to preserve as trade secrets such software and information.
  21.  * This software is furnished pursuant to a written license agreement and
  22.  * may be used, copied, transmitted, and stored only in accordance with
  23.  * the terms of such license and with the inclusion of the above copyright
  24.  * notice.  This software and information or any other copies thereof may
  25.  * not be provided or otherwise made available to any other person.
  26.  *
  27.  * Notwithstanding any other lease or license that may pertain to, or
  28.  * accompany the delivery of, this computer software and information, the
  29.  * rights of the Government regarding its use, reproduction and disclosure
  30.  * are as set forth in Section 52.227-19 of the FARS Computer
  31.  * Software-Restricted Rights clause.
  32.  * 
  33.  * Use, duplication, or disclosure by the Government is subject to
  34.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  35.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  36.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  37.  * P.O. Box 2328, Corvallis, Oregon 97339.
  38.  *
  39.  * This computer software and information is distributed with "restricted
  40.  * rights."  Use, duplication or disclosure is subject to restrictions as
  41.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  42.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  43.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  44.  * then the "Alternate III" clause applies.
  45.  *
  46.  **************************************************************************/
  47.  
  48. #include <stdcomp.h>
  49. #include <rw/stddefs.h>
  50. #include <exception>
  51.  
  52. #ifndef _RWSTD_NO_NAMESPACE 
  53. namespace __rwstd {
  54. #endif
  55.  
  56. extern const char _RWSTDExportFunc(*) __rw_stdexcept_BadAllocException;
  57.  
  58. #ifndef _RWSTD_NO_NAMESPACE 
  59. }
  60. namespace std {
  61. #endif
  62.  
  63. #if !defined(_RWSTD_BAD_ALLOC_DEFINED) || defined(__TURBOC__)
  64. class _RWSTDExport bad_alloc : public exception     
  65.   public:
  66.     bad_alloc () _RWSTD_THROW_SPEC_NULL : exception( )
  67.     { ; }
  68.     bad_alloc(const bad_alloc&) _RWSTD_THROW_SPEC_NULL
  69.     { ; }
  70.     bad_alloc& operator=(const bad_alloc&) _RWSTD_THROW_SPEC_NULL
  71.     { return *this; }
  72.     virtual ~bad_alloc ()  _RWSTD_THROW_SPEC_NULL;
  73.  
  74.     virtual const char * what () const  _RWSTD_THROW_SPEC_NULL
  75.     { 
  76.       return __RWSTD::__rw_stdexcept_BadAllocException;
  77.     }
  78. };
  79. #else
  80. #ifndef _RWSTD_NO_NAMESPACE 
  81. }
  82. #endif
  83. #if defined(_MSC_VER) && !defined(__BORLANDC__)
  84. #include _RWSTD_MS42_HEADER(new)
  85. #else
  86. #include <new.h>
  87. #endif
  88. #ifndef _RWSTD_NO_NAMESPACE 
  89. namespace std {
  90. #endif
  91. #endif /*_RWSTD_BAD_ALLOC_DEFINED */
  92.  
  93. #ifndef _RWSTD_NOTHROW_IN_STD
  94. struct nothrow_t {};
  95. extern const nothrow_t nothrow;
  96. #endif // _RWSTD_NOTHROW_IN_STD
  97.  
  98. #if !defined(_RWSTD_EXCEPTION_HANDLER_IN_STD) || defined(__BORLANDC__)
  99. typedef void ( _RTLENTRY *new_handler) ();
  100.  
  101. #if !defined(_MSC_VER) || defined(__BORLANDC__)
  102. extern new_handler _RTLENTRY _EXPFUNC set_new_handler( new_handler new_p );
  103. #endif
  104. #endif // ! _RWSTD_EXCEPTION_HANDLER_IN_STD || __BORLANDC__
  105. #ifndef _RWSTD_NO_NAMESPACE
  106. }
  107. #endif
  108.  
  109. #ifndef _RWSTD_NO_NEW_BRACKETS
  110. #ifndef _RWSTD_NO_THROW_SPEC_ON_NEW
  111. extern void * _RTLENTRY _EXPFUNC operator new(size_t, void*)  _RWSTD_THROW_SPEC_NULL;
  112. inline void*  _RTLENTRY          operator new[] ( size_t, void* ptr)  _RWSTD_THROW_SPEC_NULL
  113.  { return ptr; }
  114. #else
  115. extern void * _RTLENTRY _EXPFUNC operator new(size_t, void*);
  116. inline void*  _RTLENTRY          operator new[] ( size_t, void* ptr)
  117.  { return ptr; }
  118. #endif // _RWSTD_NO_THROW_SPEC_ON_NEW
  119. #else
  120. #if defined(_MSC_VER) && !defined(__BORLANDC__)
  121. #include <new.h>
  122. extern void * _RTLENTRY _EXPFUNC operator new(size_t, void* ptr);
  123. #else
  124. #ifndef _RWSTD_NO_THROW_SPEC_ON_NEW
  125. static inline  void * _RTLENTRY  operator new(size_t, void* ptr) _RWSTD_THROW_SPEC_NULL
  126.  { return ptr; }
  127. #else
  128. static inline  void * _RTLENTRY  operator new(size_t, void* ptr)
  129.  { return ptr; }
  130. #endif // _RWSTD_NO_THROW_SPEC_ON_NEW
  131. #endif // _MSC_VER
  132. #endif // _RWSTD_NO_NEW_BRACKETS
  133.  
  134. #ifdef __BORLANDC__
  135. // Prototypes for the standard global new & delete operators
  136. void * _RTLENTRY _EXPFUNC operator new (size_t);
  137. void   _RTLENTRY _EXPFUNC operator delete (void *);
  138. // inline versions of the nothrow_t versions of new & delete operators
  139. inline void * _RTLENTRY operator new (size_t size, const std::nothrow_t &)
  140. {
  141.     size = size ? size : 1;
  142.     return malloc(size);
  143. }
  144. inline void * _RTLENTRY operator new[] (size_t size, const std::nothrow_t &nt)
  145. {
  146.     return ::operator new (size, nt);
  147. }
  148. inline void _RTLENTRY operator delete (void *v, const std::nothrow_t &nt)
  149. {
  150.     ::operator delete (v);  // The standard operator doesn't throw any exceptions
  151. }
  152. inline void _RTLENTRY operator delete[] (void *v, const std::nothrow_t &nt)
  153. {
  154.     ::operator delete[] (v);  // The standard operator doesn't throw any exceptions
  155. }
  156. #endif // __BORLANDC__
  157.  
  158. #endif /*__STD_NEW */
  159.  
  160. #else
  161. #include <new.h>
  162. #endif /* !defined (_HPACC_) */
  163. #ifndef __USING_STD_NAMES__
  164.   using namespace std;
  165. #endif
  166. #pragma option pop
  167. #endif /* __NEW_H */
  168.