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
//***************************************************************************
177
// (Without Namespace)
178
//***************************************************************************
179
180
//---------------------------------------------------------------------------
181
#include <limits.h>
182
183
//---------------------------------------------------------------------------
184
#if defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
185
#include "
ZenLib/MemoryDebug.h
"
186
#endif // defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
187
188
//***************************************************************************
189
// Compiler helpers
190
//***************************************************************************
191
192
//---------------------------------------------------------------------------
193
//Macro to cut down on compiler warnings
194
#ifndef UNUSED
195
#define UNUSED(Identifier)
196
#endif
197
//---------------------------------------------------------------------------
198
//If we need size_t specific integer conversion
199
#if !defined(SIZE_T_IS_LONG) && (defined(__LP64__) || defined(MACOSX))
200
#define SIZE_T_IS_LONG
201
#endif
202
203
//---------------------------------------------------------------------------
204
//(-1) is known to be the MAX of an unsigned int but GCC complains about it
205
#ifdef __cplusplus
206
#include <cstddef>
//for size_t
207
#else
/* __cplusplus */
208
#include <stddef.h>
//for size_t
209
#endif
/* __cplusplus */
210
#include <cstring>
//size_t
211
namespace
ZenLib
212
{
213
const
std::size_t
Error
=((std::size_t)(-1));
214
const
std::size_t
All
=((std::size_t)(-1));
215
const
std::size_t
Unlimited
=((std::size_t)(-1));
216
}
217
218
//***************************************************************************
219
// (With namespace)
220
//***************************************************************************
221
222
namespace
ZenLib
223
{
224
225
//***************************************************************************
226
// International
227
//***************************************************************************
228
229
//---------------------------------------------------------------------------
230
//Char types
231
#if defined(__UNICODE__)
232
#if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
233
#pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
234
#endif
235
typedef
wchar_t
Char
;
236
#undef __T
237
#define __T(__x) L ## __x
238
#else // defined(__UNICODE__)
239
typedef
char
Char
;
240
#undef __T
241
#define __T(__x) __x
242
#endif // defined(__UNICODE__)
243
#ifdef wchar_t
244
typedef
wchar_t
wchar;
245
#endif // wchar_t
246
247
//***************************************************************************
248
// Platform differences
249
//***************************************************************************
250
251
//End of line
252
extern
const
Char
*
EOL
;
253
extern
const
Char
PathSeparator
;
254
255
//***************************************************************************
256
// Types
257
//***************************************************************************
258
259
//---------------------------------------------------------------------------
260
//int
261
typedef
signed
int
ints
;
262
typedef
unsigned
int
intu
;
263
264
//---------------------------------------------------------------------------
265
//8-bit int
266
#if UCHAR_MAX==0xff
267
#undef MAXTYPE_INT
268
#define MAXTYPE_INT 8
269
typedef
signed
char
int8s;
270
typedef
unsigned
char
int8u;
271
#else
272
#pragma message This machine has no 8-bit integertype?
273
#endif
274
275
//---------------------------------------------------------------------------
276
//16-bit int
277
#if UINT_MAX == 0xffff
278
#undef MAXTYPE_INT
279
#define MAXTYPE_INT 16
280
typedef
signed
int
int16s;
281
typedef
unsigned
int
int16u;
282
#elif USHRT_MAX == 0xffff
283
#undef MAXTYPE_INT
284
#define MAXTYPE_INT 16
285
typedef
signed
short
int16s;
286
typedef
unsigned
short
int16u;
287
#else
288
#pragma message This machine has no 16-bit integertype?
289
#endif
290
291
//---------------------------------------------------------------------------
292
//32-bit int
293
#if UINT_MAX == 0xfffffffful
294
#undef MAXTYPE_INT
295
#define MAXTYPE_INT 32
296
typedef
signed
int
int32s;
297
typedef
unsigned
int
int32u;
298
#elif ULONG_MAX == 0xfffffffful
299
#undef MAXTYPE_INT
300
#define MAXTYPE_INT 32
301
typedef
signed
long
int32s;
302
typedef
unsigned
long
int32u;
303
#elif USHRT_MAX == 0xfffffffful
304
#undef MAXTYPE_INT
305
#define MAXTYPE_INT 32
306
typedef
signed
short
int32s;
307
typedef
unsigned
short
int32u;
308
#else
309
#pragma message This machine has no 32-bit integer type?
310
#endif
311
312
//---------------------------------------------------------------------------
313
//64-bit int
314
#if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
315
#undef MAXTYPE_INT
316
#define MAXTYPE_INT 64
317
typedef
signed
long
long
int64s;
318
typedef
unsigned
long
long
int64u;
319
#elif defined(__WIN32__)
320
#undef MAXTYPE_INT
321
#define MAXTYPE_INT 64
322
typedef
signed
__int64 int64s;
323
typedef
unsigned
__int64 int64u;
324
#else
325
#pragma message This machine has no 64-bit integer type?
326
#endif
327
328
//---------------------------------------------------------------------------
329
//32-bit float
330
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
331
#undef MAXTYPE_FLOAT
332
#define MAXTYPE_FLOAT 32
333
typedef
float
float32;
334
#else
335
#pragma message This machine has no 32-bit float type?
336
#endif
337
338
//---------------------------------------------------------------------------
339
//64-bit float
340
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
341
#undef MAXTYPE_FLOAT
342
#define MAXTYPE_FLOAT 64
343
typedef
double
float64;
344
#else
345
#pragma message This machine has no 64-bit float type?
346
#endif
347
348
//---------------------------------------------------------------------------
349
//80-bit float
350
#if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
351
#undef MAXTYPE_FLOAT
352
#define MAXTYPE_FLOAT 80
353
typedef
long
double
float80;
354
#else
355
#pragma message This machine has no 80-bit float type?
356
#endif
357
358
//***************************************************************************
359
// Nested functions
360
//***************************************************************************
361
362
//Unices
363
#if defined (UNIX)
364
#define snwprintf swprintf
365
#endif
366
367
//Windows - MSVC (before Visual Studio 2015)
368
#if defined (_MSC_VER) && _MSC_VER < 1900
369
#define snprintf _snprintf
370
#define snwprintf _snwprintf
371
#endif
372
373
}
//namespace
374
#endif
MemoryDebug.h
ZenLib::Unlimited
const std::size_t Unlimited
Definition:
Conf.h:215
ZenLib::Char
char Char
Definition:
Conf.h:239
ZenLib
Definition:
BitStream.h:23
ZenLib::All
const std::size_t All
Definition:
Conf.h:214
ZenLib::EOL
const Char * EOL
ZenLib::PathSeparator
const Char PathSeparator
ZenLib::Error
const std::size_t Error
Definition:
Conf.h:213
ZenLib::intu
unsigned int intu
Definition:
Conf.h:262
ZenLib::ints
signed int ints
Definition:
Conf.h:261
Generated by
1.8.17