//============================================================================= // drt/sys/sdefs.hpp//============================================================================= // drt/sys/sdefs.hpp // Common C++ definitions. // // Usage // This must be the very first file #included by all C++ source files. // It contains the necessary definitions to correct the deficiencies of // the local C++ compiler. // // See also // sport.hpp // // History // 1.01, 1998-04-23, David R Tribble. // First cut. // // 1.02, 1998-05-30, David R Tribble. // Changed filename prefix from "j" to "s". // // 1.03, 1999-02-26, David R Tribble. // Moved to drt/sys/. // // 1.04, 1999-08-07, David R Tribble. // Includes "kport.h". // // Copyright ©1998-1999, by David R. Tribble, all rights reserved. // See "drt/sys/copyr.txt" for more information. //----------------------------------------------------------------------------- #ifndef drt_sys_sdefs_hpp #define drt_sys_sdefs_hpp 104 // Identification #ifndef NO_H_IDENT static const char drt_sys_sdefs_hpp_id[] = "@(#)drt/sys/sdefs.hpp 1.04"; #endif // Verify include order #ifndef __cplusplus #error Use "sys/kdefs.h" instead of "sys/sdefs.hpp" for C #endif // Special includes #ifndef drt_sys_kport_h #include "kport.h" // Defines macros for porting #endif //----------------------------------------------------------------------------- // Local definitions //----------------------------------------------------------------------------- // Porting control macros #ifndef DRT_BYTE_HL #error Unknown byte ordering within words (DRT_BYTE_HL) #endif #ifndef DRT_WORD_HL #error Unknown word ordering within longs (DRT_WORD_HL) #endif #ifndef DRT_LONG_HL #error Unknown long ordering within long longs (DRT_LONG_HL) #endif // Standard keywords and operators #if !DRT_HAS_AND #ifndef and #define and && #define and_eq &= #define bitand & #define bitor | #define compl ~ #define not ! #define not_eq != #define or || #define or_eq |= #define xor ^ #define xor_eq ^= #endif #endif #if DRT_HAS_CAST #define const_cast(t,e) const_cast(e) #define dynamic_cast(t,e) dynamic_cast(e) #define reinterpret_cast(t,e) reinterpret_cast(e) #define static_cast(t,e) static_cast(e) #else #define const_cast(t,e) (t)(e) #define dynamic_cast(t,e) (t)(e) #define reinterpret_cast(t,e) (t)(e) #define static_cast(t,e) (t)(e) #endif #if not DRT_HAS_EXPLICIT #define explicit /*nothing*/ #endif #if not DRT_HAS_EXPORT #define export /*nothing*/ #endif #if not DRT_HAS_MUTABLE #define mutable /*nothing*/ #endif #if not DRT_HAS_TYPEID #define typeid /*nothing*/ #endif #if not DRT_HAS_TYPENAME #define typename /*nothing*/ #endif #if DRT_HAS_NAMESPACE #define drt_namespace Drt #define drt_namespace_begin namespace Drt { #define drt_namespace_end } #else #define drt_namespace /*nothing*/ #define drt_namespace_begin /*nothing*/ #define drt_namespace_end /*nothing*/ #endif #if DRT_HAS_STD #define drt_std std #else #define drt_std /*nothing*/ #endif #ifndef drt_new #if DRT_HAS_NEW and DRT_HAS_NOTHROW #define drt_new(T) ::new(nothrow) T #define drt_operator_new_nothrow(n)\ ::operator new(n, nothrow) #define drt_operator_newA_nothrow(n)\ ::operator new[](n, nothrow) #else #define drt_new(T) ::new T #define drt_operator_new_nothrow(n)\ ::operator new(n) #define drt_operator_newA_nothrow(n)\ ::operator new[](n) #endif #endif // Standard types #if not DRT_HAS_BOOL typedef int bool; #endif #ifndef drt_int16_t #define drt_int16_t signed short int // 16-bit signed integer #define drt_uint16_t unsigned short int // 16-bit unsigned integer #endif #ifndef drt_int32_t #define drt_int32_t signed int // 32-bit signed integer #define drt_uint32_t unsigned int // 32-bit unsigned integer #endif #ifndef drt_int64_t #define drt_int64_t signed long long int // 64-bit signed integer #define drt_uint64_t unsigned long long int // 64-bit unsigned integer #endif // Standard constants #if not DRT_HAS_BOOL static const bool false = (bool) 0; static const bool true = (bool) 1; #endif #ifndef NULL #define NULL 0 #endif #if DRT_HAS_MEMB_TEMPL #include "snull.hpp" #else #undef null #define null NULL #endif #ifndef LLONG_MIN #define LLONG_MIN (-9223372036854775807LL-1) #endif #ifndef LLONG_MAX #define LLONG_MAX 9223372036854775807LL #endif #ifndef ULLONG_MAX #define ULLONG_MAX 0xFFFFFFFFFFFFFFFFLLU #endif // Other constants #ifndef LLONG_FMT #define LLONG_FMT "ll" #endif // Other names #undef min #undef max #endif // drt_sys_sdefs_hpp // End sdefs.hpp