aboutsummaryrefslogtreecommitdiff
path: root/libjava/include
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/include')
-rw-r--r--libjava/include/config.h.in11
-rw-r--r--libjava/include/jni.h110
-rw-r--r--libjava/include/jvm.h7
3 files changed, 113 insertions, 15 deletions
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index 6c8b98f..b4a3c6d 100644
--- a/libjava/include/config.h.in
+++ b/libjava/include/config.h.in
@@ -148,8 +148,6 @@
/* Define if you have dladdr() */
#undef HAVE_DLADDR
-/* Define if yo have dlopen(). */
-#undef HAVE_DLOPEN
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
@@ -394,3 +392,12 @@
/* Define if struct hostent_data is defined in netdb.h */
#undef HAVE_STRUCT_HOSTENT_DATA
+/* Define if dlopen is available */
+#undef HAVE_DLOPEN
+
+/* Define if <inttypes.h> is available */
+#undef HAVE_INTTYPES_H
+
+/* Define if <inttypes.h> is available */
+#undef JV_HAVE_INTTYPES_H
+
diff --git a/libjava/include/jni.h b/libjava/include/jni.h
index 705eb37..830c025 100644
--- a/libjava/include/jni.h
+++ b/libjava/include/jni.h
@@ -14,14 +14,21 @@ details. */
#ifndef __GCJ_JNI_H__
#define __GCJ_JNI_H__
+#include <gcj/libgcj-config.h>
+
#include <stdarg.h>
#define _Jv_va_list va_list
-#ifdef __cplusplus
+#ifdef __GCJ_JNI_IMPL__
-/* This is wrong, because it pollutes the name-space too much! */
+/* If __GCJ_JNI_IMPL__ is defined, then we assume that we're building
+ libgcj itself, and we include headers which taint the namespace
+ more than is acceptable for the ordinary JNI user. */
#include <gcj/javaprims.h>
#include <gcj/array.h>
+#include <gnu/gcj/runtime/JNIWeakRef.h>
+
+typedef gnu::gcj::runtime::JNIWeakRef *jweak;
typedef struct _Jv_JNIEnv JNIEnv;
typedef struct _Jv_JavaVM JavaVM;
@@ -29,8 +36,12 @@ typedef struct _Jv_JavaVM JavaVM;
#define JNI_TRUE true
#define JNI_FALSE false
-#else /* __cplusplus */
+#else /* __GCJ_JNI_IMPL__ */
+# ifdef __GNUC__
+
+/* If we're using gcc, we can use a platform-independent scheme to get
+ the right integer types. */
typedef int jbyte __attribute__((__mode__(__QI__)));
typedef int jshort __attribute__((__mode__(__HI__)));
typedef int jint __attribute__((__mode__(__SI__)));
@@ -41,11 +52,85 @@ typedef float jfloat;
typedef double jdouble;
typedef jint jsize;
+# else /* __GNUC__ */
+
+# ifdef JV_HAVE_INTTYPES_H
+
+/* If <inttypes.h> is available, we use it. */
+
+# include <inttypes.h>
+
+typedef int8_t jbyte;
+typedef int16_t jshort;
+typedef int32_t jint;
+typedef int64_t jlong;
+typedef float jfloat;
+typedef double jdouble;
+typedef jint jsize;
+typedef int8_t jboolean;
+typedef uint16_t jchar;
+
+# else /* JV_HAVE_INTTYPES_H */
+
+/* For now, we require either gcc or <inttypes.h>. If we did more
+ work at configure time we could get around this, but right now it
+ doesn't seem worth it. */
+# error jni.h not ported to this platform
+
+# endif /* JV_HAVE_INTTYPES_H */
+
+# endif /* __GNUC__ */
+
+# ifdef __cplusplus
+
+/* Define dummy classes and then define the JNI types as pointers. */
+struct __jobject {};
+struct __jclass : __jobject {};
+struct __jstring : __jobject {};
+struct __jthrowable : __jobject {};
+struct __jweak : __jobject {};
+struct __jarray : __jobject {};
+struct __jobjectArray : __jarray {};
+struct __jbyteArray : __jarray {};
+struct __jshortArray : __jarray {};
+struct __jintArray : __jarray {};
+struct __jlongArray : __jarray {};
+struct __jbooleanArray : __jarray {};
+struct __jcharArray : __jarray {};
+struct __jfloatArray : __jarray {};
+struct __jdoubleArray : __jarray {};
+
+typedef __jobject *jobject;
+typedef __jclass *jclass;
+typedef __jstring *jstring;
+typedef __jthrowable *jthrowable;
+typedef __jweak *jweak;
+typedef __jarray *jarray;
+typedef __jobjectArray *jobjectArray;
+typedef __jbyteArray *jbyteArray;
+typedef __jshortArray *jshortArray;
+typedef __jintArray *jintArray;
+typedef __jlongArray *jlongArray;
+typedef __jbooleanArray *jbooleanArray;
+typedef __jcharArray *jcharArray;
+typedef __jfloatArray *jfloatArray;
+typedef __jdoubleArray *jdoubleArray;
+
+#define JNI_TRUE true
+#define JNI_FALSE false
+
+typedef struct _Jv_JNIEnv JNIEnv;
+typedef struct _Jv_JavaVM JavaVM;
+
+# else /* __cplusplus */
+
+/* For C, simply define the class types as generic pointers. */
typedef void *jobject;
typedef jobject jclass;
typedef jobject jstring;
-typedef jobject jarray;
typedef jobject jthrowable;
+typedef jobject jweak;
+typedef jobject jarray;
typedef jobject jobjectArray;
typedef jobject jbyteArray;
typedef jobject jshortArray;
@@ -56,20 +141,19 @@ typedef jobject jcharArray;
typedef jobject jfloatArray;
typedef jobject jdoubleArray;
-/* Dummy defines. */
-typedef void *jfieldID;
-typedef void *jmethodID;
+#define JNI_TRUE 1
+#define JNI_FALSE 0
typedef const struct JNINativeInterface *JNIEnv;
typedef const struct JNIInvokeInterface *JavaVM;
-#define JNI_TRUE 1
-#define JNI_FALSE 0
+# endif /* __cplusplus */
-#endif /* __cplusplus */
+/* Dummy defines. */
+typedef void *jfieldID;
+typedef void *jmethodID;
-/* FIXME: this is wrong. */
-typedef jobject jweak;
+#endif /* __GCJ_JNI_IMPL__ */
/* Version numbers. */
#define JNI_VERSION_1_1 0x00010001
@@ -558,7 +642,7 @@ public:
/* The method table. */
struct JNINativeInterface *p;
- /* FIXME: this is really ugly. */
+ /* This is ugly, but we must live with it. */
#ifndef __GCJ_JNI_IMPL__
private:
#endif
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index ada8e11..bef5b18 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -11,6 +11,12 @@ details. */
#ifndef __JAVA_JVM_H__
#define __JAVA_JVM_H__
+// Define this before including jni.h.
+// jni.h is included by jvmpi.h, which might be included. We define
+// this unconditionally because it is convenient and it lets other
+// files include jni.h without difficulty.
+#define __GCJ_JNI_IMPL__
+
#include <gcj/javaprims.h>
#include <java-assert.h>
@@ -358,6 +364,7 @@ bool _Jv_VerifyIdentifier (_Jv_Utf8Const *);
bool _Jv_ClassNameSamePackage (_Jv_Utf8Const *name1, _Jv_Utf8Const *name2);
#ifdef ENABLE_JVMPI
+
#include "jvmpi.h"
extern void (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (JVMPI_Event *event);