comparison java/jdc/org_dyncall_DC.c @ 20:77ca609422f1

- first working build of new java binding
author cslag
date Wed, 30 Mar 2016 02:40:56 +0200
parents 5b51738793c6
children 40a2c4198016
comparison
equal deleted inserted replaced
19:5b51738793c6 20:77ca609422f1
1 #include "org_dyncall_DC.h" 1 #include "org_dyncall_DC.h"
2 #include "dyncall.h" 2 #include "dyncall.h"
3 #include "dynload.h"
3 4
4 jlong JNICALL Java_org_dyncall_DC_newCallVM(JNIEnv *pEnv, jclass clazz, jint mode, jint size) 5 jlong JNICALL Java_org_dyncall_DC_newCallVM(JNIEnv *pEnv, jclass clazz, jint size)
5 { 6 {
6 return (jlong)dcNewCallVM(mode, size); 7 return (jlong)dcNewCallVM(size);
7 //@@@ free 8 //@@@ free
8 } 9 }
9 10
10 jlong JNICALL Java_org_dyncall_DC_load(JNIEnv *, jclass, jstring s) 11 jlong JNICALL Java_org_dyncall_DC_load(JNIEnv *pEnv, jclass clazz, jstring s)
11 { 12 {
12 return dlLoadLibrary((const char*)s); 13 return (jlong)dlLoadLibrary((const char*)s);
13 //@@@ free 14 //@@@ free
14 } 15 }
15 16
16 jlong JNICALL Java_org_dyncall_DC_find(JNIEnv *, jclass, jlong libhandle, jstring s) 17 jlong JNICALL Java_org_dyncall_DC_find(JNIEnv *pEnv, jclass clazz, jlong libhandle, jstring s)
17 { 18 {
18 return dlFindSymbol((DLLib*)libhandle, (const char*)s); 19 return (jlong)dlFindSymbol((DLLib*)libhandle, (const char*)s);
19 } 20 }
20 21
21 //jint JNICALL Java_org_dyncall_DC_symsCount(JNIEnv *, jclass, jlong symshandle) 22 //jint JNICALL Java_org_dyncall_DC_symsCount(JNIEnv *pEnv, jclass clazz, jlong symshandle)
22 //{ 23 //{
23 // return dlSymsCount((DLSyms*)symshandle); 24 // return dlSymsCount((DLSyms*)symshandle);
24 //} 25 //}
25 26
26 //jstring JNICALL Java_org_dyncall_DC_symsName(JNIEnv *, jclass, jlong symshandle, jint i) 27 //jstring JNICALL Java_org_dyncall_DC_symsName(JNIEnv *pEnv, jclass clazz, jlong symshandle, jint i)
27 //{ 28 //{
28 // return dlSymsName((DLSyms*)symshandle, i); 29 // return dlSymsName((DLSyms*)symshandle, i);
29 //} 30 //}
30 31
31 void JNICALL Java_org_dyncall_DC_mode(JNIEnv *, jclass, jlong in_vm, jint i) 32 void JNICALL Java_org_dyncall_DC_mode(JNIEnv *pEnv, jclass clazz, jlong vm, jint i)
32 { 33 {
33 dcMode((DCCallVM*)in_vm, i); 34 dcMode((DCCallVM*)vm, i);
34 } 35 }
35 36
36 void JNICALL Java_org_dyncall_DC_reset(JNIEnv *, jclass, jlong in_vm) 37 void JNICALL Java_org_dyncall_DC_reset(JNIEnv *pEnv, jclass clazz, jlong vm)
37 { 38 {
38 dcReset((DCCallVM*)in_vm); 39 dcReset((DCCallVM*)vm);
39 } 40 }
40 41
41 void JNICALL Java_org_dyncall_DC_argBool(JNIEnv *, jclass, jlong in_vm, jboolean b) 42 void JNICALL Java_org_dyncall_DC_argBool(JNIEnv *pEnv, jclass clazz, jlong vm, jboolean b)
42 { 43 {
43 dcPushBool((DCCallVM*)in_vm, b); 44 dcArgBool((DCCallVM*)vm, b);
44 } 45 }
45 46
46 void JNICALL Java_org_dyncall_DC_argChar(JNIEnv *, jclass, jlong in_vm, jbyte b) 47 void JNICALL Java_org_dyncall_DC_argChar(JNIEnv *pEnv, jclass clazz, jlong vm, jbyte b)
47 { 48 {
48 dcPushChar((DCCallVM*)in_vm, b); 49 dcArgChar((DCCallVM*)vm, b);
49 } 50 }
50 51
51 void JNICALL Java_org_dyncall_DC_argShort(JNIEnv *, jclass, jlong in_vm, jshort s) 52 void JNICALL Java_org_dyncall_DC_argShort(JNIEnv *pEnv, jclass clazz, jlong vm, jshort s)
52 { 53 {
53 dcPushShort((DCCallVM*)in_vm, s); 54 dcArgShort((DCCallVM*)vm, s);
54 } 55 }
55 56
56 void JNICALL Java_org_dyncall_DC_argInt(JNIEnv *, jclass, jlong in_vm, jint i) 57 void JNICALL Java_org_dyncall_DC_argInt(JNIEnv *pEnv, jclass clazz, jlong vm, jint i)
57 { 58 {
58 dcPushInt((DCCallVM*)in_vm, i); 59 dcArgInt((DCCallVM*)vm, i);
59 } 60 }
60 61
61 void JNICALL Java_org_dyncall_DC_argLong(JNIEnv *, jclass, jlong in_vm, jlong l) 62 void JNICALL Java_org_dyncall_DC_argLong(JNIEnv *pEnv, jclass clazz, jlong vm, jlong l)
62 { 63 {
63 dcPushLong((DCCallVM*)in_vm, l); 64 dcArgLong((DCCallVM*)vm, l);
64 } 65 }
65 66
66 void JNICALL Java_org_dyncall_DC_argLongLong(JNIEnv *, jclass, jlong in_vm, jlong l) 67 void JNICALL Java_org_dyncall_DC_argLongLong(JNIEnv *pEnv, jclass clazz, jlong vm, jlong l)
67 { 68 {
68 dcPushLongLong((DCCallVM*)in_vm, l); 69 dcArgLongLong((DCCallVM*)vm, l);
69 } 70 }
70 71
71 void JNICALL Java_org_dyncall_DC_argFloat(JNIEnv *, jclass, jlong in_vm, jfloat f) 72 void JNICALL Java_org_dyncall_DC_argFloat(JNIEnv *pEnv, jclass clazz, jlong vm, jfloat f)
72 { 73 {
73 dcPushFloat((DCCallVM*)in_vm, f); 74 dcArgFloat((DCCallVM*)vm, f);
74 } 75 }
75 76
76 void JNICALL Java_org_dyncall_DC_argDouble(JNIEnv *, jclass, jlong in_vm, jdouble d) 77 void JNICALL Java_org_dyncall_DC_argDouble(JNIEnv *pEnv, jclass clazz, jlong vm, jdouble d)
77 { 78 {
78 dcPushDouble((DCCallVM*)in_vm, d); 79 dcArgDouble((DCCallVM*)vm, d);
79 } 80 }
80 81
81 void JNICALL Java_org_dyncall_DC_argPointer__JJ(JNIEnv *, jclass, jlong in_vm, jlong l) 82 void JNICALL Java_org_dyncall_DC_argPointer__JJ(JNIEnv *pEnv, jclass clazz, jlong vm, jlong l)
82 { 83 {
83 dcPushPointer((DCCallVM*)in_vm, (DCpointer)l); 84 dcArgPointer((DCCallVM*)vm, (DCpointer)l);
84 } 85 }
85 86
86 void JNICALL Java_org_dyncall_DC_argPointer__JLjava_lang_Object_2(JNIEnv *, jclass, jlong in_vm, jobject o) 87 void JNICALL Java_org_dyncall_DC_argPointer__JLjava_lang_Object_2(JNIEnv *pEnv, jclass clazz, jlong vm, jobject o)
87 { 88 {
88 dcPushPointer((DCCallVM*)in_vm, (DCpointer)o); 89 dcArgPointer((DCCallVM*)vm, (DCpointer)o);
89 } 90 }
90 91
91 void JNICALL Java_org_dyncall_DC_argString(JNIEnv *, jclass, jlong in_vm, jstring s) 92 void JNICALL Java_org_dyncall_DC_argString(JNIEnv *pEnv, jclass clazz, jlong vm, jstring s)
92 { 93 {
93 dcPushPointer((DCCallVM*)in_vm, (DCpointer)s); 94 dcArgPointer((DCCallVM*)vm, (DCpointer)s);
94 } 95 }
95 96
96 void JNICALL Java_org_dyncall_DC_callVoid (JNIEnv *, jclass, jlong in_vm, jlong in_target) 97 void JNICALL Java_org_dyncall_DC_callVoid (JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
97 { 98 {
98 dcCallVoid((DCCallVM*)in_vm, (DCpointer)target) 99 dcCallVoid((DCCallVM*)vm, (DCpointer)target);
99 } 100 }
100 101
101 jboolean JNICALL Java_org_dyncall_DC_callBool(JNIEnv *, jclass, jlong in_vm, jlong target) 102 jboolean JNICALL Java_org_dyncall_DC_callBool(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
102 { 103 {
103 return dcCallBool((DCCallVM*)in_vm, (DCpointer)target) 104 return dcCallBool((DCCallVM*)vm, (DCpointer)target);
104 } 105 }
105 106
106 jbyte JNICALL Java_org_dyncall_DC_callChar(JNIEnv *, jclass, jlong in_vm, jlong target) 107 jbyte JNICALL Java_org_dyncall_DC_callChar(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
107 { 108 {
108 return dcCallChar((DCCallVM*)in_vm, (DCpointer)target) 109 return dcCallChar((DCCallVM*)vm, (DCpointer)target);
109 } 110 }
110 111
111 jshort JNICALL Java_org_dyncall_DC_callShort(JNIEnv *, jclass, jlong in_vm, jlong target) 112 jshort JNICALL Java_org_dyncall_DC_callShort(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
112 { 113 {
113 return dcCallShort((DCCallVM*)in_vm, (DCpointer)target) 114 return dcCallShort((DCCallVM*)vm, (DCpointer)target);
114 } 115 }
115 116
116 jint JNICALL Java_org_dyncall_DC_callInt(JNIEnv *, jclass, jlong in_vm, jlong target) 117 jint JNICALL Java_org_dyncall_DC_callInt(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
117 { 118 {
118 return dcCallInt((DCCallVM*)in_vm, (DCpointer)target) 119 return dcCallInt((DCCallVM*)vm, (DCpointer)target);
119 } 120 }
120 121
121 jlong JNICALL Java_org_dyncall_DC_callLong(JNIEnv *, jclass, jlong in_vm, jlong target) 122 jlong JNICALL Java_org_dyncall_DC_callLong(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
122 { 123 {
123 return dcCallLong((DCCallVM*)in_vm, (DCpointer)target) 124 return dcCallLong((DCCallVM*)vm, (DCpointer)target);
124 } 125 }
125 126
126 jlong JNICALL Java_org_dyncall_DC_callLongLong(JNIEnv *, jclass, jlong in_vm, jlong target) 127 jlong JNICALL Java_org_dyncall_DC_callLongLong(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
127 { 128 {
128 return dcCallLongLong((DCCallVM*)in_vm, (DCpointer)target) 129 return dcCallLongLong((DCCallVM*)vm, (DCpointer)target);
129 } 130 }
130 131
131 jfloat JNICALL Java_org_dyncall_DC_callFloat(JNIEnv *, jclass, jlong in_vm, jlong target) 132 jfloat JNICALL Java_org_dyncall_DC_callFloat(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
132 { 133 {
133 return dcCallFloat((DCCallVM*)in_vm, (DCpointer)target) 134 return dcCallFloat((DCCallVM*)vm, (DCpointer)target);
134 } 135 }
135 136
136 jdouble JNICALL Java_org_dyncall_DC_callDouble(JNIEnv *, jclass, jlong in_vm, jlong target) 137 jdouble JNICALL Java_org_dyncall_DC_callDouble(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
137 { 138 {
138 return dcCallDouble((DCCallVM*)in_vm, (DCpointer)target) 139 return dcCallDouble((DCCallVM*)vm, (DCpointer)target);
139 } 140 }
140 141
141 jlong JNICALL Java_org_dyncall_DC_callPointer(JNIEnv *, jclass, jlong in_vm, jlong target) 142 jlong JNICALL Java_org_dyncall_DC_callPointer(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
142 { 143 {
143 return dcCallPointer((DCCallVM*)in_vm, (DCpointer)target) 144 return (jlong)dcCallPointer((DCCallVM*)vm, (DCpointer)target);
144 } 145 }
145 146
146 jstring JNICALL Java_org_dyncall_DC_callString(JNIEnv *, jclass, jlong in_vm, jlong target) 147 jstring JNICALL Java_org_dyncall_DC_callString(JNIEnv *pEnv, jclass clazz, jlong vm, jlong target)
147 { 148 {
148 return dcCallPointer((DCCallVM*)in_vm, (DCpointer)target) 149 return dcCallPointer((DCCallVM*)vm, (DCpointer)target);
149 } 150 }
150 151
151 jint JNICALL Java_org_dyncall_DC_getError(JNIEnv *, jclass, jlong in_vm) 152 jint JNICALL Java_org_dyncall_DC_getError(JNIEnv *pEnv, jclass clazz, jlong vm)
152 { 153 {
153 return dcGetError((DCCallVM*)in_vm); 154 return dcGetError((DCCallVM*)vm);
154 } 155 }
155 156