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