]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/missing.h
1 /******************************************************************************
2 * Name: include/wx/palmos/missing.h
3 * Purpose: the missing declarations for wxPalm
8 * Copyright: (c) 2007 Yunhui Fu
9 * Licence: wxWindows licence
10 ******************************************************************************/
12 #ifndef _PALMOS_STDIO_FAKE_H
13 #define _PALMOS_STDIO_FAKE_H
19 #include <PalmTypes.h>
20 #include <MemoryMgr.h> // Core/System/
21 #include <StringMgr.h> // Core/System/
22 #include <UIResources.h> // alertRscType,MenuRscType
27 #define _PSF_BEGIN_EXTERN_C extern "C" {
28 #define _PSF_END_EXTERN_C }
30 #define _PSF_BEGIN_EXTERN_C
31 #define _PSF_END_EXTERN_C
35 #include <wchar.h> // wint_t
36 #include <unistd.h> // access(), rmdir()
38 #include <StatusBar.h>
40 #include <PalmTypesCompatibility.h> // UInt8,UInt16,...
42 #if !defined(__MWERKS__)
43 #include <PenInputMgr.h>
46 #define uint32_t UInt32
47 #define uint16_t UInt16
49 #endif // __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
75 #define ErrFatalErrorInContext(fileName, lineNum, errMsg) ErrDisplayFileLineMsg(fileName, lineNum, errMsg)
76 #endif // __WXPALMOS6__
82 #if defined(__MWERKS__)
83 //#include <unix_stdarg.h>
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))
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)))
101 #include "sections.h"
104 #define int16_t short
105 #define int64_t long long
106 #define uint64_t unsigned int64_t
112 #define size_t uint32_t
113 #define off_t ssize_t
119 #define malloc(x) MemPtrNew(x)
120 #define free(x) MemPtrFree(x)
121 void * realloc (void *p
, size_t newsize
);
123 char * strdup (const char *old
);
125 // copy from Core/System/Unix/unix_stdio.h
127 #define sprintf StrPrintF
128 #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z)
130 int vsprintf(char *, const char *, _Va_list
);
132 int sscanf(const char *, const char *, ...);
134 ///////////////////// time ////////////////////
135 #define time_t uint64_t
136 time_t time(time_t *T
);
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
);
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
);
159 extern time_t mktime (struct tm
*TIMP
);
160 double difftime (time_t TIM1
, time_t TIM2
);
162 char *ctime(const time_t *CLOCK
);
163 char *ctime_r(const time_t *CLOCK
, char *BUF
);
165 //#define HAVE_STRFTIME 1
166 extern size_t strftime(char *S
, size_t MAXSIZE
, const char *FORMAT
, const struct tm
*TIMP
);
168 ///////////////////// locale.h ////////////////////
174 char *int_curr_symbol
;
175 char *currency_symbol
;
176 char *mon_decimal_point
;
177 char *mon_thousands_sep
;
181 char int_frac_digits
;
190 char *setlocale(int CATEGORY
, const char *LOCALE
);
191 struct lconv
*localeconv(void);
193 char *_setlocale_r(void *REENT
, int CATEGORY
, const char *LOCALE
);
194 struct lconv
*_localeconv_r(void *REENT
);
195 ///////////////////// stdlib.h ////////////////////
197 #if !defined(__MWERKS__)
198 #if !defined(__WCHAR_TYPE__) || \
199 (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
201 #else /* __WCHAR_TYPE__ and gcc < 2.96 */
202 #define wchar_t __WCHAR_TYPE__
203 #endif /* __WCHAR_TYPE__ */
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
);
214 ///////////////////// fcntl.h ////////////////////
215 #define O_RDONLY 0x01
216 #define O_WRONLY 0x02
218 #define O_APPEND 0x08
225 int open (const char*, int, ...);
226 int read (int, void*, unsigned int);
227 int write (int, const void*, unsigned int);
229 long lseek (int, long, int);
231 ///////////////////// stdio.h ////////////////////
232 int remove(const char *FILENAME
);
233 int rename(const char *OLD
, const char *NEW
);
235 ///////////////////// unistd.h ////////////////////
236 int access (const char *path
, int amode
);
237 int rmdir (const char *path
);
239 ///////////////////// FILE ////////////////////
241 #define NULL ((void *)(0))
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 */
256 FILE * fopen (const char *_name
, const char *_type
);
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 *);
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);
268 extern int fflush (FILE *FP
);
269 extern int fputs (const char *S
, FILE *FP
);
270 extern int fputc (int CH
, FILE *FP
);
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
);
281 ///////////////////// string ////////////////////
282 char *strerror(int ERRNUM
);
284 ///////////////////// ctype.h ////////////////////
285 extern int isascii(int C
);
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 *));
294 char *getenv(const char *NAME
);
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
);
300 ///////////////////// math.h ////////////////////
320 #if defined(__GNUC__) && \
321 ( (__GNUC__ >= 4) || \
322 ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
324 /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
327 #define HUGE_VAL (__builtin_huge_val())
331 #define HUGE_VALF (__builtin_huge_valf())
335 #define HUGE_VALL (__builtin_huge_vall())
338 #else /* !gcc >= 3.3 */
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
346 extern __IMPORT
const union __dmath __infinity
[];
347 #define HUGE_VAL (__infinity[0].d)
351 extern __IMPORT
const union __fmath __infinityf
[];
352 #define HUGE_VALF (__infinityf[0].f)
356 extern __IMPORT
const union __ldmath __infinityld
[];
357 #define HUGE_VALL (__infinityld[0].ld)
360 #endif /* !gcc >= 3.3 */
363 ///////////////////// PalmOS6 ////////////////////
367 time_t SysTimeToMilliSecs(time_t systime
);
368 time_t SysTimeInSecs(time_t secs
);
370 ///////////////////// END ////////////////////
372 #endif // __WXPALMOS5__
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
);
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
);
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 ** );
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
);
412 char * setlocale (int category
, const char *locale
);
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
);
421 //#define isalpha(a) TxtCharIsAlpha(a)
422 //TxtCharIsCntrl TxtCharIsDelim TxtCharIsDigit TxtCharIsGraph TxtCharIsHardKey TxtCharIsHex TxtCharIsLower TxtCharIsPrint TxtCharIsPunct TxtCharIsSpace TxtCharIsUpper
428 #endif // _PALMOS_STDIO_FAKE_H