]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/missing.h
Remove "safety margin" from wxControl::Ellipsize().
[wxWidgets.git] / include / wx / palmos / missing.h
CommitLineData
624697a4
VZ
1/******************************************************************************
2 * Name: include/wx/palmos/missing.h
3 * Purpose: the missing declarations for wxPalm
4 * Author: Yunhui Fu
5 * Created: 2007-10-18
03647350 6 * Modified by:
624697a4
VZ
7 * RCS-ID: $Id$
8 * Copyright: (c) 2007 Yunhui Fu
9 * Licence: wxWindows licence
10 ******************************************************************************/
11
e2fc40b4
VZ
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
624697a4
VZ
23#include <ErrorMgr.h>
24#include <DataMgr.h>
e2fc40b4
VZ
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>
624697a4 40 #include <PalmTypesCompatibility.h> // UInt8,UInt16,...
e2fc40b4
VZ
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__
624697a4
VZ
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)
e2fc40b4
VZ
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)
624697a4
VZ
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)
e2fc40b4
VZ
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)
624697a4
VZ
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)
e2fc40b4
VZ
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
624697a4 86#if 1
e2fc40b4
VZ
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))
624697a4 94#define strcasecmp(x,y) StrCaselessCompare((x),(y))
e2fc40b4
VZ
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
e2fc40b4
VZ
108#endif
109#define wint_t int
110
111#define ssize_t long
112#define size_t uint32_t
624697a4 113#define off_t ssize_t
e2fc40b4
VZ
114
115#if 0
624697a4
VZ
116#undef malloc
117#undef realloc
118#undef free
e2fc40b4 119#define malloc(x) MemPtrNew(x)
624697a4 120#define free(x) MemPtrFree(x)
e2fc40b4
VZ
121void * realloc (void *p, size_t newsize);
122#endif
123char * strdup (const char *old);
124
125// copy from Core/System/Unix/unix_stdio.h
126#ifndef _STDLIB
624697a4
VZ
127 #define sprintf StrPrintF
128 #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z)
e2fc40b4 129#else
624697a4 130 int vsprintf(char *, const char *, _Va_list);
e2fc40b4
VZ
131#endif
132int sscanf(const char *, const char *, ...);
133
134///////////////////// time ////////////////////
135#define time_t uint64_t
136time_t time(time_t *T);
137
e2fc40b4 138struct tm {
624697a4
VZ
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;
e2fc40b4
VZ
149};
150
151#define HAVE_LOCALTIME_R 1
152extern struct tm *localtime (const time_t *CLOCK); // datetime.cpp: GetTmNow(void)
153extern struct tm *localtime_r (const time_t *CLOCK, struct tm *RES);
154
155#define HAVE_GMTIME_R 1
156extern struct tm *gmtime (const time_t *CLOCK);
157extern struct tm *gmtime_r (const time_t *CLOCK, struct tm *RES);
158
159extern time_t mktime (struct tm *TIMP);
160double difftime (time_t TIM1, time_t TIM2);
161
162char *ctime(const time_t *CLOCK);
163char *ctime_r(const time_t *CLOCK, char *BUF);
164
165//#define HAVE_STRFTIME 1
166extern size_t strftime(char *S, size_t MAXSIZE, const char *FORMAT, const struct tm *TIMP);
167
168///////////////////// locale.h ////////////////////
169struct 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};
190char *setlocale(int CATEGORY, const char *LOCALE);
191struct lconv *localeconv(void);
192
193char *_setlocale_r(void *REENT, int CATEGORY, const char *LOCALE);
194struct lconv *_localeconv_r(void *REENT);
195///////////////////// stdlib.h ////////////////////
196
197#if !defined(__MWERKS__)
624697a4
VZ
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__ */
e2fc40b4
VZ
204#endif
205int _watoi(wchar_t * nptr);
206long _watol(wchar_t * nptr);
207double _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))
211int mbstowcs(wchar_t *PWC, const char *S, size_t N);
212int wcstombs(const char *S, wchar_t *PWC, size_t N);
213
214///////////////////// fcntl.h ////////////////////
624697a4
VZ
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
e2fc40b4
VZ
222#define O_SYNC 0x80
223
224// io.h
225int open (const char*, int, ...);
226int read (int, void*, unsigned int);
227int write (int, const void*, unsigned int);
228int close (int);
229long lseek (int, long, int);
230
231///////////////////// stdio.h ////////////////////
232int remove(const char *FILENAME);
233int rename(const char *OLD, const char *NEW);
234
235///////////////////// unistd.h ////////////////////
236int access (const char *path, int amode);
237int 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
624697a4
VZ
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 */
e2fc40b4 255
624697a4
VZ
256FILE * fopen (const char *_name, const char *_type);
257int fclose (FILE *);
e2fc40b4 258size_t fread (void *buf, size_t _size, size_t _n, FILE *);
624697a4
VZ
259size_t fwrite (const void *buf , size_t _size, size_t _n, FILE *);
260int fseek (FILE *, long, int);
e2fc40b4 261long ftell ( FILE *);
624697a4
VZ
262int feof (FILE *);
263int ferror (FILE *);
e2fc40b4
VZ
264void clearerr (FILE *);
265FILE *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
268extern int fflush (FILE *FP);
269extern int fputs (const char *S, FILE *FP);
270extern int fputc (int CH, FILE *FP);
271
272//int printf(const char *format, ...);
273int 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);
279int vsscanf (const char *s, const char *format, va_list param);
280
281///////////////////// string ////////////////////
282char *strerror(int ERRNUM);
283
284///////////////////// ctype.h ////////////////////
285extern int isascii(int C);
286
287///////////////////// stdlib ////////////////////
288void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
289void 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 *));
292void *bsearch(const void *key, const void *base, size_t nmemb,size_t size, int (*compar)(const void *, const void *));
293
294char *getenv(const char *NAME);
295
296double atof(const char *S);
297double strtod(const char *STR, char **TAIL);
298double _strtod_r(void *REENT, const char *STR, char **TAIL);
299
300///////////////////// math.h ////////////////////
301#define __IMPORT
302
303union __dmath
304{
305 unsigned long i[2];
306 double d;
307};
03647350 308
e2fc40b4
VZ
309union __fmath
310{
311 unsigned long i[1];
312 float f;
313};
03647350 314
e2fc40b4
VZ
315union __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
03647350
VZ
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
e2fc40b4
VZ
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
367time_t SysTimeToMilliSecs(time_t systime);
368time_t SysTimeInSecs(time_t secs);
369
370///////////////////// END ////////////////////
e2fc40b4
VZ
371
372#endif // __WXPALMOS5__
373
374///////////////////// wctype.h ////////////////////
375extern int iswalnum(wint_t C);
376extern int iswalpha(wint_t C);
377extern int iswcntrl(wint_t C);
378extern int iswdigit(wint_t C);
379extern int iswgraph(wint_t C);
380extern int iswlower(wint_t C);
381extern int iswprint(wint_t C);
382extern int iswpunct(wint_t C);
383extern int iswspace(wint_t C);
384extern int iswupper(wint_t C);
385extern int iswxdigit(wint_t C);
386
387extern wint_t towlower(wint_t C);
388extern wint_t towupper(wint_t C);
389extern size_t wcsftime(wchar_t *strDest, size_t maxsize, const wchar_t *format, const struct tm *timeptr);
390
391size_t wcslen (const wchar_t * str);
392wchar_t * wcscpy (wchar_t * dst, const wchar_t * src);
393wchar_t * wcsncpy (wchar_t * dst, const wchar_t * src, size_t n);
394wchar_t * wcscat (wchar_t * dst, const wchar_t * src);
395wchar_t * wcsncat (wchar_t * dst, const wchar_t * src, size_t n);
396int wcscmp (const wchar_t * str1, const wchar_t * str2);
397int wcsncmp (const wchar_t * str1, const wchar_t * str2, size_t n);
398wchar_t * wcschr (const wchar_t * str, const wchar_t chr);
399int wcscoll (const wchar_t *str1, const wchar_t * str2);
400size_t wcsxfrm (wchar_t * str1, const wchar_t * str2, size_t n);
401wchar_t * wcsrchr (const wchar_t * str, wchar_t chr);
402wchar_t * wcspbrk (const wchar_t * str, const wchar_t * set);
403size_t wcsspn (const wchar_t * str, const wchar_t * set);
404size_t wcscspn (const wchar_t * str, const wchar_t * set);
405wchar_t * wcsstr (const wchar_t * str, const wchar_t * pat);
406wchar_t * wcstok (wchar_t * str, const wchar_t * set, wchar_t ** );
407
408long wcstol (const wchar_t * str, wchar_t ** end, int base);
409unsigned long wcstoul (const wchar_t * a, wchar_t ** b, int c);
410double wcstod (const wchar_t * a, wchar_t ** b);
411
412char * setlocale (int category, const char *locale);
413
624697a4
VZ
414#define O_BINARY 0x00 /* for DOS compability */
415extern int eof(int fd);
416//extern int remove(const char *fn);
417extern int access(const char *path, int amode);
418extern off_t lseek(int fildes, off_t offset, int whence);
419
03647350 420//TxtCharIsAlNum
624697a4 421//#define isalpha(a) TxtCharIsAlpha(a)
03647350 422//TxtCharIsCntrl TxtCharIsDelim TxtCharIsDigit TxtCharIsGraph TxtCharIsHardKey TxtCharIsHex TxtCharIsLower TxtCharIsPrint TxtCharIsPunct TxtCharIsSpace TxtCharIsUpper
624697a4
VZ
423
424#include "pfall.h"
425
e2fc40b4
VZ
426_PSF_END_EXTERN_C
427
428#endif // _PALMOS_STDIO_FAKE_H