Hi.

Here are some changes to source files (*.c *.h) I've had to do to get
(part of) Classpath's native code to compile on my system.

The worst problems were in "BigInteger.c":
- The use of "#define __USE_GNU" before "#include <stdio.h>" 
  caused all sorts of problems.
- Also, on my Debian potato system, I've had to change 
  "#include <gmp2/gmp.h>" to "#include <gmp.h>".

As far as I'm concerned, these fixes are in the public domain.  (IIRC,
the GNU guidelines do not require copyright assignment for minor
patches).

Pick the changes you like, and disregard those you don't (at your
risks;-).

Have fun!

Etienne
-- 
----------------------------------------------------------------------
Etienne M. Gagnon, M.Sc.                     e-mail: [EMAIL PROTECTED]
Author of SableVM:                             http://www.sablevm.org/
----------------------------------------------------------------------
Index: native/java.io/FileDescriptor.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.io/FileDescriptor.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- native/java.io/FileDescriptor.c     2000/06/14 06:44:57     1.1.1.1
+++ native/java.io/FileDescriptor.c     2000/06/16 01:32:48     1.3
@@ -33,6 +33,7 @@
 #include <unistd.h>
 
 #include <jni.h>
+#include "java_io_FileDescriptor.h"
 #include "javaio.h"
 
 /*************************************************************************/
Index: native/java.io/java_io_ObjectInputStream.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.io/java_io_ObjectInputStream.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- native/java.io/java_io_ObjectInputStream.c  2000/06/14 06:44:58     1.1.1.1
+++ native/java.io/java_io_ObjectInputStream.c  2000/06/16 01:32:48     1.3
@@ -43,9 +43,9 @@
                                      "()Ljava/lang/ClassLoader;" );
   
   if( id == NULL )
-    return;
+    return NULL;
   
-  (*env)->CallObjectMethod( env, loader, id );
+  return (*env)->CallObjectMethod( env, loader, id );
 }
 
 
Index: native/java.io/java_io_ObjectStreamClass.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.io/java_io_ObjectStreamClass.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- native/java.io/java_io_ObjectStreamClass.c  2000/06/14 06:44:58     1.1.1.1
+++ native/java.io/java_io_ObjectStreamClass.c  2000/06/16 01:32:48     1.3
@@ -25,6 +25,7 @@
 This exception does not however invalidate any other reasons why the
 executable file might be covered by the GNU General Public License. */
 
+#include <stddef.h>
  
 #include "java_io_ObjectStreamClass.h"
 
Index: native/java.io/javaio.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.io/javaio.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.io/javaio.c     2000/06/14 06:44:58     1.1.1.1
+++ native/java.io/javaio.c     2000/06/15 21:54:13     1.2
@@ -234,7 +234,7 @@
   jbyte *bufptr;
   int rc;
 
-  bufptr = (*env)->GetByteArrayElements(env, buf, 0);
+  bufptr = (*env)->GetByteArrayElements(env, buf, JNI_FALSE);
   if (!bufptr)
     {
       _javaio_ThrowException(env, "java/io/IOException", "Internal Error");
Index: native/java.io/javaio.h
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.io/javaio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.io/javaio.h     2000/06/14 06:44:58     1.1.1.1
+++ native/java.io/javaio.h     2000/06/15 21:54:13     1.2
@@ -28,6 +28,8 @@
 #ifndef JAVAIO_H_INCLUDED
 #define JAVAIO_H_INCLUDED
 
+#include <stddef.h>
+
 /*
  * Function Prototypes
  */
Index: native/java.lang/Double.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang/Double.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang/Double.c   2000/06/14 06:45:06     1.1.1.1
+++ native/java.lang/Double.c   2000/06/16 01:32:49     1.2
@@ -25,6 +25,7 @@
 executable file might be covered by the GNU General Public License. */
 
 
+#include <stdio.h>
 #include <config.h>
 #include <stdlib.h>  /* for strtod() */
 #include <math.h>  /* for HUGE_VAL */
Index: native/java.lang/Float.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang/Float.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang/Float.c    2000/06/14 06:45:06     1.1.1.1
+++ native/java.lang/Float.c    2000/06/16 01:32:49     1.2
@@ -24,7 +24,7 @@
 This exception does not however invalidate any other reasons why the
 executable file might be covered by the GNU General Public License. */
 
-
+#include <stdio.h>
 #include <config.h>
 #include <stdlib.h>  /* for strtod() */
 #include <math.h>  /* for HUGE_VAL */
Index: native/java.lang/acos.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang/acos.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang/acos.c     2000/06/14 06:45:07     1.1.1.1
+++ native/java.lang/acos.c     2000/06/16 01:32:49     1.2
@@ -35,6 +35,7 @@
  * Function needed: sqrt
  */
 
+#include <stddef.h>
 #include "fdlibm.h"
 
 static const jdouble 
Index: native/java.lang/asin.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang/asin.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang/asin.c     2000/06/14 06:45:07     1.1.1.1
+++ native/java.lang/asin.c     2000/06/16 01:32:49     1.2
@@ -42,6 +42,7 @@
  */
 
 
+#include <stddef.h>
 #include "fdlibm.h"
 
 static const jdouble 
Index: native/java.lang/pow.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang/pow.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang/pow.c      2000/06/14 06:45:12     1.1.1.1
+++ native/java.lang/pow.c      2000/06/16 01:32:49     1.2
@@ -56,6 +56,7 @@
  * to produce the hexadecimal values shown.
  */
 
+#include <stddef.h>
 #include "fdlibm.h"
 
 static const jdouble 
Index: native/java.lang.reflect/Array.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.lang.reflect/Array.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.lang.reflect/Array.c    2000/06/14 06:45:14     1.1.1.1
+++ native/java.lang.reflect/Array.c    2000/06/16 01:32:49     1.2
@@ -30,6 +30,7 @@
  * Version: 1.1.0
  * Date: 2 Jun 1998
  */
+#include <stddef.h>
 #include "java_lang_reflect_Array.h"
 
 /*
Index: native/java.math/BigInteger.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/java.math/BigInteger.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/java.math/BigInteger.c       2000/06/14 06:45:15     1.1.1.1
+++ native/java.math/BigInteger.c       2000/06/16 01:32:49     1.2
@@ -26,13 +26,13 @@
 
 
 #include <stdlib.h>
-#define __USE_GNU
 #include <stdio.h>
 #include <unistd.h>
 #include <endian.h>
-#include <gmp2/gmp.h>
 #include <math.h>
-#include "BigInteger.h"
+#define __USE_GNU 
+#include <gmp.h>
+#include "java_math_BigInteger.h"
 #include "native_state.h"
 
 /* maximum value a jdouble can hold */
Index: native/lib/jcl.c
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/lib/jcl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/lib/jcl.c    2000/06/14 06:45:18     1.1.1.1
+++ native/lib/jcl.c    2000/06/16 01:32:49     1.2
@@ -24,6 +24,7 @@
 This exception does not however invalidate any other reasons why the
 executable file might be covered by the GNU General Public License. */
 
+#include <stdio.h>
 #include <jcl.h>
 #include <malloc.h>
 
Index: native/lib/jcl.h
===================================================================
RCS file: /cvsroot/sablevm/sablepath/native/lib/jcl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- native/lib/jcl.h    2000/06/14 06:45:18     1.1.1.1
+++ native/lib/jcl.h    2000/06/16 01:32:49     1.2
@@ -27,6 +27,7 @@
 #ifndef __JCL_H__
 #define __JCL_H__
 
+#include <stddef.h>
 #include <jni.h>
 
 JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className);

Reply via email to