00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INCL_PALM_ADAPTER
00022 #define INCL_PALM_ADAPTER
00023
00025 #include <unix_stdarg.h>
00026
00027 #include <PalmOS.h>
00028 #include <PalmTypes.h>
00029 #include <StringMgr.h>
00030 #include <DebugMgr.h>
00031
00032 #define EXTRA_SECTION_00 __attribute__ ((section ("c00")))
00033 #define EXTRA_SECTION_01 __attribute__ ((section ("c01")))
00034 #define EXTRA_SECTION_02 __attribute__ ((section ("c02")))
00035 #define EXTRA_SECTION_03 __attribute__ ((section ("c03")))
00036 #define EXTRA_SECTION_04 __attribute__ ((section ("c04")))
00037 #define EXTRA_SECTION_05 __attribute__ ((section ("c05")))
00038 #define EXTRA_SECTION_06 __attribute__ ((section ("c06")))
00039
00040 #define TEXT(t) t
00041 #define __declspec(ignore)
00042 #define __cdecl
00043 #define FALSE false
00044 #define TRUE true
00045 #define NO_STD_IO
00046
00047 #define WCHAR char
00048
00049 #define wcscat(s1, s2) StrCat(s1, s2)
00050 #define wcschr(s1, c1) StrChr(s1, c1)
00051 #define wcscmp(s1, s2) StrCompare(s1, s2)
00052 #define wcscpy(s1, s2) StrCopy(s1, s2)
00053 #define wcsncat(s1, s2, i1) StrNCat(s1, s2, i1)
00054 #define wcsncmp(s1, s2, i1) StrNCompare(s1, s2, i1)
00055 #define wcsncpy(s1, s2, i1) StrNCopy(s1, s2, i1)
00056 #define wcsstr(s1, s2) StrStr(s1, s2)
00057
00058 #define towlower(c1) tolower(c1)
00059 #define towupper(c1) toupper(c1)
00060
00061 #define atoi(s1) StrAToI(s1);
00062
00063 inline long wcstol(WCHAR* s1, WCHAR **endptr = NULL, int base = 10);
00064 inline void memcpy(WCHAR* p1, WCHAR* p2, unsigned long i1);
00065 inline void wcsprintf(WCHAR* s, WCHAR* format, ...);
00066 inline void wcstolwr(WCHAR* s);
00067 inline char toupper(char c);
00068 inline unsigned long time(void* ignored);
00069 inline unsigned long wcslen(const WCHAR* s);
00070
00071 inline long wcstol(WCHAR* s1, WCHAR **endptr = NULL, int base = 10) {
00072 return StrAToI(s1);
00073 }
00074
00075 inline void memcpy(WCHAR* p1, WCHAR* p2, unsigned long i1) {
00076 for (unsigned long i=0; i<i1; ++i) {
00077 *p1 = *p2;
00078 ++p1; ++p2;
00079 }
00080 }
00081
00082 inline void wcsprintf(WCHAR* s, WCHAR* format, ...) {
00083 va_list args;
00084
00085 va_start( args, format );
00086
00087 StrVPrintF(s, format, args);
00088
00089 va_end(args);
00090 }
00091
00092 inline const WCHAR* wcsrchr(const WCHAR* s, WCHAR c) {
00093 FrmCustomAlert(200, "wcsrchr", s, "");
00094 if (s == NULL) {
00095 return NULL;
00096 }
00097
00098 for (unsigned long i = wcslen(s)-1; i>=0; --i) {
00099 if (s[i] == c) {
00100 return &s[i];
00101 }
00102 }
00103
00104 return NULL;
00105 }
00106
00107 inline void wcstolwr(WCHAR* s) {
00108 WCHAR dest[StrLen(s)+1];
00109
00110 StrToLower(dest, s);
00111 StrCopy(s, dest);
00112 }
00113
00114 inline char tolower(char c) {
00115 return ((c >= 'A') && (c <= 'Z')) ? (c+32) : c;
00116 }
00117
00118 inline char toupper(char c) {
00119 return ((c >= 'a') && (c <= 'z')) ? (c-32) : c;
00120 }
00121
00122 inline unsigned long time(void* ignored) {
00123 return TimGetSeconds();
00124 }
00125
00126
00130 inline unsigned long wcslen(const WCHAR* s) {
00131 for (unsigned long l = 0; l<0xFFFF; ++l) {
00132 if (s[l] == 0) {
00133 return l;
00134 }
00135 }
00136
00137 return 0xFFFF;
00138 }
00139
00141 #endif