]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/missing.h
1 #ifndef _PALMOS_STDIO_FAKE_H
2 #define _PALMOS_STDIO_FAKE_H
9 #include <MemoryMgr.h> // Core/System/
10 #include <StringMgr.h> // Core/System/
11 #include <UIResources.h> // alertRscType,MenuRscType
14 #define _PSF_BEGIN_EXTERN_C extern "C" {
15 #define _PSF_END_EXTERN_C }
17 #define _PSF_BEGIN_EXTERN_C
18 #define _PSF_END_EXTERN_C
22 #include <wchar.h> // wint_t
23 #include <unistd.h> // access(), rmdir()
25 #include <StatusBar.h>
28 #if !defined(__MWERKS__)
29 #include <PenInputMgr.h>
32 #define uint32_t UInt32
33 #define uint16_t UInt16
35 #endif // __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__
52 #if defined(__MWERKS__)
53 //#include <unix_stdarg.h>
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))
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)))
74 #define int64_t long long
75 #define uint64_t unsigned int64_t
77 #define wchar_t uint16_t
82 #define size_t uint32_t
89 #define malloc(x) MemPtrNew(x)
90 #define free(x) MemPtrFree(x)
91 void * realloc (void *p
, size_t newsize
);
93 char * strdup (const char *old
);
95 // copy from Core/System/Unix/unix_stdio.h
97 #define sprintf StrPrintF
98 #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z)
100 int vsprintf(char *, const char *, _Va_list
);
102 int sscanf(const char *, const char *, ...);
104 ///////////////////// time ////////////////////
105 #define time_t uint64_t
106 time_t time(time_t *T
);
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
);
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
);
141 extern time_t mktime (struct tm
*TIMP
);
142 double difftime (time_t TIM1
, time_t TIM2
);
144 char *ctime(const time_t *CLOCK
);
145 char *ctime_r(const time_t *CLOCK
, char *BUF
);
147 //#define HAVE_STRFTIME 1
148 extern size_t strftime(char *S
, size_t MAXSIZE
, const char *FORMAT
, const struct tm
*TIMP
);
150 ///////////////////// locale.h ////////////////////
156 char *int_curr_symbol
;
157 char *currency_symbol
;
158 char *mon_decimal_point
;
159 char *mon_thousands_sep
;
163 char int_frac_digits
;
172 char *setlocale(int CATEGORY
, const char *LOCALE
);
173 struct lconv
*localeconv(void);
175 char *_setlocale_r(void *REENT
, int CATEGORY
, const char *LOCALE
);
176 struct lconv
*_localeconv_r(void *REENT
);
177 ///////////////////// stdlib.h ////////////////////
179 #if !defined(__MWERKS__)
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
);
191 ///////////////////// fcntl.h ////////////////////
192 #define O_RDONLY 0x01
193 #define O_WRONLY 0x02
195 #define O_APPEND 0x08
202 int open (const char*, int, ...);
203 int read (int, void*, unsigned int);
204 int write (int, const void*, unsigned int);
206 long lseek (int, long, int);
208 ///////////////////// stdio.h ////////////////////
209 int remove(const char *FILENAME
);
210 int rename(const char *OLD
, const char *NEW
);
212 ///////////////////// unistd.h ////////////////////
213 int access (const char *path
, int amode
);
214 int rmdir (const char *path
);
216 ///////////////////// FILE ////////////////////
218 #define NULL ((void *)(0))
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 */
233 FILE * fopen (const char *_name
, const char *_type
);
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 *);
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);
245 extern int fflush (FILE *FP
);
246 extern int fputs (const char *S
, FILE *FP
);
247 extern int fputc (int CH
, FILE *FP
);
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
);
258 ///////////////////// string ////////////////////
259 char *strerror(int ERRNUM
);
261 ///////////////////// ctype.h ////////////////////
262 extern int isascii(int C
);
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 *));
271 char *getenv(const char *NAME
);
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
);
277 ///////////////////// math.h ////////////////////
297 #if defined(__GNUC__) && \
298 ( (__GNUC__ >= 4) || \
299 ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
301 /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
304 #define HUGE_VAL (__builtin_huge_val())
308 #define HUGE_VALF (__builtin_huge_valf())
312 #define HUGE_VALL (__builtin_huge_vall())
315 #else /* !gcc >= 3.3 */
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
323 extern __IMPORT
const union __dmath __infinity
[];
324 #define HUGE_VAL (__infinity[0].d)
328 extern __IMPORT
const union __fmath __infinityf
[];
329 #define HUGE_VALF (__infinityf[0].f)
333 extern __IMPORT
const union __ldmath __infinityld
[];
334 #define HUGE_VALL (__infinityld[0].ld)
337 #endif /* !gcc >= 3.3 */
340 ///////////////////// PalmOS6 ////////////////////
344 time_t SysTimeToMilliSecs(time_t systime
);
345 time_t SysTimeInSecs(time_t secs
);
347 ///////////////////// END ////////////////////
352 #endif // __WXPALMOS5__
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
);
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
);
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 ** );
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
);
392 char * setlocale (int category
, const char *locale
);
396 #endif // _PALMOS_STDIO_FAKE_H