cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r64 - in trunk/cinvoke: bindings/java bindings/java/org/ci


From: will
Subject: [cinvoke-svn] r64 - in trunk/cinvoke: bindings/java bindings/java/org/cinvoke lib lib/arch
Date: 1 Jul 2006 18:35:13 -0400

Author: will
Date: 2006-07-01 18:35:13 -0400 (Sat, 01 Jul 2006)
New Revision: 64

Modified:
   trunk/cinvoke/bindings/java/Makefile
   trunk/cinvoke/bindings/java/org/cinvoke/CInvoke.java
   trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.cpp
   trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.h
   trunk/cinvoke/lib/arch/cl_x86_win.h
   trunk/cinvoke/lib/arch/empty_empty_empty.h
   trunk/cinvoke/lib/arch/gcc_x64_unix.h
   trunk/cinvoke/lib/arch/gcc_x86_unix.h
   trunk/cinvoke/lib/cinvoke-arch.h
   trunk/cinvoke/lib/cinvoke.c
Log:
fixed types


Modified: trunk/cinvoke/bindings/java/Makefile
===================================================================
--- trunk/cinvoke/bindings/java/Makefile        2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/bindings/java/Makefile        2006-07-01 22:35:13 UTC (rev 64)
@@ -12,6 +12,8 @@
 .cpp.o:
        g++ -Wall -Werror -c $<
 
+org_cinvoke_CInvoke.o: org_cinvoke_CInvoke.cpp org_cinvoke_CInvoke.h
+
 header:
        javah org.cinvoke.CInvoke
 

Modified: trunk/cinvoke/bindings/java/org/cinvoke/CInvoke.java
===================================================================
--- trunk/cinvoke/bindings/java/org/cinvoke/CInvoke.java        2006-07-01 
04:31:31 UTC (rev 63)
+++ trunk/cinvoke/bindings/java/org/cinvoke/CInvoke.java        2006-07-01 
22:35:13 UTC (rev 64)
@@ -15,7 +15,7 @@
        private static native long createFunction(long ctx, int cc, String 
retfmt,
                String paramfmt);
        private static native Object invokeFunction(long ctx, long func, long 
ep,
-               Object[] params);
+               Object[] params, int[] types);
        private static native int deleteFunction(long ctx, long func);
        private static native long createStruct(long ctx);
        private static native int addValueMemberStruct(long ctx, long strct,
@@ -24,10 +24,10 @@
                String name, long type);
        private static native long alloc(int sz);
        private static native void free(long m);
-       private static native void writeValue(long m, Object val);
+       private static native void writeValue(long m, Object val, int type);
        private static native Object readValue(long m, int type);
        private static native int setMemberValueStruct(long ctx, long strct,
-               long m, String name, Object val);
+               long m, String name, Object val, int type);
        private static native Object getMemberValueStruct(long ctx, long strct,
                long m, String name, int type);
        private static native int finishStruct(long ctx, long strct);
@@ -50,10 +50,10 @@
        }
 
        public class CC {
-               public static final int DEFAULT = 0;
-               public static final int CDECL = 1;
-               public static final int STDCALL = 2;
-               public static final int FASTCALL = 3;
+               public static final int DEFAULT = -1;
+               public static final int CDECL = 0;
+               public static final int STDCALL = 1;
+               public static final int FASTCALL = 2;
        }
 
        public static Object load(String libname, Class iface) {

Modified: trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.cpp
===================================================================
--- trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.cpp 2006-07-01 04:31:31 UTC 
(rev 63)
+++ trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.cpp 2006-07-01 22:35:13 UTC 
(rev 64)
@@ -3,6 +3,17 @@
 #include <cinvoke.h>
 #include "org_cinvoke_CInvoke.h"
 
+cinv_type_t gettype(jint jt) {
+       if (jt == -1)
+               return CINV_T_2BYTE;
+       else if (jt == -2)
+               return CINV_T_4BYTE;
+       else if (jt == -3)
+               return CINV_T_8BYTE;
+       else
+               return (cinv_type_t)jt;
+}
+
 JNIEXPORT jlong JNICALL Java_org_cinvoke_CInvoke_createContext(
        JNIEnv *env, jclass) {
        return (jlong)cinv_context_create();
@@ -55,6 +66,9 @@
        const char *retchrs = env->GetStringUTFChars(retfmt, NULL);
        if (retchrs == NULL) return 0;
 
+       if (cc == -1)
+               cc = CINV_CC_DEFAULT;
+
        jlong ret = (jlong)cinv_function_create(ctx, (cinv_callconv_t)cc,
                retchrs, parmchrs);
 
@@ -63,7 +77,8 @@
        return ret;
 }
 JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_invokeFunction(
-       JNIEnv *env, jclass, jlong c, jlong f, jlong e, jobjectArray params) {
+       JNIEnv *env, jclass, jlong c, jlong f, jlong e, jobjectArray params,
+       jintArray types) {
        // XXX
        return NULL;
 }
@@ -115,7 +130,7 @@
        free(ptr);
 }
 JNIEXPORT void JNICALL Java_org_cinvoke_CInvoke_writeValue(
-       JNIEnv *env, jclass, jlong p, jobject val) {
+       JNIEnv *env, jclass, jlong p, jobject val, jint type) {
        // XXX
 }
 JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_readValue(
@@ -124,7 +139,8 @@
        return NULL;
 }
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_setMemberValueStruct(
-       JNIEnv *env, jclass, jlong c, jlong s, jlong i, jstring name, jobject 
val) {
+       JNIEnv *env, jclass, jlong c, jlong s, jlong i, jstring name, jobject 
val,
+       jint type) {
        // XXX
        return 0;
 }

Modified: trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.h
===================================================================
--- trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.h   2006-07-01 04:31:31 UTC 
(rev 63)
+++ trunk/cinvoke/bindings/java/org_cinvoke_CInvoke.h   2006-07-01 22:35:13 UTC 
(rev 64)
@@ -17,17 +17,17 @@
 JNIEXPORT jlong JNICALL Java_org_cinvoke_CInvoke_loadEPLibrary (JNIEnv *env, 
jclass, jlong, jlong, jstring);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_deleteLibrary (JNIEnv *env, 
jclass, jlong, jlong);
 JNIEXPORT jlong JNICALL Java_org_cinvoke_CInvoke_createFunction (JNIEnv *env, 
jclass, jlong, jint, jstring, jstring);
-JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_invokeFunction (JNIEnv 
*env, jclass, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_invokeFunction (JNIEnv 
*env, jclass, jlong, jlong, jlong, jobjectArray, jintArray);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_deleteFunction (JNIEnv *env, 
jclass, jlong, jlong);
 JNIEXPORT jlong JNICALL Java_org_cinvoke_CInvoke_createStruct (JNIEnv *env, 
jclass, jlong);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_addValueMemberStruct (JNIEnv 
*env, jclass, jlong, jlong, jstring, jint);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_addStructMemberStruct (JNIEnv 
*env, jclass, jlong, jlong, jstring, jlong);
 JNIEXPORT jlong JNICALL Java_org_cinvoke_CInvoke_alloc (JNIEnv *env, jclass, 
jint);
 JNIEXPORT void JNICALL Java_org_cinvoke_CInvoke_free (JNIEnv *env, jclass, 
jlong);
-JNIEXPORT void JNICALL Java_org_cinvoke_CInvoke_writeValue (JNIEnv *env, 
jclass, jlong, jobject);
+JNIEXPORT void JNICALL Java_org_cinvoke_CInvoke_writeValue (JNIEnv *env, 
jclass, jlong, jobject, jint);
 JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_readValue (JNIEnv *env, 
jclass, jlong, jint);
-JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_setMemberValueStruct (JNIEnv 
*env, jclass, jlong, jlong, jlong, jstring, jobject);
-JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_getMemberValueStruct 
(JNIEnv *env, jclass, jlong, jlong, jlong, jstring);
+JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_setMemberValueStruct (JNIEnv 
*env, jclass, jlong, jlong, jlong, jstring, jobject, jint);
+JNIEXPORT jobject JNICALL Java_org_cinvoke_CInvoke_getMemberValueStruct 
(JNIEnv *env, jclass, jlong, jlong, jlong, jstring, jint);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_finishStruct (JNIEnv *env, 
jclass, jlong, jlong);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_sizeStruct (JNIEnv *env, 
jclass, jlong, jlong);
 JNIEXPORT jint JNICALL Java_org_cinvoke_CInvoke_deleteStruct (JNIEnv *env, 
jclass, jlong, jlong);

Modified: trunk/cinvoke/lib/arch/cl_x86_win.h
===================================================================
--- trunk/cinvoke/lib/arch/cl_x86_win.h 2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/arch/cl_x86_win.h 2006-07-01 22:35:13 UTC (rev 64)
@@ -59,7 +59,7 @@
 
 // setting this to stdcall makes the win32 api work, but user-compiled
 // dlls break; you can't win
-#define CINV_ARCH_CC_DEFAULT CINV_CC_CDECL
+#define CINV_CC_DEFAULT CINV_CC_CDECL
 #define CINV_T_2BYTE CINV_T_SHORT
 #define CINV_T_4BYTE CINV_T_INT
 #define CINV_T_8BYTE CINV_T_EXTRALONG

Modified: trunk/cinvoke/lib/arch/empty_empty_empty.h
===================================================================
--- trunk/cinvoke/lib/arch/empty_empty_empty.h  2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/arch/empty_empty_empty.h  2006-07-01 22:35:13 UTC (rev 64)
@@ -84,7 +84,7 @@
 // TODO: this sets the default calling convention.  most
 // archs only have one, so you can either add a new one to
 // the cinv_callconv_t enumeration, or just use "cdecl"
-#define CINV_ARCH_CC_DEFAULT CINV_CC_CDECL 
+#define CINV_CC_DEFAULT CINV_CC_CDECL 
 
 // TODO: set these similarly to the cinv_int*_t types above
 #define CINV_T_2BYTE CINV_T_SHORT

Modified: trunk/cinvoke/lib/arch/gcc_x64_unix.h
===================================================================
--- trunk/cinvoke/lib/arch/gcc_x64_unix.h       2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/arch/gcc_x64_unix.h       2006-07-01 22:35:13 UTC (rev 64)
@@ -66,7 +66,7 @@
 #define CINV_NOMEM_NEEDSFREE 1
 #define CINV_E_INVAL ((cinv_int32_t)EINVAL)
 
-#define CINV_ARCH_CC_DEFAULT CINV_CC_CDECL
+#define CINV_CC_DEFAULT CINV_CC_CDECL
 #define CINV_T_2BYTE CINV_T_SHORT
 #define CINV_T_4BYTE CINV_T_INT
 #define CINV_T_8BYTE CINV_T_EXTRALONG

Modified: trunk/cinvoke/lib/arch/gcc_x86_unix.h
===================================================================
--- trunk/cinvoke/lib/arch/gcc_x86_unix.h       2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/arch/gcc_x86_unix.h       2006-07-01 22:35:13 UTC (rev 64)
@@ -52,7 +52,7 @@
 #define CINV_NOMEM_NEEDSFREE 1
 #define CINV_E_INVAL ((cinv_int32_t)EINVAL)
 
-#define CINV_ARCH_CC_DEFAULT CINV_CC_CDECL
+#define CINV_CC_DEFAULT CINV_CC_CDECL
 #define CINV_T_2BYTE CINV_T_SHORT
 #define CINV_T_4BYTE CINV_T_INT
 #define CINV_T_8BYTE CINV_T_EXTRALONG

Modified: trunk/cinvoke/lib/cinvoke-arch.h
===================================================================
--- trunk/cinvoke/lib/cinvoke-arch.h    2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/cinvoke-arch.h    2006-07-01 22:35:13 UTC (rev 64)
@@ -48,24 +48,23 @@
 */
 typedef enum _cinv_type_t {
        CINV_T_CHAR = 0, /**< Represents the \b char C type */
-       CINV_T_SHORT, /**< Represents the \b short C type */
-       CINV_T_INT, /**< Represents the \b int C type */
-       CINV_T_LONG, /**< Represents the \b long C type */
-       CINV_T_EXTRALONG, /**< Represents the <b>long long</b> C type */
-       CINV_T_FLOAT, /**< Represents the \b float C type */
-       CINV_T_DOUBLE, /**< Represents the \b double C type */
-       CINV_T_PTR, /**< Represents any pointer type */
+       CINV_T_SHORT = 1, /**< Represents the \b short C type */
+       CINV_T_INT = 2, /**< Represents the \b int C type */
+       CINV_T_LONG = 3, /**< Represents the \b long C type */
+       CINV_T_EXTRALONG = 4, /**< Represents the <b>long long</b> C type */
+       CINV_T_FLOAT = 5, /**< Represents the \b float C type */
+       CINV_T_DOUBLE = 6, /**< Represents the \b double C type */
+       CINV_T_PTR = 7, /**< Represents any pointer type */
 
-       CINV_NUM_TYPES
+       CINV_NUM_TYPES = 8
 } cinv_type_t;
 
 /** Indicates the calling convention being used for a function.
 */
 typedef enum _cinv_callconv_t {
-       CINV_CC_DEFAULT = 0,
-       CINV_CC_CDECL = 1, /**< The cdecl calling convention, the most common 
convention on x86. */
-       CINV_CC_STDCALL = 2, /**< The stdcall calling convention, the default 
convention for the Windows API. */
-       CINV_CC_FASTCALL = 3 /**< Yet another, rarely used, Windows calling 
convention */
+       CINV_CC_CDECL = 0, /**< The cdecl calling convention, the most common 
convention on x86. */
+       CINV_CC_STDCALL = 1, /**< The stdcall calling convention, the default 
convention for the Windows API. */
+       CINV_CC_FASTCALL = 2 /**< Yet another, rarely used, Windows calling 
convention */
 } cinv_callconv_t;
 
 #ifdef ARCH_GCC_X86_UNIX

Modified: trunk/cinvoke/lib/cinvoke.c
===================================================================
--- trunk/cinvoke/lib/cinvoke.c 2006-07-01 04:31:31 UTC (rev 63)
+++ trunk/cinvoke/lib/cinvoke.c 2006-07-01 22:35:13 UTC (rev 64)
@@ -220,8 +220,6 @@
                return NULL;
        }
 
-       if (callingconvention == CINV_CC_DEFAULT)
-               callingconvention = CINV_ARCH_CC_DEFAULT;
        function->callconv = callingconvention;
        function->stacksize = 0;
        





reply via email to

[Prev in Thread] Current Thread [Next in Thread]