root/trunk/src/framework/Platform/Define.h

Revision 188, 3.8 kB (checked in by yumileroy, 17 years ago)

[svn] Merge define.h from mangos. Hope this will solve the lag problem.

Original author: megamage
Date: 2008-11-07 13:46:47-06:00

Line 
1/*
2 * Copyright (C) 2005-2008 Mangos <http://www.mangosproject.org/>
3 *
4 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21#ifndef TRINITY_DEFINE_H
22#define TRINITY_DEFINE_H
23
24#include <sys/types.h>
25
26#include <ace/Basic_Types.h>
27#include <ace/ACE_export.h>
28
29#include "Platform/CompilerDefs.h"
30
31#define TRINITY_LITTLEENDIAN 0
32#define TRINITY_BIGENDIAN    1
33
34#if !defined(TRINITY_ENDIAN)
35#  if defined (ACE_BIG_ENDIAN)
36#    define TRINITY_ENDIAN TRINITY_BIGENDIAN
37#  else //ACE_BYTE_ORDER != ACE_BIG_ENDIAN
38#    define TRINITY_ENDIAN TRINITY_LITTLEENDIAN
39#  endif //ACE_BYTE_ORDER
40#endif //TRINITY_ENDIAN
41
42#if PLATFORM == PLATFORM_WINDOWS
43#  define TRINITY_EXPORT __declspec(dllexport)
44#  define TRINITY_LIBRARY_HANDLE HMODULE
45#  define TRINITY_LOAD_LIBRARY(a) LoadLibrary(a)
46#  define TRINITY_CLOSE_LIBRARY FreeLibrary
47#  define TRINITY_GET_PROC_ADDR GetProcAddress
48#  define TRINITY_IMPORT __cdecl
49#  define TRINITY_SCRIPT_EXT ".dll"
50#  define TRINITY_SCRIPT_NAME "TrinityScript"
51#else //PLATFORM != PLATFORM_WINDOWS
52#  define TRINITY_LIBRARY_HANDLE void*
53#  define TRINITY_EXPORT export
54#  define TRINITY_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)
55#  define TRINITY_CLOSE_LIBRARY dlclose
56#  define TRINITY_GET_PROC_ADDR dlsym
57#  if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
58#    define TRINITY_IMPORT __attribute__ ((longcall))
59#  else
60#    define TRINITY_IMPORT __attribute__ ((cdecl))
61#  endif //__APPLE_CC__ && BIG_ENDIAN
62#  define TRINITY_SCRIPT_EXT ".so"
63#  define TRINITY_SCRIPT_NAME "libtrinityscript"
64#endif //PLATFORM
65
66#if PLATFORM == PLATFORM_WINDOWS
67#  ifdef TRINITY_WIN32_DLL_IMPORT
68#    define TRINITY_DLL_DECL __declspec(dllimport)
69#  else //!TRINITY_WIN32_DLL_IMPORT
70#    ifdef TRINITY_WIND_DLL_EXPORT
71#      define TRINITY_DLL_DECL __declspec(dllexport)
72#    else //!TRINITY_WIND_DLL_EXPORT
73#      define TRINITY_DLL_DECL
74#    endif //TRINITY_WIND_DLL_EXPORT
75#  endif //TRINITY_WIN32_DLL_IMPORT
76#else //PLATFORM != PLATFORM_WINDOWS
77#  define TRINITY_DLL_DECL
78#endif //PLATFORM
79
80#if PLATFORM == PLATFORM_WINDOWS
81#  define TRINITY_DLL_SPEC __declspec(dllexport)
82#  ifndef DECLSPEC_NORETURN
83#    define DECLSPEC_NORETURN __declspec(noreturn)
84#  endif //DECLSPEC_NORETURN
85#else //PLATFORM != PLATFORM_WINDOWS
86#  define TRINITY_DLL_SPEC
87#  define DECLSPEC_NORETURN
88#endif //PLATFORM
89
90#if !defined(DEBUG)
91#  define TRINITY_INLINE inline
92#else //DEBUG
93#  if !defined(TRINITY_DEBUG)
94#    define TRINITY_DEBUG
95#  endif //TRINITY_DEBUG
96#  define TRINITY_INLINE
97#endif //!DEBUG
98
99#if COMPILER == COMPILER_GNU
100#  define ATTR_NORETURN __attribute__((noreturn))
101#  define ATTR_PRINTF(F,V) __attribute__ ((format (printf, F, V)))
102#else //COMPILER != COMPILER_GNU
103#  define ATTR_NORETURN
104#  define ATTR_PRINTF(F,V)
105#endif //COMPILER == COMPILER_GNU
106
107typedef ACE_INT64 int64;
108typedef ACE_INT32 int32;
109typedef ACE_INT16 int16;
110typedef ACE_INT8 int8;
111typedef ACE_UINT64 uint64;
112typedef ACE_UINT32 uint32;
113typedef ACE_UINT16 uint16;
114typedef ACE_UINT8 uint8;
115
116#if COMPILER != COMPILER_MICROSOFT
117typedef uint16      WORD;
118typedef uint32      DWORD;
119#endif //COMPILER
120
121typedef uint64 OBJECT_HANDLE;
122
123#endif //TRINITY_DEFINE_H
Note: See TracBrowser for help on using the browser.