[4361] Applied MaNGOS coding style to src/framework.
[mangos-git.git] / src / framework / Platform / Define.h
blob1c2f127cd2a49d6023cd60577b75e197d1f0dc49
1 /*
2 * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOS_DEFINE_H
20 #define MANGOS_DEFINE_H
22 #include "Platform/CompilerDefs.h"
23 #include <sys/types.h>
25 #ifdef WIN32
26 #define MANGOS_EXPORT __declspec(dllexport)
27 #define MANGOS_LIBRARY_HANDLE HMODULE
28 #define MANGOS_LOAD_LIBRARY(a) LoadLibrary(a)
29 #define MANGOS_CLOSE_LIBRARY FreeLibrary
30 #define MANGOS_GET_PROC_ADDR GetProcAddress
31 #define MANGOS_IMPORT __cdecl
32 #define MANGOS_SCRIPT_EXT ".dll"
33 #define MANGOS_SCRIPT_NAME "MaNGOSScript"
34 #define SIGQUIT 3
35 #else
36 #define MANGOS_LIBRARY_HANDLE void*
37 #define MANGOS_EXPORT export
38 #define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)
39 #define MANGOS_CLOSE_LIBRARY dlclose
40 #define MANGOS_GET_PROC_ADDR dlsym
42 #if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
43 #define MANGOS_IMPORT __attribute__ ((longcall))
44 #else
45 #define MANGOS_IMPORT __attribute__ ((cdecl))
46 #endif
48 #define MANGOS_SCRIPT_EXT ".so"
49 #define MANGOS_SCRIPT_NAME "libmangosscript"
50 #endif
52 #ifdef WIN32
53 #ifdef MANGOS_WIN32_DLL_IMPORT
55 #define MANGOS_DLL_DECL __declspec(dllimport)
56 #else
57 #ifdef MANGOS_WIND_DLL_EXPORT
58 #define MANGOS_DLL_DECL __declspec(dllexport)
59 #else
60 #define MANGOS_DLL_DECL
61 #endif
62 #endif
64 #else
65 #define MANGOS_DLL_DECL
66 #endif
68 #ifndef DEBUG
69 #define MANGOS_INLINE inline
70 #else
71 #ifndef MANGOS_DEBUG
72 #define MANGOS_DEBUG
73 #endif
74 #define MANGOS_INLINE
75 #endif
77 #if COMPILER == COMPILER_MICROSOFT
78 typedef __int64 int64;
79 typedef long int32;
80 typedef short int16;
81 typedef char int8;
82 typedef unsigned __int64 uint64;
83 typedef unsigned long uint32;
84 typedef unsigned short uint16;
85 typedef unsigned char uint8;
86 #else
87 //typedef long long int64;
88 typedef __int64_t int64;
89 typedef __int32_t int32;
90 typedef __int16_t int16;
91 typedef __int8_t int8;
92 typedef __uint64_t uint64;
93 typedef __uint32_t uint32;
94 typedef __uint16_t uint16;
95 typedef __uint8_t uint8;
96 typedef uint16 WORD;
97 typedef uint32 DWORD;
98 #endif
99 typedef uint64 OBJECT_HANDLE;
101 #if PLATFORM == PLATFORM_WIN32
102 # ifndef DECLSPEC_NORETURN
103 # define DECLSPEC_NORETURN __declspec(noreturn)
104 # endif
105 #else
106 # define DECLSPEC_NORETURN
107 #endif
109 #if COMPILER == COMPILER_GNU
110 # define ATTR_NORETURN __attribute__((noreturn))
111 # define ATTR_PRINTF(F,V) __attribute__ ((format (printf, F, V)))
112 #else
113 # define ATTR_NORETURN
114 # define ATTR_PRINTF(F,V)
115 #endif
116 #endif