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