method.h (JvNumMethods): Moved from Class.h.

* gcj/method.h (JvNumMethods): Moved from Class.h.
	(JvGetFirstMethod): Likewise.
	* java/lang/Class.h (Object): Updated decl of
	_Jv_JNI_ToReflectedField.
	(Object): Added _Jv_JNI_ToReflectedMethod as a friend.
	* Makefile.in: Rebuilt.
	* Makefile.am (java/lang/reflect/Field.h): Added `jboolean'
	argument of _Jv_JNI_ToReflectedField.
	(java/lang/reflect/Constructor.h): Added _Jv_JNI_ToReflectedMethod
	as a friend.
	(java/lang/reflect/Method.h): Likewise.
	* include/jni.h (class _Jv_JNIEnv): Added `klass' member.  Use
	__GCJ_JNI_IMPL__.
	(jweak): New typedef.
	(struct JNINativeInterface): Correctly declare remaining entries.
	* jni.cc: Include Class.h, ClassLoader.h.
	(_Jv_JNI_FindClass): New function.
	(_Jv_JNI_DefineClass): New function.
	(_Jv_JNI_conversion_call): New function.
	(_Jv_JNI_FindClass): Use current class loader to find class.
	(_Jv_JNI_ExceptionCheck): New function.
	(_Jv_JNI_FromReflectedField): Now static.
	(MethodClass): New define.
	(_Jv_JNI_FromReflectedMethod): New function.
	(_Jv_JNI_ToReflectedMethod): Likewise.
	Include Method.h.
	(_Jv_JNI_IsAssignableFrom): Renamed.
	(_Jv_JNI_GetStringRegion): New function.
	Include StringIndexOutOfBoundsException.h.
	(_Jv_JNI_GetStringUTFRegion): New function.
	(_Jv_JNIFunctions): Updated for new functions.
	(_Jv_JNI_GetPrimitiveArrayCritical): New function
	(_Jv_JNI_ReleasePrimitiveArrayCritical): Likewise.
	(_Jv_JNI_GetStringCritical): New function.
	(_Jv_JNI_ReleaseStringCritical): Likewise.
	(get_throwable): Removed.
	(GCJ_JV_JNIENV_FRIEND): Removed.
	(__GCJ_JNI_IMPL__): Define.
	Include method.h.

From-SVN: r31638
This commit is contained in:
Tom Tromey 2000-01-26 23:56:36 +00:00 committed by Tom Tromey
parent 673fdf6d77
commit 355dff4cef
7 changed files with 367 additions and 92 deletions

View file

@ -65,6 +65,9 @@ typedef const struct JNINativeInterface *JNIEnv;
#endif /* __cplusplus */
/* FIXME: this is wrong. */
typedef jobject jweak;
/* Version numbers. */
#define JNI_VERSION_1_1 0x00010001
#define JNI_VERSION_1_2 0x00010002
@ -88,35 +91,57 @@ typedef union jvalue
typedef void * (*_Jv_func)(...);
/* This structure is used when registering native methods. */
typedef struct
{
char *name;
char *signature;
void *fnPtr; /* Sigh. */
} JNINativeMethod;
/* FIXME: this is just a placeholder. */
typedef int JavaVM;
struct JNINativeInterface
{
_Jv_func reserved0;
_Jv_func reserved1;
_Jv_func reserved2;
_Jv_func reserved3;
jint (*GetVersion) (JNIEnv*);
_Jv_func DefineClass;
_Jv_func FindClass;
_Jv_func reserved4;
_Jv_func reserved5;
_Jv_func reserved6;
jclass (*GetSuperclass) (JNIEnv*, jclass);
jboolean (*IsAssignableFrom) (JNIEnv*, jclass, jclass);
_Jv_func reserved7;
jint (*Throw) (JNIEnv*, jthrowable);
jint (*ThrowNew) (JNIEnv*, jclass, const char *);
jint (*GetVersion) (JNIEnv *);
jclass (*DefineClass) (JNIEnv *, jobject,
const jbyte *, jsize);
jclass (*FindClass) (JNIEnv *, const char *);
jmethodID (*FromReflectedMethod) (JNIEnv *, jobject);
jfieldID (*FromReflectedField) (JNIEnv *, jobject);
jobject (*ToReflectedMethod) (JNIEnv *, jclass, jmethodID,
jboolean);
jclass (*GetSuperclass) (JNIEnv *, jclass);
jboolean (*IsAssignableFrom) (JNIEnv *, jclass, jclass);
jobject (*ToReflectedField) (JNIEnv *, jclass, jfieldID,
jboolean);
jint (*Throw) (JNIEnv *, jthrowable);
jint (*ThrowNew) (JNIEnv *, jclass, const char *);
jthrowable (*ExceptionOccurred) (JNIEnv *);
void (*ExceptionDescribe) (JNIEnv *);
void (*ExceptionClear) (JNIEnv *);
void (*FatalError) (JNIEnv *, const char *);
_Jv_func reserved8;
_Jv_func reserved9;
_Jv_func NewGlobalRef;
_Jv_func DeleteGlobalRef;
_Jv_func DeleteLocalRef;
jint (*PushLocalFrame) (JNIEnv *, jint);
jobject (*PopLocalFrame) (JNIEnv *, jobject result);
jobject (*NewGlobalRef) (JNIEnv *, jobject);
void (*DeleteGlobalRef) (JNIEnv *, jobject);
void (*DeleteLocalRef) (JNIEnv *, jobject);;
jboolean (*IsSameObject) (JNIEnv *, jobject, jobject);
_Jv_func reserved10;
_Jv_func reserved11;
jobject (*NewLocalRef) (JNIEnv *, jobject);
jint (*EnsureLocalCapacity) (JNIEnv *, jint);
jobject (*AllocObject) (JNIEnv *, jclass);
jobject (*NewObject) (JNIEnv *, jclass, jmethodID, ...);
@ -471,20 +496,29 @@ struct JNINativeInterface
void (*SetDoubleArrayRegion) (JNIEnv *, jbooleanArray,
jsize, jsize, jboolean *);
_Jv_func RegisterNatives;
_Jv_func UnregisterNatives;
jint (*RegisterNatives) (JNIEnv *, jclass,
const JNINativeMethod *, jint);
jint (*UnregisterNatives) (JNIEnv *, jclass);
jint (*MonitorEnter) (JNIEnv *, jobject);
jint (*MonitorExit) (JNIEnv *, jobject);
_Jv_func GetJavaVM;
};
jint (*GetJavaVM) (JNIEnv *, JavaVM **);
/* This structure is used when registering native methods. */
typedef struct
{
char *name;
char *signature;
void *fnPtr; /* Sigh. */
} JNINativeMethod;
void (*GetStringRegion) (JNIEnv *, jstring, jsize,
jsize, jchar *);
void (*GetStringUTFRegion) (JNIEnv *, jstring, jsize,
jsize, char *);
void * (*GetPrimitiveArrayCritical) (JNIEnv *, jarray, jboolean *);
void (*ReleasePrimitiveArrayCritical) (JNIEnv *, jarray, void *, jint);
const jchar * (*GetStringCritical) (JNIEnv *, jstring, jboolean *);
void (*ReleaseStringCritical) (JNIEnv *, jstring, const jchar *);
jweak (*NewWeakGlobalRef) (JNIEnv *, jobject);
void (*DeleteWeakGlobalRef) (JNIEnv *, jweak);
jboolean (*ExceptionCheck) (JNIEnv *);
};
#ifdef __cplusplus
@ -494,16 +528,15 @@ public:
/* The method table. */
struct JNINativeInterface *p;
/* FIXME: this is really ugly. */
#ifndef __GCJ_JNI_IMPL__
private:
#endif
/* The current exception. */
jthrowable ex;
/* This doesn't really protect the private contents, because anybody
can set this macro. However, if they do set it then they at
least know they are doing something unportable. */
#ifdef GCJ_JV_JNIENV_FRIEND
GCJ_JV_JNIENV_FRIEND;
#endif
/* The class of the current native method. */
jclass klass;
public:
jclass GetSuperclass (jclass cl)