📄 jni.h
字号:
/*
* @(#)jni.h 1.28 97/05/19
*
* Copyright (c) 1993-1996 Sun Microsystems, Inc. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for NON-COMMERCIAL purposes and without
* fee is hereby granted provided that this copyright notice
* appears in all copies.
*
* The Java source code is the confidential and proprietary information
* of Sun Microsystems, Inc. ("Confidential Information"). You shall
* not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/
/*
* We used part of Netscape's Java Runtime Interface (JRI) as the starting
* point of our design and implementation.
*/
/******************************************************************************
* Java Runtime Interface
* Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
*****************************************************************************/
#ifndef JNI_H
#define JNI_H
#include <stdio.h>
#include <stdarg.h>
/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
and jlong */
#include "jni_md.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* JNI Types
*/
typedef unsigned char jboolean;
typedef unsigned short jchar;
typedef short jshort;
typedef float_t jfloat; /*ibm.1229*/
typedef double_t jdouble; /*ibm.1229*/
typedef jint jsize;
#ifdef __cplusplus
class _jobject {};
class _jclass : public _jobject {};
class _jthrowable : public _jobject {};
class _jstring : public _jobject {};
class _jarray : public _jobject {};
class _jbooleanArray : public _jarray {};
class _jbyteArray : public _jarray {};
class _jcharArray : public _jarray {};
class _jshortArray : public _jarray {};
class _jintArray : public _jarray {};
class _jlongArray : public _jarray {};
class _jfloatArray : public _jarray {};
class _jdoubleArray : public _jarray {};
class _jobjectArray : public _jarray {};
typedef _jobject *jobject;
typedef _jclass *jclass;
typedef _jthrowable *jthrowable;
typedef _jstring *jstring;
typedef _jarray *jarray;
typedef _jbooleanArray *jbooleanArray;
typedef _jbyteArray *jbyteArray;
typedef _jcharArray *jcharArray;
typedef _jshortArray *jshortArray;
typedef _jintArray *jintArray;
typedef _jlongArray *jlongArray;
typedef _jfloatArray *jfloatArray;
typedef _jdoubleArray *jdoubleArray;
typedef _jobjectArray *jobjectArray;
#else
struct _jobject;
typedef struct _jobject *jobject;
typedef jobject jclass;
typedef jobject jthrowable;
typedef jobject jstring;
typedef jobject jarray;
typedef jarray jbooleanArray;
typedef jarray jbyteArray;
typedef jarray jcharArray;
typedef jarray jshortArray;
typedef jarray jintArray;
typedef jarray jlongArray;
typedef jarray jfloatArray;
typedef jarray jdoubleArray;
typedef jarray jobjectArray;
#endif
typedef jobject jref; /* For transition---not meant to be part of public
API anymore.*/
typedef union jvalue {
jboolean z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong j;
jfloat f;
jdouble d;
jobject l;
} jvalue;
struct _jfieldID;
typedef struct _jfieldID *jfieldID;
struct _jmethodID;
typedef struct _jmethodID *jmethodID;
/*
* jboolean constants
*/
#define JNI_FALSE 0
#define JNI_TRUE 1
/*
* possible return values for JNI functions.
*/
#if defined(IBM_JVMPI) /*ibm.6402*/
#define JNI_OK 0 /* success */
#define JNI_ERR (-1) /* unknown error */
#define JNI_EDETACHED (-2) /* thread detached from the VM */
#define JNI_EVERSION (-3) /* JNI version error */
#define JNI_ENOMEM (-4) /* not enough memory */
#define JNI_EEXIST (-5) /* VM already created */
#define JNI_EINVAL (-6) /* invalid arguments */
#else /* !IBM_JVMPI */ /*ibm.6402*/
#define JNI_OK 0
#define JNI_ERR (-1)
#endif /* !IBM_JVMPI */ /*ibm.6402*/
/*
* used in ReleaseScalarArrayElements
*/
#define JNI_COMMIT 1
#define JNI_ABORT 2
/*
* used in RegisterNatives to describe native method name, signature,
* and function pointer.
*/
typedef struct {
char *name;
char *signature;
void *fnPtr;
} JNINativeMethod;
/*
* JNI Native Method Interface.
*/
struct JNINativeInterface_;
struct JNIEnv_;
#ifdef __cplusplus
typedef JNIEnv_ JNIEnv;
#else
typedef const struct JNINativeInterface_ *JNIEnv;
#endif
/*
* JNI Invocation Interface.
*/
struct JNIInvokeInterface_;
struct JavaVM_;
#ifdef __cplusplus
typedef JavaVM_ JavaVM;
#else
typedef const struct JNIInvokeInterface_ *JavaVM;
#endif
#if !defined PJNICALL /*ibm*/
#define PJNICALL JNICALL * /*ibm*/
#endif /*ibm*/
struct JNINativeInterface_ {
void *reserved0;
void *reserved1;
void *reserved2;
void *reserved3;
jint (PJNICALL GetVersion)(JNIEnv *env); /*ibm*/
jclass (PJNICALL DefineClass) /*ibm*/
(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
jsize len);
jclass (PJNICALL FindClass) /*ibm*/
(JNIEnv *env, const char *name);
void *reserved4;
void *reserved5;
void *reserved6;
jclass (PJNICALL GetSuperclass) /*ibm*/
(JNIEnv *env, jclass sub);
jboolean (PJNICALL IsAssignableFrom) /*ibm*/
(JNIEnv *env, jclass sub, jclass sup);
void *reserved7;
jint (PJNICALL Throw) /*ibm*/
(JNIEnv *env, jthrowable obj);
jint (PJNICALL ThrowNew) /*ibm*/
(JNIEnv *env, jclass clazz, const char *msg);
jthrowable (PJNICALL ExceptionOccurred) /*ibm*/
(JNIEnv *env);
void (PJNICALL ExceptionDescribe) /*ibm*/
(JNIEnv *env);
void (PJNICALL ExceptionClear) /*ibm*/
(JNIEnv *env);
void (PJNICALL FatalError) /*ibm*/
(JNIEnv *env, const char *msg);
void *reserved8;
void *reserved9;
jobject (PJNICALL NewGlobalRef) /*ibm*/
(JNIEnv *env, jobject lobj);
void (PJNICALL DeleteGlobalRef) /*ibm*/
(JNIEnv *env, jobject gref);
void (PJNICALL DeleteLocalRef) /*ibm*/
(JNIEnv *env, jobject obj);
jboolean (PJNICALL IsSameObject) /*ibm*/
(JNIEnv *env, jobject obj1, jobject obj2);
void *reserved10;
void *reserved11;
jobject (PJNICALL AllocObject) /*ibm*/
(JNIEnv *env, jclass clazz);
jobject (PJNICALL NewObject) /*ibm*/
(JNIEnv *env, jclass clazz, jmethodID methodID, ...);
jobject (PJNICALL NewObjectV) /*ibm*/
(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
jobject (PJNICALL NewObjectA) /*ibm*/
(JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args);
jclass (PJNICALL GetObjectClass) /*ibm*/
(JNIEnv *env, jobject obj);
jboolean (PJNICALL IsInstanceOf) /*ibm*/
(JNIEnv *env, jobject obj, jclass clazz);
jmethodID (PJNICALL GetMethodID) /*ibm*/
(JNIEnv *env, jclass clazz, const char *name, const char *sig);
jobject (PJNICALL CallObjectMethod) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, ...);
jobject (PJNICALL CallObjectMethodV) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
jobject (PJNICALL CallObjectMethodA) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args);
jboolean (PJNICALL CallBooleanMethod) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, ...);
jboolean (PJNICALL CallBooleanMethodV) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
jboolean (PJNICALL CallBooleanMethodA) /*ibm*/
(JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -