diff options
author | Chris Apers | 2005-09-03 17:14:41 +0000 |
---|---|---|
committer | Chris Apers | 2005-09-03 17:14:41 +0000 |
commit | 20e088801e17fbb0b5176764cbcd6fb1f8475761 (patch) | |
tree | 1c27c9f3773c85e106c1e9a8413f20142dc97ca7 /backends/PalmOS/Src/missing | |
parent | 80a5644c790a0676c3e11a56106a47b0151da94a (diff) | |
download | scummvm-rg350-20e088801e17fbb0b5176764cbcd6fb1f8475761.tar.gz scummvm-rg350-20e088801e17fbb0b5176764cbcd6fb1f8475761.tar.bz2 scummvm-rg350-20e088801e17fbb0b5176764cbcd6fb1f8475761.zip |
More ARM stuffs
svn-id: r18754
Diffstat (limited to 'backends/PalmOS/Src/missing')
-rw-r--r-- | backends/PalmOS/Src/missing/_stdlib.cpp | 22 | ||||
-rw-r--r-- | backends/PalmOS/Src/missing/math.h | 6 | ||||
-rw-r--r-- | backends/PalmOS/Src/missing/stdlib.h | 19 | ||||
-rw-r--r-- | backends/PalmOS/Src/missing/string.h | 9 | ||||
-rw-r--r-- | backends/PalmOS/Src/missing/time.h | 2 | ||||
-rw-r--r-- | backends/PalmOS/Src/missing/unistd.h | 6 |
6 files changed, 47 insertions, 17 deletions
diff --git a/backends/PalmOS/Src/missing/_stdlib.cpp b/backends/PalmOS/Src/missing/_stdlib.cpp index e91f9eb93c..e116aa0f06 100644 --- a/backends/PalmOS/Src/missing/_stdlib.cpp +++ b/backends/PalmOS/Src/missing/_stdlib.cpp @@ -23,10 +23,15 @@ #include <stdlib.h> void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int (*compar)(const void *, const void *)) { +#ifdef PALMOS_68K Int32 position; - if (SysBinarySearch(base, nmemb, size, (SearchFuncPtr)compar, key, 0, &position, true)) return (void *)((UInt32)base + size * position); +#else + for (int i = 0; i < nmemb; i++) + if (compar(key, (void*)((UInt32)base + size * i)) == 0) + return (void*)((UInt32)base + size * i); +#endif return NULL; } @@ -34,11 +39,11 @@ void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int long strtol(const char *s, char **endptr, int base) { // WARNING : only base = 10 supported long val = StrAToI(s); - + if (endptr) { Char str[maxStrIToALen]; StrIToA(str, val); - + if (StrNCompare(s, str, StrLen(str)) == 0) *endptr = (char *)s + StrLen(str); } @@ -65,18 +70,18 @@ Err free(MemPtr memP) { } MemPtr realloc(MemPtr oldP, UInt32 size) { - + if (oldP != NULL) if (MemPtrResize(oldP,size) == 0) return oldP; MemPtr newP = MemPtrNew(size); - + if (oldP!=NULL) { MemMove(newP,oldP,MemPtrSize(oldP)); MemPtrFree(oldP); - } + } return newP; } @@ -84,8 +89,13 @@ ErrJumpBuf stdlib_errJumpBuf; #define ERR_MAGIC 0xDADA void exit(Int16 status) { +#ifdef PALMOS_68K EventType event; event.eType = keyDownEvent; +#else + SysEventType event; + event.eType = sysEventKeyDownEvent; +#endif event.data.keyDown.chr = vchrLaunch; event.data.keyDown.modifiers = commandKeyMask; EvtAddUniqueEventToQueue(&event, 0, true); diff --git a/backends/PalmOS/Src/missing/math.h b/backends/PalmOS/Src/missing/math.h index aac0ad60ff..aa3dc8e02d 100644 --- a/backends/PalmOS/Src/missing/math.h +++ b/backends/PalmOS/Src/missing/math.h @@ -23,7 +23,11 @@ #ifndef __MATH_H__ #define __MATH_H__ -#include "mathlib.h" +#ifndef PALMOS_ARM +# include "mathlib.h" +#else +# include "matharm.h" +#endif #ifndef M_PI # define M_PI 3.14159265358979323846 diff --git a/backends/PalmOS/Src/missing/stdlib.h b/backends/PalmOS/Src/missing/stdlib.h index 56a485f487..76395b0ae0 100644 --- a/backends/PalmOS/Src/missing/stdlib.h +++ b/backends/PalmOS/Src/missing/stdlib.h @@ -23,8 +23,15 @@ #ifndef STDLIB_H #define STDLIB_H -#include <PalmOS.h> +#include "palmversion.h" + +#ifdef PALMOS_68K #include "MemGlue.h" +#endif + +#if defined(COMPILE_ZODIAC) && defined(PALMOS_ARM) +#define MemGluePtrNew MemPtrNew +#endif extern ErrJumpBuf stdlib_errJumpBuf; @@ -34,11 +41,15 @@ extern ErrJumpBuf stdlib_errJumpBuf; #define atoi StrAToI #define atol StrAToI #define abs(a) ((a) < 0 ? -(a) : (a)) -//#define abs fabs #define malloc(a) MemGluePtrNew(a) -//#define free MemPtrFree -//#define strtol(a,b,c) StrAToI(a) + +#ifdef PALMOS_68K #define qsort(a,b,c,d) SysQSort((a), (b), (c), (CmpFuncPtr)(&d), 0); +#else +typedef int (*_compare_function)(const void*, const void*); +extern "C" void qsort(void * table_base, size_t num_members, size_t member_size, _compare_function compare_members); +#endif + #define rand() SysRandom(0) #define abort() #define strtoul(a,b,c) ((unsigned long)strtol(a,b,c)) diff --git a/backends/PalmOS/Src/missing/string.h b/backends/PalmOS/Src/missing/string.h index 230837d464..161400f601 100644 --- a/backends/PalmOS/Src/missing/string.h +++ b/backends/PalmOS/Src/missing/string.h @@ -19,8 +19,10 @@ * $Header$ * */ +#ifndef STRING_H +#define STRING_H -#include <PalmOS.h> +#include "palmversion.h" #define memcmp MemCmp #define memcpy MemMove @@ -38,6 +40,7 @@ #define strncmp StrNCompare #define strstr StrStr + void *memchr (const void *s, int c, UInt32 n); Char *strtok (Char *str, const Char *sep); Char *strrchr (const Char *s, int c); @@ -45,4 +48,6 @@ Char *strdup (const Char *strSource); Char *strpbrk (const Char *s1, const Char *s2); UInt32 strspn (const char *s1, const char *s2); -#define StrTok strtok
\ No newline at end of file +#define StrTok strtok + +#endif diff --git a/backends/PalmOS/Src/missing/time.h b/backends/PalmOS/Src/missing/time.h index d9312f493f..825482eeb3 100644 --- a/backends/PalmOS/Src/missing/time.h +++ b/backends/PalmOS/Src/missing/time.h @@ -23,7 +23,7 @@ #define __TIME_H__ -#include <PalmOS.h> +#include "palmversion.h" typedef UInt32 time_t; diff --git a/backends/PalmOS/Src/missing/unistd.h b/backends/PalmOS/Src/missing/unistd.h index ca43602c37..ab64869fcb 100644 --- a/backends/PalmOS/Src/missing/unistd.h +++ b/backends/PalmOS/Src/missing/unistd.h @@ -23,10 +23,10 @@ #ifndef __UNISTD_H__ #define __UNISTD_H__ -#include <PalmOS.h> +#include "palmversion.h" extern const Char *gUnistdCWD; -Char *getcwd(Char *buf, UInt32 size); +Char *getcwd(Char *buf, UInt32 size); -#endif
\ No newline at end of file +#endif |