TrinityCore
Loading...
Searching...
No Matches
Define.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_DEFINE_H
19#define TRINITY_DEFINE_H
20
21#include "CompilerDefs.h"
22
23#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
24# if !defined(__STDC_FORMAT_MACROS)
25# define __STDC_FORMAT_MACROS
26# endif
27# if !defined(__STDC_CONSTANT_MACROS)
28# define __STDC_CONSTANT_MACROS
29# endif
30# if !defined(_GLIBCXX_USE_NANOSLEEP)
31# define _GLIBCXX_USE_NANOSLEEP
32# endif
33# if defined(HELGRIND)
34# include <valgrind/helgrind.h>
35# undef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
36# undef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
37# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) ANNOTATE_HAPPENS_BEFORE(A)
38# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) ANNOTATE_HAPPENS_AFTER(A)
39# endif
40#endif
41
42#include <cstddef>
43#include <cinttypes>
44#include <climits>
45
46#define TRINITY_LITTLEENDIAN 0
47#define TRINITY_BIGENDIAN 1
48
49#if !defined(TRINITY_ENDIAN)
50# if defined (BOOST_BIG_ENDIAN)
51# define TRINITY_ENDIAN TRINITY_BIGENDIAN
52# else
53# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN
54# endif
55#endif
56
57#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
58# define TRINITY_PATH_MAX 260
59#else // TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
60# define TRINITY_PATH_MAX PATH_MAX
61#endif // TRINITY_PLATFORM
62
63#if !defined(COREDEBUG)
64# define TRINITY_INLINE inline
65#else //COREDEBUG
66# if !defined(TRINITY_DEBUG)
67# define TRINITY_DEBUG
68# endif //TRINITY_DEBUG
69# define TRINITY_INLINE
70#endif
71
72#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
73# define ATTR_PRINTF(F, V) __attribute__ ((__format__ (__printf__, F, V)))
74#else //TRINITY_COMPILER != TRINITY_COMPILER_GNU
75# define ATTR_PRINTF(F, V)
76#endif //TRINITY_COMPILER == TRINITY_COMPILER_GNU
77
78#ifdef TRINITY_API_USE_DYNAMIC_LINKING
79# if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT
80# define TC_API_EXPORT __declspec(dllexport)
81# define TC_API_IMPORT __declspec(dllimport)
82# elif TRINITY_COMPILER == TRINITY_COMPILER_GNU
83# define TC_API_EXPORT __attribute__((visibility("default")))
84# define TC_API_IMPORT
85# else
86# error compiler not supported!
87# endif
88#else
89# define TC_API_EXPORT
90# define TC_API_IMPORT
91#endif
92
93#ifdef TRINITY_API_EXPORT_COMMON
94# define TC_COMMON_API TC_API_EXPORT
95#else
96# define TC_COMMON_API TC_API_IMPORT
97#endif
98
99#ifdef TRINITY_API_EXPORT_DATABASE
100# define TC_DATABASE_API TC_API_EXPORT
101#else
102# define TC_DATABASE_API TC_API_IMPORT
103#endif
104
105#ifdef TRINITY_API_EXPORT_SHARED
106# define TC_SHARED_API TC_API_EXPORT
107#else
108# define TC_SHARED_API TC_API_IMPORT
109#endif
110
111#ifdef TRINITY_API_EXPORT_GAME
112# define TC_GAME_API TC_API_EXPORT
113#else
114# define TC_GAME_API TC_API_IMPORT
115#endif
116
117#define UI64FMTD "%" PRIu64
118#define UI64LIT(N) UINT64_C(N)
119
120#define SI64FMTD "%" PRId64
121#define SI64LIT(N) INT64_C(N)
122
123#define SZFMTD "%" PRIuPTR
124
125#define STRING_VIEW_FMT "%.*s"
126#define STRING_VIEW_FMT_ARG(str) static_cast<int>((str).length()), (str).data()
127
128typedef int64_t int64;
129typedef int32_t int32;
130typedef int16_t int16;
131typedef int8_t int8;
132typedef uint64_t uint64;
133typedef uint32_t uint32;
134typedef uint16_t uint16;
135typedef uint8_t uint8;
136
137#endif //TRINITY_DEFINE_H
uint8_t uint8
Definition Define.h:135
int64_t int64
Definition Define.h:128
int16_t int16
Definition Define.h:130
int8_t int8
Definition Define.h:131
int32_t int32
Definition Define.h:129
uint64_t uint64
Definition Define.h:132
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133