aboutsummaryrefslogtreecommitdiff
path: root/libjava/include/jni.h
blob: bf7b015cdca13a1892b4cfbec203ebe541cdcd52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/* Copyright (C) 1998, 1999  Cygnus Solutions

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#ifndef __JAVA_JNI_H__
#define __JAVA_JNI_H__

#ifdef __GNUC__
# define __need___va_list
# include <stdarg.h>
# define _Jv_va_list __gnuc_va_list
#else
# include <stdarg.h>
# define _Jv_va_list va_list
#endif

#ifdef __cplusplus

// This is wrong, because it pollutes the name-space too much!
#include <javaprims.h>

typedef struct _Jv_JNIEnv JNIEnv;
#else

typedef int    jbyte  __attribute__((__mode__(__QI__)));
typedef int    jshort __attribute__((__mode__(__HI__)));
typedef int    jint   __attribute__((__mode__(__SI__)));
typedef int    jlong  __attribute__((__mode__(__DI__)));
typedef bool   jboolean __attribute__((__mode__(__QI__)));
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
typedef float  jfloat;
typedef double jdouble;
typedef jint jsize;

typedef const struct JNINativeInterface *JNIEnv;
#endif

typedef union jvalue
{
  jboolean z;
  jbyte    b;
  jchar    c;
  jshort  s;
  jint    i;
  jlong    j;
  jfloat  f;
  jdouble  d;
  jobject l;
} jvalue;

typedef void * (*_Jv_func)(...);

struct JNINativeInterface
{
  _Jv_func reserved0;
  _Jv_func reserved1;
  _Jv_func reserved2;
  _Jv_func reserved3;
  _Jv_func GetVersion;
  _Jv_func DefineClass;
  _Jv_func FindClass;
  _Jv_func reserved4;
  _Jv_func reserved5;
  _Jv_func reserved6;
  jclass   (*GetSuperclass)                (JNIEnv*, jclass);
  jboolean (*IsAssignableFrom)             (JNIEnv*, jclass, jclass);
  _Jv_func reserved7;
  jint     (*Throw)                        (JNIEnv*, jthrowable);
  _Jv_func ThrowNew;
  _Jv_func ExceptionOccurred;
  _Jv_func ExceptionDescribe;
  _Jv_func ExceptionClear;
  _Jv_func FatalError;
  _Jv_func reserved8;
  _Jv_func reserved9;
  _Jv_func NewGlobalRef;
  _Jv_func DeleteGlobalRef;
  _Jv_func DeleteLocalRef;
  _Jv_func IsSameObject;
  _Jv_func reserved10;
  _Jv_func reserved11;
  _Jv_func AllocObject;
  _Jv_func NewObject;
  _Jv_func NewObjectV;
  _Jv_func NewObjectA;
  _Jv_func GetObjectClass;
  _Jv_func IsInstanceOf;
  _Jv_func GetMethodID;
  _Jv_func CallObjectMethod;
  _Jv_func CallObjectMethodV;
  _Jv_func CallObjectMethodA;
  _Jv_func CallBooleanMethod;
  _Jv_func CallBooleanMethodV;
  _Jv_func CallBooleanMethodA;
  _Jv_func CallByteMethod;
  _Jv_func CallByteMethodV;
  _Jv_func CallByteMethodA;
  _Jv_func CallCharMethod;
  _Jv_func CallCharMethodV;
  _Jv_func CallCharMethodA;
  _Jv_func CallShortMethod;
  _Jv_func CallShortMethodV;
  _Jv_func CallShortMethodA;
  _Jv_func CallIntMethod;
  _Jv_func CallIntMethodV;
  _Jv_func CallIntMethodA;
  _Jv_func CallLongMethod;
  _Jv_func CallLongMethodV;
  _Jv_func CallLongMethodA;
  _Jv_func CallFloatMethod;
  _Jv_func CallFloatMethodV;
  _Jv_func CallFloatMethodA;
  _Jv_func CallDoubleMethod;
  _Jv_func CallDoubleMethodV;
  _Jv_func CallDoubleMethodA;
  _Jv_func CallVoidMethod;
  _Jv_func CallVoidMethodV;
  _Jv_func CallVoidMethodA;
  _Jv_func CallNonvirtualObjectMethod;
  _Jv_func CallNonvirtualObjectMethodV;
  _Jv_func CallNonvirtualObjectMethodA;
  jboolean (*CallNonvirtualBooleanMethod)  (JNIEnv*, jobject, jclass, jmethodID, ...);
  jboolean (*CallNonvirtualBooleanMethodV) (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
  jboolean (*CallNonvirtualBooleanMethodA) (JNIEnv*, jobject, jclass, jmethodID, jvalue*);
  _Jv_func CallNonvirtualByteMethod;
  _Jv_func CallNonvirtualByteMethodV;
  _Jv_func CallNonvirtualByteMethodA;
  _Jv_func CallNonvirtualCharMethod;
  _Jv_func CallNonvirtualCharMethodV;
  _Jv_func CallNonvirtualCharMethodA;
  _Jv_func CallNonvirtualShortMethod;
  _Jv_func CallNonvirtualShortMethodV;
  _Jv_func CallNonvirtualShortMethodA;
  _Jv_func CallNonvirtualIntMethod;
  _Jv_func CallNonvirtualIntMethodV;
  _Jv_func CallNonvirtualIntMethodA;
  _Jv_func CallNonvirtualLongMethod;
  _Jv_func CallNonvirtualLongMethodV;
  _Jv_func CallNonvirtualLongMethodA;
  _Jv_func CallNonvirtualFloatMethod;
  _Jv_func CallNonvirtualFloatMethodV;
  _Jv_func CallNonvirtualFloatMethodA;
  _Jv_func CallNonvirtualDoubleMethod;
  jdouble  (*CallNonvirtualDoubleMethodV)  (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
  _Jv_func CallNonvirtualDoubleMethodA;
  _Jv_func CallNonvirtualVoidMethod;
  _Jv_func CallNonvirtualVoidMethodV;
  _Jv_func CallNonvirtualVoidMethodA;
  _Jv_func GetFieldID;
  jobject  (*GetObjectField)               (JNIEnv*, jobject, jfieldID);
  jboolean (*GetBooleanField)              (JNIEnv*, jobject, jfieldID);
  jbyte    (*GetByteField)                 (JNIEnv*, jobject, jfieldID);
  jchar    (*GetCharField)                 (JNIEnv*, jobject, jfieldID);
  jshort   (*GetShortField)                (JNIEnv*, jobject, jfieldID);
  jint     (*GetIntField)                  (JNIEnv*, jobject, jfieldID);
  jlong    (*GetLongField)                 (JNIEnv*, jobject, jfieldID);
  jfloat   (*GetFloatField)                (JNIEnv*, jobject, jfieldID);
  jdouble  (*GetDoubleField)               (JNIEnv*, jobject, jfieldID);
  _Jv_func SetObjectField;
  _Jv_func SetBooleanField;
  _Jv_func SetByteField;
  _Jv_func SetCharField;
  _Jv_func SetShortField;
  _Jv_func SetIntField;
  _Jv_func SetLongField;
  _Jv_func SetFloatField;
  _Jv_func SetDoubleField;
  _Jv_func GetStaticMethodID;
  _Jv_func CallStaticObjectMethod;
  _Jv_func CallStaticObjectMethodV;
  _Jv_func CallStaticObjectMethodA;
  _Jv_func CallStaticBooleanMethod;
  _Jv_func CallStaticBooleanMethodV;
  _Jv_func CallStaticBooleanMethodA;
  _Jv_func CallStaticByteMethod;
  _Jv_func CallStaticByteMethodV;
  _Jv_func CallStaticByteMethodA;
  _Jv_func CallStaticCharMethod;
  _Jv_func CallStaticCharMethodV;
  _Jv_func CallStaticCharMethodA;
  _Jv_func CallStaticShortMethod;
  _Jv_func CallStaticShortMethodV;
  _Jv_func CallStaticShortMethodA;
  _Jv_func CallStaticIntMethod;
  _Jv_func CallStaticIntMethodV;
  _Jv_func CallStaticIntMethodA;
  _Jv_func CallStaticLongMethod;
  _Jv_func CallStaticLongMethodV;
  _Jv_func CallStaticLongMethodA;
  _Jv_func CallStaticFloatMethod;
  _Jv_func CallStaticFloatMethodV;
  _Jv_func CallStaticFloatMethodA;
  _Jv_func CallStaticDoubleMethod;
  _Jv_func CallStaticDoubleMethodV;
  _Jv_func CallStaticDoubleMethodA;
  _Jv_func CallStaticVoidMethod;
  _Jv_func CallStaticVoidMethodV;
  _Jv_func CallStaticVoidMethodA;
  _Jv_func GetStaticFieldID;
  _Jv_func GetStaticObjectField;
  _Jv_func GetStaticBooleanField;
  _Jv_func GetStaticByteField;
  _Jv_func GetStaticCharField;
  _Jv_func GetStaticShortField;
  _Jv_func GetStaticIntField;
  _Jv_func GetStaticLongField;
  _Jv_func GetStaticFloatField;
  _Jv_func GetStaticDoubleField;
  _Jv_func SetStaticObjectField;
  _Jv_func SetStaticBooleanField;
  _Jv_func SetStaticByteField;
  _Jv_func SetStaticCharField;
  _Jv_func SetStaticShortField;
  _Jv_func SetStaticIntField;
  _Jv_func SetStaticLongField;
  _Jv_func SetStaticFloatField;
  _Jv_func SetStaticDoubleField;
  _Jv_func NewString;
  jint     (*GetStringLength)              (JNIEnv*, jstring);
  _Jv_func GetStringChars;
  _Jv_func ReleaseStringChars;
  _Jv_func NewStringUTF;
  _Jv_func GetStringUTFLength;
  _Jv_func GetStringUTFChars;
  _Jv_func ReleaseStringUTFChars;
  _Jv_func GetArrayLength;
  _Jv_func NewObjectArray;
  _Jv_func GetObjectArrayElement;
  _Jv_func SetObjectArrayElement;
  _Jv_func NewBooleanArray;
  _Jv_func NewByteArray;
  _Jv_func NewCharArray;
  _Jv_func NewShortArray;
  _Jv_func NewIntArray;
  _Jv_func NewLongArray;
  _Jv_func NewFloatArray;
  _Jv_func NewDoubleArray;
  _Jv_func GetBooleanArrayElements;
  _Jv_func GetByteArrayElements;
  _Jv_func GetCharArrayElements;
  _Jv_func GetShortArrayElements;
  _Jv_func GetIntArrayElements;
  _Jv_func GetLongArrayElements;
  _Jv_func GetFloatArrayElements;
  _Jv_func GetDoubleArrayElements;
  _Jv_func ReleaseBooleanArrayElements;
  _Jv_func ReleaseByteArrayElements;
  _Jv_func ReleaseCharArrayElements;
  _Jv_func ReleaseShortArrayElements;
  _Jv_func ReleaseIntArrayElements;
  _Jv_func ReleaseLongArrayElements;
  _Jv_func ReleaseFloatArrayElements;
  _Jv_func ReleaseDoubleArrayElements;
  _Jv_func GetBooleanArrayRegion;
  _Jv_func GetByteArrayRegion;
  _Jv_func GetCharArrayRegion;
  _Jv_func GetShortArrayRegion;
  _Jv_func GetIntArrayRegion;
  _Jv_func GetLongArrayRegion;
  _Jv_func GetFloatArrayRegion;
  _Jv_func GetDoubleArrayRegion;
  _Jv_func SetBooleanArrayRegion;
  _Jv_func SetByteArrayRegion;
  _Jv_func SetCharArrayRegion;
  _Jv_func SetShortArrayRegion;
  _Jv_func SetIntArrayRegion;
  _Jv_func SetLongArrayRegion;
  _Jv_func SetFloatArrayRegion;
  _Jv_func SetDoubleArrayRegion;
  _Jv_func RegisterNatives;
  _Jv_func UnregisterNatives;
  _Jv_func MonitorEnter;
  _Jv_func MonitorExit;
  _Jv_func GetJavaVM;
};

#ifdef __cplusplus

struct _Jv_JNIEnv
{
  struct JNINativeInterface *p;

  jclass GetSuperclass (jclass cl);
  jsize GetStringLength (jstring str);

};

extern inline jclass
_Jv_JNIEnv::GetSuperclass (jclass cl)
{ return p->GetSuperclass (this, cl); }

extern inline jsize
_Jv_JNIEnv::GetStringLength (jstring str)
{ return p->GetStringLength (this, str); }

#endif

#endif /* __JAVA_JNI_H__ */