From c91f003551542c2aab62dd8ef89a7894c7e50689 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 15 Jun 2009 22:42:48 +0000 Subject: Copied JOGL_2_SANDBOX r145 on to trunk; JOGL_2_SANDBOX branch is now closed git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@147 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c | 89 +++++++++++++++++++++ src/native/unix/UnixDynamicLinkerImpl_JNI.c | 89 +++++++++++++++++++++ src/native/windows/WindowsDynamicLinkerImpl_JNI.c | 95 +++++++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100755 src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c create mode 100755 src/native/unix/UnixDynamicLinkerImpl_JNI.c create mode 100755 src/native/windows/WindowsDynamicLinkerImpl_JNI.c (limited to 'src/native') diff --git a/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c b/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c new file mode 100755 index 0000000..2b0a2a7 --- /dev/null +++ b/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c @@ -0,0 +1,89 @@ +/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:27:00 PDT 2006 ----! */ + +#include + +#include + + #include + #include + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl + * Java method: int dlclose(long __handle) + * C function: int dlclose(void * __handle); + */ +JNIEXPORT jint JNICALL +Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong __handle) { + int _res; + _res = dlclose((void *) (intptr_t) __handle); + return _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl + * Java method: java.lang.String dlerror() + * C function: char * dlerror(void); + */ +JNIEXPORT jstring JNICALL +Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) { + char * _res; + _res = dlerror(); + if (_res == NULL) return NULL; return (*env)->NewStringUTF(env, _res); +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl + * Java method: long dlopen(java.lang.String __path, int __mode) + * C function: void * dlopen(const char * __path, int __mode); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring __path, jint __mode) { + const char* _UTF8__path = NULL; + void * _res; + if (__path != NULL) { + if (__path != NULL) { + _UTF8__path = (*env)->GetStringUTFChars(env, __path, (jboolean*)NULL); + if (_UTF8__path == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"__path\" in native dispatcher for \"dlopen\""); + return 0; + } + } + } + _res = dlopen((char *) _UTF8__path, (int) __mode); + if (__path != NULL) { + (*env)->ReleaseStringUTFChars(env, __path, _UTF8__path); + } + return (jlong) (intptr_t) _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl + * Java method: long dlsym(long __handle, java.lang.String __symbol) + * C function: void * dlsym(void * __handle, const char * __symbol); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong __handle, jstring __symbol) { + const char* _UTF8__symbol = NULL; + void * _res; + if (__symbol != NULL) { + if (__symbol != NULL) { + _UTF8__symbol = (*env)->GetStringUTFChars(env, __symbol, (jboolean*)NULL); + if (_UTF8__symbol == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"__symbol\" in native dispatcher for \"dlsym\""); + return 0; + } + } + } + _res = dlsym((void *) (intptr_t) __handle, (char *) _UTF8__symbol); + if (__symbol != NULL) { + (*env)->ReleaseStringUTFChars(env, __symbol, _UTF8__symbol); + } + return (jlong) (intptr_t) _res; +} + + diff --git a/src/native/unix/UnixDynamicLinkerImpl_JNI.c b/src/native/unix/UnixDynamicLinkerImpl_JNI.c new file mode 100755 index 0000000..6d72646 --- /dev/null +++ b/src/native/unix/UnixDynamicLinkerImpl_JNI.c @@ -0,0 +1,89 @@ +/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */ + +#include + +#include + + #include + #include + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: int dlclose(long arg0) + * C function: int dlclose(void * ); + */ +JNIEXPORT jint JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong arg0) { + int _res; + _res = dlclose((void *) (intptr_t) arg0); + return _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: java.lang.String dlerror() + * C function: char * dlerror(void); + */ +JNIEXPORT jstring JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) { + char * _res; + _res = dlerror(); + if (_res == NULL) return NULL; return (*env)->NewStringUTF(env, _res); +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: long dlopen(java.lang.String arg0, int arg1) + * C function: void * dlopen(const char * , int); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) { + const char* _UTF8arg0 = NULL; + void * _res; + if (arg0 != NULL) { + if (arg0 != NULL) { + _UTF8arg0 = (*env)->GetStringUTFChars(env, arg0, (jboolean*)NULL); + if (_UTF8arg0 == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"arg0\" in native dispatcher for \"dlopen\""); + return 0; + } + } + } + _res = dlopen((char *) _UTF8arg0, (int) arg1); + if (arg0 != NULL) { + (*env)->ReleaseStringUTFChars(env, arg0, _UTF8arg0); + } + return (jlong) (intptr_t) _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: long dlsym(long arg0, java.lang.String arg1) + * C function: void * dlsym(void * , const char * ); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) { + const char* _UTF8arg1 = NULL; + void * _res; + if (arg1 != NULL) { + if (arg1 != NULL) { + _UTF8arg1 = (*env)->GetStringUTFChars(env, arg1, (jboolean*)NULL); + if (_UTF8arg1 == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"arg1\" in native dispatcher for \"dlsym\""); + return 0; + } + } + } + _res = dlsym((void *) (intptr_t) arg0, (char *) _UTF8arg1); + if (arg1 != NULL) { + (*env)->ReleaseStringUTFChars(env, arg1, _UTF8arg1); + } + return (jlong) (intptr_t) _res; +} + + diff --git a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c new file mode 100755 index 0000000..63afd99 --- /dev/null +++ b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c @@ -0,0 +1,95 @@ +/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Tue May 27 02:37:55 PDT 2008 ----! */ + +#include +#include + +#include + + #include + /* This typedef is apparently needed for compilers before VC8, + and for the embedded ARM compilers we're using */ + #if (_MSC_VER < 1400) || defined(UNDER_CE) + typedef int intptr_t; + #endif + /* GetProcAddress doesn't exist in A/W variants under desktop Windows */ + #ifndef UNDER_CE + #define GetProcAddressA GetProcAddress + #endif + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl + * Java method: int FreeLibrary(long hLibModule) + * C function: BOOL FreeLibrary(HANDLE hLibModule); + */ +JNIEXPORT jint JNICALL +Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env, jclass _unused, jlong hLibModule) { + BOOL _res; + _res = FreeLibrary((HANDLE) (intptr_t) hLibModule); + return _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl + * Java method: int GetLastError() + * C function: DWORD GetLastError(void); + */ +JNIEXPORT jint JNICALL +Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env, jclass _unused) { + DWORD _res; + _res = GetLastError(); + return _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl + * Java method: long GetProcAddressA(long hModule, java.lang.String lpProcName) + * C function: PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) { + const char* _strchars_lpProcName = NULL; + PROC _res; + if (lpProcName != NULL) { + _strchars_lpProcName = (*env)->GetStringUTFChars(env, lpProcName, (jboolean*)NULL); + if (_strchars_lpProcName == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"lpProcName\" in native dispatcher for \"GetProcAddressA\""); + return 0; + } + } + _res = GetProcAddressA((HANDLE) (intptr_t) hModule, (LPCSTR) _strchars_lpProcName); + if (lpProcName != NULL) { + (*env)->ReleaseStringUTFChars(env, lpProcName, _strchars_lpProcName); + } + return (jlong) (intptr_t) _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl + * Java method: long LoadLibraryW(java.lang.String lpLibFileName) + * C function: HANDLE LoadLibraryW(LPCWSTR lpLibFileName); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_LoadLibraryW__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring lpLibFileName) { + jchar* _strchars_lpLibFileName = NULL; + HANDLE _res; + if (lpLibFileName != NULL) { + _strchars_lpLibFileName = (jchar *) calloc((*env)->GetStringLength(env, lpLibFileName) + 1, sizeof(jchar)); + if (_strchars_lpLibFileName == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Could not allocate temporary buffer for copying string argument \"lpLibFileName\" in native dispatcher for \"LoadLibraryW\""); + return 0; + } + (*env)->GetStringRegion(env, lpLibFileName, 0, (*env)->GetStringLength(env, lpLibFileName), _strchars_lpLibFileName); + } + _res = LoadLibraryW((LPCWSTR) _strchars_lpLibFileName); + if (lpLibFileName != NULL) { + free((void*) _strchars_lpLibFileName); + } + return (jlong) (intptr_t) _res; +} + + -- cgit v1.2.3