Hi

At Wed, 07 Jul 1999 11:00:55 -0700,
 Christoph Toshok <[EMAIL PROTECTED]>  wrote ...
> Makoto Kato wrote:
> 
> > Are anyone porting to BeOS?
> 
> I actually started doing a port the other night.  it shouldn't be too
> terribly hard.  the code that we need for mutex's/cvars/dlls can be
> gleaned from mozilla..  also, the xptcall code for x86 works on beos now
> too (xptcall is mozilla's version of libffi.)

Can you marge the following code to currect cvs? 

---------------------------------------------------------------------
diff -urN japhar.org/arch/dynamic_loading.c japhar/arch/dynamic_loading.c
--- japhar.org/arch/dynamic_loading.c   Tue May 25 19:31:37 1999
+++ japhar/arch/dynamic_loading.c       Thu Jul  8 23:36:31 1999
@@ -42,6 +42,9 @@
 #if defined(HAVE_WINDOWS_H)
 #include <windows.h>
 #endif
+#if defined(BEOS)
+#include <be/kernel/image.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -74,11 +77,18 @@
 #  define DLL_PATH_SEPARATOR ';'
 #  define DLL_SLASH "\\"
 #  define DLL_ERRORSTR "[ I have no idea! ]"
+#elif defined(HAVE_LOAD_ADD_ON) /* && defined(HAVE_UNLOAD_ADD_ON) && 
+defined(HAVE_GET_IMAGE_SYMBOL) */
+#  define HAVE_BEOS_DLL
+#  define DLL_ENDING ".so"
+#  define DLL_PATH_ENV "LIBRARY_PATH"
+#  define DLL_PATH_SEPARATOR ':'
+#  define DLL_SLASH "/"
+#  define DLL_ERRORSTR "[ I have no idea! ]"
 #else
 #  error "Unsupported DLL API.  Port me"
 #endif
 
-#if (!defined(HAVE_UNIX_DLL) && !defined(HAVE_HPUX_DLL) && !defined(HAVE_WIN32_DLL)) 
/*|| defined PROFILING*/
+#if (!defined(HAVE_UNIX_DLL) && !defined(HAVE_HPUX_DLL) && !defined(HAVE_WIN32_DLL) 
+&& !defined(HAVE_BEOS_DLL)) /*|| defined PROFILING*/
 #undef USE_DLL
 #else
 #  ifndef USE_DLL
@@ -222,6 +232,8 @@
   handle = shl_load(lib_path, BIND_DEFERRED, 0L);
 #elif defined(HAVE_WIN32_DLL)
   handle = LoadLibrary(lib_path);
+#elif defined(HAVE_BEOS_DLL)
+  handle = (DLL_LibHandle) load_add_on(lib_path);
 #else
 #  error "Port me"
 #endif
@@ -398,6 +410,8 @@
   close_val = shl_unload(handle);
 #elif defined(HAVE_WIN32_DLL)
   close_val = FreeLibrary(handle);
+#elif defined(HAVE_BEOS_DLL)
+  close_val = unload_add_on((image_id) handle);
 #else
 #  error "Port me!"
 #endif
@@ -440,6 +454,12 @@
   }
 #elif defined(HAVE_WIN32_DLL)
   return GetProcAddress(handle, buf);
+#elif defined(HAVE_BEOS_DLL)
+  {
+    void *func = NULL;
+    get_image_symbol((image_id) handle, buf, B_SYMBOL_TYPE_TEXT, &func);
+    return func;
+  }
 #else
 #  error "Port me!"
 #endif
@@ -476,6 +496,9 @@
 #elif defined(HAVE_WIN32_DLL)
       handle = GetModuleHandle(NULL);
       add_to_library_cache ("JapharJVM.dll", GetModuleHandle("JapharJVM"));
+#elif defined(HAVE_BEOS_DLL)
+      /* I have no idea.  Let me know good idea! */ 
+      handle = -1;
 #else
 #  error "port me"
 #endif
diff -urN japhar.org/arch/scandir.c japhar/arch/scandir.c
--- japhar.org/arch/scandir.c   Tue May 25 19:31:40 1999
+++ japhar/arch/scandir.c       Thu Jul  8 23:59:16 1999
@@ -135,7 +135,15 @@
 
   names = malloc(sizeof(struct dirent *) * count);
 
+#ifndef BEOS
   seekdir(d, start);
+#else
+  /* BeOS don't have seekdir() function */
+  closedir(d);
+  d = opendir(dir);
+  if (NULL == d)
+    return -1;
+#endif
 
   while (NULL != (current = readdir(d))) {
     if ( NULL == select || select(current) ) {
diff -urN japhar.org/configure.in japhar/configure.in
--- japhar.org/configure.in     Mon Jul  5 14:07:23 1999
+++ japhar/configure.in Thu Jul  8 23:24:40 1999
@@ -66,6 +66,7 @@
   i386-*-gnu*)     OS_DEFINE="-DHURD -D_GNU_SOURCE";;
   *-*-linux*)      OS_DEFINE=-DLINUX;;
   mips-sgi-irix6*) OS_DEFINE=-DIRIX;;
+  *-*-beos*)       OS_DEFINE=-DBEOS;;
 esac
 
 dnl
---------------------------------------------------------------------


----------
  Makoto Kato
    mailto:[EMAIL PROTECTED]     ICQ No.14395562
    http://hp.vector.co.jp/authors/VA008030/

Reply via email to