From 4474d1cd270c86bd15f832eb974065277897d966 Mon Sep 17 00:00:00 2001 From: Zoltán Mizsei Date: Wed, 1 May 2019 08:47:54 +0200 Subject: Add Haiku support --- src/StormPort.h | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/StormPort.h b/src/StormPort.h index 1da974b..c842a8a 100644 --- a/src/StormPort.h +++ b/src/StormPort.h @@ -81,7 +81,7 @@ #if (__ppc__ == 1) || (__POWERPC__ == 1) || (_ARCH_PPC == 1) #include #include - #endif + #endif #define PKEXPORT #define __SYS_ZLIB @@ -96,6 +96,31 @@ #endif +#if !defined(PLATFORM_DEFINED) && defined(__HAIKU__) + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #ifndef __BIG_ENDIAN__ + #define PLATFORM_LITTLE_ENDIAN + #endif + + #define PLATFORM_HAIKU + #define PLATFORM_DEFINED // The platform is known now + +#endif + //----------------------------------------------------------------------------- // Assumption: we are not on Windows nor Macintosh, so this must be linux *grin* @@ -165,8 +190,8 @@ #ifndef _countof #define _countof(x) (sizeof(x) / sizeof(x[0])) #endif - - #define WINAPI + + #define WINAPI #define FILE_BEGIN SEEK_SET #define FILE_CURRENT SEEK_CUR @@ -193,7 +218,7 @@ #endif // !PLATFORM_WINDOWS // 64-bit calls are supplied by "normal" calls on Mac -#if defined(PLATFORM_MAC) +#if defined(PLATFORM_MAC) || defined(PLATFORM_HAIKU) #define stat64 stat #define fstat64 fstat #define lseek64 lseek @@ -201,9 +226,9 @@ #define off64_t off_t #define O_LARGEFILE 0 #endif - + // Platform-specific error codes for UNIX-based platforms -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU) #define ERROR_SUCCESS 0 #define ERROR_FILE_NOT_FOUND ENOENT #define ERROR_ACCESS_DENIED EPERM -- cgit v1.2.3