Debian Codegraph @

native/jni_include/jni.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18 * JNI specification, as defined by Sun:
19 * http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html
20 *
21 * Everything here is expected to be VM-neutral.
22 */
23
24 #ifndef JNI_H_
25 #define JNI_H_
26
27 #include <stdarg.h>
28
29 #ifdef _MSC_VER // broken m$ compiler does not have c99 std header
30 #if _MSC_VER >= 1600
31 #include <cstdint>
32 #else
33 typedef __int8 int8_t;
34 typedef __int16 int16_t;
35 typedef __int32 int32_t;
36 typedef __int64 int64_t;
37 typedef unsigned __int8 uint8_t;
38 typedef unsigned __int16 uint16_t;
39 typedef unsigned __int32 uint32_t;
40 typedef unsigned __int64 uint64_t;
41 #endif
42 #else
43 #include <stdint.h>
44 #endif
45
46 #include <sys/types.h>
47
48 /* Primitive types that match up with Java equivalents. */
49 typedef uint8_t jboolean; /* unsigned 8 bits */
50 typedef int8_t jbyte; /* signed 8 bits */
51 typedef uint16_t jchar; /* unsigned 16 bits */
52 typedef int16_t jshort; /* signed 16 bits */
53 #if defined(_WIN32)
54 typedef long jint;
55 #else
56 typedef int32_t jint; /* signed 32 bits */
57 #endif
58
59 // define jlong
60 #ifdef _LP64 /* 64-bit build */
61 typedef int64_t jlong; /* signed 64 bits */
62 // typedef long jlong;
63 #else
64 typedef long long jlong;
65 #endif
66 typedef float jfloat; /* 32-bit IEEE 754 */
67 typedef double jdouble; /* 64-bit IEEE 754 */
68
69 /* "cardinal indices and sizes" */
70 typedef jint jsize;
71
72 #ifndef __has_attribute
73 #define __has_attribute(x) 0
74 #endif
75
76 #if defined(_WIN32)
77 #define JNIEXPORT __declspec(dllexport)
78 #define JNIIMPORT __declspec(dllimport)
79 #define JNICALL __stdcall
80 #elif (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
81 #define JNIEXPORT __attribute__((visibility("default")))
82 #define JNIIMPORT __attribute__((visibility("default")))
83 #define JNICALL
84 #else
85 #define JNICALL
86 #define JNIEXPORT
87 #define JNIIMPORT
88 #endif
89
90 #ifdef __cplusplus
91 /*
92 * Reference types, in C++
93 */
94 class _jobject {};
95 class _jclass : public _jobject {};
96 class _jstring : public _jobject {};
97 class _jarray : public _jobject {};
98 class _jobjectArray : public _jarray {};
99 class _jbooleanArray : public _jarray {};
100 class _jbyteArray : public _jarray {};
101 class _jcharArray : public _jarray {};
102 class _jshortArray : public _jarray {};
103 class _jintArray : public _jarray {};
104 class _jlongArray : public _jarray {};
105 class _jfloatArray : public _jarray {};
106 class _jdoubleArray : public _jarray {};
107 class _jthrowable : public _jobject {};
108
109 typedef _jobject* jobject;
110 typedef _jclass* jclass;
111 typedef _jstring* jstring;
112 typedef _jarray* jarray;
113 typedef _jobjectArray* jobjectArray;
114 typedef _jbooleanArray* jbooleanArray;
115 typedef _jbyteArray* jbyteArray;
116 typedef _jcharArray* jcharArray;
117 typedef _jshortArray* jshortArray;
118 typedef _jintArray* jintArray;
119 typedef _jlongArray* jlongArray;
120 typedef _jfloatArray* jfloatArray;
121 typedef _jdoubleArray* jdoubleArray;
122 typedef _jthrowable* jthrowable;
123 typedef _jobject* jweak;
124
125
126 #else /* not __cplusplus */
127
128 /*
129 * Reference types, in C.
130 */
131 typedef void* jobject;
132 typedef jobject jclass;
133 typedef jobject jstring;
134 typedef jobject jarray;
135 typedef jarray jobjectArray;
136 typedef jarray jbooleanArray;
137 typedef jarray jbyteArray;
138 typedef jarray jcharArray;
139 typedef jarray jshortArray;
140 typedef jarray jintArray;
141 typedef jarray jlongArray;
142 typedef jarray jfloatArray;
143 typedef jarray jdoubleArray;
144 typedef jobject jthrowable;
145 typedef jobject jweak;
146
147 #endif /* not __cplusplus */
148
149 struct _jfieldID; /* opaque structure */
150 typedef struct _jfieldID* jfieldID; /* field IDs */
151
152 struct _jmethodID; /* opaque structure */
153 typedef struct _jmethodID* jmethodID; /* method IDs */
154
155 struct JNIInvokeInterface;
156
157 typedef union jvalue {
158 jboolean z;
159 jbyte b;
160 jchar c;
161 jshort s;
162 jint i;
163 jlong j;
164 jfloat f;
165 jdouble d;
166 jobject l;
167 } jvalue;
168
169 typedef enum jobjectRefType {
170 JNIInvalidRefType = 0,
171 JNILocalRefType = 1,
172 JNIGlobalRefType = 2,
173 JNIWeakGlobalRefType = 3
174 } jobjectRefType;
175
176 typedef struct {
177 const char* name;
178 const char* signature;
179 void* fnPtr;
180 } JNINativeMethod;
181
182 struct _JNIEnv;
183 struct _JavaVM;
184 typedef const struct JNINativeInterface* C_JNIEnv;
185
186 #if defined(__cplusplus)
187 typedef _JNIEnv JNIEnv;
188 typedef _JavaVM JavaVM;
189 #else
190 typedef const struct JNINativeInterface* JNIEnv;
191 typedef const struct JNIInvokeInterface* JavaVM;
192 #endif
193
194 /*
195 * Table of interface function pointers.
196 */
197 struct JNINativeInterface {
198 void* reserved0;
199 void* reserved1;
200 void* reserved2;
201 void* reserved3;
202
203 jint (*GetVersion)(JNIEnv *);
204
205 jclass (*DefineClass)(JNIEnv*, const char*, jobject, const jbyte*,
206 jsize);
207 jclass (*FindClass)(JNIEnv*, const char*);
208
209 jmethodID (*FromReflectedMethod)(JNIEnv*, jobject);
210 jfieldID (*FromReflectedField)(JNIEnv*, jobject);
211 /* spec doesn't show jboolean parameter */
212 jobject (*ToReflectedMethod)(JNIEnv*, jclass, jmethodID, jboolean);
213
214 jclass (*GetSuperclass)(JNIEnv*, jclass);
215 jboolean (*IsAssignableFrom)(JNIEnv*, jclass, jclass);
216
217 /* spec doesn't show jboolean parameter */
218 jobject (*ToReflectedField)(JNIEnv*, jclass, jfieldID, jboolean);
219
220 jint (*Throw)(JNIEnv*, jthrowable);
221 jint (*ThrowNew)(JNIEnv *, jclass, const char *);
222 jthrowable (*ExceptionOccurred)(JNIEnv*);
223 void (*ExceptionDescribe)(JNIEnv*);
224 void (*ExceptionClear)(JNIEnv*);
225 void (*FatalError)(JNIEnv*, const char*);
226
227 jint (*PushLocalFrame)(JNIEnv*, jint);
228 jobject (*PopLocalFrame)(JNIEnv*, jobject);
229
230 jobject (*NewGlobalRef)(JNIEnv*, jobject);
231 void (*DeleteGlobalRef)(JNIEnv*, jobject);
232 void (*DeleteLocalRef)(JNIEnv*, jobject);
233 jboolean (*IsSameObject)(JNIEnv*, jobject, jobject);
234
235 jobject (*NewLocalRef)(JNIEnv*, jobject);
236 jint (*EnsureLocalCapacity)(JNIEnv*, jint);
237
238 jobject (*AllocObject)(JNIEnv*, jclass);
239 jobject (*NewObject)(JNIEnv*, jclass, jmethodID, ...);
240 jobject (*NewObjectV)(JNIEnv*, jclass, jmethodID, va_list);
241 jobject (*NewObjectA)(JNIEnv*, jclass, jmethodID, jvalue*);
242
243 jclass (*GetObjectClass)(JNIEnv*, jobject);
244 jboolean (*IsInstanceOf)(JNIEnv*, jobject, jclass);
245 jmethodID (*GetMethodID)(JNIEnv*, jclass, const char*, const char*);
246
247 jobject (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...);
248 jobject (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list);
249 jobject (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
250 jboolean (*CallBooleanMethod)(JNIEnv*, jobject, jmethodID, ...);
251 jboolean (*CallBooleanMethodV)(JNIEnv*, jobject, jmethodID, va_list);
252 jboolean (*CallBooleanMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
253 jbyte (*CallByteMethod)(JNIEnv*, jobject, jmethodID, ...);
254 jbyte (*CallByteMethodV)(JNIEnv*, jobject, jmethodID, va_list);
255 jbyte (*CallByteMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
256 jchar (*CallCharMethod)(JNIEnv*, jobject, jmethodID, ...);
257 jchar (*CallCharMethodV)(JNIEnv*, jobject, jmethodID, va_list);
258 jchar (*CallCharMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
259 jshort (*CallShortMethod)(JNIEnv*, jobject, jmethodID, ...);
260 jshort (*CallShortMethodV)(JNIEnv*, jobject, jmethodID, va_list);
261 jshort (*CallShortMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
262 jint (*CallIntMethod)(JNIEnv*, jobject, jmethodID, ...);
263 jint (*CallIntMethodV)(JNIEnv*, jobject, jmethodID, va_list);
264 jint (*CallIntMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
265 jlong (*CallLongMethod)(JNIEnv*, jobject, jmethodID, ...);
266 jlong (*CallLongMethodV)(JNIEnv*, jobject, jmethodID, va_list);
267 jlong (*CallLongMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
268 jfloat (*CallFloatMethod)(JNIEnv*, jobject, jmethodID, ...);
269 jfloat (*CallFloatMethodV)(JNIEnv*, jobject, jmethodID, va_list);
270 jfloat (*CallFloatMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
271 jdouble (*CallDoubleMethod)(JNIEnv*, jobject, jmethodID, ...);
272 jdouble (*CallDoubleMethodV)(JNIEnv*, jobject, jmethodID, va_list);
273 jdouble (*CallDoubleMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
274 void (*CallVoidMethod)(JNIEnv*, jobject, jmethodID, ...);
275 void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list);
276 void (*CallVoidMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
277
278 jobject (*CallNonvirtualObjectMethod)(JNIEnv*, jobject, jclass,
279 jmethodID, ...);
280 jobject (*CallNonvirtualObjectMethodV)(JNIEnv*, jobject, jclass,
281 jmethodID, va_list);
282 jobject (*CallNonvirtualObjectMethodA)(JNIEnv*, jobject, jclass,
283 jmethodID, jvalue*);
284 jboolean (*CallNonvirtualBooleanMethod)(JNIEnv*, jobject, jclass,
285 jmethodID, ...);
286 jboolean (*CallNonvirtualBooleanMethodV)(JNIEnv*, jobject, jclass,
287 jmethodID, va_list);
288 jboolean (*CallNonvirtualBooleanMethodA)(JNIEnv*, jobject, jclass,
289 jmethodID, jvalue*);
290 jbyte (*CallNonvirtualByteMethod)(JNIEnv*, jobject, jclass,
291 jmethodID, ...);
292 jbyte (*CallNonvirtualByteMethodV)(JNIEnv*, jobject, jclass,
293 jmethodID, va_list);
294 jbyte (*CallNonvirtualByteMethodA)(JNIEnv*, jobject, jclass,
295 jmethodID, jvalue*);
296 jchar (*CallNonvirtualCharMethod)(JNIEnv*, jobject, jclass,
297 jmethodID, ...);
298 jchar (*CallNonvirtualCharMethodV)(JNIEnv*, jobject, jclass,
299 jmethodID, va_list);
300 jchar (*CallNonvirtualCharMethodA)(JNIEnv*, jobject, jclass,
301 jmethodID, jvalue*);
302 jshort (*CallNonvirtualShortMethod)(JNIEnv*, jobject, jclass,
303 jmethodID, ...);
304 jshort (*CallNonvirtualShortMethodV)(JNIEnv*, jobject, jclass,
305 jmethodID, va_list);
306 jshort (*CallNonvirtualShortMethodA)(JNIEnv*, jobject, jclass,
307 jmethodID, jvalue*);
308 jint (*CallNonvirtualIntMethod)(JNIEnv*, jobject, jclass,
309 jmethodID, ...);
310 jint (*CallNonvirtualIntMethodV)(JNIEnv*, jobject, jclass,
311 jmethodID, va_list);
312 jint (*CallNonvirtualIntMethodA)(JNIEnv*, jobject, jclass,
313 jmethodID, jvalue*);
314 jlong (*CallNonvirtualLongMethod)(JNIEnv*, jobject, jclass,
315 jmethodID, ...);
316 jlong (*CallNonvirtualLongMethodV)(JNIEnv*, jobject, jclass,
317 jmethodID, va_list);
318 jlong (*CallNonvirtualLongMethodA)(JNIEnv*, jobject, jclass,
319 jmethodID, jvalue*);
320 jfloat (*CallNonvirtualFloatMethod)(JNIEnv*, jobject, jclass,
321 jmethodID, ...);
322 jfloat (*CallNonvirtualFloatMethodV)(JNIEnv*, jobject, jclass,
323 jmethodID, va_list);
324 jfloat (*CallNonvirtualFloatMethodA)(JNIEnv*, jobject, jclass,
325 jmethodID, jvalue*);
326 jdouble (*CallNonvirtualDoubleMethod)(JNIEnv*, jobject, jclass,
327 jmethodID, ...);
328 jdouble (*CallNonvirtualDoubleMethodV)(JNIEnv*, jobject, jclass,
329 jmethodID, va_list);
330 jdouble (*CallNonvirtualDoubleMethodA)(JNIEnv*, jobject, jclass,
331 jmethodID, jvalue*);
332 void (*CallNonvirtualVoidMethod)(JNIEnv*, jobject, jclass,
333 jmethodID, ...);
334 void (*CallNonvirtualVoidMethodV)(JNIEnv*, jobject, jclass,
335 jmethodID, va_list);
336 void (*CallNonvirtualVoidMethodA)(JNIEnv*, jobject, jclass,
337 jmethodID, jvalue*);
338
339 jfieldID (*GetFieldID)(JNIEnv*, jclass, const char*, const char*);
340
341 jobject (*GetObjectField)(JNIEnv*, jobject, jfieldID);
342 jboolean (*GetBooleanField)(JNIEnv*, jobject, jfieldID);
343 jbyte (*GetByteField)(JNIEnv*, jobject, jfieldID);
344 jchar (*GetCharField)(JNIEnv*, jobject, jfieldID);
345 jshort (*GetShortField)(JNIEnv*, jobject, jfieldID);
346 jint (*GetIntField)(JNIEnv*, jobject, jfieldID);
347 jlong (*GetLongField)(JNIEnv*, jobject, jfieldID);
348 jfloat (*GetFloatField)(JNIEnv*, jobject, jfieldID);
349 jdouble (*GetDoubleField)(JNIEnv*, jobject, jfieldID);
350
351 void (*SetObjectField)(JNIEnv*, jobject, jfieldID, jobject);
352 void (*SetBooleanField)(JNIEnv*, jobject, jfieldID, jboolean);
353 void (*SetByteField)(JNIEnv*, jobject, jfieldID, jbyte);
354 void (*SetCharField)(JNIEnv*, jobject, jfieldID, jchar);
355 void (*SetShortField)(JNIEnv*, jobject, jfieldID, jshort);
356 void (*SetIntField)(JNIEnv*, jobject, jfieldID, jint);
357 void (*SetLongField)(JNIEnv*, jobject, jfieldID, jlong);
358 void (*SetFloatField)(JNIEnv*, jobject, jfieldID, jfloat);
359 void (*SetDoubleField)(JNIEnv*, jobject, jfieldID, jdouble);
360
361 jmethodID (*GetStaticMethodID)(JNIEnv*, jclass, const char*, const char*);
362
363 jobject (*CallStaticObjectMethod)(JNIEnv*, jclass, jmethodID, ...);
364 jobject (*CallStaticObjectMethodV)(JNIEnv*, jclass, jmethodID, va_list);
365 jobject (*CallStaticObjectMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
366 jboolean (*CallStaticBooleanMethod)(JNIEnv*, jclass, jmethodID, ...);
367 jboolean (*CallStaticBooleanMethodV)(JNIEnv*, jclass, jmethodID,
368 va_list);
369 jboolean (*CallStaticBooleanMethodA)(JNIEnv*, jclass, jmethodID,
370 jvalue*);
371 jbyte (*CallStaticByteMethod)(JNIEnv*, jclass, jmethodID, ...);
372 jbyte (*CallStaticByteMethodV)(JNIEnv*, jclass, jmethodID, va_list);
373 jbyte (*CallStaticByteMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
374 jchar (*CallStaticCharMethod)(JNIEnv*, jclass, jmethodID, ...);
375 jchar (*CallStaticCharMethodV)(JNIEnv*, jclass, jmethodID, va_list);
376 jchar (*CallStaticCharMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
377 jshort (*CallStaticShortMethod)(JNIEnv*, jclass, jmethodID, ...);
378 jshort (*CallStaticShortMethodV)(JNIEnv*, jclass, jmethodID, va_list);
379 jshort (*CallStaticShortMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
380 jint (*CallStaticIntMethod)(JNIEnv*, jclass, jmethodID, ...);
381 jint (*CallStaticIntMethodV)(JNIEnv*, jclass, jmethodID, va_list);
382 jint (*CallStaticIntMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
383 jlong (*CallStaticLongMethod)(JNIEnv*, jclass, jmethodID, ...);
384 jlong (*CallStaticLongMethodV)(JNIEnv*, jclass, jmethodID, va_list);
385 jlong (*CallStaticLongMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
386 jfloat (*CallStaticFloatMethod)(JNIEnv*, jclass, jmethodID, ...);
387 jfloat (*CallStaticFloatMethodV)(JNIEnv*, jclass, jmethodID, va_list);
388 jfloat (*CallStaticFloatMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
389 jdouble (*CallStaticDoubleMethod)(JNIEnv*, jclass, jmethodID, ...);
390 jdouble (*CallStaticDoubleMethodV)(JNIEnv*, jclass, jmethodID, va_list);
391 jdouble (*CallStaticDoubleMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
392 void (*CallStaticVoidMethod)(JNIEnv*, jclass, jmethodID, ...);
393 void (*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list);
394 void (*CallStaticVoidMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
395
396 jfieldID (*GetStaticFieldID)(JNIEnv*, jclass, const char*,
397 const char*);
398
399 jobject (*GetStaticObjectField)(JNIEnv*, jclass, jfieldID);
400 jboolean (*GetStaticBooleanField)(JNIEnv*, jclass, jfieldID);
401 jbyte (*GetStaticByteField)(JNIEnv*, jclass, jfieldID);
402 jchar (*GetStaticCharField)(JNIEnv*, jclass, jfieldID);
403 jshort (*GetStaticShortField)(JNIEnv*, jclass, jfieldID);
404 jint (*GetStaticIntField)(JNIEnv*, jclass, jfieldID);
405 jlong (*GetStaticLongField)(JNIEnv*, jclass, jfieldID);
406 jfloat (*GetStaticFloatField)(JNIEnv*, jclass, jfieldID);
407 jdouble (*GetStaticDoubleField)(JNIEnv*, jclass, jfieldID);
408
409 void (*SetStaticObjectField)(JNIEnv*, jclass, jfieldID, jobject);
410 void (*SetStaticBooleanField)(JNIEnv*, jclass, jfieldID, jboolean);
411 void (*SetStaticByteField)(JNIEnv*, jclass, jfieldID, jbyte);
412 void (*SetStaticCharField)(JNIEnv*, jclass, jfieldID, jchar);
413 void (*SetStaticShortField)(JNIEnv*, jclass, jfieldID, jshort);
414 void (*SetStaticIntField)(JNIEnv*, jclass, jfieldID, jint);
415 void (*SetStaticLongField)(JNIEnv*, jclass, jfieldID, jlong);
416 void (*SetStaticFloatField)(JNIEnv*, jclass, jfieldID, jfloat);
417 void (*SetStaticDoubleField)(JNIEnv*, jclass, jfieldID, jdouble);
418
419 jstring (*NewString)(JNIEnv*, const jchar*, jsize);
420 jsize (*GetStringLength)(JNIEnv*, jstring);
421 const jchar* (*GetStringChars)(JNIEnv*, jstring, jboolean*);
422 void (*ReleaseStringChars)(JNIEnv*, jstring, const jchar*);
423 jstring (*NewStringUTF)(JNIEnv*, const char*);
424 jsize (*GetStringUTFLength)(JNIEnv*, jstring);
425 /* JNI spec says this returns const jbyte*, but that's inconsistent */
426 const char* (*GetStringUTFChars)(JNIEnv*, jstring, jboolean*);
427 void (*ReleaseStringUTFChars)(JNIEnv*, jstring, const char*);
428 jsize (*GetArrayLength)(JNIEnv*, jarray);
429 jobjectArray (*NewObjectArray)(JNIEnv*, jsize, jclass, jobject);
430 jobject (*GetObjectArrayElement)(JNIEnv*, jobjectArray, jsize);
431 void (*SetObjectArrayElement)(JNIEnv*, jobjectArray, jsize, jobject);
432
433 jbooleanArray (*NewBooleanArray)(JNIEnv*, jsize);
434 jbyteArray (*NewByteArray)(JNIEnv*, jsize);
435 jcharArray (*NewCharArray)(JNIEnv*, jsize);
436 jshortArray (*NewShortArray)(JNIEnv*, jsize);
437 jintArray (*NewIntArray)(JNIEnv*, jsize);
438 jlongArray (*NewLongArray)(JNIEnv*, jsize);
439 jfloatArray (*NewFloatArray)(JNIEnv*, jsize);
440 jdoubleArray (*NewDoubleArray)(JNIEnv*, jsize);
441
442 jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*);
443 jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*);
444 jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*);
445 jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*);
446 jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*);
447 jlong* (*GetLongArrayElements)(JNIEnv*, jlongArray, jboolean*);
448 jfloat* (*GetFloatArrayElements)(JNIEnv*, jfloatArray, jboolean*);
449 jdouble* (*GetDoubleArrayElements)(JNIEnv*, jdoubleArray, jboolean*);
450
451 void (*ReleaseBooleanArrayElements)(JNIEnv*, jbooleanArray,
452 jboolean*, jint);
453 void (*ReleaseByteArrayElements)(JNIEnv*, jbyteArray,
454 jbyte*, jint);
455 void (*ReleaseCharArrayElements)(JNIEnv*, jcharArray,
456 jchar*, jint);
457 void (*ReleaseShortArrayElements)(JNIEnv*, jshortArray,
458 jshort*, jint);
459 void (*ReleaseIntArrayElements)(JNIEnv*, jintArray,
460 jint*, jint);
461 void (*ReleaseLongArrayElements)(JNIEnv*, jlongArray,
462 jlong*, jint);
463 void (*ReleaseFloatArrayElements)(JNIEnv*, jfloatArray,
464 jfloat*, jint);
465 void (*ReleaseDoubleArrayElements)(JNIEnv*, jdoubleArray,
466 jdouble*, jint);
467
468 void (*GetBooleanArrayRegion)(JNIEnv*, jbooleanArray,
469 jsize, jsize, jboolean*);
470 void (*GetByteArrayRegion)(JNIEnv*, jbyteArray,
471 jsize, jsize, jbyte*);
472 void (*GetCharArrayRegion)(JNIEnv*, jcharArray,
473 jsize, jsize, jchar*);
474 void (*GetShortArrayRegion)(JNIEnv*, jshortArray,
475 jsize, jsize, jshort*);
476 void (*GetIntArrayRegion)(JNIEnv*, jintArray,
477 jsize, jsize, jint*);
478 void (*GetLongArrayRegion)(JNIEnv*, jlongArray,
479 jsize, jsize, jlong*);
480 void (*GetFloatArrayRegion)(JNIEnv*, jfloatArray,
481 jsize, jsize, jfloat*);
482 void (*GetDoubleArrayRegion)(JNIEnv*, jdoubleArray,
483 jsize, jsize, jdouble*);
484
485 /* spec shows these without const; some jni.h do, some don't */
486 void (*SetBooleanArrayRegion)(JNIEnv*, jbooleanArray,
487 jsize, jsize, const jboolean*);
488 void (*SetByteArrayRegion)(JNIEnv*, jbyteArray,
489 jsize, jsize, const jbyte*);
490 void (*SetCharArrayRegion)(JNIEnv*, jcharArray,
491 jsize, jsize, const jchar*);
492 void (*SetShortArrayRegion)(JNIEnv*, jshortArray,
493 jsize, jsize, const jshort*);
494 void (*SetIntArrayRegion)(JNIEnv*, jintArray,
495 jsize, jsize, const jint*);
496 void (*SetLongArrayRegion)(JNIEnv*, jlongArray,
497 jsize, jsize, const jlong*);
498 void (*SetFloatArrayRegion)(JNIEnv*, jfloatArray,
499 jsize, jsize, const jfloat*);
500 void (*SetDoubleArrayRegion)(JNIEnv*, jdoubleArray,
501 jsize, jsize, const jdouble*);
502
503 jint (*RegisterNatives)(JNIEnv*, jclass, const JNINativeMethod*,
504 jint);
505 jint (*UnregisterNatives)(JNIEnv*, jclass);
506 jint (*MonitorEnter)(JNIEnv*, jobject);
507 jint (*MonitorExit)(JNIEnv*, jobject);
508 jint (*GetJavaVM)(JNIEnv*, JavaVM**);
509
510 void (*GetStringRegion)(JNIEnv*, jstring, jsize, jsize, jchar*);
511 void (*GetStringUTFRegion)(JNIEnv*, jstring, jsize, jsize, char*);
512
513 void* (*GetPrimitiveArrayCritical)(JNIEnv*, jarray, jboolean*);
514 void (*ReleasePrimitiveArrayCritical)(JNIEnv*, jarray, void*, jint);
515
516 const jchar* (*GetStringCritical)(JNIEnv*, jstring, jboolean*);
517 void (*ReleaseStringCritical)(JNIEnv*, jstring, const jchar*);
518
519 jweak (*NewWeakGlobalRef)(JNIEnv*, jobject);
520 void (*DeleteWeakGlobalRef)(JNIEnv*, jweak);
521
522 jboolean (*ExceptionCheck)(JNIEnv*);
523
524 jobject (*NewDirectByteBuffer)(JNIEnv*, void*, jlong);
525 void* (*GetDirectBufferAddress)(JNIEnv*, jobject);
526 jlong (*GetDirectBufferCapacity)(JNIEnv*, jobject);
527
528 /* added in JNI 1.6 */
529 jobjectRefType (*GetObjectRefType)(JNIEnv*, jobject);
530 };
531
532 /*
533 * C++ object wrapper.
534 *
535 * This is usually overlaid on a C struct whose first element is a
536 * JNINativeInterface*. We rely somewhat on compiler behavior.
537 */
538 struct _JNIEnv {
539 /* do not rename this; it does not seem to be entirely opaque */
540 const struct JNINativeInterface* functions;
541
542 #if defined(__cplusplus)
543
544 jint GetVersion()
545 { return functions->GetVersion(this); }
546
547 jclass DefineClass(const char *name, jobject loader, const jbyte* buf,
548 jsize bufLen)
549 { return functions->DefineClass(this, name, loader, buf, bufLen); }
550
551 jclass FindClass(const char* name)
552 { return functions->FindClass(this, name); }
553
554 jmethodID FromReflectedMethod(jobject method)
555 { return functions->FromReflectedMethod(this, method); }
556
557 jfieldID FromReflectedField(jobject field)
558 { return functions->FromReflectedField(this, field); }
559
560 jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic)
561 { return functions->ToReflectedMethod(this, cls, methodID, isStatic); }
562
563 jclass GetSuperclass(jclass clazz)
564 { return functions->GetSuperclass(this, clazz); }
565
566 jboolean IsAssignableFrom(jclass clazz1, jclass clazz2)
567 { return functions->IsAssignableFrom(this, clazz1, clazz2); }
568
569 jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic)
570 { return functions->ToReflectedField(this, cls, fieldID, isStatic); }
571
572 jint Throw(jthrowable obj)
573 { return functions->Throw(this, obj); }
574
575 jint ThrowNew(jclass clazz, const char* message)
576 { return functions->ThrowNew(this, clazz, message); }
577
578 jthrowable ExceptionOccurred()
579 { return functions->ExceptionOccurred(this); }
580
581 void ExceptionDescribe()
582 { functions->ExceptionDescribe(this); }
583
584 void ExceptionClear()
585 { functions->ExceptionClear(this); }
586
587 void FatalError(const char* msg)
588 { functions->FatalError(this, msg); }
589
590 jint PushLocalFrame(jint capacity)
591 { return functions->PushLocalFrame(this, capacity); }
592
593 jobject PopLocalFrame(jobject result)
594 { return functions->PopLocalFrame(this, result); }
595
596 jobject NewGlobalRef(jobject obj)
597 { return functions->NewGlobalRef(this, obj); }
598
599 void DeleteGlobalRef(jobject globalRef)
600 { functions->DeleteGlobalRef(this, globalRef); }
601
602 void DeleteLocalRef(jobject localRef)
603 { functions->DeleteLocalRef(this, localRef); }
604
605 jboolean IsSameObject(jobject ref1, jobject ref2)
606 { return functions->IsSameObject(this, ref1, ref2); }
607
608 jobject NewLocalRef(jobject ref)
609 { return functions->NewLocalRef(this, ref); }
610
611 jint EnsureLocalCapacity(jint capacity)
612 { return functions->EnsureLocalCapacity(this, capacity); }
613
614 jobject AllocObject(jclass clazz)
615 { return functions->AllocObject(this, clazz); }
616
617 jobject NewObject(jclass clazz, jmethodID methodID, ...)
618 {
619 va_list args;
620 va_start(args, methodID);
621 jobject result = functions->NewObjectV(this, clazz, methodID, args);
622 va_end(args);
623 return result;
624 }
625
626 jobject NewObjectV(jclass clazz, jmethodID methodID, va_list args)
627 { return functions->NewObjectV(this, clazz, methodID, args); }
628
629 jobject NewObjectA(jclass clazz, jmethodID methodID, jvalue* args)
630 { return functions->NewObjectA(this, clazz, methodID, args); }
631
632 jclass GetObjectClass(jobject obj)
633 { return functions->GetObjectClass(this, obj); }
634
635 jboolean IsInstanceOf(jobject obj, jclass clazz)
636 { return functions->IsInstanceOf(this, obj, clazz); }
637
638 jmethodID GetMethodID(jclass clazz, const char* name, const char* sig)
639 { return functions->GetMethodID(this, clazz, name, sig); }
640
641 #define CALL_TYPE_METHOD(_jtype, _jname) \
642 _jtype Call##_jname##Method(jobject obj, jmethodID methodID, ...) \
643 { \
644 _jtype result; \
645 va_list args; \
646 va_start(args, methodID); \
647 result = functions->Call##_jname##MethodV(this, obj, methodID, \
648 args); \
649 va_end(args); \
650 return result; \
651 }
652 #define CALL_TYPE_METHODV(_jtype, _jname) \
653 _jtype Call##_jname##MethodV(jobject obj, jmethodID methodID, \
654 va_list args) \
655 { return functions->Call##_jname##MethodV(this, obj, methodID, args); }
656 #define CALL_TYPE_METHODA(_jtype, _jname) \
657 _jtype Call##_jname##MethodA(jobject obj, jmethodID methodID, \
658 jvalue* args) \
659 { return functions->Call##_jname##MethodA(this, obj, methodID, args); }
660
661 #define CALL_TYPE(_jtype, _jname) \
662 CALL_TYPE_METHOD(_jtype, _jname) \
663 CALL_TYPE_METHODV(_jtype, _jname) \
664 CALL_TYPE_METHODA(_jtype, _jname)
665
666 CALL_TYPE(jobject, Object)
667 CALL_TYPE(jboolean, Boolean)
668 CALL_TYPE(jbyte, Byte)
669 CALL_TYPE(jchar, Char)
670 CALL_TYPE(jshort, Short)
671 CALL_TYPE(jint, Int)
672 CALL_TYPE(jlong, Long)
673 CALL_TYPE(jfloat, Float)
674 CALL_TYPE(jdouble, Double)
675
676 void CallVoidMethod(jobject obj, jmethodID methodID, ...)
677 {
678 va_list args;
679 va_start(args, methodID);
680 functions->CallVoidMethodV(this, obj, methodID, args);
681 va_end(args);
682 }
683 void CallVoidMethodV(jobject obj, jmethodID methodID, va_list args)
684 { functions->CallVoidMethodV(this, obj, methodID, args); }
685 void CallVoidMethodA(jobject obj, jmethodID methodID, jvalue* args)
686 { functions->CallVoidMethodA(this, obj, methodID, args); }
687
688 #define CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \
689 _jtype CallNonvirtual##_jname##Method(jobject obj, jclass clazz, \
690 jmethodID methodID, ...) \
691 { \
692 _jtype result; \
693 va_list args; \
694 va_start(args, methodID); \
695 result = functions->CallNonvirtual##_jname##MethodV(this, obj, \
696 clazz, methodID, args); \
697 va_end(args); \
698 return result; \
699 }
700 #define CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \
701 _jtype CallNonvirtual##_jname##MethodV(jobject obj, jclass clazz, \
702 jmethodID methodID, va_list args) \
703 { return functions->CallNonvirtual##_jname##MethodV(this, obj, clazz, \
704 methodID, args); }
705 #define CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) \
706 _jtype CallNonvirtual##_jname##MethodA(jobject obj, jclass clazz, \
707 jmethodID methodID, jvalue* args) \
708 { return functions->CallNonvirtual##_jname##MethodA(this, obj, clazz, \
709 methodID, args); }
710
711 #define CALL_NONVIRT_TYPE(_jtype, _jname) \
712 CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \
713 CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \
714 CALL_NONVIRT_TYPE_METHODA(_jtype, _jname)
715
716 CALL_NONVIRT_TYPE(jobject, Object)
717 CALL_NONVIRT_TYPE(jboolean, Boolean)
718 CALL_NONVIRT_TYPE(jbyte, Byte)
719 CALL_NONVIRT_TYPE(jchar, Char)
720 CALL_NONVIRT_TYPE(jshort, Short)
721 CALL_NONVIRT_TYPE(jint, Int)
722 CALL_NONVIRT_TYPE(jlong, Long)
723 CALL_NONVIRT_TYPE(jfloat, Float)
724 CALL_NONVIRT_TYPE(jdouble, Double)
725
726 void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
727 jmethodID methodID, ...)
728 {
729 va_list args;
730 va_start(args, methodID);
731 functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args);
732 va_end(args);
733 }
734 void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
735 jmethodID methodID, va_list args)
736 { functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); }
737 void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
738 jmethodID methodID, jvalue* args)
739 { functions->CallNonvirtualVoidMethodA(this, obj, clazz, methodID, args); }
740
741 jfieldID GetFieldID(jclass clazz, const char* name, const char* sig)
742 { return functions->GetFieldID(this, clazz, name, sig); }
743
744 jobject GetObjectField(jobject obj, jfieldID fieldID)
745 { return functions->GetObjectField(this, obj, fieldID); }
746 jboolean GetBooleanField(jobject obj, jfieldID fieldID)
747 { return functions->GetBooleanField(this, obj, fieldID); }
748 jbyte GetByteField(jobject obj, jfieldID fieldID)
749 { return functions->GetByteField(this, obj, fieldID); }
750 jchar GetCharField(jobject obj, jfieldID fieldID)
751 { return functions->GetCharField(this, obj, fieldID); }
752 jshort GetShortField(jobject obj, jfieldID fieldID)
753 { return functions->GetShortField(this, obj, fieldID); }
754 jint GetIntField(jobject obj, jfieldID fieldID)
755 { return functions->GetIntField(this, obj, fieldID); }
756 jlong GetLongField(jobject obj, jfieldID fieldID)
757 { return functions->GetLongField(this, obj, fieldID); }
758 jfloat GetFloatField(jobject obj, jfieldID fieldID)
759 { return functions->GetFloatField(this, obj, fieldID); }
760 jdouble GetDoubleField(jobject obj, jfieldID fieldID)
761 { return functions->GetDoubleField(this, obj, fieldID); }
762
763 void SetObjectField(jobject obj, jfieldID fieldID, jobject value)
764 { functions->SetObjectField(this, obj, fieldID, value); }
765 void SetBooleanField(jobject obj, jfieldID fieldID, jboolean value)
766 { functions->SetBooleanField(this, obj, fieldID, value); }
767 void SetByteField(jobject obj, jfieldID fieldID, jbyte value)
768 { functions->SetByteField(this, obj, fieldID, value); }
769 void SetCharField(jobject obj, jfieldID fieldID, jchar value)
770 { functions->SetCharField(this, obj, fieldID, value); }
771 void SetShortField(jobject obj, jfieldID fieldID, jshort value)
772 { functions->SetShortField(this, obj, fieldID, value); }
773 void SetIntField(jobject obj, jfieldID fieldID, jint value)
774 { functions->SetIntField(this, obj, fieldID, value); }
775 void SetLongField(jobject obj, jfieldID fieldID, jlong value)
776 { functions->SetLongField(this, obj, fieldID, value); }
777 void SetFloatField(jobject obj, jfieldID fieldID, jfloat value)
778 { functions->SetFloatField(this, obj, fieldID, value); }
779 void SetDoubleField(jobject obj, jfieldID fieldID, jdouble value)
780 { functions->SetDoubleField(this, obj, fieldID, value); }
781
782 jmethodID GetStaticMethodID(jclass clazz, const char* name, const char* sig)
783 { return functions->GetStaticMethodID(this, clazz, name, sig); }
784
785 #define CALL_STATIC_TYPE_METHOD(_jtype, _jname) \
786 _jtype CallStatic##_jname##Method(jclass clazz, jmethodID methodID, \
787 ...) \
788 { \
789 _jtype result; \
790 va_list args; \
791 va_start(args, methodID); \
792 result = functions->CallStatic##_jname##MethodV(this, clazz, \
793 methodID, args); \
794 va_end(args); \
795 return result; \
796 }
797 #define CALL_STATIC_TYPE_METHODV(_jtype, _jname) \
798 _jtype CallStatic##_jname##MethodV(jclass clazz, jmethodID methodID, \
799 va_list args) \
800 { return functions->CallStatic##_jname##MethodV(this, clazz, methodID, \
801 args); }
802 #define CALL_STATIC_TYPE_METHODA(_jtype, _jname) \
803 _jtype CallStatic##_jname##MethodA(jclass clazz, jmethodID methodID, \
804 jvalue* args) \
805 { return functions->CallStatic##_jname##MethodA(this, clazz, methodID, \
806 args); }
807
808 #define CALL_STATIC_TYPE(_jtype, _jname) \
809 CALL_STATIC_TYPE_METHOD(_jtype, _jname) \
810 CALL_STATIC_TYPE_METHODV(_jtype, _jname) \
811 CALL_STATIC_TYPE_METHODA(_jtype, _jname)
812
813 CALL_STATIC_TYPE(jobject, Object)
814 CALL_STATIC_TYPE(jboolean, Boolean)
815 CALL_STATIC_TYPE(jbyte, Byte)
816 CALL_STATIC_TYPE(jchar, Char)
817 CALL_STATIC_TYPE(jshort, Short)
818 CALL_STATIC_TYPE(jint, Int)
819 CALL_STATIC_TYPE(jlong, Long)
820 CALL_STATIC_TYPE(jfloat, Float)
821 CALL_STATIC_TYPE(jdouble, Double)
822
823 void CallStaticVoidMethod(jclass clazz, jmethodID methodID, ...)
824 {
825 va_list args;
826 va_start(args, methodID);
827 functions->CallStaticVoidMethodV(this, clazz, methodID, args);
828 va_end(args);
829 }
830 void CallStaticVoidMethodV(jclass clazz, jmethodID methodID, va_list args)
831 { functions->CallStaticVoidMethodV(this, clazz, methodID, args); }
832 void CallStaticVoidMethodA(jclass clazz, jmethodID methodID, jvalue* args)
833 { functions->CallStaticVoidMethodA(this, clazz, methodID, args); }
834
835 jfieldID GetStaticFieldID(jclass clazz, const char* name, const char* sig)
836 { return functions->GetStaticFieldID(this, clazz, name, sig); }
837
838 jobject GetStaticObjectField(jclass clazz, jfieldID fieldID)
839 { return functions->GetStaticObjectField(this, clazz, fieldID); }
840 jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID)
841 { return functions->GetStaticBooleanField(this, clazz, fieldID); }
842 jbyte GetStaticByteField(jclass clazz, jfieldID fieldID)
843 { return functions->GetStaticByteField(this, clazz, fieldID); }
844 jchar GetStaticCharField(jclass clazz, jfieldID fieldID)
845 { return functions->GetStaticCharField(this, clazz, fieldID); }
846 jshort GetStaticShortField(jclass clazz, jfieldID fieldID)
847 { return functions->GetStaticShortField(this, clazz, fieldID); }
848 jint GetStaticIntField(jclass clazz, jfieldID fieldID)
849 { return functions->GetStaticIntField(this, clazz, fieldID); }
850 jlong GetStaticLongField(jclass clazz, jfieldID fieldID)
851 { return functions->GetStaticLongField(this, clazz, fieldID); }
852 jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID)
853 { return functions->GetStaticFloatField(this, clazz, fieldID); }
854 jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID)
855 { return functions->GetStaticDoubleField(this, clazz, fieldID); }
856
857 void SetStaticObjectField(jclass clazz, jfieldID fieldID, jobject value)
858 { functions->SetStaticObjectField(this, clazz, fieldID, value); }
859 void SetStaticBooleanField(jclass clazz, jfieldID fieldID, jboolean value)
860 { functions->SetStaticBooleanField(this, clazz, fieldID, value); }
861 void SetStaticByteField(jclass clazz, jfieldID fieldID, jbyte value)
862 { functions->SetStaticByteField(this, clazz, fieldID, value); }
863 void SetStaticCharField(jclass clazz, jfieldID fieldID, jchar value)
864 { functions->SetStaticCharField(this, clazz, fieldID, value); }
865 void SetStaticShortField(jclass clazz, jfieldID fieldID, jshort value)
866 { functions->SetStaticShortField(this, clazz, fieldID, value); }
867 void SetStaticIntField(jclass clazz, jfieldID fieldID, jint value)
868 { functions->SetStaticIntField(this, clazz, fieldID, value); }
869 void SetStaticLongField(jclass clazz, jfieldID fieldID, jlong value)
870 { functions->SetStaticLongField(this, clazz, fieldID, value); }
871 void SetStaticFloatField(jclass clazz, jfieldID fieldID, jfloat value)
872 { functions->SetStaticFloatField(this, clazz, fieldID, value); }
873 void SetStaticDoubleField(jclass clazz, jfieldID fieldID, jdouble value)
874 { functions->SetStaticDoubleField(this, clazz, fieldID, value); }
875
876 jstring NewString(const jchar* unicodeChars, jsize len)
877 { return functions->NewString(this, unicodeChars, len); }
878
879 jsize GetStringLength(jstring string)
880 { return functions->GetStringLength(this, string); }
881
882 const jchar* GetStringChars(jstring string, jboolean* isCopy)
883 { return functions->GetStringChars(this, string, isCopy); }
884
885 void ReleaseStringChars(jstring string, const jchar* chars)
886 { functions->ReleaseStringChars(this, string, chars); }
887
888 jstring NewStringUTF(const char* bytes)
889 { return functions->NewStringUTF(this, bytes); }
890
891 jsize GetStringUTFLength(jstring string)
892 { return functions->GetStringUTFLength(this, string); }
893
894 const char* GetStringUTFChars(jstring string, jboolean* isCopy)
895 { return functions->GetStringUTFChars(this, string, isCopy); }
896
897 void ReleaseStringUTFChars(jstring string, const char* utf)
898 { functions->ReleaseStringUTFChars(this, string, utf); }
899
900 jsize GetArrayLength(jarray array)
901 { return functions->GetArrayLength(this, array); }
902
903 jobjectArray NewObjectArray(jsize length, jclass elementClass,
904 jobject initialElement)
905 { return functions->NewObjectArray(this, length, elementClass,
906 initialElement); }
907
908 jobject GetObjectArrayElement(jobjectArray array, jsize index)
909 { return functions->GetObjectArrayElement(this, array, index); }
910
911 void SetObjectArrayElement(jobjectArray array, jsize index, jobject value)
912 { functions->SetObjectArrayElement(this, array, index, value); }
913
914 jbooleanArray NewBooleanArray(jsize length)
915 { return functions->NewBooleanArray(this, length); }
916 jbyteArray NewByteArray(jsize length)
917 { return functions->NewByteArray(this, length); }
918 jcharArray NewCharArray(jsize length)
919 { return functions->NewCharArray(this, length); }
920 jshortArray NewShortArray(jsize length)
921 { return functions->NewShortArray(this, length); }
922 jintArray NewIntArray(jsize length)
923 { return functions->NewIntArray(this, length); }
924 jlongArray NewLongArray(jsize length)
925 { return functions->NewLongArray(this, length); }
926 jfloatArray NewFloatArray(jsize length)
927 { return functions->NewFloatArray(this, length); }
928 jdoubleArray NewDoubleArray(jsize length)
929 { return functions->NewDoubleArray(this, length); }
930
931 jboolean* GetBooleanArrayElements(jbooleanArray array, jboolean* isCopy)
932 { return functions->GetBooleanArrayElements(this, array, isCopy); }
933 jbyte* GetByteArrayElements(jbyteArray array, jboolean* isCopy)
934 { return functions->GetByteArrayElements(this, array, isCopy); }
935 jchar* GetCharArrayElements(jcharArray array, jboolean* isCopy)
936 { return functions->GetCharArrayElements(this, array, isCopy); }
937 jshort* GetShortArrayElements(jshortArray array, jboolean* isCopy)
938 { return functions->GetShortArrayElements(this, array, isCopy); }
939 jint* GetIntArrayElements(jintArray array, jboolean* isCopy)
940 { return functions->GetIntArrayElements(this, array, isCopy); }
941 jlong* GetLongArrayElements(jlongArray array, jboolean* isCopy)
942 { return functions->GetLongArrayElements(this, array, isCopy); }
943 jfloat* GetFloatArrayElements(jfloatArray array, jboolean* isCopy)
944 { return functions->GetFloatArrayElements(this, array, isCopy); }
945 jdouble* GetDoubleArrayElements(jdoubleArray array, jboolean* isCopy)
946 { return functions->GetDoubleArrayElements(this, array, isCopy); }
947
948 void ReleaseBooleanArrayElements(jbooleanArray array, jboolean* elems,
949 jint mode)
950 { functions->ReleaseBooleanArrayElements(this, array, elems, mode); }
951 void ReleaseByteArrayElements(jbyteArray array, jbyte* elems,
952 jint mode)
953 { functions->ReleaseByteArrayElements(this, array, elems, mode); }
954 void ReleaseCharArrayElements(jcharArray array, jchar* elems,
955 jint mode)
956 { functions->ReleaseCharArrayElements(this, array, elems, mode); }
957 void ReleaseShortArrayElements(jshortArray array, jshort* elems,
958 jint mode)
959 { functions->ReleaseShortArrayElements(this, array, elems, mode); }
960 void ReleaseIntArrayElements(jintArray array, jint* elems,
961 jint mode)
962 { functions->ReleaseIntArrayElements(this, array, elems, mode); }
963 void ReleaseLongArrayElements(jlongArray array, jlong* elems,
964 jint mode)
965 { functions->ReleaseLongArrayElements(this, array, elems, mode); }
966 void ReleaseFloatArrayElements(jfloatArray array, jfloat* elems,
967 jint mode)
968 { functions->ReleaseFloatArrayElements(this, array, elems, mode); }
969 void ReleaseDoubleArrayElements(jdoubleArray array, jdouble* elems,
970 jint mode)
971 { functions->ReleaseDoubleArrayElements(this, array, elems, mode); }
972
973 void GetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
974 jboolean* buf)
975 { functions->GetBooleanArrayRegion(this, array, start, len, buf); }
976 void GetByteArrayRegion(jbyteArray array, jsize start, jsize len,
977 jbyte* buf)
978 { functions->GetByteArrayRegion(this, array, start, len, buf); }
979 void GetCharArrayRegion(jcharArray array, jsize start, jsize len,
980 jchar* buf)
981 { functions->GetCharArrayRegion(this, array, start, len, buf); }
982 void GetShortArrayRegion(jshortArray array, jsize start, jsize len,
983 jshort* buf)
984 { functions->GetShortArrayRegion(this, array, start, len, buf); }
985 void GetIntArrayRegion(jintArray array, jsize start, jsize len,
986 jint* buf)
987 { functions->GetIntArrayRegion(this, array, start, len, buf); }
988 void GetLongArrayRegion(jlongArray array, jsize start, jsize len,
989 jlong* buf)
990 { functions->GetLongArrayRegion(this, array, start, len, buf); }
991 void GetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
992 jfloat* buf)
993 { functions->GetFloatArrayRegion(this, array, start, len, buf); }
994 void GetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
995 jdouble* buf)
996 { functions->GetDoubleArrayRegion(this, array, start, len, buf); }
997
998 void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
999 const jboolean* buf)
1000 { functions->SetBooleanArrayRegion(this, array, start, len, buf); }
1001 void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
1002 const jbyte* buf)
1003 { functions->SetByteArrayRegion(this, array, start, len, buf); }
1004 void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
1005 const jchar* buf)
1006 { functions->SetCharArrayRegion(this, array, start, len, buf); }
1007 void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
1008 const jshort* buf)
1009 { functions->SetShortArrayRegion(this, array, start, len, buf); }
1010 void SetIntArrayRegion(jintArray array, jsize start, jsize len,
1011 const jint* buf)
1012 { functions->SetIntArrayRegion(this, array, start, len, buf); }
1013 void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
1014 const jlong* buf)
1015 { functions->SetLongArrayRegion(this, array, start, len, buf); }
1016 void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
1017 const jfloat* buf)
1018 { functions->SetFloatArrayRegion(this, array, start, len, buf); }
1019 void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
1020 const jdouble* buf)
1021 { functions->SetDoubleArrayRegion(this, array, start, len, buf); }
1022
1023 jint RegisterNatives(jclass clazz, const JNINativeMethod* methods,
1024 jint nMethods)
1025 { return functions->RegisterNatives(this, clazz, methods, nMethods); }
1026
1027 jint UnregisterNatives(jclass clazz)
1028 { return functions->UnregisterNatives(this, clazz); }
1029
1030 jint MonitorEnter(jobject obj)
1031 { return functions->MonitorEnter(this, obj); }
1032
1033 jint MonitorExit(jobject obj)
1034 { return functions->MonitorExit(this, obj); }
1035
1036 jint GetJavaVM(JavaVM** vm)
1037 { return functions->GetJavaVM(this, vm); }
1038
1039 void GetStringRegion(jstring str, jsize start, jsize len, jchar* buf)
1040 { functions->GetStringRegion(this, str, start, len, buf); }
1041
1042 void GetStringUTFRegion(jstring str, jsize start, jsize len, char* buf)
1043 { return functions->GetStringUTFRegion(this, str, start, len, buf); }
1044
1045 void* GetPrimitiveArrayCritical(jarray array, jboolean* isCopy)
1046 { return functions->GetPrimitiveArrayCritical(this, array, isCopy); }
1047
1048 void ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode)
1049 { functions->ReleasePrimitiveArrayCritical(this, array, carray, mode); }
1050
1051 const jchar* GetStringCritical(jstring string, jboolean* isCopy)
1052 { return functions->GetStringCritical(this, string, isCopy); }
1053
1054 void ReleaseStringCritical(jstring string, const jchar* carray)
1055 { functions->ReleaseStringCritical(this, string, carray); }
1056
1057 jweak NewWeakGlobalRef(jobject obj)
1058 { return functions->NewWeakGlobalRef(this, obj); }
1059
1060 void DeleteWeakGlobalRef(jweak obj)
1061 { functions->DeleteWeakGlobalRef(this, obj); }
1062
1063 jboolean ExceptionCheck()
1064 { return functions->ExceptionCheck(this); }
1065
1066 jobject NewDirectByteBuffer(void* address, jlong capacity)
1067 { return functions->NewDirectByteBuffer(this, address, capacity); }
1068
1069 void* GetDirectBufferAddress(jobject buf)
1070 { return functions->GetDirectBufferAddress(this, buf); }
1071
1072 jlong GetDirectBufferCapacity(jobject buf)
1073 { return functions->GetDirectBufferCapacity(this, buf); }
1074
1075 /* added in JNI 1.6 */
1076 jobjectRefType GetObjectRefType(jobject obj)
1077 { return functions->GetObjectRefType(this, obj); }
1078 #endif /*__cplusplus*/
1079 };
1080
1081
1082 /*
1083 * JNI invocation interface.
1084 */
1085 struct JNIInvokeInterface {
1086 void* reserved0;
1087 void* reserved1;
1088 void* reserved2;
1089
1090 jint (*DestroyJavaVM)(JavaVM*);
1091 jint (*AttachCurrentThread)(JavaVM*, void**, void*);
1092 jint (*DetachCurrentThread)(JavaVM*);
1093 jint (*GetEnv)(JavaVM*, void**, jint);
1094 jint (*AttachCurrentThreadAsDaemon)(JavaVM*, void**, void*);
1095 };
1096
1097 /*
1098 * C++ version.
1099 */
1100 struct _JavaVM {
1101 const struct JNIInvokeInterface* functions;
1102
1103 #if defined(__cplusplus)
1104 jint DestroyJavaVM()
1105 { return functions->DestroyJavaVM(this); }
1106 jint AttachCurrentThread(void** p_env, void* thr_args)
1107 { return functions->AttachCurrentThread(this, p_env, thr_args); }
1108 jint DetachCurrentThread()
1109 { return functions->DetachCurrentThread(this); }
1110 jint GetEnv(void** env, jint version)
1111 { return functions->GetEnv(this, env, version); }
1112 jint AttachCurrentThreadAsDaemon(void** p_env, void* thr_args)
1113 { return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); }
1114 #endif /*__cplusplus*/
1115 };
1116
1117 struct JavaVMAttachArgs {
1118 jint version; /* must be >= JNI_VERSION_1_2 */
1119 const char* name; /* NULL or name of thread as modified UTF-8 str */
1120 jobject group; /* global ref of a ThreadGroup object, or NULL */
1121 };
1122 typedef struct JavaVMAttachArgs JavaVMAttachArgs;
1123
1124 /*
1125 * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no
1126 * longer supported.)
1127 */
1128 typedef struct JavaVMOption {
1129 const char* optionString;
1130 void* extraInfo;
1131 } JavaVMOption;
1132
1133 typedef struct JavaVMInitArgs {
1134 jint version; /* use JNI_VERSION_1_2 or later */
1135
1136 jint nOptions;
1137 JavaVMOption* options;
1138 jboolean ignoreUnrecognized;
1139 } JavaVMInitArgs;
1140
1141 #ifdef __cplusplus
1142 extern "C" {
1143 #endif
1144 /*
1145 * VM initialization functions.
1146 *
1147 * Note these are the only symbols exported for JNI by the VM.
1148 */
1149 jint JNI_GetDefaultJavaVMInitArgs(void*);
1150 jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*);
1151 jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*);
1152
1153 // commented out by marscher
1154 //#define JNIIMPORT
1155 //#define JNIEXPORT __attribute__ ((visibility ("default")))
1156 //#define JNICALL
1157
1158 /*
1159 * Prototypes for functions exported by loadable shared libs. These are
1160 * called by JNI, not provided by JNI.
1161 */
1162 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved);
1163 JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved);
1164
1165 #ifdef __cplusplus
1166 }
1167 #endif
1168
1169
1170 /*
1171 * Manifest constants.
1172 */
1173 #define JNI_FALSE 0
1174 #define JNI_TRUE 1
1175
1176 #define JNI_VERSION_1_1 0x00010001
1177 #define JNI_VERSION_1_2 0x00010002
1178 #define JNI_VERSION_1_4 0x00010004
1179 #define JNI_VERSION_1_6 0x00010006
1180 #define JNI_VERSION_1_7 0x00010007
1181 #define JNI_VERSION_1_8 0x00010008
1182 #define JNI_VERSION_9 0x00090000
1183 #define JNI_VERSION_10 0x000a0000
1184 #define JNI_VERSION_19 0x00130000
1185 #define JNI_VERSION_20 0x00140000
1186 #define JNI_VERSION_21 0x00150000
1187
1188 #define JNI_OK (0) /* no error */
1189 #define JNI_ERR (-1) /* generic error */
1190 #define JNI_EDETACHED (-2) /* thread detached from the VM */
1191 #define JNI_EVERSION (-3) /* JNI version error */
1192
1193 #define JNI_COMMIT 1 /* copy content, do not free buffer */
1194 #define JNI_ABORT 2 /* free buffer w/o copying back */
1195
1196 #endif /* JNI_H_ */