comparison deps/Platinum/ThirdParty/Neptune/Source/Core/NptConfig.h @ 0:3425707ddbf6

Initial import (hopefully this mercurial stuff works...)
author fraserofthenight
date Mon, 06 Jul 2009 08:06:28 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3425707ddbf6
1 /*****************************************************************
2 |
3 | Neptune - Configuration
4 |
5 | Copyright (c) 2002-2008, Axiomatic Systems, LLC.
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 | * Neither the name of Axiomatic Systems nor the
16 | names of its contributors may be used to endorse or promote products
17 | derived from this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 ****************************************************************/
31
32 #ifndef _NPT_CONFIG_H_
33 #define _NPT_CONFIG_H_
34
35 /*----------------------------------------------------------------------
36 | defaults
37 +---------------------------------------------------------------------*/
38 #define NPT_CONFIG_HAVE_ASSERT_H
39 #define NPT_CONFIG_HAVE_STD_C
40 #define NPT_CONFIG_HAVE_STDLIB_H
41 #define NPT_CONFIG_HAVE_STDIO_H
42 #define NPT_CONFIG_HAVE_STDARG_H
43 #define NPT_CONFIG_HAVE_STRING_H
44 #define NPT_CONFIG_HAVE_LIMITS_H
45
46 /*----------------------------------------------------------------------
47 | standard C runtime
48 +---------------------------------------------------------------------*/
49 #if defined(NPT_CONFIG_HAVE_STD_C)
50 #define NPT_CONFIG_HAVE_MALLOC
51 #define NPT_CONFIG_HAVE_CALLOC
52 #define NPT_CONFIG_HAVE_REALLOC
53 #define NPT_CONFIG_HAVE_FREE
54 #define NPT_CONFIG_HAVE_MEMCPY
55 #define NPT_CONFIG_HAVE_MEMSET
56 #define NPT_CONFIG_HAVE_MEMCMP
57 #define NPT_CONFIG_HAVE_GETENV
58 #define NPT_CONFIG_HAVE_READDIR_R
59 #endif /* NPT_CONFIG_HAS_STD_C */
60
61 #if defined(NPT_CONFIG_HAVE_STRING_H)
62 #define NPT_CONFIG_HAVE_STRCMP
63 #define NPT_CONFIG_HAVE_STRNCMP
64 #define NPT_CONFIG_HAVE_STRDUP
65 #define NPT_CONFIG_HAVE_STRLEN
66 #define NPT_CONFIG_HAVE_STRCPY
67 #define NPT_CONFIG_HAVE_STRNCPY
68 #endif /* NPT_CONFIG_HAVE_STRING_H */
69
70 #if defined(NPT_CONFIG_HAVE_STDIO_H)
71 #define NPT_CONFIG_HAVE_SPRINTF
72 #define NPT_CONFIG_HAVE_SNPRINTF
73 #define NPT_CONFIG_HAVE_VSPRINTF
74 #define NPT_CONFIG_HAVE_VSNPRINTF
75 #endif /* NPT_CONFIG_HAVE_STDIO_H */
76
77 #if defined(NPT_CONFIG_HAVE_LIMITS_H)
78 #define NPT_CONFIG_HAVE_INT_MIN
79 #define NPT_CONFIG_HAVE_INT_MAX
80 #define NPT_CONFIG_HAVE_UINT_MAX
81 #define NPT_CONFIG_HAVE_LONG_MIN
82 #define NPT_CONFIG_HAVE_LONG_MAX
83 #define NPT_CONFIG_HAVE_ULONG_MAX
84 #endif
85
86 /*----------------------------------------------------------------------
87 | standard C++ runtime
88 +---------------------------------------------------------------------*/
89 #define NPT_CONFIG_HAVE_NEW_H
90
91 /*----------------------------------------------------------------------
92 | sockets
93 +---------------------------------------------------------------------*/
94 #define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
95
96 /*----------------------------------------------------------------------
97 | platform specifics
98 +---------------------------------------------------------------------*/
99 /* Windows 32 */
100 #if defined(_WIN32) || defined(_XBOX)
101 #if !defined(STRICT)
102 #define STRICT
103 #endif
104
105 /* Visual Studio 2008 defines vsnprintf */
106 #if _MSC_VER < 1500
107 #define vsnprintf _vsnprintf
108 #endif
109 #define snprintf _snprintf
110 #endif
111
112 /* XBox */
113 #if defined(_XBOX)
114 #define NPT_CONFIG_THREAD_STACK_SIZE 0x10000
115 #endif
116
117 /* QNX */
118 #if defined(__QNX__)
119 #endif
120
121 /* cygwin */
122 #if defined(__CYGWIN__)
123 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
124 #endif
125
126 /* linux */
127 #if defined(__linux__)
128 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
129 #endif
130
131 /* symbian */
132 #if defined(__SYMBIAN32__)
133 /* If defined, specify the stack size of each NPT_Thread. */
134 #define NPT_CONFIG_THREAD_STACK_SIZE 0x14000
135 #endif
136
137 /*----------------------------------------------------------------------
138 | compiler specifics
139 +---------------------------------------------------------------------*/
140 /* GCC */
141 #if defined(__GNUC__)
142 #define NPT_LocalFunctionName __FUNCTION__
143 #define NPT_COMPILER_UNUSED(p) (void)p
144 #else
145 #define NPT_COMPILER_UNUSED(p)
146 #endif
147
148 /* TriMedia C/C++ Compiler */
149 #if defined(__TCS__)
150 #undef NPT_CONFIG_HAVE_ASSERT_H
151 #undef NPT_CONFIG_HAVE_SNPRINTF
152 #undef NPT_CONFIG_HAVE_VSNPRINTF
153 #endif
154
155 /* palmos compiler */
156 #if defined(__PALMOS__)
157 #if __PALMOS__ <= 0x05000000
158 #undef NPT_CONFIG_HAVE_ASSERT_H
159 #undef NPT_CONFIG_HAVE_SNPRINTF
160 #undef NPT_CONFIG_HAVE_VSNPRINTF
161 #endif
162 #endif
163
164 /* Microsoft C/C++ Compiler */
165 #if defined(_MSC_VER)
166 #define NPT_FORMAT_64 "I64"
167 #define NPT_CONFIG_INT64_TYPE __int64
168 #define NPT_INT64_MIN _I64_MIN
169 #define NPT_INT64_MAX _I64_MAX
170 #define NPT_UINT64_MAX _UI64_MAX
171 #define NPT_INT64_C(_x) _x##i64
172 #define NPT_UINT64_C(_x) _x##ui64
173 #define NPT_LocalFunctionName __FUNCTION__
174 #if !defined(_WIN32_WCE)
175 #define NPT_fseek _fseeki64
176 #define NPT_ftell _ftelli64
177 #else
178 #define NPT_fseek(a,b,c) fseek((a),(long)(b), (c))
179 #define NPT_ftell ftell
180 #endif
181 #define NPT_stat NPT_stat_utf8
182 #define NPT_stat_struct struct __stat64
183 #if defined(_WIN64)
184 typedef __int64 NPT_PointerLong;
185 #else
186 #if _MSC_VER >= 1400
187 typedef __w64 long NPT_PointerLong;
188 #else
189 typedef long NPT_PointerLong;
190 #endif
191 #endif
192 #define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
193 #if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
194 #define NPT_CONFIG_HAVE_FOPEN_S
195 #define NPT_CONFIG_HAVE_FSOPEN
196 #define NPT_CONFIG_HAVE_SHARE_H
197 #define NPT_vsnprintf(s,c,f,a) _vsnprintf_s(s,c,_TRUNCATE,f,a)
198 #define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
199 #define NPT_strncpy(d,s,c) strncpy_s(d,c+1,s,c)
200 #define NPT_strcpy(d,s) strcpy_s(d,strlen(s)+1,s)
201 #undef NPT_CONFIG_HAVE_GETENV
202 #define NPT_CONFIG_HAVE_DUPENV_S
203 #define dupenv_s _dupenv_s
204 #else
205 #define NPT_vsnprintf _vsnprintf
206 #define NPT_snprintf _snprintf
207 #endif
208 #if defined(_DEBUG)
209 #define _CRTDBG_MAP_ALLOC
210 #endif
211 #endif
212
213 /* Windows CE */
214 #if defined(_WIN32_WCE)
215 #if defined(NPT_CONFIG_HAVE_FOPEN_S)
216 #undef NPT_CONFIG_HAVE_FOPEN_S
217 #endif
218 #endif
219
220 /* Symbian */
221 #if defined(__SYMBIAN32__)
222 #undef NPT_CONFIG_HAVE_NEW_H
223 #include "e32std.h"
224 #define explicit
225 #define NPT_fseek fseek // no fseeko ?
226 #define NPT_ftell ftell // no ftello ?
227 #endif
228
229 /*----------------------------------------------------------------------
230 | defaults
231 +---------------------------------------------------------------------*/
232 #if !defined(NPT_FORMAT_64)
233 #define NPT_FORMAT_64 "ll"
234 #endif
235
236 #if !defined(NPT_POINTER_TO_LONG)
237 #define NPT_POINTER_TO_LONG(_p) ((long)(_p))
238 #endif
239
240 #if !defined(NPT_CONFIG_INT64_TYPE)
241 #define NPT_CONFIG_INT64_TYPE long long
242 #endif
243
244 #if !defined(NPT_INT64_C)
245 #define NPT_INT64_C(_x) _x##LL
246 #endif
247
248 #if !defined(NPT_UINT64_C)
249 #define NPT_UINT64_C(_x) _x##ULL
250 #endif
251
252 #if !defined(NPT_snprintf)
253 #define NPT_snprintf snprintf
254 #endif
255
256 #if !defined(NPT_strcpy)
257 #define NPT_strcpy strcpy
258 #endif
259
260 #if !defined(NPT_strncpy)
261 #define NPT_strncpy strncpy
262 #endif
263
264 #if !defined(NPT_vsnprintf)
265 #define NPT_vsnprintf vsnprintf
266 #endif
267
268 #if !defined(NPT_LocalFunctionName)
269 #define NPT_LocalFunctionName (NULL)
270 #endif
271
272 #if !defined(NPT_CONFIG_THREAD_STACK_SIZE)
273 #define NPT_CONFIG_THREAD_STACK_SIZE 0
274 #endif
275
276 #if !defined(NPT_fseek)
277 #define NPT_fseek fseeko
278 #endif
279
280 #if !defined(NPT_ftell)
281 #define NPT_ftell ftello
282 #endif
283
284 #if !defined(NPT_stat)
285 #define NPT_stat stat
286 #endif
287
288 #if !defined(NPT_stat_struct)
289 #define NPT_stat_struct struct stat
290 #endif
291
292 /*----------------------------------------------------------------------
293 | includes
294 +---------------------------------------------------------------------*/
295 #if defined(DMALLOC)
296 #include <dmalloc.h>
297 #endif
298
299 #endif // _NPT_CONFIG_H_