20 #ifndef INC_PLATFORMABSTRACTION
21 #define INC_PLATFORMABSTRACTION
29 #if defined(USE_WIN32_WINDOWS)
36 # define WINVER 0x0501
37 # define _WIN32_WINDOWS 0x0501
38 # define _WIN32_WINNT 0x0501
39 # define _WIN32_IE 0x0501
42 # define WINVER 0x0500
43 # define _WIN32_WINDOWS 0x0500
44 # define _WIN32_WINNT 0x0501
45 # define _WIN32_IE 0x0501
49 #define WIN32_LEAN_AND_MEAN
58 #define DEPRECATED __declspec(deprecated)
59 #elif defined(__GNUC__)
60 #define DEPRECATED __attribute__((deprecated))
66 #pragma warning(disable : 4786)
67 #pragma warning(disable: 4706)
68 #pragma warning(disable: 4239)
69 #pragma warning(disable: 4521)
71 # define _USE_MATH_DEFINES
73 #define _WINSOCK_DEPRECATED_NO_WARNINGS
89 #define GNUC_FORMAT_ATTRIBUTE __attribute__ ((format (printf, 1, 2)))
90 #define GNUC_FORMAT_ATTRIBUTE_O __attribute__ ((format (printf, 2, 3)))
91 #define ALWAYS_INLINE inline __attribute__ ((always_inline))
92 #define NORETURN __attribute__ ((noreturn))
93 #elif defined(_MSC_VER)
94 #define GNUC_FORMAT_ATTRIBUTE
95 #define GNUC_FORMAT_ATTRIBUTE_O
96 #define ALWAYS_INLINE __forceinline
97 #define NORETURN __declspec(noreturn)
99 #define GNUC_FORMAT_ATTRIBUTE
100 #define GNUC_FORMAT_ATTRIBUTE_O
101 #define ALWAYS_INLINE inline
107 #if defined(_DEBUG) && defined(_MSC_VER)
109 # define BREAKPOINT_HERE __debugbreak()
110 #elif defined(_DEBUG) && defined(__GNUC__)
111 # define BREAKPOINT_HERE asm volatile("int $3")
112 #elif defined(_DEBUG) && defined(HAVE_SIGNAL_H)
114 # if defined(SIGTRAP)
115 # define BREAKPOINT_HERE raise(SIGTRAP);
117 # define BREAKPOINT_HERE ((void)0)
120 # define BREAKPOINT_HERE ((void)0)
127 typedef unsigned long DWORD;
128 typedef unsigned char BYTE;
129 typedef unsigned short WORD;
139 inline int stricmp(
const char *s1,
const char *s2)
141 return strcasecmp(s1, s2);
149 #define C4_OS "win-x86_64"
150 #elif defined(_WIN32)
151 #define C4_OS "win-x86"
152 #elif defined(__linux__)
153 #if defined(__x86_64__)
154 #define C4_OS "linux-x86_64"
156 #define C4_OS "linux-x86"
158 #elif defined(__APPLE__)
159 #define C4_OS "mac-x86"
171 bool OpenURL(
const char* szURL);
183 #define _MAX_PATH PATH_MAX
184 #define _MAX_FNAME NAME_MAX
186 bool CopyFile(
const char *szSource,
const char *szTarget,
bool FailIfExists);
188 #define _MAX_PATH_LEN _MAX_PATH + 1
189 #define _MAX_FNAME_LEN _MAX_FNAME + 1
198 #define DirectorySeparator '\\'
199 #define AltDirectorySeparator '/'
202 #define DirectorySeparator '/'
203 #define AltDirectorySeparator '\\'