lugre_platform.h

Go to the documentation of this file.
00001 /*
00002 http://www.opensource.org/licenses/mit-license.php  (MIT-License)
00003 
00004 Copyright (c) 2007 Lugre-Team
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining a copy
00007 of this software and associated documentation files (the "Software"), to deal
00008 in the Software without restriction, including without limitation the rights
00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010 copies of the Software, and to permit persons to whom the Software is
00011 furnished to do so, subject to the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00021 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00022 THE SOFTWARE.
00023 */
00024 
00025 #ifndef LUGRE_PLATFORM_H
00026 #define LUGRE_PLATFORM_H
00027 
00028 /* Initial platform/compiler-related stuff to set.
00029 */
00030 #define LUGRE_PLATFORM_WIN32 1
00031 #define LUGRE_PLATFORM_LINUX 2
00032 #define LUGRE_PLATFORM_APPLE 3
00033 
00034 #define LUGRE_COMPILER_MSVC 1
00035 #define LUGRE_COMPILER_GNUC 2
00036 #define LUGRE_COMPILER_BORL 3
00037 
00038 #define LUGRE_ENDIAN_LITTLE 1
00039 #define LUGRE_ENDIAN_BIG 2
00040 
00041 #define LUGRE_ARCHITECTURE_32 1
00042 #define LUGRE_ARCHITECTURE_64 2
00043 
00044 
00045 /* Finds the compiler type and version. */
00046 #if defined( _MSC_VER )
00047 #   define LUGRE_COMPILER LUGRE_COMPILER_MSVC
00048 #   define LUGRE_COMP_VER _MSC_VER
00049 
00050 #elif defined( __GNUC__ )
00051 #   define LUGRE_COMPILER LUGRE_COMPILER_GNUC
00052 #   define LUGRE_COMP_VER (((__GNUC__)*100) + \
00053         (__GNUC_MINOR__*10) + \
00054         __GNUC_PATCHLEVEL__)
00055 
00056 #elif defined( __BORLANDC__ )
00057 #   define LUGRE_COMPILER LUGRE_COMPILER_BORL
00058 #   define LUGRE_COMP_VER __BCPLUSPLUS__
00059 #   define __FUNCTION__ __FUNC__ 
00060 #else
00061 #   pragma error "No known compiler. Abort! Abort!"
00062 
00063 #endif
00064 
00065 
00066 /* Finds the current platform */
00067 #if defined( __WIN32__ ) || defined( _WIN32 )
00068 #   define LUGRE_PLATFORM LUGRE_PLATFORM_WIN32
00069 
00070 #elif defined( __APPLE_CC__)
00071 #   define LUGRE_PLATFORM LUGRE_PLATFORM_APPLE
00072 
00073 #else
00074 #   define LUGRE_PLATFORM LUGRE_PLATFORM_LINUX
00075 #endif
00076 
00077 
00078 /* Find the arch type */
00079 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
00080 #   define LUGRE_ARCH_TYPE LUGRE_ARCHITECTURE_64
00081 #else
00082 #   define LUGRE_ARCH_TYPE LUGRE_ARCHITECTURE_32
00083 #endif
00084 
00085 
00086 //----------------------------------------------------------------------------
00087 // Endian Settings
00088 // check for BIG_ENDIAN config flag, set LUGRE_ENDIAN correctly
00089 #ifdef LUGRE_CONFIG_BIG_ENDIAN
00090 #    define LUGRE_ENDIAN LUGRE_ENDIAN_BIG
00091 #else
00092 #    define LUGRE_ENDIAN LUGRE_ENDIAN_LITTLE
00093 #endif
00094 
00095 namespace Lugre {
00096 
00097 // Integer formats of fixed bit width
00098 typedef unsigned int uint32;
00099 typedef unsigned short uint16;
00100 typedef unsigned char uint8;
00101 // define uint64 type
00102 #if LUGRE_COMPILER == LUGRE_COMPILER_MSVC
00103     typedef unsigned __int64 uint64;
00104 #else
00105     typedef unsigned long long uint64;
00106 #endif
00107 
00108 // signed versions
00109 typedef int int32;
00110 typedef short int16;
00111 typedef char int8;
00112 #if LUGRE_COMPILER == LUGRE_COMPILER_MSVC
00113     typedef __int64 int64;
00114 #else
00115     typedef long long int64;
00116 #endif
00117 
00118 }
00119 
00120 //----------------------------------------------------------------------------
00121 //----------------------------------------------------------------------------
00122 //----------------------------------------------------------------------------
00123 //----------------------------------------------------------------------------
00124 
00125 #if LUGRE_PLATFORM == LUGRE_PLATFORM_APPLE
00126     #include <Carbon/Carbon.h>
00127 #endif
00128 
00129 /*
00130 #if LUGRE_PLATFORM == LUGRE_PLATFORM_WIN32
00131     #include <stdint.h>
00132 #endif
00133 */
00134 // ??? strange platform voodo
00135 #ifdef WIN32
00136 #ifndef snprintf
00137 #ifndef MINGW
00138     int snprintf (char *str, int n, char *fmt, ...);
00139     #define DEFINE_SNPRINTF
00140 #endif
00141 #endif
00142 
00143 
00144 #endif
00145 
00146 
00147 #endif

Generated on Wed May 23 06:00:13 2012 for cpp by  doxygen 1.5.6