/*============================================================================= * drt/sys/kport.h * DRT C/C++ system-specific porting definitions. * * Usage * This file must be modified by the programmer when porting to a new * platform. It contains definitions for controlling the porting of the * source code. Most of the definitions are determined by testing macros * that are predefined by the compiler (such as '_unix'). * * This file is #included by "kdefs.h" and "sdefs.hpp". This file is not * explicitly #included by any other source file; rather, the "kdefs.h" * (for C) and "sdefs.hpp" (for C++) files are #included by all source * files, and they in turn #include this header file. * * There are four macro groups that get defined in this file: * * DRT_CPU_XXX - Specifies the CPU of the local system * DRT_CXX_XXX - Specifies the local C++ compiler * DRT_C_XXX - Specifies the local C compiler * DRT_OS_XXX - Specifies the local operating system * * Definitions * The following control macros are defined in each "k_xxx.h" or * "s_xxx.hpp"header file that is #included by this file. * * The following macros are for C compilers: * * DRT_HAS_BOOL 0 or 1 Has 'bool' type * DRT_HAS_LLONG 0 or 1 Has a 'long long' type * * The following macros are for C++ compilers: * * DRT_HAS_AND 0 or 1 Has 'and' keyword * DRT_HAS_ARRAY_CTOR 0 or 1 Allows member array init in ctor * DRT_HAS_ARRAY_NEW 0 or 1 Has 'new[]' operator * DRT_HAS_BOOL 0 or 1 Has 'bool' type * DRT_HAS_CAST 0 or 1 Has 'static_cast' keyword * DRT_HAS_EXPLICIT 0 or 1 Has 'explicit' keyword * DRT_HAS_EXPORT 0 or 1 Has 'export' keyword * DRT_HAS_LLONG 0 or 1 Has a 'long long' type * DRT_HAS_MEMB_TEMPL 0 or 1 Has member template funcs * DRT_HAS_MUTABLE 0 or 1 Has 'mutable' keyword * DRT_HAS_NAMESPACE 0 or 1 Has namespaces * DRT_HAS_NEW 0 or 1 Has standard header * DRT_HAS_NOTHROW 0 or 1 Has 'new(nothrow)' * DRT_HAS_STD 0 or 1 Has 'std::' namespace * DRT_HAS_STL 0 or 1 Has standard template lib * DRT_HAS_THROW 0 or 1 Has exceptions * DRT_HAS_TYPEID 0 or 1 Has 'typeid' keyword * DRT_HAS_TYPENAME 0 or 1 Has 'typename' keyword * * See also * kdefs.h * k_xxx.h * sdefs.hpp * s_xxx.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 "k". * * 1.03, 1998-06-17, David R Tribble. * Documented the control macro names. * * 1.04, 1999-02-26, David R Tribble. * Moved to drt/sys/. * * 1.05, 1999-03-19, David R Tribble. * Converted from C++ to C. * * 1.06, 1999-08-07, David R Tribble. * Handles both C and C++ porting macros. * Deduces CPU, O/S, and compiler from predefined preprocessor macros. * * Copyright ©1998-1999, by David R. Tribble, all rights reserved. * See "drt/sys/copyr.txt" for more information. *----------------------------------------------------------------------------*/ #ifndef drt_sys_kport_h #define drt_sys_kport_h 106 /* Identification */ #ifndef NO_H_IDENT static const char drt_sys_kport_h_id[] = "@(#)drt/sys/kport.h 1.06"; #endif /* Verify include order */ #ifdef __cplusplus #ifndef drt_sys_sdefs_hpp #error Use "sys/sdefs.hpp" instead of this header #endif #else #ifndef drt_sys_kdefs_h #error Use "sys/kdefs.h" instead of this header #endif #endif /*----------------------------------------------------------------------------- * System-specific porting macros *----------------------------------------------------------------------------*/ /* Determine the local CPU type */ #if defined(_M_IX86) #define DRT_CPU_IAPX86 1 /* Intel iAPX/86 */ #elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) #define DRT_CPU_PARISC 1 /* HP PA-RISC */ #elif defined(__sparc) #define DRT_CPU_SPARC 1 /* Sun Sparc */ #elif defined(__alpha) || defined(__host_alpha) || defined(_M_ALPHA) #define DRT_CPU_ALPHA 1 /* DEC Alpha */ #elif defined(_POWER) #define DRT_CPU_RS6000 1 /* IBM RS/6000 */ #elif defined(__370__) #define DRT_CPU_S370 1 /* IBM S/390 */ #elif defined(_SEQUENT_) #define DRT_CPU_SEQUENT 1 /* Sequent */ #elif defined(__sgi) #define DRT_CPU_SGI 1 /* SGI */ #else #error Cannot determine the CPU type from predefined macros #endif /* Determine the local operating system type */ #if defined(_WIN32) #define DRT_OS_WIN32 1 /* Microsoft Win32 */ #elif defined(__370__) && defined(__MVS__) #define DRT_OS_IBM_OS390_2 1 /* IBM OS/390 2.x */ #define DRT_OS_MVS 1 /* IBM MVS */ #define DRT_OS_UNIX 1 /* IBM OS/390 Unix */ #elif defined(__MVS__) #define DRT_OS_MVS 1 /* IBM MVS */ #define DRT_OS_UNIX 1 /* IBM OS/390 Unix */ #elif defined(hpux) || defined(_hpux) || defined(__hpux) #define DRT_OS_HPUX 1 /* HP HP-UX */ #elif defined(__sparc) && defined(__SVR4) #define DRT_OS_SUNOS 1 /* Sun SunOS */ #elif defined(_AIX) #define DRT_OS_AIX 1 /* IBM AIX */ #elif defined(__osf__) #define DRT_OS_OSF1 1 /* OSF/1 */ #define DRT_OS_DECUNIX_40 1 /* DEC OSF Unix 4.x */ #elif defined(_SEQUENT_) #define DRT_OS_DYNIX 1 /* Sequent Dynix */ #elif defined(__sgi) #define DRT_OS_IRIX 1 /* SGI IRIX */ #elif defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__) #define DRT_OS_UNIX 1 /* Generic Unix (POSIX) */ #else #error Cannot determine the operating system from predefined macros #endif /* Determine the local C/C++ compiler type */ #if __cplusplus #if defined(_MSC_VER) #define DRT_CXX_MSC 1 /* Microsloth C++ */ #elif defined(__hpux) #define DRT_CXX_HPUX 1 /* HP-UX */ #elif defined(__sgi) #define DRT_CXX_SGI 1 /* SGI */ #elif defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__) #define DRT_CXX_UNIX 1 /* Generic Unix (POSIX) */ /*#elif {your_platform_macro_goes_here}*/ /* #define DRT_CXX_{platform} 1 /* {description} */ #else #error Cannot determine the C++ compiler type from predefined macros #endif #else #if defined(_MSC_VER) #define DRT_C_MSC 1 /* Microsloth C++ */ #elif defined(__hpux) #define DRT_C_HPUX 1 /* HP-UX */ #elif defined(__sgi) #define DRT_C_SGI 1 /* SGI */ #elif defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__) #define DRT_C_UNIX 1 /* Generic Unix (POSIX) */ /*#elif {your_platform_macro_goes_here}*/ /* #define DRT_C_{platform} 1 /* {description} */ #else #error Cannot determine the C compiler type from predefined macros #endif #endif /*----------------------------------------------------------------------------- * System-specific porting includes *----------------------------------------------------------------------------*/ #ifdef __cplusplus /* C++ */ #if DRT_CXX_MSC #include "s_msc32.hpp" #elif DRT_CXX_HPUX #include "s_hpux.hpp" #elif DRT_CXX_UNIX #include "s_unix.hpp" #else #error No porting header for this C++ system #endif #else /* C */ #if DRT_C_MSC #include "k_msc32.h" #elif DRT_C_HPUX #include "k_hpux.h" #elif DRT_C_UNIX #include "k_unix.h" #else #error No porting header for this C system #endif #endif /*----------------------------------------------------------------------------- * Set macro defaults *----------------------------------------------------------------------------*/ #ifdef __cplusplus #ifndef DRT_HAS_AND #define DRT_HAS_AND 0 /* Has 'and' keyword */ #endif #ifndef DRT_HAS_ARRAY_CTOR #define DRT_HAS_ARRAY_CTOR 0 /* Allows member array init in ctor */ #endif #ifndef DRT_HAS_ARRAY_NEW #define DRT_HAS_ARRAY_NEW 0 /* Has 'new[]' operator */ #endif #ifndef DRT_HAS_BOOL #define DRT_HAS_BOOL 0 /* Has 'bool' type */ #endif #ifndef DRT_HAS_CAST #define DRT_HAS_CAST 0 /* Has 'static_cast' keyword */ #endif #ifndef DRT_HAS_EXPLICIT #define DRT_HAS_EXPLICIT 0 /* Has 'explicit' keyword */ #endif #ifndef DRT_HAS_EXPORT #define DRT_HAS_EXPORT 0 /* Has 'export' keyword */ #endif #ifndef DRT_HAS_LLONG #define DRT_HAS_LLONG 0 /* Has a 'long long' type */ #endif #ifndef DRT_HAS_MEMB_TEMPL #define DRT_HAS_MEMB_TEMPL 0 /* Has member template funcs */ #endif #ifndef DRT_HAS_MUTABLE #define DRT_HAS_MUTABLE 0 /* Has 'mutable' keyword */ #endif #ifndef DRT_HAS_NAMESPACE #define DRT_HAS_NAMESPACE 0 /* Has namespaces */ #endif #ifndef DRT_HAS_NEW #define DRT_HAS_NEW 0 /* Has standard header */ #endif #ifndef DRT_HAS_NOTHROW #define DRT_HAS_NOTHROW 0 /* Has 'new(nothrow)' */ #endif #ifndef DRT_HAS_STD #define DRT_HAS_STD 0 /* Has 'std::' namespace */ #endif #ifndef DRT_HAS_STL #define DRT_HAS_STL 0 /* Has standard template lib */ #endif #ifndef DRT_HAS_THROW #define DRT_HAS_THROW 0 /* Has exceptions */ #endif #ifndef DRT_HAS_TYPEID #define DRT_HAS_TYPEID 0 /* Has 'typeid' keyword */ #endif #ifndef DRT_HAS_TYPENAME #define DRT_HAS_TYPENAME 0 /* Has 'typename' keyword */ #endif #else #ifndef DRT_HAS_BOOL #define DRT_HAS_BOOL 0 /* Has 'bool' type */ #endif #ifndef DRT_HAS_LLONG #define DRT_HAS_LLONG 0 /* Has a 'long long' type */ #endif #endif #endif /* drt_sys_kport_h */ /* End kport.h */