aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZoltán Mizsei <zmizsei@extrowerk.com>2019-05-01 08:47:54 +0200
committerZoltán Mizsei <zmizsei@extrowerk.com>2019-05-01 08:47:54 +0200
commit4474d1cd270c86bd15f832eb974065277897d966 (patch)
tree8793fe691837f448c702c3df55584ed9c4b9b404 /src
parentf2c8d249607009a282904a43a4c4ba60922a92bb (diff)
Add Haiku support
Diffstat (limited to 'src')
-rw-r--r--src/StormPort.h37
1 files 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 <stdint.h>
#include <CoreFoundation/CFByteOrder.h>
- #endif
+ #endif
#define PKEXPORT
#define __SYS_ZLIB
@@ -96,6 +96,31 @@
#endif
+#if !defined(PLATFORM_DEFINED) && defined(__HAIKU__)
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include <string.h>
+ #include <ctype.h>
+ #include <assert.h>
+ #include <errno.h>
+
+ #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