/////////////////////////////////////////////////////////////////////////////// // Target.h // // // // Copyright (c) Jan Knepper, 1995-2002 All Rights Reserved. // // Written by Jan Knepper // // // // Redistribution and use in source and binary forms, with or without // // modification, are permitted provided that the following conditions // // are met: // // 1. Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // // notice, this list of conditions and the following disclaimer in the // // documentation and/or other materials provided with the distribution. // // 3. The name of the author may not be used to endorse or promote products // // derived from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND // // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE // // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // // THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////////// #ifndef TARGET_H #define TARGET_H /////////////////////////////////////////////////////////////////////////////// // Target.h // // // // This file contains definitions for generating target executables with // // different compilers. The usual order of the compilers is: // // __DMC__ - __Digital_Mars_CPP__ - Digital Mars C++ // // __SC__ - __Symantec_CPP__ - Symantec C++ // // __BORLANDC__ - __Borland_CPP__ - Borland C++ // // __ICL - __Intel_CPP__ - Intel C++ // // _MSC_VER - __Microsoft_CMM__ - Microsoft C-- // // __WATCOMC__ - __Watcom_CPP__ - Watcom C++ // // __IBMCPP__ - __ICM_CPP__ - IBM C++ // // __MWERKS__ - __MetroWerks_CPP__ - MetroWerks C++ // // __KCC - __KAI_CPP__ - KAI C++ // // __GNUC__ - __GNU_CPP__ - GNU C++ // // Do not change the order of these because __ICL has to be checked before // // _MSC_VER since __ICL is a replacement for _MSC_VER and defines _MSC_VER // // as well! // /////////////////////////////////////////////////////////////////////////////// #ifndef NOMINMAX // windef.h conflicts with STL! # if __BORLANDC__ >= 0x0540 # define NOMINMAX # else # define NOMINMAX 1 # endif #endif #if defined(__SC__) || defined(__DMC__) // Symantec C++ / Digital Mars C++ #define __Symantec_CPP__ __SC__ #ifdef __DMC__ #define __Digital_Mars_CPP_ __DMC__ #endif #ifdef __DMC__ #pragma message ( " Digital Mars C++" ); #else #pragma message ( " Symantec C++" ); #endif #if defined(_CPPRTTI) # if !defined(__TYPEINFO_H) # include # endif # define _typeinfo Type_info // JAK 19971209, not standardized already? #endif # if ( defined(_WIN32) || defined(__NT__) ) # pragma message ( " Win32" ); # define I_WIN_32 1 // Windows 32 bits. # define I_NNW 1 # if defined(_WINDLL) # define I_DLL 1 // Compiling a DLL. # endif //# define I_IMPORT __declspec(dllimport) # define I_IMPORT __declspec(dllexport) # define I_EXPORT __declspec(dllexport) # elif defined(_WINDOWS) # pragma message ( " Win16" ); # define I_WIN_16 1 // Windows 16 bits. # define I_NNW 1 # if defined(_WINDLL) # define I_DLL 1 // Compiling a DLL. # endif # define I_IMPORT __declspec(dllexport) # define I_EXPORT __declspec(dllexport) # elif defined(DOS386) # pragma message ( " DOS32" ); # define I_DOS_32 1 // DOS 32 bits. # define I_DOS_32_X 1 // DOSX for Symantec C++. # define I_NNW 1 # else # pragma message ( " DOS16" ); # define I_DOS_16 1 // DOS 16 bits. # endif # define I_STD // namespace std wrapping. #elif defined(__BORLANDC__) // Borland C++. #define __Borland_CPP__ __BORLANDC__ #if defined(__BCPLUSPLUS__) //# define __MINMAX_DEFINED // Prevent stdlib.h from defining min() and max () # include # define _typeinfo typeinfo // JAK 19971209, not standardized already? #endif # if ( defined(__WIN32__) || defined(__CONSOLE__) ) # define I_WIN_32 1 // Windows 32 bits. # define I_NNW 1 # if defined(__DLL__) # define I_DLL 1 // Compiling a DLL. # endif # define I_IMPORT __import # define I_EXPORT __export # elif defined(_Windows) # define I_WIN_16 1 // Windows 16 bits. # define I_NNW 1 # if defined(__DLL__) # define I_DLL 1 // Compiling a DLL. # endif # if __BORLANDC__ < 0x500 # define I_IMPORT huge // __import # define I_EXPORT __export # else # define I_IMPORT __import # define I_EXPORT __export # endif # elif defined(__DPMI32__) # define I_DOS_32 1 // DOS 32 bits. # define I_DOS_32_PP 1 # define I_NNW 1 # else # define I_DOS_16 1 // DOS 16 bits. # endif # if __BORLANDC__ < 0x500 // namespace std wrapping # define I_STD # else # define I_STD std :: # endif #elif defined(__ICL) // Intel C++ #define __Intel_CPP__ __ICL #define __JAK_NO_ORTVMF__ 1 // No Overloading Return Type Virtual Member Functions #define _JAK_DISABLE_INLINE #if defined(_CPPRTTI) # if !defined(_INC_TYPEINFO) # include # endif # define _typeinfo type_info // JAK 20000311, not standardized already? #endif # if defined(_WIN32) # define I_WIN_32 1 # endif # define I_NNW 1 # define I_IMPORT # define I_EXPORT # define I_STD std :: // namespace std wrapping. #elif defined(_MSC_VER) #define __Microsoft_CMM__ _MSC_VER #define __JAK_NO_ORTVMF__ 1 // No Overloading Return Type Virtual Member Functions #if defined(_CPPRTTI) # if !defined(_INC_TYPEINFO) # include # endif # define _typeinfo type_info // JAK 20000311, not standardized already? #endif # define I_WIN_32 1 # define I_NNW 1 # define I_IMPORT # define I_EXPORT # define I_STD std :: // namespace std wrapping. #elif defined(__WATCOMC__) // Watcom C++. #define __Watcom_CPP__ __WATCOMC__ # if __WATCOMC__ >= 1100 && defined(__cplusplus) //#ifdef __cplusplus # include # define _typeinfo type_info // JAK 19971209, not standardized already? # endif # if defined(N_PLAT_NLM) // JAK 19980812, provision for NLM compile. # define I_NET_32 1 // -bt=netware should not be used because # define I_TARGET 1 // it causes server abends! # endif # if !defined(I_TARGET) # if defined(__NT__) # define I_WIN_32 1 // Windows 32 bits. # define I_NNW 1 # if defined(__SW__BD) # define I_DLL 1 // Compiling a DLL. # endif # define I_IMPORT // __declspec(dllexport) # define I_EXPORT // __declspec(dllexport) # elif defined(__WINDOWS__) # define I_WIN_16 1 // Windows 16 bits. # define I_NNW 1 # if defined(__SW__BD) # define I_DLL 1 // Compiling a DLL. # endif # define I_IMPORT // __declspec(dllexport) # define I_EXPORT // __declspec(dllexport) # elif defined(__OS2__) # define I_OS2_32 1 // OS/2 32 bits. # elif defined(__NETWARE_386__) # define I_NET_32 1 // NetWare 386. # error "__NETWARE_386__ defined probably because of -bt=netware, causes ABEND!" # elif defined(__DOS4G__) # define I_DOS_32 1 // DOS 32 bits. # define I_DOS_32_4G 1 // DOS4G for Watcom C++. # define I_NNW 1 # else # define I_DOS_16 1 // DOS 16 bits. # endif # endif #elif defined(__IBMCPP__) // IBM VisualAge C++ #define __IBM_CPP__ __IBMCPP__ # if defined(HOS_OS2) # define I_OS2_32 1 # endif #elif defined(__MWERKS__) #define __MetroWerks_CPP__ __MWERKS__ #elif defined(__KCC) #define __KAI_CPP__ __KCC #if defined(_CPPRTTI) # if !defined(_INC_TYPEINFO) # include # endif # define _typeinfo type_info // JAK 20000311, not standardized already? #endif # define I_WIN_32 1 # define I_NNW 1 # define I_IMPORT # define I_EXPORT # define I_STD std :: // namespace std wrapping. #elif __GNUC__ #define __GNU_CPP__ __GNUC__ #if defined(_CPPRTTI) //# if !defined(_INC_TYPEINFO) # if !defined(__TYPEINFO__) # include # endif # define _typeinfo type_info // JAK 20000311, not standardized already? #endif #if defined(__unix__) # define I_UNIX_32 1 # define I_NNW 1 # define I_IMPORT # define I_EXPORT # define I_STD std :: // namespace std wrapping. #else # error "Undefined target platform for GNU C++!" #endif #else # error "Compiler not defined in 'Target.h'" #endif //#define I_USERDLL(x) (x)?I_EXPORT:I_IMPORT /////////////////////////////////////////////////////////////////////////////// // Use inline if _AFX_ENABLE_INLINES (MFC) is defined or DEBUG and _DEBUG // // undefined, which means non-debug compile. // /////////////////////////////////////////////////////////////////////////////// #ifndef _JAK_DISABLE_INLINE # ifndef _JAK_ENABLE_INLINE # if defined(_AFX_ENABLE_INLINES) # pragma message ( " inline enabled" ) # define _JAK_ENABLE_INLINE # elif !defined(DEBUG) && !defined(_DEBUG) # pragma message ( " inline enabled" ) # define _JAK_ENABLE_INLINE # endif # endif #endif /////////////////////////////////////////////////////////////////////////////// // Define a couple of macro's that indicate the platform base, i.e. 16 or 32 // // bits. This is use full for several features as int64 defined in Typedef.h // // that require a 32 bits target platform. // /////////////////////////////////////////////////////////////////////////////// #if ( defined(I_WIN_32) || defined(I_DOS_32) || defined(I_OS2_32) || defined(I_NET_32) || defined(I_UNIX_32) ) # define I_PLAT_32 1 #elif ( defined(I_WIN_16) || defined(I_DOS_16) ) # define I_PLAT_16 1 #else # error "No 32 or 16 bits platform?" #endif /////////////////////////////////////////////////////////////////////////////// // Macro I_UNICODE defines if "Unicode" is available, not if it is used to // // generate a Unicode compliant target as UNICODE and _UNICODE do. // /////////////////////////////////////////////////////////////////////////////// #if defined(I_WIN_32) # define I_UNICODE 1 #endif #endif // TARGET_H