OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / setup.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005\r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / general OS configuration file\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 #ifndef _GF_SETUP_H_\r
26 #define _GF_SETUP_H_\r
27 \r
28 #ifdef __cplusplus\r
29 extern "C" {\r
30 #endif\r
31 \r
32 \r
33 /*WIN32 and WinCE config*/\r
34 #if defined(WIN32) || defined(_WIN32_WCE)\r
35 \r
36 #ifdef GPAC_HAVE_CONFIG_H\r
37 \r
38 #if defined(__GNUC__)\r
39 #include <gpac/internal/config.h>\r
40 #else\r
41 #include <gpac/internal/config_static.h>\r
42 #endif\r
43 \r
44 #endif\r
45 \r
46 /*common win32 parts*/\r
47 #include <stdio.h>\r
48 #include <stdlib.h>\r
49 \r
50 \r
51 typedef unsigned __int64 u64;\r
52 typedef unsigned int u32;\r
53 typedef unsigned short u16;\r
54 typedef unsigned char u8;\r
55 typedef __int64 s64;\r
56 typedef int s32;\r
57 typedef short s16;\r
58 typedef char s8;\r
59 \r
60 #if defined(__GNUC__)\r
61 #define GFINLINE inline\r
62 #else\r
63 #define GFINLINE __inline\r
64 #endif\r
65 \r
66 #define GF_PATH_SEPARATOR       '\\'\r
67 #define GF_MAX_PATH     1024\r
68 \r
69 /*WINCE config*/\r
70 #if defined(_WIN32_WCE)\r
71 \r
72 /*winCE read-only (smaller)*/\r
73 #ifndef GPAC_READ_ONLY\r
74 #define GPAC_READ_ONLY\r
75 #endif\r
76 \r
77 /*winCE always fixed-point*/\r
78 #ifndef GPAC_FIXED_POINT\r
79 #define GPAC_FIXED_POINT\r
80 #endif\r
81 \r
82 /*win32 assert*/\r
83 #ifndef assert\r
84 \r
85 void CE_Assert(u32 valid, char *file, u32 line);\r
86 \r
87 #ifndef NDEBUG\r
88 #define assert( t )     CE_Assert((unsigned int) (t), __FILE__, __LINE__ )\r
89 #else\r
90 #define assert(t)\r
91 #endif\r
92 \r
93 #endif\r
94 \r
95 \r
96 /*performs wide->char and char->wide conversion on a buffer GF_MAX_PATH long*/\r
97 void CE_WideToChar(unsigned short *w_str, char *str);\r
98 void CE_CharToWide(char *str, unsigned short *w_str);\r
99 \r
100 \r
101 #define strdup _strdup\r
102 #define stricmp _stricmp\r
103 #define strnicmp _strnicmp\r
104 #define strupr _strupr\r
105 \r
106 #ifndef _PTRDIFF_T_DEFINED\r
107 typedef int ptrdiff_t;\r
108 #define PTRDIFF(p1, p2, type)   ((p1) - (p2))\r
109 #define _PTRDIFF_T_DEFINED\r
110 #endif\r
111 \r
112 #ifndef _SIZE_T_DEFINED\r
113 typedef unsigned int size_t;\r
114 #define _SIZE_T_DEFINED\r
115 #endif\r
116 \r
117 #ifndef offsetof\r
118 #define offsetof(s,m) ((size_t)&(((s*)0)->m))\r
119 #endif\r
120 \r
121 #ifndef getenv\r
122 #define getenv(a) 0L\r
123 #endif\r
124 \r
125 #define strupr _strupr\r
126 #define strlwr _strlwr\r
127 \r
128 //#define GPAC_DISABLE_LOG\r
129 \r
130 #else   /*END WINCE*/\r
131 \r
132 /*WIN32 not-WinCE*/\r
133 #include <ctype.h>\r
134 #include <string.h>\r
135 #include <float.h>\r
136 #include <limits.h>\r
137 #include <stdarg.h>\r
138 #include <assert.h>\r
139 \r
140 \r
141 #endif  /*END WIN32 non win-ce*/\r
142 /*end WIN32 config*/\r
143 \r
144 /*start SYMBIAN config*/\r
145 #elif defined(__SYMBIAN32__)\r
146 \r
147 #define GFINLINE inline\r
148 #define GF_PATH_SEPARATOR       '\\'\r
149 \r
150 /*we must explicitely export our functions...*/\r
151 #define GF_EXPORT EXPORT_C\r
152 \r
153 #include <stdio.h>\r
154 #include <stdlib.h>\r
155 #include <stdarg.h>\r
156 #include <limits.h>\r
157 #include <ctype.h>\r
158 #include <string.h>\r
159 #include <assert.h>\r
160 \r
161 #ifdef __SERIES60_3X__\r
162 \r
163 typedef unsigned __int64 u64;\r
164 typedef __int64 s64;\r
165 \r
166 #else \r
167 \r
168 /*FIXME - we don't have 64bit support here we should get rid of all 64bits divisions*/\r
169 //typedef unsigned long long u64;\r
170 //typedef long long s64;\r
171 \r
172 typedef unsigned int u64;\r
173 typedef signed int s64;\r
174 \r
175 #endif  /*symbian 8*/\r
176 \r
177 /*SYMBIAN always fixed-point*/\r
178 #ifndef GPAC_FIXED_POINT\r
179 #define GPAC_FIXED_POINT\r
180 #endif\r
181 \r
182 \r
183 typedef unsigned int u32;\r
184 typedef unsigned short u16;\r
185 typedef unsigned char u8;\r
186 typedef int s32;\r
187 typedef short s16;\r
188 typedef signed char s8;\r
189 \r
190 #pragma mpwc_relax on\r
191 \r
192 #define GF_MAX_PATH     260\r
193 \r
194 /*sorry this was developed under w32 :)*/\r
195 #define stricmp         strcasecmp\r
196 #define strnicmp        strncasecmp\r
197 \r
198 #ifndef strupr\r
199 char * my_str_upr(char *str);\r
200 #define strupr my_str_upr\r
201 #endif\r
202 \r
203 #ifndef strlwr\r
204 char * my_str_lwr(char *str);\r
205 #define strlwr my_str_lwr\r
206 #endif\r
207 \r
208 #ifndef DBL_MAX\r
209 #include <libc/ieeefp.h>\r
210 #define DBL_MAX (__IEEE_DBL_MAXPOWTWO)\r
211 #endif\r
212 \r
213 #ifndef FLT_MAX\r
214 #include <libc/ieeefp.h>\r
215 #define FLT_MAX (__IEEE_FLT_MAXPOWTWO)\r
216 #endif\r
217 \r
218 #ifndef FLT_EPSILON\r
219 #define FLT_EPSILON 1\r
220 #endif\r
221 \r
222 /*end SYMBIAN config*/\r
223 \r
224 #else \r
225 \r
226 /*UNIX likes*/\r
227 \r
228 #ifdef GPAC_HAVE_CONFIG_H\r
229 #include "config.h"\r
230 #endif\r
231 \r
232 \r
233 /*force large file support*/\r
234 #ifndef _FILE_OFFSET_BITS\r
235 #define _FILE_OFFSET_BITS 64\r
236 #endif\r
237 #ifndef _LARGEFILE_SOURCE\r
238 #define _LARGEFILE_SOURCE\r
239 #endif\r
240 #ifndef _LARGEFILE64_SOURCE\r
241 #define _LARGEFILE64_SOURCE\r
242 #endif\r
243 \r
244 #include <stdint.h>\r
245 #include <stdio.h>\r
246 #include <stdlib.h>\r
247 #include <stdarg.h>\r
248 #include <limits.h>\r
249 #include <float.h>\r
250 #include <ctype.h>\r
251 #include <string.h>\r
252 #include <assert.h>\r
253 \r
254 \r
255 typedef uint64_t u64;\r
256 typedef uint32_t u32;\r
257 typedef uint16_t u16;\r
258 typedef uint8_t u8;\r
259 typedef int64_t s64;\r
260 typedef int32_t s32;\r
261 typedef int16_t s16;\r
262 typedef int8_t s8;\r
263 \r
264 #define GFINLINE        inline\r
265 \r
266 /*sorry this was developed under w32 :)*/\r
267 #define stricmp         strcasecmp\r
268 #define strnicmp        strncasecmp\r
269 \r
270 #ifndef strupr\r
271 char * my_str_upr(char *str);\r
272 #define strupr my_str_upr\r
273 #endif\r
274 \r
275 #ifndef strlwr\r
276 char * my_str_lwr(char *str);\r
277 #define strlwr my_str_lwr\r
278 #endif\r
279 \r
280 #define GF_PATH_SEPARATOR       '/'\r
281 \r
282 #ifdef PATH_MAX\r
283 #define GF_MAX_PATH     PATH_MAX\r
284 #else\r
285 /*PATH_MAX not defined*/\r
286 #define GF_MAX_PATH     1023\r
287 #endif\r
288 \r
289 \r
290 #endif /* end platform specific Win32/WinCE/UNIX*/\r
291 \r
292 /*define what's missing*/\r
293 #ifndef NULL\r
294 #define NULL 0\r
295 #endif\r
296 \r
297 \r
298 typedef double Double;\r
299 typedef float Float;\r
300 /* 128 bit IDs */\r
301 typedef u8 bin128[16];\r
302 \r
303 #define GF_MAX_DOUBLE           DBL_MAX\r
304 #define GF_MIN_DOUBLE           -GF_MAX_DOUBLE\r
305 #define GF_MAX_FLOAT            FLT_MAX\r
306 #define GF_MIN_FLOAT            -GF_MAX_FLOAT\r
307 #define GF_EPSILON_FLOAT        FLT_EPSILON\r
308 #define GF_SHORT_MAX            SHRT_MAX\r
309 #define GF_SHORT_MIN            SHRT_MIN\r
310 \r
311 #ifndef MIN\r
312 #define MIN(X, Y) ((X)<(Y)?(X):(Y))\r
313 #endif\r
314 #ifndef MAX\r
315 #define MAX(X, Y) ((X)>(Y)?(X):(Y))\r
316 #endif\r
317 \r
318 #define ABSDIFF(a, b)   ( ( (a) > (b) ) ? ((a) - (b)) : ((b) - (a)) )\r
319 \r
320 #ifndef ABS\r
321 #define ABS(a)  ( ( (a) > 0 ) ? (a) : - (a) )\r
322 #endif\r
323 \r
324 #ifndef Bool\r
325 typedef u32 Bool;\r
326 #endif\r
327 \r
328 /*GPAC memory tracking*/\r
329 #define GPAC_MEMORY_TRACKING    0\r
330 \r
331 #if GPAC_MEMORY_TRACKING\r
332 void *gf_malloc(size_t size);\r
333 void *gf_realloc(void *ptr, size_t size);\r
334 void gf_free(void *ptr);\r
335 char *gf_strdup(const char *str);\r
336 \r
337 #undef malloc\r
338 #define malloc gf_malloc\r
339 #undef realloc\r
340 #define realloc gf_realloc\r
341 #undef free\r
342 #define free gf_free\r
343 #undef strdup\r
344 #define strdup gf_strdup\r
345 \r
346 #endif\r
347 /*end GPAC memory tracking*/\r
348 \r
349 #if defined (WIN32) && !defined(__GNUC__)\r
350 #define LLD "%I64d"\r
351 #define LLU "%I64u"\r
352 #define LLD_CAST\r
353 #define LLU_CAST\r
354 #elif defined (__SYMBIAN32__)\r
355 #define LLD "%d"\r
356 #define LLU "%u"\r
357 #define LLD_CAST (u32)\r
358 #define LLU_CAST (s32)\r
359 #else\r
360 #define LLD "%lld"\r
361 #define LLU "%llu"\r
362 #define LLD_CAST\r
363 #define LLU_CAST\r
364 #endif\r
365 \r
366 \r
367 #ifndef GF_EXPORT\r
368 /*use def files for windows or let compiler decide*/\r
369 #define GF_EXPORT \r
370 #endif\r
371 \r
372 \r
373 #ifdef __cplusplus\r
374 }\r
375 #endif\r
376 \r
377 #endif  /*_GF_SETUP_H_*/\r