commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r886874 - in /commons/sandbox/runtime/trunk/src/main/native/shared: constp.c db.c descriptor.c mbstr.c pointer.c
Date Thu, 03 Dec 2009 18:30:37 GMT
Author: mturk
Date: Thu Dec  3 18:30:36 2009
New Revision: 886874

URL: http://svn.apache.org/viewvc?rev=886874&view=rev
Log:
Use new class macros

Modified:
    commons/sandbox/runtime/trunk/src/main/native/shared/constp.c
    commons/sandbox/runtime/trunk/src/main/native/shared/db.c
    commons/sandbox/runtime/trunk/src/main/native/shared/descriptor.c
    commons/sandbox/runtime/trunk/src/main/native/shared/mbstr.c
    commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/constp.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/constp.c?rev=886874&r1=886873&r2=886874&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/constp.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/constp.c Thu Dec  3 18:30:36 2009
@@ -37,34 +37,14 @@
 #define ACR_CPT_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_ConstPointer64_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "ConstPointer64"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(JJJ)V"
-};
-
+J_DECLARE_CLASS(ConstPointer64, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,          JJJ);
 #else
 #define ACR_DBB_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_ConstPointer32_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "ConstPointer32"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(III)V"
-};
-
+J_DECLARE_CLASS(ConstPointer32, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,          III);
 #endif
 
 ACR_CLASS_LDEF(ConstPointer)
@@ -73,7 +53,7 @@
 
     if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
-    J_LOAD_METHOD(0000);
+    J_LOAD_METHOD(ctor0);
 
     return ACR_SUCCESS;
 }
@@ -94,8 +74,8 @@
 ACR_DECLARE(jobject) ACR_NewConstPointer(JNIEnv *_E, const void *p, size_t len,
                                          acr_pointer_cleanup_fn_t *cb)
 {
-    if (_clazzn.i && J4MID(0000)) {
-         return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
+    if (_clazzn.i && J4MID(ctor0)) {
+         return (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0),
                                  P2N(p), P2N(cb), (acr_ptr_t)len);
     }
     else {

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/db.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/db.c?rev=886874&r1=886873&r2=886874&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/db.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/db.c Thu Dec  3 18:30:36 2009
@@ -38,34 +38,14 @@
 #define ACR_DBB_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_DirectBuffer64_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "DirectBuffer64"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(JJJ)V"
-};
-
+J_DECLARE_CLASS(DirectBuffer64, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,          JJJ);
 #else
 #define ACR_DBB_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_DirectBuffer32_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "DirectBuffer32"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(III)V"
-};
-
+J_DECLARE_CLASS(DirectBuffer32, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,          III);
 #endif
 
 ACR_CLASS_LDEF(DirectBuffer)
@@ -74,7 +54,7 @@
 
     if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
-    J_LOAD_METHOD(0000);
+    J_LOAD_METHOD(ctor0);
 
     return ACR_SUCCESS;
 }
@@ -108,7 +88,7 @@
 
 ACR_DECLARE(jobject) ACR_NewDirectBuffer(JNIEnv *_E, size_t len)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         jobject ptr = NULL;
         void   *mem;
         acr_size_t siz = (acr_size_t)ACR_ALIGN_DEFAULT(len);
@@ -121,7 +101,7 @@
         if (mem) {
             /* Create the DirectBuffer class with default cleanup.
              */
-            ptr = (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
+            ptr = (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0),
                                    P2N(mem), P2N(direct_buffer_cleanup),
                                    (acr_ptr_t)len);
             if (!ptr)
@@ -138,8 +118,8 @@
 ACR_DECLARE(jobject) ACR_NewDirectBufferEx(JNIEnv *_E, void *p, size_t len,
                                            acr_pointer_cleanup_fn_t *cb)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
+    if (_clazzn.i && J4MID(ctor0)) {
+        return (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0),
                                 P2N(p), P2N(cb), (acr_ptr_t)len);
     }
     else {

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/descriptor.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/descriptor.c?rev=886874&r1=886873&r2=886874&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/descriptor.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/descriptor.c Thu Dec  3 18:30:36
2009
@@ -31,77 +31,20 @@
  * Descriptor class utilities
  */
 #if CC_SIZEOF_VOIDP == 8
-
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "Descriptor64"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(IIJJ)V"
-};
-
+J_DECLARE_CLASS(Descriptor64, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,        IIJJ);
 #else
-
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "Descriptor32"
-};
-
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(IIII)V"
-};
-
+J_DECLARE_CLASS(Descriptor32, ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,        IIII);
 #endif
 
-J_DECLARE_F_ID(0000) = {
-    NULL,
-    "ISVALID",
-    "I"
-};
-
-J_DECLARE_F_ID(0001) = {
-    NULL,
-    "IHANDLE",
-    "I"
-};
-
-J_DECLARE_F_ID(0002) = {
-    NULL,
-    "PHANDLE",
-    IFIELD_PTR
-};
-
-J_DECLARE_F_ID(0003) = {
-    NULL,
-    "HANDLER",
-    IFIELD_PTR
-};
-
-J_DECLARE_F_ID(0004) = {
-    NULL,
-    "IERRNUM",
-    "I"
-};
-
-J_DECLARE_F_ID(0005) = {
-    NULL,
-    "IDFLAGS",
-    "I"
-};
-
-J_DECLARE_F_ID(0006) = {
-    NULL,
-    "CONTEXT",
-    "Ljava/lang/Object;"
-};
+J_DECLARE_FIELD(ISVALID,     I);
+J_DECLARE_FIELD(IHANDLE,     I);
+J_DECLARE_FIELD(PHANDLE,     IFIELD_PTR);
+J_DECLARE_FIELD(HANDLER,     IFIELD_PTR);
+J_DECLARE_FIELD(IERRNUM,     I);
+J_DECLARE_FIELD(IDFLAGS,     I);
+J_DECLARE_FIELD(CONTEXT,     "Ljava/lang/Object;");
 
 ACR_CLASS_LDEF(Descriptor)
 {
@@ -109,14 +52,14 @@
 
     if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
-    J_LOAD_IFIELD(0000);
-    J_LOAD_IFIELD(0001);
-    J_LOAD_IFIELD(0002);
-    J_LOAD_IFIELD(0003);
-    J_LOAD_IFIELD(0004);
-    J_LOAD_IFIELD(0005);
-    J_LOAD_IFIELD(0006);
-    J_LOAD_METHOD(0000);
+    J_LOAD_IFIELD(ISVALID);
+    J_LOAD_IFIELD(IHANDLE);
+    J_LOAD_IFIELD(PHANDLE);
+    J_LOAD_IFIELD(HANDLER);
+    J_LOAD_IFIELD(IERRNUM);
+    J_LOAD_IFIELD(IDFLAGS);
+    J_LOAD_IFIELD(CONTEXT);
+    J_LOAD_METHOD(ctor0);
 
     return ACR_SUCCESS;
 }
@@ -148,30 +91,30 @@
         initd0(_E);
     }
     nd = ACR_DescriptorCreate(_E, 0, -1, NULL, NULL);
-    if (nd && _clazzn.i && J4MID(0000)) {
-        SET_IFIELD_I(0004, nd, ACR_EBADF);
+    if (nd && _clazzn.i && J4MID(ctor0)) {
+        SET_IFIELD_I(IERRNUM, nd, ACR_EBADF);
     }
     return nd;
 }
 
 ACR_JNI_EXPORT_DECLARE(void, Descriptor, close0)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_descriptor_cb_t cb;
         acr_descriptor_handler_fn_t *handler;
 
-        cb.di   = GET_IFIELD_I(0001, _O);
-        cb.dp   = GET_IFIELD_V(0002, _O, void *);
-        handler = GET_IFIELD_V(0003, _O, acr_descriptor_handler_fn_t *);
+        cb.di   = GET_IFIELD_I(IHANDLE, _O);
+        cb.dp   = GET_IFIELD_V(PHANDLE, _O, void *);
+        handler = GET_IFIELD_V(HANDLER, _O, acr_descriptor_handler_fn_t *);
 
-        SET_IFIELD_I(0000, _O, 0);
+        SET_IFIELD_I(ISVALID, _O, 0);
         if (cb.dp) {
-            SET_IFIELD_P(0002, _O, NULL);
+            SET_IFIELD_P(PHANDLE, _O, NULL);
         }
         if (handler) {
             int rc;
             cb.thiz = _O;
-            cb.data = GET_IFIELD_O(0006, _O);
+            cb.data = GET_IFIELD_O(CONTEXT, _O);
             if ((rc = (*handler)(_E, _O, ACR_DESC_CLOSE, &cb))) {
                 /* Throw IOException with errno message */
                 ACR_THROW_IO_IF_ERR(rc);
@@ -184,23 +127,23 @@
 
 ACR_JNI_EXPORT_DECLARE(void, Descriptor, close1)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_descriptor_cb_t cb;
         acr_descriptor_handler_fn_t *handler;
 
-        cb.di   = GET_IFIELD_I(0001, _O);
-        cb.dp   = GET_IFIELD_V(0002, _O, void *);
-        handler = GET_IFIELD_V(0003, _O, acr_descriptor_handler_fn_t *);
+        cb.di   = GET_IFIELD_I(IHANDLE, _O);
+        cb.dp   = GET_IFIELD_V(PHANDLE, _O, void *);
+        handler = GET_IFIELD_V(HANDLER, _O, acr_descriptor_handler_fn_t *);
 
         if (cb.di >= 0) {
-            SET_IFIELD_I(0001, _O, -1);
+            SET_IFIELD_I(IHANDLE, _O, -1);
         }
         if (cb.dp) {
-            SET_IFIELD_P(0002, _O, NULL);
+            SET_IFIELD_P(PHANDLE, _O, NULL);
         }
         if (handler) {
             cb.thiz = _O;
-            cb.data = GET_IFIELD_O(0006, _O);
+            cb.data = GET_IFIELD_O(CONTEXT, _O);
             (*handler)(_E, _O, ACR_DESC_FINALIZE, &cb);
         }
     }
@@ -208,18 +151,18 @@
 
 ACR_JNI_EXPORT_DECLARE(void, Descriptor, sync0)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_descriptor_cb_t cb;
         acr_descriptor_handler_fn_t *handler;
 
-        cb.di   = GET_IFIELD_I(0001, _O);
-        cb.dp   = GET_IFIELD_V(0002, _O, void *);
-        handler = GET_IFIELD_V(0003, _O, acr_descriptor_handler_fn_t *);
+        cb.di   = GET_IFIELD_I(IHANDLE, _O);
+        cb.dp   = GET_IFIELD_V(PHANDLE, _O, void *);
+        handler = GET_IFIELD_V(HANDLER, _O, acr_descriptor_handler_fn_t *);
 
         if (handler) {
             int rc;
             cb.thiz = _O;
-            cb.data = GET_IFIELD_O(0006, _O);
+            cb.data = GET_IFIELD_O(CONTEXT, _O);
             if ((rc = (*handler)(_E, _O, ACR_DESC_SYNC, &cb))) {
                 if (rc == ACR_ENOTIMPL) {
                     ACR_THROW_EX_IF_ERR(ACR_EX_ESYNC, rc);
@@ -237,18 +180,18 @@
 
 ACR_JNI_EXPORT_DECLARE(void, Descriptor, flush0)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_descriptor_cb_t cb;
         acr_descriptor_handler_fn_t *handler;
 
-        cb.di   = GET_IFIELD_I(0001, _O);
-        cb.dp   = GET_IFIELD_V(0002, _O, void *);
-        handler = GET_IFIELD_V(0003, _O, acr_descriptor_handler_fn_t *);
+        cb.di   = GET_IFIELD_I(IHANDLE, _O);
+        cb.dp   = GET_IFIELD_V(PHANDLE, _O, void *);
+        handler = GET_IFIELD_V(HANDLER, _O, acr_descriptor_handler_fn_t *);
 
         if (handler) {
             int rc;
             cb.thiz = _O;
-            cb.data = GET_IFIELD_O(0006, _O);
+            cb.data = GET_IFIELD_O(CONTEXT, _O);
             if ((rc = (*handler)(_E, _O, ACR_DESC_FLUSH, &cb))) {
                 if (rc == ACR_ENOTIMPL) {
                     ACR_THROW_EX_IF_ERR(ACR_EX_ESYNC, rc);
@@ -267,8 +210,8 @@
 ACR_DECLARE(jobject) ACR_DescriptorCreate(JNIEnv *_E, int f, int i, void *p,
                                           acr_descriptor_handler_fn_t *cb)
 {
-    if (_clazzn.i && J4MID(0000))
-        return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
+    if (_clazzn.i && J4MID(ctor0))
+        return (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0),
                                 (jint)f, (jint)i, P2N(p), P2N(cb));
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -280,18 +223,18 @@
                                       int f, int i, void *p,
                                       acr_descriptor_handler_fn_t *c)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         if ((*_E)->MonitorEnter(_E, dp)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        SET_IFIELD_I(0000, dp, 1);
-        SET_IFIELD_I(0001, dp, i);
-        SET_IFIELD_P(0002, dp, p);
-        SET_IFIELD_P(0003, dp, c);
-        SET_IFIELD_I(0004, dp, 0);
-        SET_IFIELD_I(0005, dp, f);
-        SET_IFIELD_O(0006, dp, NULL);
+        SET_IFIELD_I(ISVALID, dp, 1);
+        SET_IFIELD_I(IHANDLE, dp, i);
+        SET_IFIELD_P(PHANDLE, dp, p);
+        SET_IFIELD_P(HANDLER, dp, c);
+        SET_IFIELD_I(IERRNUM, dp, 0);
+        SET_IFIELD_I(IDFLAGS, dp, f);
+        SET_IFIELD_O(CONTEXT, dp, NULL);
 
         (*_E)->MonitorExit(_E, dp);
         return ACR_SUCCESS;
@@ -303,7 +246,7 @@
 
 ACR_DECLARE(int) ACR_DescriptorCleanup(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_descriptor_cb_t cb;
         acr_descriptor_handler_fn_t *handler;
 
@@ -311,23 +254,23 @@
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        cb.di   = GET_IFIELD_I(0001, _O);
-        cb.dp   = GET_IFIELD_V(0002, _O, void *);
-        handler = GET_IFIELD_V(0003, _O, acr_descriptor_handler_fn_t *);
+        cb.di   = GET_IFIELD_I(IHANDLE, _O);
+        cb.dp   = GET_IFIELD_V(PHANDLE, _O, void *);
+        handler = GET_IFIELD_V(HANDLER, _O, acr_descriptor_handler_fn_t *);
         if (cb.di >= 0) {
-            SET_IFIELD_I(0001, _O, -1);
+            SET_IFIELD_I(IHANDLE, _O, -1);
         }
         if (cb.dp) {
-            SET_IFIELD_P(0002, _O, NULL);
+            SET_IFIELD_P(PHANDLE, _O, NULL);
         }
         if (handler) {
-            SET_IFIELD_P(0003, _O, NULL);
+            SET_IFIELD_P(HANDLER, _O, NULL);
         }
         (*_E)->MonitorExit(_E, _O);
 
         if (handler) {
             cb.thiz = _O;
-            cb.data = GET_IFIELD_O(0006, _O);
+            cb.data = GET_IFIELD_O(CONTEXT, _O);
             return (*handler)(_E, _O, ACR_DESC_FINALIZE, &cb);
         }
         else {
@@ -341,18 +284,18 @@
 
 ACR_DECLARE(int) ACR_DescriptorClear(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         if ((*_E)->MonitorEnter(_E, _O)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        SET_IFIELD_I(0000, _O, 0);
-        SET_IFIELD_I(0001, _O, -1);
-        SET_IFIELD_P(0002, _O, NULL);
-        SET_IFIELD_P(0003, _O, NULL);
-        SET_IFIELD_I(0004, _O, 0);
-        SET_IFIELD_I(0005, _O, 0);
-        SET_IFIELD_O(0006, _O, NULL);
+        SET_IFIELD_I(ISVALID, _O, 0);
+        SET_IFIELD_I(IHANDLE, _O, -1);
+        SET_IFIELD_P(PHANDLE, _O, NULL);
+        SET_IFIELD_P(HANDLER, _O, NULL);
+        SET_IFIELD_I(IERRNUM, _O, 0);
+        SET_IFIELD_I(IDFLAGS, _O, 0);
+        SET_IFIELD_O(CONTEXT, _O, NULL);
 
         (*_E)->MonitorExit(_E, _O);
         return ACR_SUCCESS;
@@ -363,8 +306,8 @@
 
 ACR_DECLARE(void *) ACR_DescriptorGetPtr(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return GET_IFIELD_V(0002, _O, void *);
+    if (_clazzn.i && J4MID(ctor0)) {
+        return GET_IFIELD_V(PHANDLE, _O, void *);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -374,8 +317,8 @@
 
 ACR_DECLARE(int) ACR_DescriptorGetInt(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return GET_DFIELD_I(0001, _O, -1);
+    if (_clazzn.i && J4MID(ctor0)) {
+        return GET_DFIELD_I(IHANDLE, _O, -1);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -385,8 +328,8 @@
 
 ACR_DECLARE(int) ACR_DescriptorGetErr(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return GET_IFIELD_I(0004, _O);
+    if (_clazzn.i && J4MID(ctor0)) {
+        return GET_IFIELD_I(IERRNUM, _O);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -396,8 +339,8 @@
 
 ACR_DECLARE(int) ACR_DescriptorFlags(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return GET_IFIELD_I(0005, _O);
+    if (_clazzn.i && J4MID(ctor0)) {
+        return GET_IFIELD_I(IDFLAGS, _O);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -407,12 +350,12 @@
 
 ACR_DECLARE(int) ACR_DescriptorSetPtr(ACR_JNISTDARGS, void *p)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
+    if (_clazzn.i && J4MID(ctor0) && _O) {
         if ((*_E)->MonitorEnter(_E, _O)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        SET_IFIELD_P(0002, _O, p);
+        SET_IFIELD_P(PHANDLE, _O, p);
         (*_E)->MonitorExit(_E, _O);
         return ACR_SUCCESS;
     }
@@ -423,12 +366,12 @@
 
 ACR_DECLARE(int) ACR_DescriptorSetInt(ACR_JNISTDARGS, int i)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
+    if (_clazzn.i && J4MID(ctor0) && _O) {
         if ((*_E)->MonitorEnter(_E, _O)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        SET_IFIELD_I(0001, _O, i);
+        SET_IFIELD_I(IHANDLE, _O, i);
         (*_E)->MonitorExit(_E, _O);
         return ACR_SUCCESS;
     }
@@ -439,8 +382,8 @@
 
 ACR_DECLARE(int) ACR_DescriptorSetErr(ACR_JNISTDARGS, int e)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        SET_IFIELD_I(0004, _O, e);
+    if (_clazzn.i && J4MID(ctor0)) {
+        SET_IFIELD_I(IERRNUM, _O, e);
         return ACR_SUCCESS;
     }
     else {
@@ -450,8 +393,8 @@
 
 ACR_DECLARE(int) ACR_DescriptorSetCtx(ACR_JNISTDARGS, jobject ctx)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        SET_IFIELD_O(0006, _O, ctx);
+    if (_clazzn.i && J4MID(ctor0)) {
+        SET_IFIELD_O(CONTEXT, _O, ctx);
         return ACR_SUCCESS;
     }
     else {
@@ -461,8 +404,8 @@
 
 ACR_DECLARE(jobject) ACR_DescriptorGetCtx(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        return GET_IFIELD_O(0006, _O);
+    if (_clazzn.i && J4MID(ctor0)) {
+        return GET_IFIELD_O(CONTEXT, _O);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -475,7 +418,7 @@
     if (_clazzn.i && _O) {
         _O = (*_E)->NewLocalRef(_E, _O);
         if (_O) {
-            SET_IFIELD_I(0004, _O, e);
+            SET_IFIELD_I(IERRNUM, _O, e);
             (*_E)->DeleteLocalRef(_E, _O);
         }
         return ACR_SUCCESS;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/mbstr.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/mbstr.c?rev=886874&r1=886873&r2=886874&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/mbstr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/mbstr.c Thu Dec  3 18:30:36 2009
@@ -24,23 +24,9 @@
 #include "acr_clazz.h"
 #include "acr_vm.h"
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "MbString"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "([B)V"
-};
-
-J_DECLARE_F_ID(0000) = {
-    NULL,
-    "mbstr",
-    "[B"
-};
+J_DECLARE_CLASS(MbString,   ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,      "[B");
+J_DECLARE_FIELD(mbstr,      "[B");
 
 ACR_CLASS_LDEF(MbString)
 {
@@ -48,8 +34,8 @@
 
     if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
-    J_LOAD_METHOD(0000);
-    J_LOAD_IFIELD(0000);
+    J_LOAD_METHOD(ctor0);
+    J_LOAD_IFIELD(mbstr);
 
     return ACR_SUCCESS;
 }
@@ -61,13 +47,13 @@
 
 ACR_DECLARE(jobject) ACR_NewMbString(JNIEnv *_E, const char *str)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         jbyteArray ba;
         size_t sl = strlen(str) + 1;
 
         if ((ba = (*_E)->NewByteArray(_E, (jsize)sl))) {
             (*_E)->SetByteArrayRegion(_E, ba, 0, (jsize)sl, (jbyte *)str);
-            return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000), ba);
+            return (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0), ba);
         }
         else {
             ACR_SET_OS_ERROR(ACR_ENOMEM);
@@ -82,8 +68,8 @@
 
 ACR_DECLARE(jbyteArray) ACR_GetMbString(ACR_JNISTDARGS, char **str)
 {
-    if (_clazzn.i && J4MID(0000)) {
-        jbyteArray ba = GET_IFIELD_O(0000, _O);
+    if (_clazzn.i && J4MID(ctor0)) {
+        jbyteArray ba = GET_IFIELD_O(mbstr, _O);
         if (ba) {
             *str = (char *)(*_E)->GetByteArrayElements(_E, ba, NULL);
             return ba;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=886874&r1=886873&r2=886874&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Thu Dec  3 18:30:36 2009
@@ -32,54 +32,20 @@
 #define ACR_PTR_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_Pointer64_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "Pointer64"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(JJJ)V"
-};
-
+J_DECLARE_CLASS(Pointer64,  ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,      JJJ);
 #else
 #define ACR_PTR_EXPORT_DECLARE(RT, FN)  \
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_Pointer32_##FN
 
-J_DECLARE_CLAZZ = {
-    NULL,
-    NULL,
-    ACR_CLASS_PATH "Pointer32"
-};
-
-J_DECLARE_M_ID(0000) = {
-    NULL,
-    "<init>",
-    "(III)V"
-};
-
+J_DECLARE_CLASS(Pointer32,  ACR_CLASS_PATH);
+J_DECLARE_M_INI(ctor0,      III);
 #endif
 
-J_DECLARE_F_ID(0000) = {
-    NULL,
-    "POINTER",
-    IFIELD_PTR
-};
-
-J_DECLARE_F_ID(0001) = {
-    NULL,
-    "CLEANUP",
-    IFIELD_PTR
-};
-
-J_DECLARE_F_ID(0002) = {
-    NULL,
-    "PLENGTH",
-    IFIELD_PTR
-};
-
+J_DECLARE_FIELD(IHANDLE,    I);
+J_DECLARE_FIELD(POINTER,    IFIELD_PTR);
+J_DECLARE_FIELD(CLEANUP,    IFIELD_PTR);
+J_DECLARE_FIELD(PLENGTH,    IFIELD_PTR);
 
 ACR_CLASS_LDEF(AbstractPointer)
 {
@@ -87,10 +53,10 @@
 
     if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
-    J_LOAD_IFIELD(0000);
-    J_LOAD_IFIELD(0001);
-    J_LOAD_IFIELD(0002);
-    J_LOAD_METHOD(0000);
+    J_LOAD_IFIELD(POINTER);
+    J_LOAD_IFIELD(CLEANUP);
+    J_LOAD_IFIELD(PLENGTH);
+    J_LOAD_METHOD(ctor0);
 
     return ACR_SUCCESS;
 }
@@ -133,18 +99,18 @@
 
 ACR_JNI_EXPORT_DECLARE(void, AbstractPointer, cleanup0)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_pointer_cleanup_fn_t *cleanup;
         void  *pointer;
 
-        pointer = GET_IFIELD_V(0000, _O, void *);
-        cleanup = GET_IFIELD_V(0001, _O, acr_pointer_cleanup_fn_t *);
+        pointer = GET_IFIELD_V(POINTER, _O, void *);
+        cleanup = GET_IFIELD_V(CLEANUP, _O, acr_pointer_cleanup_fn_t *);
         if (pointer) {
-            SET_IFIELD_P(0000, _O, NULL);
+            SET_IFIELD_P(POINTER, _O, NULL);
         }
         if (cleanup) {
             int rc;
-            size_t plength = (size_t)GET_IFIELD_P(0002, _O);
+            size_t plength = (size_t)GET_IFIELD_P(PLENGTH, _O);
             if ((rc = (*cleanup)(pointer, plength))) {
                 /* Throw RuntimeException with errno message */
                 ACR_ThrowException(_E, THROW_FMARK, ACR_EX_ERUNTIME, rc);
@@ -158,17 +124,17 @@
 
 ACR_JNI_EXPORT_DECLARE(void, AbstractPointer, cleanup1)(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000)) {
+    if (_clazzn.i && J4MID(ctor0)) {
         acr_pointer_cleanup_fn_t *cleanup;
         void  *pointer;
 
-        pointer = GET_IFIELD_V(0000, _O, void *);
-        cleanup = GET_IFIELD_V(0001, _O, acr_pointer_cleanup_fn_t *);
+        pointer = GET_IFIELD_V(POINTER, _O, void *);
+        cleanup = GET_IFIELD_V(CLEANUP, _O, acr_pointer_cleanup_fn_t *);
         if (pointer) {
-            SET_IFIELD_P(0000, _O, NULL);
+            SET_IFIELD_P(POINTER, _O, NULL);
         }
         if (cleanup) {
-            size_t plength = (size_t)GET_IFIELD_P(0002, _O);
+            size_t plength = (size_t)GET_IFIELD_P(PLENGTH, _O);
             (*cleanup)(pointer, plength);
         }
     }
@@ -257,8 +223,8 @@
 ACR_DECLARE(jobject) ACR_NewBasicPointer(JNIEnv *_E, void *p, size_t len,
                                          acr_pointer_cleanup_fn_t *cb)
 {
-    if (_clazzn.i && J4MID(0000))
-        return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
+    if (_clazzn.i && J4MID(ctor0))
+        return (*_E)->NewObject(_E, _clazzn.i, J4MID(ctor0),
                                 P2N(p), P2N(cb), (acr_ptr_t)len);
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
@@ -268,7 +234,7 @@
 
 ACR_DECLARE(int) ACR_PointerCleanup(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
+    if (_clazzn.i && J4MID(ctor0) && _O) {
         acr_pointer_cleanup_fn_t *cleanup;
         void  *pointer;
 
@@ -276,17 +242,17 @@
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
-        pointer = GET_IFIELD_V(0000, _O, void *);
-        cleanup = GET_IFIELD_V(0001, _O, acr_pointer_cleanup_fn_t *);
+        pointer = GET_IFIELD_V(POINTER, _O, void *);
+        cleanup = GET_IFIELD_V(CLEANUP, _O, acr_pointer_cleanup_fn_t *);
         if (pointer) {
-            SET_IFIELD_P(0000, _O, NULL);
+            SET_IFIELD_P(POINTER, _O, NULL);
         }
         if (cleanup) {
-            SET_IFIELD_P(0001, _O, NULL);
+            SET_IFIELD_P(CLEANUP, _O, NULL);
         }
         (*_E)->MonitorExit(_E, _O);
         if (cleanup) {
-            size_t plength = (size_t)GET_IFIELD_P(0002, _O);
+            size_t plength = (size_t)GET_IFIELD_P(PLENGTH, _O);
             return (*cleanup)(pointer, plength);
         }
         else {
@@ -300,10 +266,10 @@
 
 ACR_DECLARE(void *) ACR_PointerGet(ACR_JNISTDARGS, size_t *len)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
-        void *pointer = GET_IFIELD_V(0000, _O, void *);
+    if (_clazzn.i && J4MID(ctor0) && _O) {
+        void *pointer = GET_IFIELD_V(POINTER, _O, void *);
         if (len) {
-            *len = (size_t)GET_IFIELD_P(0002, _O);
+            *len = (size_t)GET_IFIELD_P(PLENGTH, _O);
         }
         return pointer;
     }
@@ -315,15 +281,15 @@
 
 ACR_DECLARE(int) ACR_PointerSet(ACR_JNISTDARGS, void *p, size_t len)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
+    if (_clazzn.i && J4MID(ctor0) && _O) {
         if ((*_E)->MonitorEnter(_E, _O)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
 
-        SET_IFIELD_P(0000, _O, p);
+        SET_IFIELD_P(POINTER, _O, p);
         if (len) {
-            SET_IFIELD_P(0002, _O, len);
+            SET_IFIELD_P(PLENGTH, _O, len);
         }
         (*_E)->MonitorExit(_E, _O);
         return ACR_SUCCESS;
@@ -336,15 +302,15 @@
 ACR_DECLARE(int) ACR_PointerAttach(ACR_JNISTDARGS, void *p, size_t len,
                                    acr_pointer_cleanup_fn_t *cb)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
+    if (_clazzn.i && J4MID(ctor0) && _O) {
         if ((*_E)->MonitorEnter(_E, _O)) {
             /* Object locking failed */
             return ACR_ENOLOCK;
         }
 
-        SET_IFIELD_P(0000, _O, p);
-        SET_IFIELD_P(0001, _O, cb);
-        SET_IFIELD_P(0002, _O, len);
+        SET_IFIELD_P(POINTER, _O, p);
+        SET_IFIELD_P(CLEANUP, _O, cb);
+        SET_IFIELD_P(PLENGTH, _O, len);
 
         (*_E)->MonitorExit(_E, _O);
         return ACR_SUCCESS;
@@ -356,8 +322,8 @@
 
 ACR_DECLARE(acr_pointer_cleanup_fn_t *) ACR_PointerCallbackGet(ACR_JNISTDARGS)
 {
-    if (_clazzn.i && J4MID(0000) && _O) {
-        return GET_IFIELD_V(0001, _O, acr_pointer_cleanup_fn_t *);
+    if (_clazzn.i && J4MID(ctor0) && _O) {
+        return GET_IFIELD_V(CLEANUP, _O, acr_pointer_cleanup_fn_t *);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);



Mime
View raw message