Skip to content

Commit

Permalink
More BeOS wankery.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Dec 13, 2006
1 parent 1bbbba1 commit e386bf5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -37,8 +37,9 @@ IF(MACOSX)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} "-framework Carbon")
ENDIF(MACOSX)

# !!! FIXME: Workaround for lua issue...fix this better.
IF(BEOS)
ADD_DEFINITIONS(-DPLATFORM_BEOS=1)
# !!! FIXME: Workaround for lua issue...fix this better.
ADD_DEFINITIONS(-D_setjmp=setjmp)
ADD_DEFINITIONS(-D_longjmp=longjmp)
ENDIF(BEOS)
Expand Down
2 changes: 1 addition & 1 deletion fileio.c
Expand Up @@ -4,7 +4,7 @@
#include "fileio.h"
#include "platform.h"

#ifdef __BEOS__ // !!! FIXME
#if PLATFORM_BEOS // !!! FIXME
#define realpath(x,y) NULL
#endif

Expand Down
2 changes: 2 additions & 0 deletions platform.h
Expand Up @@ -57,6 +57,8 @@ boolean MojoPlatform_osVersion(char *buf, size_t len);
#define PLATFORM_NAME "macosx"
#elif PLATFORM_UNIX
#define PLATFORM_NAME "unix"
#elif PLATFORM_BEOS
#define PLATFORM_NAME "beos"
#else
#error Unknown platform.
#endif
Expand Down
28 changes: 22 additions & 6 deletions platform/unix.c
Expand Up @@ -11,14 +11,29 @@
#include <time.h>
#include <unistd.h>

#if !__BEOS__
#if !PLATFORM_BEOS
#include <dlfcn.h>
#else
#include <be/kernel/image.h>
#endif

#include "../platform.h"


#if PLATFORM_BEOS
// BeOS headers conflict badly with MojoSetup, so just chisel in the things
// we specifically need...
typedef int32 image_id;
typedef int32 status_t;
extern __declspec(dllimport) image_id load_add_on(const char *path);
extern __declspec(dllimport) status_t unload_add_on(image_id imid);
extern __declspec(dllimport) status_t get_image_symbol(image_id imid,
const char *name, int32 sclass, void **ptr);

static void *beos_dlopen(const char *fname)
{
return (void *) load_add_on(fname);
const image_id lib = load_add_on(fname);
if (lib < 0)
return NULL;
return (void *) lib;
} // beos_dlopen

static void *beos_dlsym(void *lib, const char *sym)
Expand All @@ -37,10 +52,9 @@ static void beos_dlclose(void *lib)
#define dlopen(fname) beos_dlopen(fname)
#define dlsym(lib, sym) beos_dlsym(lib, sym)
#define dlclose(lib) beos_dlclose(lib)
#endif // __BEOS__
#endif // PLATFORM_BEOS


#include "../platform.h"

static struct timeval startup_time;

Expand Down Expand Up @@ -158,6 +172,8 @@ boolean MojoPlatform_osType(char *buf, size_t len)
{
#if PLATFORM_MACOSX
xstrncpy(buf, "macosx", len);
#elif PLATFORM_BEOS
xstrncpy(buf, "beos", len); // !!! FIXME: zeta? haiku?
#elif defined(linux) || defined(__linux) || defined(__linux__)
xstrncpy(buf, "linux", len);
#elif defined(__FreeBSD__) || defined(__DragonFly__)
Expand Down
2 changes: 1 addition & 1 deletion universal.h
Expand Up @@ -163,7 +163,7 @@ extern MojoSetupEntryPoints GEntryPoints;


#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if ((defined _MSC_VER) || (__BEOS__))
#if ((defined _MSC_VER) || (PLATFORM_BEOS))
#define __EXPORT__ __declspec(dllexport)
#elif (__GNUC__ >= 3)
#define __EXPORT__ __attribute__((visibility("default")))
Expand Down

0 comments on commit e386bf5

Please sign in to comment.