Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: chrome/test/chromedriver/third_party/jni/jni.h

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

Powered by Google App Engine
This is Rietveld 408576698