ZenLib
ZenLib
Conf.h
Go to the documentation of this file.
1
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2
*
3
* Use of this source code is governed by a zlib-style license that can
4
* be found in the License.txt file in the root of the source tree.
5
*/
6
7
//---------------------------------------------------------------------------
8
#ifndef ZenConfH
9
#define ZenConfH
10
//---------------------------------------------------------------------------
11
12
//***************************************************************************
13
// Platforms
14
//***************************************************************************
15
16
//---------------------------------------------------------------------------
17
//Win32
18
#if defined(__NT__) || defined(_WIN32) || defined(WIN32)
19
#ifndef WIN32
20
#define WIN32
21
#endif
22
#ifndef _WIN32
23
#define _WIN32
24
#endif
25
#ifndef __WIN32__
26
#define __WIN32__ 1
27
#endif
28
#endif
29
30
//---------------------------------------------------------------------------
31
//Win64
32
#if defined(_WIN64) || defined(WIN64)
33
#ifndef WIN64
34
#define WIN64
35
#endif
36
#ifndef _WIN64
37
#define _WIN64
38
#endif
39
#ifndef __WIN64__
40
#define __WIN64__ 1
41
#endif
42
#endif
43
44
//---------------------------------------------------------------------------
45
//Windows
46
#if defined(WIN32) || defined(WIN64)
47
#ifndef WINDOWS
48
#define WINDOWS
49
#endif
50
#ifndef _WINDOWS
51
#define _WINDOWS
52
#endif
53
#ifndef __WINDOWS__
54
#define __WINDOWS__ 1
55
#endif
56
#endif
57
58
//---------------------------------------------------------------------------
59
//Windows UWP
60
#if defined(WIN32) || defined(WIN64)
61
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP)
62
#ifndef WINDOWS_UWP
63
#define WINDOWS_UWP
64
#endif
65
#endif
66
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_GAMES)
67
#ifndef WINDOWS_GAMES
68
#define WINDOWS_GAMES
69
#endif
70
#endif
71
#endif
72
73
//---------------------------------------------------------------------------
74
//Unix (Linux, HP, Sun, BeOS...)
75
#if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \
76
|| defined(__unix) || defined(__unix__) \
77
|| defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \
78
|| defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \
79
|| defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
80
#ifndef UNIX
81
#define UNIX
82
#endif
83
#ifndef _UNIX
84
#define _UNIX
85
#endif
86
#ifndef __UNIX__
87
#define __UNIX__ 1
88
#endif
89
#endif
90
91
//---------------------------------------------------------------------------
92
//Linux
93
#if defined(__LINUX__) || defined(__linux__)
94
#ifndef LINUX
95
#define LINUX
96
#endif
97
#ifndef _LINUX
98
#define _LINUX
99
#endif
100
#ifndef __LINUX__
101
#define __LINUX__ 1
102
#endif
103
#endif
104
105
//---------------------------------------------------------------------------
106
//MacOS Classic
107
#if defined(macintosh)
108
#ifndef MACOS
109
#define MACOS
110
#endif
111
#ifndef _MACOS
112
#define _MACOS
113
#endif
114
#ifndef __MACOS__
115
#define __MACOS__ 1
116
#endif
117
#endif
118
119
//---------------------------------------------------------------------------
120
//MacOS X
121
#if defined(__APPLE__) && defined(__MACH__)
122
#ifndef MACOSX
123
#define MACOSX
124
#endif
125
#ifndef _MACOSX
126
#define _MACOSX
127
#endif
128
#ifndef __MACOSX__
129
#define __MACOSX__ 1
130
#endif
131
#endif
132
133
//Test of targets
134
#if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX)
135
#pragma message Multiple platforms???
136
#endif
137
138
#if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX)
139
#pragma message No known platforms, assume default
140
#endif
141
142
//***************************************************************************
143
// Internationnal
144
//***************************************************************************
145
146
//---------------------------------------------------------------------------
147
//Unicode
148
#if defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__)
149
#ifndef _UNICODE
150
#define _UNICODE
151
#endif
152
#ifndef UNICODE
153
#define UNICODE
154
#endif
155
#ifndef __UNICODE__
156
#define __UNICODE__ 1
157
#endif
158
#endif
159
160
//---------------------------------------------------------------------------
161
//wchar_t stuff
162
#if defined(MACOS) || defined(MACOSX)
163
#include <wchar.h>
164
#endif
165
166
//***************************************************************************
167
// Compiler bugs/unuseful warning
168
//***************************************************************************
169
170
//MSVC6 : for(int t=0; t<10; ++t) { do something }; for(int t=0; t<10; ++t) { do something }
171
#if defined(_MSC_VER) && _MSC_VER <= 1200
172
#define for if(true)for
173
#pragma warning(disable:4786) // MSVC6 doesn't like typenames longer than 255 chars (which generates an enormous amount of warnings).
174
#endif
175
176
//MSVC2005 : "deprecated" warning (replacement functions are not in MinGW32 or Borland!)
177
#if defined(_MSC_VER) && _MSC_VER >= 1400
178
#pragma warning(disable : 4996)
179
#endif
180
181
//***************************************************************************
182
// (Without Namespace)
183
//***************************************************************************
184
185
//---------------------------------------------------------------------------
186
#include <limits.h>
187
188
//---------------------------------------------------------------------------
189
#if defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
190
#include "
ZenLib/MemoryDebug.h
"
191
#endif // defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
192
193
//***************************************************************************
194
// Compiler helpers
195
//***************************************************************************
196
197
//---------------------------------------------------------------------------
198
//Macro to cut down on compiler warnings
199
#ifndef UNUSED
200
#define UNUSED(Identifier)
201
#endif
202
//---------------------------------------------------------------------------
203
//If we need size_t specific integer conversion
204
#if !defined(SIZE_T_IS_LONG) && (defined(__LP64__) || defined(MACOSX))
205
#define SIZE_T_IS_LONG
206
#endif
207
208
//---------------------------------------------------------------------------
209
//(-1) is known to be the MAX of an unsigned int but GCC complains about it
210
#ifdef __cplusplus
211
#include <cstddef>
//for size_t
212
#else
/* __cplusplus */
213
#include <stddef.h>
//for size_t
214
#endif
/* __cplusplus */
215
#include <cstring>
//size_t
216
namespace
ZenLib
217
{
218
const
std::size_t
Error
=((std::size_t)(-1));
219
const
std::size_t
All
=((std::size_t)(-1));
220
const
std::size_t
Unlimited
=((std::size_t)(-1));
221
}
222
223
//***************************************************************************
224
// (With namespace)
225
//***************************************************************************
226
227
namespace
ZenLib
228
{
229
230
//***************************************************************************
231
// International
232
//***************************************************************************
233
234
//---------------------------------------------------------------------------
235
//Char types
236
#if defined(__UNICODE__)
237
#if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
238
#pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
239
#endif
240
typedef
wchar_t
Char
;
241
#undef __T
242
#define __T(__x) L ## __x
243
#else // defined(__UNICODE__)
244
typedef
char
Char
;
245
#undef __T
246
#define __T(__x) __x
247
#endif // defined(__UNICODE__)
248
#ifdef wchar_t
249
typedef
wchar_t
wchar;
250
#endif // wchar_t
251
252
//***************************************************************************
253
// Platform differences
254
//***************************************************************************
255
256
//End of line
257
extern
const
Char
*
EOL
;
258
extern
const
Char
PathSeparator
;
259
260
//***************************************************************************
261
// Types
262
//***************************************************************************
263
264
//---------------------------------------------------------------------------
265
//int
266
typedef
signed
int
ints
;
267
typedef
unsigned
int
intu
;
268
269
//---------------------------------------------------------------------------
270
//8-bit int
271
#if UCHAR_MAX==0xff
272
#undef MAXTYPE_INT
273
#define MAXTYPE_INT 8
274
typedef
signed
char
int8s;
275
typedef
unsigned
char
int8u;
276
#else
277
#pragma message This machine has no 8-bit integertype?
278
#endif
279
280
//---------------------------------------------------------------------------
281
//16-bit int
282
#if UINT_MAX == 0xffff
283
#undef MAXTYPE_INT
284
#define MAXTYPE_INT 16
285
typedef
signed
int
int16s;
286
typedef
unsigned
int
int16u;
287
#elif USHRT_MAX == 0xffff
288
#undef MAXTYPE_INT
289
#define MAXTYPE_INT 16
290
typedef
signed
short
int16s;
291
typedef
unsigned
short
int16u;
292
#else
293
#pragma message This machine has no 16-bit integertype?
294
#endif
295
296
//---------------------------------------------------------------------------
297
//32-bit int
298
#if UINT_MAX == 0xfffffffful
299
#undef MAXTYPE_INT
300
#define MAXTYPE_INT 32
301
typedef
signed
int
int32s;
302
typedef
unsigned
int
int32u;
303
#elif ULONG_MAX == 0xfffffffful
304
#undef MAXTYPE_INT
305
#define MAXTYPE_INT 32
306
typedef
signed
long
int32s;
307
typedef
unsigned
long
int32u;
308
#elif USHRT_MAX == 0xfffffffful
309
#undef MAXTYPE_INT
310
#define MAXTYPE_INT 32
311
typedef
signed
short
int32s;
312
typedef
unsigned
short
int32u;
313
#else
314
#pragma message This machine has no 32-bit integer type?
315
#endif
316
317
//---------------------------------------------------------------------------
318
//64-bit int
319
#if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
320
#undef MAXTYPE_INT
321
#define MAXTYPE_INT 64
322
typedef
signed
long
long
int64s;
323
typedef
unsigned
long
long
int64u;
324
#elif defined(__WIN32__)
325
#undef MAXTYPE_INT
326
#define MAXTYPE_INT 64
327
typedef
signed
__int64 int64s;
328
typedef
unsigned
__int64 int64u;
329
#else
330
#pragma message This machine has no 64-bit integer type?
331
#endif
332
333
//---------------------------------------------------------------------------
334
//32-bit float
335
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
336
#undef MAXTYPE_FLOAT
337
#define MAXTYPE_FLOAT 32
338
typedef
float
float32;
339
#else
340
#pragma message This machine has no 32-bit float type?
341
#endif
342
343
//---------------------------------------------------------------------------
344
//64-bit float
345
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
346
#undef MAXTYPE_FLOAT
347
#define MAXTYPE_FLOAT 64
348
typedef
double
float64;
349
#else
350
#pragma message This machine has no 64-bit float type?
351
#endif
352
353
//---------------------------------------------------------------------------
354
//80-bit float
355
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
356
#undef MAXTYPE_FLOAT
357
#define MAXTYPE_FLOAT 80
358
typedef
long
double
float80;
359
#else
360
#pragma message This machine has no 80-bit float type?
361
#endif
362
363
//***************************************************************************
364
// Nested functions
365
//***************************************************************************
366
367
//Unices
368
#if defined (UNIX)
369
#define snwprintf swprintf
370
#endif
371
372
//Windows - MSVC (before Visual Studio 2015)
373
#if defined (_MSC_VER) && _MSC_VER < 1900
374
#define snprintf _snprintf
375
#define snwprintf _snwprintf
376
#endif
377
378
}
//namespace
379
#endif
MemoryDebug.h
ZenLib::Unlimited
const std::size_t Unlimited
Definition:
Conf.h:220
ZenLib::Char
char Char
Definition:
Conf.h:244
ZenLib
Definition:
BitStream.h:23
ZenLib::All
const std::size_t All
Definition:
Conf.h:219
ZenLib::EOL
const Char * EOL
ZenLib::PathSeparator
const Char PathSeparator
ZenLib::Error
const std::size_t Error
Definition:
Conf.h:218
ZenLib::intu
unsigned int intu
Definition:
Conf.h:267
ZenLib::ints
signed int ints
Definition:
Conf.h:266
Generated by
1.8.17