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