]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/missing.h
fixed wxGTK1 compilation after wxDC changes (still doesn't work)
[wxWidgets.git] / include / wx / palmos / missing.h
1 #ifndef _PALMOS_STDIO_FAKE_H
2 #define _PALMOS_STDIO_FAKE_H
3
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <PalmTypes.h>
9 #include <MemoryMgr.h> // Core/System/
10 #include <StringMgr.h> // Core/System/
11 #include <UIResources.h> // alertRscType,MenuRscType
12
13 #ifdef __cplusplus
14 #define _PSF_BEGIN_EXTERN_C extern "C" {
15 #define _PSF_END_EXTERN_C }
16 #else
17 #define _PSF_BEGIN_EXTERN_C
18 #define _PSF_END_EXTERN_C
19 #endif
20
21 #if __WXPALMOS6__
22 #include <wchar.h> // wint_t
23 #include <unistd.h> // access(), rmdir()
24 #include <time.h>
25 #include <StatusBar.h>
26 #include <Loader.h>
27 #else
28 #if !defined(__MWERKS__)
29 #include <PenInputMgr.h>
30 #endif
31
32 #define uint32_t UInt32
33 #define uint16_t UInt16
34 #define uint8_t UInt8
35 #endif // __WXPALMOS6__
36 #if __WXPALMOS6__
37 #define POS_DmGetResource(a,b,c) DmGetResource(a,b,c)
38 #define POS_FrmSetMenu(a,b,c) FrmSetMenu(a,b,c)
39 #define POS_FrmCustomAlert(a,b,c,d,e) FrmCustomAlert(a,b,c,d,e)
40 #define POS_MemNumRAMHeaps(a) MemNumRAMHeaps()
41 #else // __WXPALMOS6__
42 #define POS_DmGetResource(a,b,c) DmGetResource(b,c)
43 #define POS_FrmSetMenu(a,b,c) FrmSetMenu(a,c)
44 #define POS_FrmCustomAlert(a,b,c,d,e) FrmCustomAlert(b,c,d,e)
45 #define POS_MemNumRAMHeaps(a) MemNumRAMHeaps(a)
46 #endif // __WXPALMOS6__
47
48 _PSF_BEGIN_EXTERN_C
49
50 #if __WXPALMOS5__
51
52 #if defined(__MWERKS__)
53 //#include <unix_stdarg.h>
54 #endif
55
56 #if 0
57 #define strcpy(x,y) StrCopy((char*)(x),(char*)(y))
58 #define strncpy(x,y,z) StrNCopy((x),(y),(z))
59 #define strcmp(x,y) StrCompare((x),(y))
60 #define strcat(x,y) StrCat((x),(y))
61 #define strlen(x) StrLen((char*)(x))
62 #define strchr(x,y) StrChr((x),(y))
63 #define strstr(x,y) StrStr((x),(y))
64
65 #define memcpy(x,y,z) ((0 == MemMove((x),(void *)(y),(z))) ? (x) : (0))
66 #define memset(x,y,z) (MemSet((x),(z),(y)))
67 #define memcmp(x,y,z) (MemCmp((x),(y),(z)))
68 #endif
69
70 #include "sections.h"
71 #ifndef int8_t
72 #define int8_t char
73 #define int16_t short
74 #define int64_t long long
75 #define uint64_t unsigned int64_t
76
77 #define wchar_t uint16_t
78 #endif
79 #define wint_t int
80
81 #define ssize_t long
82 #define size_t uint32_t
83
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87
88 #if 0
89 #define malloc(x) MemPtrNew(x)
90 #define free(x) MemPtrFree(x)
91 void * realloc (void *p, size_t newsize);
92 #endif
93 char * strdup (const char *old);
94
95 // copy from Core/System/Unix/unix_stdio.h
96 #ifndef _STDLIB
97 #define sprintf StrPrintF
98 #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z)
99 #else
100 int vsprintf(char *, const char *, _Va_list);
101 #endif
102 int sscanf(const char *, const char *, ...);
103
104 ///////////////////// time ////////////////////
105 #define time_t uint64_t
106 time_t time(time_t *T);
107
108 #define JAN 0
109 #define FEB 1
110 #define MAR 2
111 #define APR 3
112 #define MAY 4
113 #define JUN 5
114 #define JUL 6
115 #define AUG 7
116 #define SEP 8
117 #define OCT 9
118 #define NOV 10
119 #define DEC 11
120 struct tm {
121 int8_t tm_gmtoff;
122 int8_t tm_isdst;
123 uint8_t tm_sec;
124 uint8_t tm_min;
125 uint8_t tm_hour;
126 uint8_t tm_wday;
127 uint8_t tm_mday;
128 uint8_t tm_mon;
129 uint16_t tm_yday;
130 uint64_t tm_year;
131 };
132
133 #define HAVE_LOCALTIME_R 1
134 extern struct tm *localtime (const time_t *CLOCK); // datetime.cpp: GetTmNow(void)
135 extern struct tm *localtime_r (const time_t *CLOCK, struct tm *RES);
136
137 #define HAVE_GMTIME_R 1
138 extern struct tm *gmtime (const time_t *CLOCK);
139 extern struct tm *gmtime_r (const time_t *CLOCK, struct tm *RES);
140
141 extern time_t mktime (struct tm *TIMP);
142 double difftime (time_t TIM1, time_t TIM2);
143
144 char *ctime(const time_t *CLOCK);
145 char *ctime_r(const time_t *CLOCK, char *BUF);
146
147 //#define HAVE_STRFTIME 1
148 extern size_t strftime(char *S, size_t MAXSIZE, const char *FORMAT, const struct tm *TIMP);
149
150 ///////////////////// locale.h ////////////////////
151 struct lconv
152 {
153 char *decimal_point;
154 char *thousands_sep;
155 char *grouping;
156 char *int_curr_symbol;
157 char *currency_symbol;
158 char *mon_decimal_point;
159 char *mon_thousands_sep;
160 char *mon_grouping;
161 char *positive_sign;
162 char *negative_sign;
163 char int_frac_digits;
164 char frac_digits;
165 char p_cs_precedes;
166 char p_sep_by_space;
167 char n_cs_precedes;
168 char n_sep_by_space;
169 char p_sign_posn;
170 char n_sign_posn;
171 };
172 char *setlocale(int CATEGORY, const char *LOCALE);
173 struct lconv *localeconv(void);
174
175 char *_setlocale_r(void *REENT, int CATEGORY, const char *LOCALE);
176 struct lconv *_localeconv_r(void *REENT);
177 ///////////////////// stdlib.h ////////////////////
178
179 #if !defined(__MWERKS__)
180 #define wchar_t int
181 #endif
182 int _watoi(wchar_t * nptr);
183 long _watol(wchar_t * nptr);
184 double _watof(wchar_t *nptr);
185 #define watoi(a) _watoi((wchar_t *)(a))
186 #define watol(a) _watol((wchar_t *)(a))
187 #define watof(a) _watof((wchar_t *)(a))
188 int mbstowcs(wchar_t *PWC, const char *S, size_t N);
189 int wcstombs(const char *S, wchar_t *PWC, size_t N);
190
191 ///////////////////// fcntl.h ////////////////////
192 #define O_RDONLY 0x01
193 #define O_WRONLY 0x02
194 #define O_RDWR 0x04
195 #define O_APPEND 0x08
196 #define O_CREAT 0x10
197 #define O_TRUNC 0x20
198 #define O_EXCL 0x40
199 #define O_SYNC 0x80
200
201 // io.h
202 int open (const char*, int, ...);
203 int read (int, void*, unsigned int);
204 int write (int, const void*, unsigned int);
205 int close (int);
206 long lseek (int, long, int);
207
208 ///////////////////// stdio.h ////////////////////
209 int remove(const char *FILENAME);
210 int rename(const char *OLD, const char *NEW);
211
212 ///////////////////// unistd.h ////////////////////
213 int access (const char *path, int amode);
214 int rmdir (const char *path);
215
216 ///////////////////// FILE ////////////////////
217 #ifndef NULL
218 #define NULL ((void *)(0))
219 #endif
220
221 #define FILE void
222 #undef stdin
223 #undef stdout
224 #undef stderr
225 #define stdin NULL
226 #define stdout NULL
227 #define stderr NULL
228
229 #define SEEK_SET 0 /* set file offset to offset */
230 #define SEEK_CUR 1 /* set file offset to current plus offset */
231 #define SEEK_END 2 /* set file offset to EOF plus offset */
232
233 FILE * fopen (const char *_name, const char *_type);
234 int fclose (FILE *);
235 size_t fread (void *buf, size_t _size, size_t _n, FILE *);
236 size_t fwrite (const void *buf , size_t _size, size_t _n, FILE *);
237 int fseek (FILE *, long, int);
238 long ftell ( FILE *);
239 int feof (FILE *);
240 int ferror (FILE *);
241 void clearerr (FILE *);
242 FILE *freopen(const char *fn, const char *mode, FILE *fp);
243 //FILE *_freopen_r(struct _reent *PTR, const char *fn, const char *mode, FILE *fp);
244
245 extern int fflush (FILE *FP);
246 extern int fputs (const char *S, FILE *FP);
247 extern int fputc (int CH, FILE *FP);
248
249 //int printf(const char *format, ...);
250 int fprintf(FILE *stream, const char *format, ...);
251 //int sprintf(char *str, const char *format, ...);
252 //int snprintf(char *str, size_t size, const char *format, ...);
253 //int vfprintf(FILE * restrict stream, const char * restrict format, va_list ap);
254 //int vsprintf(char * restrict str, const char * restrict format, va_list ap);
255 //int vsnprintf(char * restrict str, size_t size, const char * restrict format, va_list ap);
256 int vsscanf (const char *s, const char *format, va_list param);
257
258 ///////////////////// string ////////////////////
259 char *strerror(int ERRNUM);
260
261 ///////////////////// ctype.h ////////////////////
262 extern int isascii(int C);
263
264 ///////////////////// stdlib ////////////////////
265 void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
266 void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *));
267 //int heapsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
268 //int mergesort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
269 void *bsearch(const void *key, const void *base, size_t nmemb,size_t size, int (*compar)(const void *, const void *));
270
271 char *getenv(const char *NAME);
272
273 double atof(const char *S);
274 double strtod(const char *STR, char **TAIL);
275 double _strtod_r(void *REENT, const char *STR, char **TAIL);
276
277 ///////////////////// math.h ////////////////////
278 #define __IMPORT
279
280 union __dmath
281 {
282 unsigned long i[2];
283 double d;
284 };
285
286 union __fmath
287 {
288 unsigned long i[1];
289 float f;
290 };
291
292 union __ldmath
293 {
294 unsigned long i[4];
295 long double ld;
296 };
297 #if defined(__GNUC__) && \
298 ( (__GNUC__ >= 4) || \
299 ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
300
301 /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
302
303 #ifndef HUGE_VAL
304 #define HUGE_VAL (__builtin_huge_val())
305 #endif
306
307 #ifndef HUGE_VALF
308 #define HUGE_VALF (__builtin_huge_valf())
309 #endif
310
311 #ifndef HUGE_VALL
312 #define HUGE_VALL (__builtin_huge_vall())
313 #endif
314
315 #else /* !gcc >= 3.3 */
316
317 /* No builtins. Use floating-point unions instead. Declare as an array
318 without bounds so no matter what small data support a port and/or
319 library has, the reference will be via the general method for accessing
320 globals. */
321
322 #ifndef HUGE_VAL
323 extern __IMPORT const union __dmath __infinity[];
324 #define HUGE_VAL (__infinity[0].d)
325 #endif
326
327 #ifndef HUGE_VALF
328 extern __IMPORT const union __fmath __infinityf[];
329 #define HUGE_VALF (__infinityf[0].f)
330 #endif
331
332 #ifndef HUGE_VALL
333 extern __IMPORT const union __ldmath __infinityld[];
334 #define HUGE_VALL (__infinityld[0].ld)
335 #endif
336
337 #endif /* !gcc >= 3.3 */
338 #undef __IMPORT
339
340 ///////////////////// PalmOS6 ////////////////////
341 #define status_t Err
342
343 // TimeMgr.h
344 time_t SysTimeToMilliSecs(time_t systime);
345 time_t SysTimeInSecs(time_t secs);
346
347 ///////////////////// END ////////////////////
348 #ifdef __cplusplus
349 }
350 #endif
351
352 #endif // __WXPALMOS5__
353
354 ///////////////////// wctype.h ////////////////////
355 extern int iswalnum(wint_t C);
356 extern int iswalpha(wint_t C);
357 extern int iswcntrl(wint_t C);
358 extern int iswdigit(wint_t C);
359 extern int iswgraph(wint_t C);
360 extern int iswlower(wint_t C);
361 extern int iswprint(wint_t C);
362 extern int iswpunct(wint_t C);
363 extern int iswspace(wint_t C);
364 extern int iswupper(wint_t C);
365 extern int iswxdigit(wint_t C);
366
367 extern wint_t towlower(wint_t C);
368 extern wint_t towupper(wint_t C);
369 extern size_t wcsftime(wchar_t *strDest, size_t maxsize, const wchar_t *format, const struct tm *timeptr);
370
371 size_t wcslen (const wchar_t * str);
372 wchar_t * wcscpy (wchar_t * dst, const wchar_t * src);
373 wchar_t * wcsncpy (wchar_t * dst, const wchar_t * src, size_t n);
374 wchar_t * wcscat (wchar_t * dst, const wchar_t * src);
375 wchar_t * wcsncat (wchar_t * dst, const wchar_t * src, size_t n);
376 int wcscmp (const wchar_t * str1, const wchar_t * str2);
377 int wcsncmp (const wchar_t * str1, const wchar_t * str2, size_t n);
378 wchar_t * wcschr (const wchar_t * str, const wchar_t chr);
379 int wcscoll (const wchar_t *str1, const wchar_t * str2);
380 size_t wcsxfrm (wchar_t * str1, const wchar_t * str2, size_t n);
381 wchar_t * wcsrchr (const wchar_t * str, wchar_t chr);
382 wchar_t * wcspbrk (const wchar_t * str, const wchar_t * set);
383 size_t wcsspn (const wchar_t * str, const wchar_t * set);
384 size_t wcscspn (const wchar_t * str, const wchar_t * set);
385 wchar_t * wcsstr (const wchar_t * str, const wchar_t * pat);
386 wchar_t * wcstok (wchar_t * str, const wchar_t * set, wchar_t ** );
387
388 long wcstol (const wchar_t * str, wchar_t ** end, int base);
389 unsigned long wcstoul (const wchar_t * a, wchar_t ** b, int c);
390 double wcstod (const wchar_t * a, wchar_t ** b);
391
392 char * setlocale (int category, const char *locale);
393
394 _PSF_END_EXTERN_C
395
396 #endif // _PALMOS_STDIO_FAKE_H