2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / general OS configuration file
\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
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
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
25 #ifndef _GF_SETUP_H_
\r
26 #define _GF_SETUP_H_
\r
33 /*WIN32 and WinCE config*/
\r
34 #if defined(WIN32) || defined(_WIN32_WCE)
\r
36 #ifdef GPAC_HAVE_CONFIG_H
\r
38 #if defined(__GNUC__)
\r
39 #include <gpac/internal/config.h>
\r
41 #include <gpac/internal/config_static.h>
\r
46 /*common win32 parts*/
\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
60 #if defined(__GNUC__)
\r
61 #define GFINLINE inline
\r
63 #define GFINLINE __inline
\r
66 #define GF_PATH_SEPARATOR '\\'
\r
67 #define GF_MAX_PATH 1024
\r
70 #if defined(_WIN32_WCE)
\r
72 /*winCE read-only (smaller)*/
\r
73 #ifndef GPAC_READ_ONLY
\r
74 #define GPAC_READ_ONLY
\r
77 /*winCE always fixed-point*/
\r
78 #ifndef GPAC_FIXED_POINT
\r
79 #define GPAC_FIXED_POINT
\r
85 void CE_Assert(u32 valid, char *file, u32 line);
\r
88 #define assert( t ) CE_Assert((unsigned int) (t), __FILE__, __LINE__ )
\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
101 #define strdup _strdup
\r
102 #define stricmp _stricmp
\r
103 #define strnicmp _strnicmp
\r
104 #define strupr _strupr
\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
112 #ifndef _SIZE_T_DEFINED
\r
113 typedef unsigned int size_t;
\r
114 #define _SIZE_T_DEFINED
\r
118 #define offsetof(s,m) ((size_t)&(((s*)0)->m))
\r
122 #define getenv(a) 0L
\r
125 #define strupr _strupr
\r
126 #define strlwr _strlwr
\r
128 //#define GPAC_DISABLE_LOG
\r
130 #else /*END WINCE*/
\r
132 /*WIN32 not-WinCE*/
\r
134 #include <string.h>
\r
136 #include <limits.h>
\r
137 #include <stdarg.h>
\r
138 #include <assert.h>
\r
141 #endif /*END WIN32 non win-ce*/
\r
142 /*end WIN32 config*/
\r
144 /*start SYMBIAN config*/
\r
145 #elif defined(__SYMBIAN32__)
\r
147 #define GFINLINE inline
\r
148 #define GF_PATH_SEPARATOR '\\'
\r
150 /*we must explicitely export our functions...*/
\r
151 #define GF_EXPORT EXPORT_C
\r
154 #include <stdlib.h>
\r
155 #include <stdarg.h>
\r
156 #include <limits.h>
\r
158 #include <string.h>
\r
159 #include <assert.h>
\r
161 #ifdef __SERIES60_3X__
\r
163 typedef unsigned __int64 u64;
\r
164 typedef __int64 s64;
\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
172 typedef unsigned int u64;
\r
173 typedef signed int s64;
\r
175 #endif /*symbian 8*/
\r
177 /*SYMBIAN always fixed-point*/
\r
178 #ifndef GPAC_FIXED_POINT
\r
179 #define GPAC_FIXED_POINT
\r
183 typedef unsigned int u32;
\r
184 typedef unsigned short u16;
\r
185 typedef unsigned char u8;
\r
188 typedef signed char s8;
\r
190 #pragma mpwc_relax on
\r
192 #define GF_MAX_PATH 260
\r
194 /*sorry this was developed under w32 :)*/
\r
195 #define stricmp strcasecmp
\r
196 #define strnicmp strncasecmp
\r
199 char * my_str_upr(char *str);
\r
200 #define strupr my_str_upr
\r
204 char * my_str_lwr(char *str);
\r
205 #define strlwr my_str_lwr
\r
209 #include <libc/ieeefp.h>
\r
210 #define DBL_MAX (__IEEE_DBL_MAXPOWTWO)
\r
214 #include <libc/ieeefp.h>
\r
215 #define FLT_MAX (__IEEE_FLT_MAXPOWTWO)
\r
218 #ifndef FLT_EPSILON
\r
219 #define FLT_EPSILON 1
\r
222 /*end SYMBIAN config*/
\r
228 #ifdef GPAC_HAVE_CONFIG_H
\r
229 #include "config.h"
\r
233 /*force large file support*/
\r
234 #ifndef _FILE_OFFSET_BITS
\r
235 #define _FILE_OFFSET_BITS 64
\r
237 #ifndef _LARGEFILE_SOURCE
\r
238 #define _LARGEFILE_SOURCE
\r
240 #ifndef _LARGEFILE64_SOURCE
\r
241 #define _LARGEFILE64_SOURCE
\r
244 #include <stdint.h>
\r
246 #include <stdlib.h>
\r
247 #include <stdarg.h>
\r
248 #include <limits.h>
\r
251 #include <string.h>
\r
252 #include <assert.h>
\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
264 #define GFINLINE inline
\r
266 /*sorry this was developed under w32 :)*/
\r
267 #define stricmp strcasecmp
\r
268 #define strnicmp strncasecmp
\r
271 char * my_str_upr(char *str);
\r
272 #define strupr my_str_upr
\r
276 char * my_str_lwr(char *str);
\r
277 #define strlwr my_str_lwr
\r
280 #define GF_PATH_SEPARATOR '/'
\r
283 #define GF_MAX_PATH PATH_MAX
\r
285 /*PATH_MAX not defined*/
\r
286 #define GF_MAX_PATH 1023
\r
290 #endif /* end platform specific Win32/WinCE/UNIX*/
\r
292 /*define what's missing*/
\r
298 typedef double Double;
\r
299 typedef float Float;
\r
301 typedef u8 bin128[16];
\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
312 #define MIN(X, Y) ((X)<(Y)?(X):(Y))
\r
315 #define MAX(X, Y) ((X)>(Y)?(X):(Y))
\r
318 #define ABSDIFF(a, b) ( ( (a) > (b) ) ? ((a) - (b)) : ((b) - (a)) )
\r
321 #define ABS(a) ( ( (a) > 0 ) ? (a) : - (a) )
\r
328 /*GPAC memory tracking*/
\r
329 #define GPAC_MEMORY_TRACKING 0
\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
338 #define malloc gf_malloc
\r
340 #define realloc gf_realloc
\r
342 #define free gf_free
\r
344 #define strdup gf_strdup
\r
347 /*end GPAC memory tracking*/
\r
349 #if defined (WIN32) && !defined(__GNUC__)
\r
350 #define LLD "%I64d"
\r
351 #define LLU "%I64u"
\r
354 #elif defined (__SYMBIAN32__)
\r
357 #define LLD_CAST (u32)
\r
358 #define LLU_CAST (s32)
\r
368 /*use def files for windows or let compiler decide*/
\r
377 #endif /*_GF_SETUP_H_*/
\r