Changeset 44 for trunk/src/framework/Platform/Define.h
- Timestamp:
- 11/19/08 13:27:40 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/framework/Platform/Define.h
r2 r44 1 1 /* 2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 3 * 4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> 3 5 * 4 6 * This program is free software; you can redistribute it and/or modify … … 9 11 * This program is distributed in the hope that it will be useful, 10 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 14 * GNU General Public License for more details. 13 15 * 14 16 * You should have received a copy of the GNU General Public License 15 17 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 19 */ 18 20 19 #ifndef MANGOS_DEFINE_H20 #define MANGOS_DEFINE_H21 #ifndef TRINITY_DEFINE_H 22 #define TRINITY_DEFINE_H 21 23 22 24 #include "Platform/CompilerDefs.h" … … 88 90 */ 89 91 90 #define MANGOS_LITTLEENDIAN 091 #define MANGOS_BIGENDIAN 192 93 #if !defined( MANGOS_ENDIAN)92 #define TRINITY_LITTLEENDIAN 0 93 #define TRINITY_BIGENDIAN 1 94 95 #if !defined(TRINITY_ENDIAN) 94 96 # if defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN) 95 97 # if defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) 96 98 # if defined(BYTE_ORDER) 97 99 # if (BYTE_ORDER == LITTLE_ENDIAN) 98 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN100 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 99 101 # elif (BYTE_ORDER == BIG_ENDIAN) 100 # define MANGOS_ENDIAN MANGOS_BIGENDIAN102 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 101 103 # endif 102 104 # endif 103 105 # elif defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) 104 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN106 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 105 107 # elif !defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) 106 # define MANGOS_ENDIAN MANGOS_BIGENDIAN108 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 107 109 # endif 108 110 # elif defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN) … … 110 112 # if defined(_BYTE_ORDER) 111 113 # if (_BYTE_ORDER == _LITTLE_ENDIAN) 112 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN114 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 113 115 # elif (_BYTE_ORDER == _BIG_ENDIAN) 114 # define MANGOS_ENDIAN MANGOS_BIGENDIAN116 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 115 117 # endif 116 118 # endif 117 119 # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) 118 # define MANGOS_ENDIAN MANGOS_LITTLE_ENDIAN120 # define TRINITY_ENDIAN TRINITY_LITTLE_ENDIAN 119 121 # elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) 120 # define MANGOS_ENDIAN MANGOS_BIGENDIAN122 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 121 123 # endif 122 124 # elif 0 /* **** EDIT HERE IF NECESSARY **** */ 123 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN125 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 124 126 # elif 0 /* **** EDIT HERE IF NECESSARY **** */ 125 # define MANGOS_ENDIAN MANGOS_BIGENDIAN127 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 126 128 # elif (('1234' >> 24) == '1') 127 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN129 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 128 130 # elif (('4321' >> 24) == '1') 129 # define MANGOS_ENDIAN MANGOS_BIGENDIAN130 # else 131 # define MANGOS_ENDIAN MANGOS_LITTLEENDIAN131 # define TRINITY_ENDIAN TRINITY_BIGENDIAN 132 # else 133 # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN 132 134 # endif 133 135 #endif … … 136 138 137 139 #if PLATFORM == PLATFORM_WINDOWS 138 #define MANGOS_EXPORT __declspec(dllexport)139 #define MANGOS_LIBRARY_HANDLE HMODULE140 #define MANGOS_LOAD_LIBRARY(a) LoadLibrary(a)141 #define MANGOS_CLOSE_LIBRARY FreeLibrary142 #define MANGOS_GET_PROC_ADDR GetProcAddress143 #define MANGOS_IMPORT __cdecl144 #define MANGOS_SCRIPT_EXT ".dll"145 #define MANGOS_SCRIPT_NAME "TrinityScript"146 #else 147 #define MANGOS_LIBRARY_HANDLE void*148 #define MANGOS_EXPORT export149 #define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)150 #define MANGOS_CLOSE_LIBRARY dlclose151 #define MANGOS_GET_PROC_ADDR dlsym140 #define TRINITY_EXPORT __declspec(dllexport) 141 #define TRINITY_LIBRARY_HANDLE HMODULE 142 #define TRINITY_LOAD_LIBRARY(a) LoadLibrary(a) 143 #define TRINITY_CLOSE_LIBRARY FreeLibrary 144 #define TRINITY_GET_PROC_ADDR GetProcAddress 145 #define TRINITY_IMPORT __cdecl 146 #define TRINITY_SCRIPT_EXT ".dll" 147 #define TRINITY_SCRIPT_NAME "TrinityScript" 148 #else 149 #define TRINITY_LIBRARY_HANDLE void* 150 #define TRINITY_EXPORT export 151 #define TRINITY_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW) 152 #define TRINITY_CLOSE_LIBRARY dlclose 153 #define TRINITY_GET_PROC_ADDR dlsym 152 154 153 155 #if defined(__APPLE_CC__) && defined(BIG_ENDIAN) 154 #define MANGOS_IMPORT __attribute__ ((longcall))155 #else 156 #define MANGOS_IMPORT __attribute__ ((cdecl))157 #endif 158 159 #define MANGOS_SCRIPT_EXT ".so"160 #define MANGOS_SCRIPT_NAME "libtrinityscript"156 #define TRINITY_IMPORT __attribute__ ((longcall)) 157 #else 158 #define TRINITY_IMPORT __attribute__ ((cdecl)) 159 #endif 160 161 #define TRINITY_SCRIPT_EXT ".so" 162 #define TRINITY_SCRIPT_NAME "libtrinityscript" 161 163 #endif 162 164 163 165 #ifdef WIN32 164 #ifdef MANGOS_WIN32_DLL_IMPORT165 166 #define MANGOS_DLL_DECL __declspec(dllimport)167 #else 168 #ifdef MANGOS_WIND_DLL_EXPORT169 #define MANGOS_DLL_DECL __declspec(dllexport)170 #else 171 #define MANGOS_DLL_DECL172 #endif 173 #endif 174 175 #else 176 #define MANGOS_DLL_DECL166 #ifdef TRINITY_WIN32_DLL_IMPORT 167 168 #define TRINITY_DLL_DECL __declspec(dllimport) 169 #else 170 #ifdef TRINITY_WIND_DLL_EXPORT 171 #define TRINITY_DLL_DECL __declspec(dllexport) 172 #else 173 #define TRINITY_DLL_DECL 174 #endif 175 #endif 176 177 #else 178 #define TRINITY_DLL_DECL 177 179 #endif 178 180 179 181 #ifndef DEBUG 180 #define MANGOS_INLINE inline181 #else 182 #ifndef MANGOS_DEBUG183 #define MANGOS_DEBUG184 #endif 185 #define MANGOS_INLINE182 #define TRINITY_INLINE inline 183 #else 184 #ifndef TRINITY_DEBUG 185 #define TRINITY_DEBUG 186 #endif 187 #define TRINITY_INLINE 186 188 #endif 187 189 … … 210 212 211 213 #if PLATFORM == PLATFORM_WINDOWS 212 # define MANGOS_DLL_SPEC __declspec(dllexport)214 # define TRINITY_DLL_SPEC __declspec(dllexport) 213 215 # ifndef DECLSPEC_NORETURN 214 216 # define DECLSPEC_NORETURN __declspec(noreturn) 215 217 # endif 216 218 #else 217 # define MANGOS_DLL_SPEC219 # define TRINITY_DLL_SPEC 218 220 # define DECLSPEC_NORETURN 219 221 #endif