1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* ***** BEGIN LICENSE BLOCK ***** 3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1 4 * 5 * The contents of this file are subject to the Netscape Public License 6 * Version 1.1 (the "License"); you may not use this file except in 7 * compliance with the License. You may obtain a copy of the License at 8 * http://www.mozilla.org/NPL/ 9 * 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 12 * for the specific language governing rights and limitations under the 13 * License. 14 * 15 * The Original Code is mozilla.org code. 16 * 17 * The Initial Developer of the Original Code is 18 * Netscape Communications Corporation. 19 * Portions created by the Initial Developer are Copyright (C) 1998 20 * the Initial Developer. All Rights Reserved. 21 * 22 * Contributor(s): 23 * 24 * Alternatively, the contents of this file may be used under the terms of 25 * either the GNU General Public License Version 2 or later (the "GPL"), or 26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 27 * in which case the provisions of the GPL or the LGPL are applicable instead 28 * of those above. If you wish to allow use of your version of this file only 29 * under the terms of either the GPL or the LGPL, and not to allow others to 30 * use your version of this file under the terms of the NPL, indicate your 31 * decision by deleting the provisions above and replace them with the notice 32 * and other provisions required by the GPL or the LGPL. If you do not delete 33 * the provisions above, a recipient may use your version of this file under 34 * the terms of any one of the NPL, the GPL or the LGPL. 35 * 36 * ***** END LICENSE BLOCK ***** */ 37 38 /******************************************************************************* 39 * Java Runtime Interface 40 ******************************************************************************/ 41 42 #ifndef JRI_H 43 #define JRI_H 44 45 #include "jritypes.h" 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif /* __cplusplus */ 50 51 /******************************************************************************* 52 * JRIEnv 53 ******************************************************************************/ 54 55 /* The type of the JRIEnv interface. */ 56 typedef struct JRIEnvInterface JRIEnvInterface; 57 58 /* The type of a JRIEnv instance. */ 59 typedef const JRIEnvInterface* JRIEnv; 60 61 /******************************************************************************* 62 * JRIEnv Operations 63 ******************************************************************************/ 64 65 #define JRI_DefineClass(env, classLoader, buf, bufLen) \ 66 (((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen)) 67 68 #define JRI_FindClass(env, name) \ 69 (((*(env))->FindClass)(env, JRI_FindClass_op, name)) 70 71 #define JRI_Throw(env, obj) \ 72 (((*(env))->Throw)(env, JRI_Throw_op, obj)) 73 74 #define JRI_ThrowNew(env, clazz, message) \ 75 (((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message)) 76 77 #define JRI_ExceptionOccurred(env) \ 78 (((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op)) 79 80 #define JRI_ExceptionDescribe(env) \ 81 (((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op)) 82 83 #define JRI_ExceptionClear(env) \ 84 (((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op)) 85 86 #define JRI_NewGlobalRef(env, ref) \ 87 (((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref)) 88 89 #define JRI_DisposeGlobalRef(env, gref) \ 90 (((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref)) 91 92 #define JRI_GetGlobalRef(env, gref) \ 93 (((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref)) 94 95 #define JRI_SetGlobalRef(env, gref, ref) \ 96 (((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref)) 97 98 #define JRI_IsSameObject(env, a, b) \ 99 (((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b)) 100 101 #define JRI_NewObject(env) ((*(env))->NewObject) 102 #define JRI_NewObjectV(env, clazz, methodID, args) \ 103 (((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args)) 104 #define JRI_NewObjectA(env, clazz, method, args) \ 105 (((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args)) 106 107 #define JRI_GetObjectClass(env, obj) \ 108 (((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj)) 109 110 #define JRI_IsInstanceOf(env, obj, clazz) \ 111 (((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz)) 112 113 #define JRI_GetMethodID(env, clazz, name, sig) \ 114 (((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig)) 115 116 #define JRI_CallMethod(env) ((*(env))->CallMethod) 117 #define JRI_CallMethodV(env, obj, methodID, args) \ 118 (((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args)) 119 #define JRI_CallMethodA(env, obj, methodID, args) \ 120 (((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args)) 121 122 #define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean) 123 #define JRI_CallMethodBooleanV(env, obj, methodID, args) \ 124 (((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args)) 125 #define JRI_CallMethodBooleanA(env, obj, methodID, args) \ 126 (((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args)) 127 128 #define JRI_CallMethodByte(env) ((*(env))->CallMethodByte) 129 #define JRI_CallMethodByteV(env, obj, methodID, args) \ 130 (((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args)) 131 #define JRI_CallMethodByteA(env, obj, methodID, args) \ 132 (((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args)) 133 134 #define JRI_CallMethodChar(env) ((*(env))->CallMethodChar) 135 #define JRI_CallMethodCharV(env, obj, methodID, args) \ 136 (((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args)) 137 #define JRI_CallMethodCharA(env, obj, methodID, args) \ 138 (((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args)) 139 140 #define JRI_CallMethodShort(env) ((*(env))->CallMethodShort) 141 #define JRI_CallMethodShortV(env, obj, methodID, args) \ 142 (((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args)) 143 #define JRI_CallMethodShortA(env, obj, methodID, args) \ 144 (((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args)) 145 146 #define JRI_CallMethodInt(env) ((*(env))->CallMethodInt) 147 #define JRI_CallMethodIntV(env, obj, methodID, args) \ 148 (((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args)) 149 #define JRI_CallMethodIntA(env, obj, methodID, args) \ 150 (((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args)) 151 152 #define JRI_CallMethodLong(env) ((*(env))->CallMethodLong) 153 #define JRI_CallMethodLongV(env, obj, methodID, args) \ 154 (((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args)) 155 #define JRI_CallMethodLongA(env, obj, methodID, args) \ 156 (((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args)) 157 158 #define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat) 159 #define JRI_CallMethodFloatV(env, obj, methodID, args) \ 160 (((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args)) 161 #define JRI_CallMethodFloatA(env, obj, methodID, args) \ 162 (((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args)) 163 164 #define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble) 165 #define JRI_CallMethodDoubleV(env, obj, methodID, args) \ 166 (((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args)) 167 #define JRI_CallMethodDoubleA(env, obj, methodID, args) \ 168 (((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args)) 169 170 #define JRI_GetFieldID(env, clazz, name, sig) \ 171 (((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig)) 172 173 #define JRI_GetField(env, obj, fieldID) \ 174 (((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID)) 175 176 #define JRI_GetFieldBoolean(env, obj, fieldID) \ 177 (((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID)) 178 179 #define JRI_GetFieldByte(env, obj, fieldID) \ 180 (((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID)) 181 182 #define JRI_GetFieldChar(env, obj, fieldID) \ 183 (((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID)) 184 185 #define JRI_GetFieldShort(env, obj, fieldID) \ 186 (((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID)) 187 188 #define JRI_GetFieldInt(env, obj, fieldID) \ 189 (((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID)) 190 191 #define JRI_GetFieldLong(env, obj, fieldID) \ 192 (((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID)) 193 194 #define JRI_GetFieldFloat(env, obj, fieldID) \ 195 (((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID)) 196 197 #define JRI_GetFieldDouble(env, obj, fieldID) \ 198 (((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID)) 199 200 #define JRI_SetField(env, obj, fieldID, value) \ 201 (((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value)) 202 203 #define JRI_SetFieldBoolean(env, obj, fieldID, value) \ 204 (((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value)) 205 206 #define JRI_SetFieldByte(env, obj, fieldID, value) \ 207 (((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value)) 208 209 #define JRI_SetFieldChar(env, obj, fieldID, value) \ 210 (((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value)) 211 212 #define JRI_SetFieldShort(env, obj, fieldID, value) \ 213 (((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value)) 214 215 #define JRI_SetFieldInt(env, obj, fieldID, value) \ 216 (((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value)) 217 218 #define JRI_SetFieldLong(env, obj, fieldID, value) \ 219 (((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value)) 220 221 #define JRI_SetFieldFloat(env, obj, fieldID, value) \ 222 (((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value)) 223 224 #define JRI_SetFieldDouble(env, obj, fieldID, value) \ 225 (((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value)) 226 227 #define JRI_IsSubclassOf(env, a, b) \ 228 (((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b)) 229 230 #define JRI_GetStaticMethodID(env, clazz, name, sig) \ 231 (((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig)) 232 233 #define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod) 234 #define JRI_CallStaticMethodV(env, clazz, methodID, args) \ 235 (((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args)) 236 #define JRI_CallStaticMethodA(env, clazz, methodID, args) \ 237 (((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args)) 238 239 #define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean) 240 #define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \ 241 (((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args)) 242 #define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \ 243 (((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args)) 244 245 #define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte) 246 #define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \ 247 (((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args)) 248 #define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \ 249 (((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args)) 250 251 #define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar) 252 #define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \ 253 (((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args)) 254 #define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \ 255 (((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args)) 256 257 #define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort) 258 #define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \ 259 (((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args)) 260 #define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \ 261 (((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args)) 262 263 #define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt) 264 #define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \ 265 (((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args)) 266 #define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \ 267 (((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args)) 268 269 #define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong) 270 #define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \ 271 (((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args)) 272 #define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \ 273 (((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args)) 274 275 #define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat) 276 #define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \ 277 (((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args)) 278 #define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \ 279 (((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args)) 280 281 #define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble) 282 #define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \ 283 (((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args)) 284 #define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \ 285 (((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args)) 286 287 #define JRI_GetStaticFieldID(env, clazz, name, sig) \ 288 (((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig)) 289 290 #define JRI_GetStaticField(env, clazz, fieldID) \ 291 (((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID)) 292 293 #define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \ 294 (((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID)) 295 296 #define JRI_GetStaticFieldByte(env, clazz, fieldID) \ 297 (((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID)) 298 299 #define JRI_GetStaticFieldChar(env, clazz, fieldID) \ 300 (((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID)) 301 302 #define JRI_GetStaticFieldShort(env, clazz, fieldID) \ 303 (((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID)) 304 305 #define JRI_GetStaticFieldInt(env, clazz, fieldID) \ 306 (((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID)) 307 308 #define JRI_GetStaticFieldLong(env, clazz, fieldID) \ 309 (((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID)) 310 311 #define JRI_GetStaticFieldFloat(env, clazz, fieldID) \ 312 (((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID)) 313 314 #define JRI_GetStaticFieldDouble(env, clazz, fieldID) \ 315 (((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID)) 316 317 #define JRI_SetStaticField(env, clazz, fieldID, value) \ 318 (((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value)) 319 320 #define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \ 321 (((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value)) 322 323 #define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \ 324 (((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value)) 325 326 #define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \ 327 (((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value)) 328 329 #define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \ 330 (((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value)) 331 332 #define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \ 333 (((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value)) 334 335 #define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \ 336 (((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value)) 337 338 #define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \ 339 (((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value)) 340 341 #define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \ 342 (((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value)) 343 344 #define JRI_NewString(env, unicode, len) \ 345 (((*(env))->NewString)(env, JRI_NewString_op, unicode, len)) 346 347 #define JRI_GetStringLength(env, string) \ 348 (((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string)) 349 350 #define JRI_GetStringChars(env, string) \ 351 (((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string)) 352 353 #define JRI_NewStringUTF(env, utf, len) \ 354 (((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len)) 355 356 #define JRI_GetStringUTFLength(env, string) \ 357 (((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string)) 358 359 #define JRI_GetStringUTFChars(env, string) \ 360 (((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string)) 361 362 #define JRI_NewScalarArray(env, length, elementSig, initialElements) \ 363 (((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements)) 364 365 #define JRI_GetScalarArrayLength(env, array) \ 366 (((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array)) 367 368 #define JRI_GetScalarArrayElements(env, array) \ 369 (((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array)) 370 371 #define JRI_NewObjectArray(env, length, elementClass, initialElement) \ 372 (((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement)) 373 374 #define JRI_GetObjectArrayLength(env, array) \ 375 (((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array)) 376 377 #define JRI_GetObjectArrayElement(env, array, index) \ 378 (((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index)) 379 380 #define JRI_SetObjectArrayElement(env, array, index, value) \ 381 (((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value)) 382 383 #define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \ 384 (((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray)) 385 386 #define JRI_UnregisterNatives(env, clazz) \ 387 (((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz)) 388 389 #define JRI_NewStringPlatform(env, string, len, encoding, encodingLength) \ 390 (((*(env))->NewStringPlatform)(env, JRI_NewStringPlatform_op, string, len, encoding, encodingLength)) 391 392 #define JRI_GetStringPlatformChars(env, string, encoding, encodingLength) \ 393 (((*(env))->GetStringPlatformChars)(env, JRI_GetStringPlatformChars_op, string, encoding, encodingLength)) 394 395 396 /******************************************************************************* 397 * JRIEnv Interface 398 ******************************************************************************/ 399 400 struct java_lang_ClassLoader; 401 struct java_lang_Class; 402 struct java_lang_Throwable; 403 struct java_lang_Object; 404 struct java_lang_String; 405 406 struct JRIEnvInterface { 407 void* reserved0; 408 void* reserved1; 409 void* reserved2; 410 void* reserved3; 411 struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a); 412 void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a); 413 void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b); 414 struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op); 415 void (*ExceptionDescribe)(JRIEnv* env, jint op); 416 void (*ExceptionClear)(JRIEnv* env, jint op); 417 jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a); 418 void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a); 419 void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a); 420 void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b); 421 jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b); 422 void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 423 void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 424 void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 425 struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a); 426 jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b); 427 jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); 428 void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...); 429 void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 430 void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 431 jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...); 432 jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 433 jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 434 jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...); 435 jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 436 jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 437 jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...); 438 jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 439 jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 440 jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...); 441 jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 442 jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 443 jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...); 444 jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 445 jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 446 jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...); 447 jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 448 jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 449 jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...); 450 jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 451 jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 452 jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...); 453 jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c); 454 jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); 455 jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); 456 void* (*GetField)(JRIEnv* env, jint op, void* a, jint b); 457 jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b); 458 jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b); 459 jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b); 460 jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b); 461 jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b); 462 jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b); 463 jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b); 464 jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b); 465 void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c); 466 void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c); 467 void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c); 468 void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c); 469 void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c); 470 void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c); 471 void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c); 472 void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c); 473 void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c); 474 jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b); 475 jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); 476 void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 477 void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 478 void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 479 jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 480 jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 481 jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 482 jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 483 jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 484 jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 485 jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 486 jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 487 jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 488 jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 489 jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 490 jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 491 jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 492 jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 493 jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 494 jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 495 jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 496 jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 497 jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 498 jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 499 jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 500 jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); 501 jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); 502 jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); 503 jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); 504 void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 505 jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 506 jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 507 jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 508 jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 509 jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 510 jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 511 jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 512 jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); 513 void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c); 514 void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c); 515 void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c); 516 void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c); 517 void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c); 518 void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c); 519 void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c); 520 void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c); 521 void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c); 522 struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b); 523 jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a); 524 const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a); 525 struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b); 526 jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a); 527 const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a); 528 void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c); 529 jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a); 530 jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a); 531 void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c); 532 jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a); 533 void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b); 534 void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c); 535 void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c); 536 void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a); 537 struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen); 538 struct java_lang_String* (*NewStringPlatform)(JRIEnv* env, jint op, const jbyte* a, jint b, const jbyte* c, jint d); 539 const jbyte* (*GetStringPlatformChars)(JRIEnv* env, jint op, struct java_lang_String* a, const jbyte* b, jint c); 540 }; 541 542 /* 543 ** **************************************************************************** 544 ** JRIEnv Operation IDs 545 ** *************************************************************************** 546 */ 547 548 typedef enum JRIEnvOperations { 549 JRI_Reserved0_op, 550 JRI_Reserved1_op, 551 JRI_Reserved2_op, 552 JRI_Reserved3_op, 553 JRI_FindClass_op, 554 JRI_Throw_op, 555 JRI_ThrowNew_op, 556 JRI_ExceptionOccurred_op, 557 JRI_ExceptionDescribe_op, 558 JRI_ExceptionClear_op, 559 JRI_NewGlobalRef_op, 560 JRI_DisposeGlobalRef_op, 561 JRI_GetGlobalRef_op, 562 JRI_SetGlobalRef_op, 563 JRI_IsSameObject_op, 564 JRI_NewObject_op, 565 JRI_NewObject_op_va_list, 566 JRI_NewObject_op_array, 567 JRI_GetObjectClass_op, 568 JRI_IsInstanceOf_op, 569 JRI_GetMethodID_op, 570 JRI_CallMethod_op, 571 JRI_CallMethod_op_va_list, 572 JRI_CallMethod_op_array, 573 JRI_CallMethodBoolean_op, 574 JRI_CallMethodBoolean_op_va_list, 575 JRI_CallMethodBoolean_op_array, 576 JRI_CallMethodByte_op, 577 JRI_CallMethodByte_op_va_list, 578 JRI_CallMethodByte_op_array, 579 JRI_CallMethodChar_op, 580 JRI_CallMethodChar_op_va_list, 581 JRI_CallMethodChar_op_array, 582 JRI_CallMethodShort_op, 583 JRI_CallMethodShort_op_va_list, 584 JRI_CallMethodShort_op_array, 585 JRI_CallMethodInt_op, 586 JRI_CallMethodInt_op_va_list, 587 JRI_CallMethodInt_op_array, 588 JRI_CallMethodLong_op, 589 JRI_CallMethodLong_op_va_list, 590 JRI_CallMethodLong_op_array, 591 JRI_CallMethodFloat_op, 592 JRI_CallMethodFloat_op_va_list, 593 JRI_CallMethodFloat_op_array, 594 JRI_CallMethodDouble_op, 595 JRI_CallMethodDouble_op_va_list, 596 JRI_CallMethodDouble_op_array, 597 JRI_GetFieldID_op, 598 JRI_GetField_op, 599 JRI_GetFieldBoolean_op, 600 JRI_GetFieldByte_op, 601 JRI_GetFieldChar_op, 602 JRI_GetFieldShort_op, 603 JRI_GetFieldInt_op, 604 JRI_GetFieldLong_op, 605 JRI_GetFieldFloat_op, 606 JRI_GetFieldDouble_op, 607 JRI_SetField_op, 608 JRI_SetFieldBoolean_op, 609 JRI_SetFieldByte_op, 610 JRI_SetFieldChar_op, 611 JRI_SetFieldShort_op, 612 JRI_SetFieldInt_op, 613 JRI_SetFieldLong_op, 614 JRI_SetFieldFloat_op, 615 JRI_SetFieldDouble_op, 616 JRI_IsSubclassOf_op, 617 JRI_GetStaticMethodID_op, 618 JRI_CallStaticMethod_op, 619 JRI_CallStaticMethod_op_va_list, 620 JRI_CallStaticMethod_op_array, 621 JRI_CallStaticMethodBoolean_op, 622 JRI_CallStaticMethodBoolean_op_va_list, 623 JRI_CallStaticMethodBoolean_op_array, 624 JRI_CallStaticMethodByte_op, 625 JRI_CallStaticMethodByte_op_va_list, 626 JRI_CallStaticMethodByte_op_array, 627 JRI_CallStaticMethodChar_op, 628 JRI_CallStaticMethodChar_op_va_list, 629 JRI_CallStaticMethodChar_op_array, 630 JRI_CallStaticMethodShort_op, 631 JRI_CallStaticMethodShort_op_va_list, 632 JRI_CallStaticMethodShort_op_array, 633 JRI_CallStaticMethodInt_op, 634 JRI_CallStaticMethodInt_op_va_list, 635 JRI_CallStaticMethodInt_op_array, 636 JRI_CallStaticMethodLong_op, 637 JRI_CallStaticMethodLong_op_va_list, 638 JRI_CallStaticMethodLong_op_array, 639 JRI_CallStaticMethodFloat_op, 640 JRI_CallStaticMethodFloat_op_va_list, 641 JRI_CallStaticMethodFloat_op_array, 642 JRI_CallStaticMethodDouble_op, 643 JRI_CallStaticMethodDouble_op_va_list, 644 JRI_CallStaticMethodDouble_op_array, 645 JRI_GetStaticFieldID_op, 646 JRI_GetStaticField_op, 647 JRI_GetStaticFieldBoolean_op, 648 JRI_GetStaticFieldByte_op, 649 JRI_GetStaticFieldChar_op, 650 JRI_GetStaticFieldShort_op, 651 JRI_GetStaticFieldInt_op, 652 JRI_GetStaticFieldLong_op, 653 JRI_GetStaticFieldFloat_op, 654 JRI_GetStaticFieldDouble_op, 655 JRI_SetStaticField_op, 656 JRI_SetStaticFieldBoolean_op, 657 JRI_SetStaticFieldByte_op, 658 JRI_SetStaticFieldChar_op, 659 JRI_SetStaticFieldShort_op, 660 JRI_SetStaticFieldInt_op, 661 JRI_SetStaticFieldLong_op, 662 JRI_SetStaticFieldFloat_op, 663 JRI_SetStaticFieldDouble_op, 664 JRI_NewString_op, 665 JRI_GetStringLength_op, 666 JRI_GetStringChars_op, 667 JRI_NewStringUTF_op, 668 JRI_GetStringUTFLength_op, 669 JRI_GetStringUTFChars_op, 670 JRI_NewScalarArray_op, 671 JRI_GetScalarArrayLength_op, 672 JRI_GetScalarArrayElements_op, 673 JRI_NewObjectArray_op, 674 JRI_GetObjectArrayLength_op, 675 JRI_GetObjectArrayElement_op, 676 JRI_SetObjectArrayElement_op, 677 JRI_RegisterNatives_op, 678 JRI_UnregisterNatives_op, 679 JRI_DefineClass_op, 680 JRI_NewStringPlatform_op, 681 JRI_GetStringPlatformChars_op 682 } JRIEnvOperations; 683 684 #ifdef __cplusplus 685 } /* extern "C" */ 686 #endif /* __cplusplus */ 687 688 #endif /* JRI_H */ 689 /******************************************************************************/ 690