From 3018edde4c5f6f8e69351874ed18f38436fa3dae Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 3 Apr 2003 20:20:29 +0000 Subject: [PATCH] Added Sys.NULL constant --- src/java/org/lwjgl/Sys.java | 11 +++++++++++ src/native/common/org_lwjgl_Sys.h | 11 ++++++++++- src/native/linux/org_lwjgl_Sys.cpp | 11 +++++++++++ src/native/win32/org_lwjgl_Sys.cpp | 11 +++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java index 841aa6f3..79289be9 100644 --- a/src/java/org/lwjgl/Sys.java +++ b/src/java/org/lwjgl/Sys.java @@ -82,10 +82,16 @@ public final class Sys { * the library, and whether assertions are enabled or not. */ public static final boolean DEBUG; + + /** + * The integer equivalent of the native NULL constant + */ + public static final int NULL; private static boolean _debug; static { + NULL = nGetNULLValue(); try { assert false; LIBRARY_NAME = "lwjgl"; @@ -123,6 +129,11 @@ public final class Sys { setTime(0); } + /** + * Gets the native NULL constant value + */ + private static native int nGetNULLValue(); + /** * Gets the address of a buffer. If the address cannot be obtained for any reason * then this method returns 0. diff --git a/src/native/common/org_lwjgl_Sys.h b/src/native/common/org_lwjgl_Sys.h index ed575875..01a6fb4e 100644 --- a/src/native/common/org_lwjgl_Sys.h +++ b/src/native/common/org_lwjgl_Sys.h @@ -18,8 +18,17 @@ extern "C" { #define org_lwjgl_Sys_REALTIME_PRIORITY 2L /* Inaccessible static: LIBRARY_NAME */ /* Inaccessible static: DEBUG */ +/* Inaccessible static: NULL */ /* Inaccessible static: _debug */ -/* Inaccessible static: class_000240 */ +/* Inaccessible static: class_00024org_00024lwjgl_00024Sys */ +/* + * Class: org_lwjgl_Sys + * Method: nGetNULLValue + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_nGetNULLValue + (JNIEnv *, jclass); + /* * Class: org_lwjgl_Sys * Method: getDirectBufferAddress diff --git a/src/native/linux/org_lwjgl_Sys.cpp b/src/native/linux/org_lwjgl_Sys.cpp index 7aceb9e0..62eb1f42 100644 --- a/src/native/linux/org_lwjgl_Sys.cpp +++ b/src/native/linux/org_lwjgl_Sys.cpp @@ -48,6 +48,17 @@ long int hires_timer_freq; // Hires timer frequency long int hires_timer_start; // Hires timer start long int hires_timer; // Hires timer current time +/* + * Class: org_lwjgl_Sys + * Method: nGetNULLValue + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_nGetNULLValue + (JNIEnv *, jclass) +{ + return (jint)NULL; +} + /* * Class: org_lwjgl_Sys * Method: getDirectBufferAddress diff --git a/src/native/win32/org_lwjgl_Sys.cpp b/src/native/win32/org_lwjgl_Sys.cpp index d7ae3c54..6d902d97 100644 --- a/src/native/win32/org_lwjgl_Sys.cpp +++ b/src/native/win32/org_lwjgl_Sys.cpp @@ -49,6 +49,17 @@ __int64 hires_timer_freq; // Hires timer frequency __int64 hires_timer_start; // Hires timer start __int64 hires_timer; // Hires timer current time +/* + * Class: org_lwjgl_Sys + * Method: nGetNULLValue + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_nGetNULLValue + (JNIEnv *, jclass) +{ + return (jint)NULL; +} + /* * Class: org_lwjgl_Sys * Method: getDirectBufferAddress