From 35318a7719a2f428f8ed2033814196f731971e4c Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 15 Apr 2011 00:40:28 +0000 Subject: [PATCH] more changes --- Robust/src/Runtime/jni/jni-private.h | 23 +++++++-- Robust/src/Runtime/jni/jni-stuff.c | 76 ++++++++++++++++++++++++++-- Robust/src/Runtime/jni/jni.c | 10 ++-- 3 files changed, 94 insertions(+), 15 deletions(-) diff --git a/Robust/src/Runtime/jni/jni-private.h b/Robust/src/Runtime/jni/jni-private.h index f41b9867..9cc6a132 100644 --- a/Robust/src/Runtime/jni/jni-private.h +++ b/Robust/src/Runtime/jni/jni-private.h @@ -45,7 +45,8 @@ jobject RC_AllocObject(JNIEnv * env, jclass cls); jobject RC_NewObject(JNIEnv * env, jclass cls, jmethodID methodobj, ...); jobject RC_NewObjectV(JNIEnv * env, jclass cls, jmethodID methodobj, va_list valist); jobject RC_NewObjectA(JNIEnv * env, jclass cls, jmethodID methodobj, const jvalue * args); - +jobject RC_GetObjectArrayElement(JNIEnv *, jobjectArray, jsize); +void RC_SetObjectArrayElement(JNIEnv *, jobjectArray, jsize, jobject); jclass RC_GetObjectClass(JNIEnv * env, jobject obj); jboolean RC_IsInstanceOf(JNIEnv * env, jobject obj, jclass cls); @@ -63,9 +64,9 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char #define CALLNVMETHODA(R, T) R RC_CallNonvirtual ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); -#define GETFIELD(R, T) R Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld); +#define GETFIELD(R, T) R RC_Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld); -#define SETFIELD(R, T) void Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src); +#define SETFIELD(R, T) void RC_Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src); #define CALLSTMETHOD(R, T) R RC_CallStatic ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); @@ -83,9 +84,9 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char #define RELEASEARRAY(R, T) void RC_Release ## T ## ArrayElements(JNIEnv *env, R ## Array array, R * ptr, jint num); -#define GETARRAYREGION(R, T) void Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr); +#define GETARRAYREGION(R, T) void RC_Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr); -#define SETARRAYREGION(R, T) void Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr); +#define SETARRAYREGION(R, T) void RC_Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr); #define CALLSET(R, T) \ CALLMETHODV(R, T) \ @@ -120,6 +121,9 @@ CALLSET(jdouble, Double); void RC_CallVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); void RC_CallVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...); void RC_CallVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); +void RC_CallStaticVoidMethod(JNIEnv *env, jclass cls, jmethodID mid, ...); +void RC_CallStaticVoidMethodV(JNIEnv * env, jclass cls, jmethodID mid, va_list va); +void RC_CallStaticVoidMethodA(JNIEnv * env, jclass cls, jmethodID mid, const jvalue * valarray); void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...); void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); @@ -131,5 +135,14 @@ jint RC_UnregisterNatives(JNIEnv * env, jclass cls); jint RC_MonitorEnter(JNIEnv * env, jobject obj); jint RC_MonitorExit(JNIEnv * env, jobject obj); jint RC_GetJavaVM(JNIEnv * env, JavaVM ** jvm); +jstring RC_NewString(JNIEnv * env, const jchar * str, jsize size); +jsize RC_GetStringLength(JNIEnv *env, jstring str); +const jchar * RC_GetStringChars(JNIEnv * env, jstring str, jboolean * flag); +void RC_ReleaseStringChars(JNIEnv * env, jstring str, const jchar * str2); +jstring RC_NewStringUTF(JNIEnv * env, const char *str); +jsize RC_GetStringUTFLength(JNIEnv * env, jstring str); +const char * RC_GetStringUTFChars(JNIEnv * env, jstring str, jboolean * flag); +void RC_ReleaseStringUTFChars(JNIEnv * env, jstring str, const char * str2); +jsize RC_GetArrayLength(JNIEnv * env, jarray array); #endif diff --git a/Robust/src/Runtime/jni/jni-stuff.c b/Robust/src/Runtime/jni/jni-stuff.c index 8fbcb6cd..08584edf 100644 --- a/Robust/src/Runtime/jni/jni-stuff.c +++ b/Robust/src/Runtime/jni/jni-stuff.c @@ -133,6 +133,15 @@ jobject RC_NewObjectA(JNIEnv * env, jclass cls, jmethodID mid, const jvalue * va return NULL; } +jobject RC_GetObjectArrayElement(JNIEnv * env, jobjectArray array, jsize size) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} + +void RC_SetObjectArrayElement(JNIEnv * env, jobjectArray array, jsize size, jobject obj) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + jclass RC_GetObjectClass(JNIEnv * env, jobject obj) { printf("MISSING FEATURE IN %d\n",__LINE__); return NULL; @@ -180,12 +189,12 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char return (R)0; \ } -#define GETFIELD(R, T) R Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld) { \ +#define GETFIELD(R, T) R RC_Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ return (R)0; \ } -#define SETFIELD(R, T) void Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src) { \ +#define SETFIELD(R, T) void RC_Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ } @@ -228,11 +237,11 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char printf("MISSING FEATURE IN %d\n",__LINE__); \ } -#define GETARRAYREGION(R, T) void Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr) { \ +#define GETARRAYREGION(R, T) void RC_Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ } -#define SETARRAYREGION(R, T) void Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr) { \ +#define SETARRAYREGION(R, T) void RC_Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ } @@ -291,7 +300,7 @@ void RC_CallVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...) { va_list va; va_start(va, mid); - RC_CallVoidMethodV(env, obj, mid, va); + RC_CallNonvirtualVoidMethodV(env, obj, mid, va); } void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va) { @@ -302,6 +311,20 @@ void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, cons printf("MISSING FEATURE IN %d\n",__LINE__); } +void RC_CallStaticVoidMethod(JNIEnv *env, jclass cls, jmethodID mid, ...) { + va_list va; + va_start(va, mid); + RC_CallStaticVoidMethodV(env, obj, mid, va); +} + +void RC_CallStaticVoidMethodV(JNIEnv * env, jclass cls, jmethodID mid, va_list va) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + +void RC_CallStaticVoidMethodA(JNIEnv * env, jclass cls, jmethodID mid, const jvalue * valarray) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + jfieldID RC_GetFieldID(JNIEnv * env, jclass cls, const char * str1, const char * str2) { printf("MISSING FEATURE IN %d\n",__LINE__); return NULL; @@ -341,3 +364,46 @@ jint RC_GetJavaVM(JNIEnv * env, JavaVM ** jvm) { printf("MISSING FEATURE IN %d\n",__LINE__); return 0; } + +jstring RC_NewString(JNIEnv * env, const jchar * str, jsize size) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} + +jsize RC_GetStringLength(JNIEnv *env, jstring str) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return 0; +} + +const jchar * RC_GetStringChars(JNIEnv * env, jstring str, jboolean * flag) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} + +void RC_ReleaseStringChars(JNIEnv * env, jstring str, const jchar * str2) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + +jstring RC_NewStringUTF(JNIEnv * env, const char *str) + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} + +jsize RC_GetStringUTFLength(JNIEnv * env, jstring str) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return 0; +} + +const char * RC_GetStringUTFChars(JNIEnv * env, jstring str, jboolean * flag) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} + +void RC_ReleaseStringUTFChars(JNIEnv * env, jstring str, const char * str2) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + +jsize RC_GetArrayLength(JNIEnv * env, jarray array) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return 0; +} diff --git a/Robust/src/Runtime/jni/jni.c b/Robust/src/Runtime/jni/jni.c index cb0132e0..0e570d5c 100644 --- a/Robust/src/Runtime/jni/jni.c +++ b/Robust/src/Runtime/jni/jni.c @@ -1,7 +1,7 @@ #include #include -struct JNINativeInterface JNI_vtable = { +struct JNINativeInterface_ JNI_vtable = { NULL, //void *reserved0; NULL, //void *reserved1; NULL, //void *reserved2; @@ -10,7 +10,7 @@ struct JNINativeInterface JNI_vtable = { RC_DefineClass, //jclass (JNICALL *DefineClass) (JNIEnv *, const char *, jobject, const jbyte *, jsize); RC_FindClass, //jclass (JNICALL *FindClass) (JNIEnv *, const char *); RC_FromReflectedMethod, // jmethodID (JNICALL *FromReflectedMethod) (JNIEnv *, jobject); - RC_FromRefectedField, //jfieldID (JNICALL *FromReflectedField) (JNIEnv *, jobject); + RC_FromReflectedField, //jfieldID (JNICALL *FromReflectedField) (JNIEnv *, jobject); RC_ToReflectedMethod, //jobject (JNICALL *ToReflectedMethod) (JNIEnv *, jclass, jmethodID, jboolean); RC_GetSuperclass, // jclass (JNICALL *GetSuperclass) (JNIEnv *, jclass); RC_IsAssignableFrom, //jboolean (JNICALL *IsAssignableFrom) (JNIEnv *, jclass, jclass); @@ -66,9 +66,9 @@ struct JNINativeInterface JNI_vtable = { RC_CallVoidMethod, //void (JNICALL *CallVoidMethod) (JNIEnv *, jobject, jmethodID, ...); RC_CallVoidMethodV, //void (JNICALL *CallVoidMethodV) (JNIEnv *, jobject, jmethodID, va_list); RC_CallVoidMethodA, //void (JNICALL *CallVoidMethodA) (JNIEnv *, jobject, jmethodID, const jvalue *); - RC_CallNonVirtualObjectMethod,// jobject (JNICALL *CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); - RC_CallNonVirtualObjectMethodV, //jobject (JNICALL *CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass, jmethodID, va_list); - RC_CallNonVirtualObjectMethodA, //jobject (JNICALL *CallNonvirtualObjectMethodA) (JNIEnv *, jobject, jclass, jmethodID, const jvalue *); + RC_CallNonvirtualObjectMethod,// jobject (JNICALL *CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); + RC_CallNonvirtualObjectMethodV, //jobject (JNICALL *CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass, jmethodID, va_list); + RC_CallNonvirtualObjectMethodA, //jobject (JNICALL *CallNonvirtualObjectMethodA) (JNIEnv *, jobject, jclass, jmethodID, const jvalue *); RC_CallNonvirtualBooleanMethod,//jboolean (JNICALL *CallNonvirtualBooleanMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); RC_CallNonvirtualBooleanMethodV, // jboolean (JNICALL *CallNonvirtualBooleanMethodV) (JNIEnv *, jobject, jclass, jmethodID, va_list); RC_CallNonvirtualBooleanMethodA, // jboolean (JNICALL *CallNonvirtualBooleanMethodA) (JNIEnv *, jobject, jclass, jmethodID, const jvalue *); -- 2.34.1