OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / libjava / jni.cc
1 // jni.cc - JNI implementation, including the jump table.
2
3 /* Copyright (C) 1998, 1999  Cygnus Solutions
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #include <config.h>
12
13 #include <stddef.h>
14
15 #include <jni.h>
16 #include <java-field.h>
17
18 static jclass
19 _Jv_JNI_GetSuperclass (JNIEnv *, jclass clazz)
20 {
21   return clazz->getSuperclass ();
22 }
23
24 static jboolean
25 IsAssignableFrom(JNIEnv *, jclass clazz1, jclass clazz2)
26 {
27   return clazz1->isAssignableFrom (clazz2);
28 }
29
30 static jobject
31 _Jv_JNI_GetObjectField (JNIEnv *, jobject obj, jfieldID field) 
32 {
33   return _Jv_GetObjectField (obj, field);
34 }
35
36 static jbyte
37 _Jv_JNI_GetByteField (JNIEnv *, jobject obj, jfieldID field) 
38 {
39   return _Jv_GetByteField (obj, field);
40 }
41
42 static jshort
43 _Jv_JNI_GetShortField (JNIEnv *, jobject obj, jfieldID field) 
44 {
45   return _Jv_GetShortField (obj, field);
46 }
47
48 static jint
49 _Jv_JNI_GetIntField (JNIEnv *, jobject obj, jfieldID field) 
50 {
51   return _Jv_GetIntField (obj, field);
52 }
53
54 static jlong
55 _Jv_JNI_GetLongField (JNIEnv *, jobject obj, jfieldID field) 
56 {
57   return _Jv_GetLongField (obj, field);
58 }
59
60 static jsize
61 _Jv_JNI_GetStringLength (JNIEnv *, jstring string)
62 {
63   return string->length();
64 }
65
66 // JDK 1.2
67 jobject
68 _Jv_JNI_ToReflectedField (JNIEnv *, jclass cls, jfieldID fieldID)
69 {
70   java::lang::reflect::Field *field = new java::lang::reflect::Field();
71   field->declaringClass = cls;
72   field->offset = (char*) fieldID - (char *) cls->fields;
73   field->name = _Jv_NewStringUtf8Const (fieldID->getNameUtf8Const (cls));
74   return field;
75 }
76
77 // JDK 1.2
78 jfieldID
79 _Jv_JNI_FromReflectedField (JNIEnv *, java::lang::reflect::Field *field)
80 {
81   return _Jv_FromReflectedField (field);
82 }
83
84 #define NOT_IMPL NULL
85
86 struct JNINativeInterface _Jv_JNIFunctions =
87 {
88   NULL,
89   NULL,
90   NULL,
91   NULL,
92   NOT_IMPL /* GetVersion */,
93   NOT_IMPL /* DefineClass */,
94   NOT_IMPL /* FindClass */,
95   NULL,
96   NULL,
97   NULL,
98   _Jv_JNI_GetSuperclass,
99   IsAssignableFrom,
100   NULL,
101   NOT_IMPL /* Throw */,
102   NOT_IMPL /* ThrowNew */,
103   NOT_IMPL /* ExceptionOccurred */,
104   NOT_IMPL /* ExceptionDescribe */,
105   NOT_IMPL /* ExceptionClear */,
106   NOT_IMPL /* FatalError */,
107   NOT_IMPL /* NULL */,
108   NOT_IMPL /* NULL */,
109   NOT_IMPL /* NewGlobalRef */,
110   NOT_IMPL /* DeleteGlobalRef */,
111   NOT_IMPL /* DeleteLocalRef */,
112   NOT_IMPL /* IsSameObject */,
113   NOT_IMPL /* NULL */,
114   NOT_IMPL /* NULL */,
115   NOT_IMPL /* AllocObject */,
116   NOT_IMPL /* NewObject */,
117   NOT_IMPL /* NewObjectV */,
118   NOT_IMPL /* NewObjectA */,
119   NOT_IMPL /* GetObjectClass */,
120   NOT_IMPL /* IsInstanceOf */,
121   NOT_IMPL /* GetMethodID */,
122   NOT_IMPL /* CallObjectMethod */,
123   NOT_IMPL /* CallObjectMethodV */,
124   NOT_IMPL /* CallObjectMethodA */,
125   NOT_IMPL /* CallBooleanMethod */,
126   NOT_IMPL /* CallBooleanMethodV */,
127   NOT_IMPL /* CallBooleanMethodA */,
128   NOT_IMPL /* CallByteMethod */,
129   NOT_IMPL /* CallByteMethodV */,
130   NOT_IMPL /* CallByteMethodA */,
131   NOT_IMPL /* CallCharMethod */,
132   NOT_IMPL /* CallCharMethodV */,
133   NOT_IMPL /* CallCharMethodA */,
134   NOT_IMPL /* CallShortMethod */,
135   NOT_IMPL /* CallShortMethodV */,
136   NOT_IMPL /* CallShortMethodA */,
137   NOT_IMPL /* CallIntMethod */,
138   NOT_IMPL /* CallIntMethodV */,
139   NOT_IMPL /* CallIntMethodA */,
140   NOT_IMPL /* CallLongMethod */,
141   NOT_IMPL /* CallLongMethodV */,
142   NOT_IMPL /* CallLongMethodA */,
143   NOT_IMPL /* CallFloatMethod */,
144   NOT_IMPL /* CallFloatMethodV */,
145   NOT_IMPL /* CallFloatMethodA */,
146   NOT_IMPL /* CallDoubleMethod */,
147   NOT_IMPL /* CallDoubleMethodV */,
148   NOT_IMPL /* CallDoubleMethodA */,
149   NOT_IMPL /* CallVoidMethod */,
150   NOT_IMPL /* CallVoidMethodV */,
151   NOT_IMPL /* CallVoidMethodA */,
152   NOT_IMPL /* CallNonvirtualObjectMethod */,
153   NOT_IMPL /* CallNonvirtualObjectMethodV */,
154   NOT_IMPL /* CallNonvirtualObjectMethodA */,
155   NOT_IMPL /* CallNonvirtualBooleanMethod */,
156   NOT_IMPL /* CallNonvirtualBooleanMethodV */,
157   NOT_IMPL /* CallNonvirtualBooleanMethodA */,
158   NOT_IMPL /* CallNonvirtualByteMethod */,
159   NOT_IMPL /* CallNonvirtualByteMethodV */,
160   NOT_IMPL /* CallNonvirtualByteMethodA */,
161   NOT_IMPL /* CallNonvirtualCharMethod */,
162   NOT_IMPL /* CallNonvirtualCharMethodV */,
163   NOT_IMPL /* CallNonvirtualCharMethodA */,
164   NOT_IMPL /* CallNonvirtualShortMethod */,
165   NOT_IMPL /* CallNonvirtualShortMethodV */,
166   NOT_IMPL /* CallNonvirtualShortMethodA */,
167   NOT_IMPL /* CallNonvirtualIntMethod */,
168   NOT_IMPL /* CallNonvirtualIntMethodV */,
169   NOT_IMPL /* CallNonvirtualIntMethodA */,
170   NOT_IMPL /* CallNonvirtualLongMethod */,
171   NOT_IMPL /* CallNonvirtualLongMethodV */,
172   NOT_IMPL /* CallNonvirtualLongMethodA */,
173   NOT_IMPL /* CallNonvirtualFloatMethod */,
174   NOT_IMPL /* CallNonvirtualFloatMethodV */,
175   NOT_IMPL /* CallNonvirtualFloatMethodA */,
176   NOT_IMPL /* CallNonvirtualDoubleMethod */,
177   NOT_IMPL /* CallNonvirtualDoubleMethodV */,
178   NOT_IMPL /* CallNonvirtualDoubleMethodA */,
179   NOT_IMPL /* CallNonvirtualVoidMethod */,
180   NOT_IMPL /* CallNonvirtualVoidMethodV */,
181   NOT_IMPL /* CallNonvirtualVoidMethodA */,
182   NOT_IMPL /* GetFieldID */,
183   _Jv_JNI_GetObjectField,
184   NOT_IMPL /* GetBooleanField */,
185   _Jv_JNI_GetByteField,
186   NOT_IMPL /* GetCharField */,
187   _Jv_JNI_GetShortField,
188   _Jv_JNI_GetIntField,
189   _Jv_JNI_GetLongField,
190   NOT_IMPL /* GetFloatField */,
191   NOT_IMPL /* GetDoubleField */,
192   NOT_IMPL /* SetObjectField */,
193   NOT_IMPL /* SetBooleanField */,
194   NOT_IMPL /* SetByteField */,
195   NOT_IMPL /* SetCharField */,
196   NOT_IMPL /* SetShortField */,
197   NOT_IMPL /* SetIntField */,
198   NOT_IMPL /* SetLongField */,
199   NOT_IMPL /* SetFloatField */,
200   NOT_IMPL /* SetDoubleField */,
201   NOT_IMPL /* GetStaticMethodID */,
202   NOT_IMPL /* CallStaticObjectMethod */,
203   NOT_IMPL /* CallStaticObjectMethodV */,
204   NOT_IMPL /* CallStaticObjectMethodA */,
205   NOT_IMPL /* CallStaticBooleanMethod */,
206   NOT_IMPL /* CallStaticBooleanMethodV */,
207   NOT_IMPL /* CallStaticBooleanMethodA */,
208   NOT_IMPL /* CallStaticByteMethod */,
209   NOT_IMPL /* CallStaticByteMethodV */,
210   NOT_IMPL /* CallStaticByteMethodA */,
211   NOT_IMPL /* CallStaticCharMethod */,
212   NOT_IMPL /* CallStaticCharMethodV */,
213   NOT_IMPL /* CallStaticCharMethodA */,
214   NOT_IMPL /* CallStaticShortMethod */,
215   NOT_IMPL /* CallStaticShortMethodV */,
216   NOT_IMPL /* CallStaticShortMethodA */,
217   NOT_IMPL /* CallStaticIntMethod */,
218   NOT_IMPL /* CallStaticIntMethodV */,
219   NOT_IMPL /* CallStaticIntMethodA */,
220   NOT_IMPL /* CallStaticLongMethod */,
221   NOT_IMPL /* CallStaticLongMethodV */,
222   NOT_IMPL /* CallStaticLongMethodA */,
223   NOT_IMPL /* CallStaticFloatMethod */,
224   NOT_IMPL /* CallStaticFloatMethodV */,
225   NOT_IMPL /* CallStaticFloatMethodA */,
226   NOT_IMPL /* CallStaticDoubleMethod */,
227   NOT_IMPL /* CallStaticDoubleMethodV */,
228   NOT_IMPL /* CallStaticDoubleMethodA */,
229   NOT_IMPL /* CallStaticVoidMethod */,
230   NOT_IMPL /* CallStaticVoidMethodV */,
231   NOT_IMPL /* CallStaticVoidMethodA */,
232   NOT_IMPL /* GetStaticFieldID */,
233   NOT_IMPL /* GetStaticObjectField */,
234   NOT_IMPL /* GetStaticBooleanField */,
235   NOT_IMPL /* GetStaticByteField */,
236   NOT_IMPL /* GetStaticCharField */,
237   NOT_IMPL /* GetStaticShortField */,
238   NOT_IMPL /* GetStaticIntField */,
239   NOT_IMPL /* GetStaticLongField */,
240   NOT_IMPL /* GetStaticFloatField */,
241   NOT_IMPL /* GetStaticDoubleField */,
242   NOT_IMPL /* SetStaticObjectField */,
243   NOT_IMPL /* SetStaticBooleanField */,
244   NOT_IMPL /* SetStaticByteField */,
245   NOT_IMPL /* SetStaticCharField */,
246   NOT_IMPL /* SetStaticShortField */,
247   NOT_IMPL /* SetStaticIntField */,
248   NOT_IMPL /* SetStaticLongField */,
249   NOT_IMPL /* SetStaticFloatField */,
250   NOT_IMPL /* SetStaticDoubleField */,
251   NOT_IMPL /* NewString */,
252   _Jv_JNI_GetStringLength,
253   NOT_IMPL /* GetStringChars */,
254   NOT_IMPL /* ReleaseStringChars */,
255   NOT_IMPL /* NewStringUTF */,
256   NOT_IMPL /* GetStringUTFLength */,
257   NOT_IMPL /* GetStringUTFChars */,
258   NOT_IMPL /* ReleaseStringUTFChars */,
259   NOT_IMPL /* GetArrayLength */,
260   NOT_IMPL /* NewObjectArray */,
261   NOT_IMPL /* GetObjectArrayElement */,
262   NOT_IMPL /* SetObjectArrayElement */,
263   NOT_IMPL /* NewBooleanArray */,
264   NOT_IMPL /* NewByteArray */,
265   NOT_IMPL /* NewCharArray */,
266   NOT_IMPL /* NewShortArray */,
267   NOT_IMPL /* NewIntArray */,
268   NOT_IMPL /* NewLongArray */,
269   NOT_IMPL /* NewFloatArray */,
270   NOT_IMPL /* NewDoubleArray */,
271   NOT_IMPL /* GetBooleanArrayElements */,
272   NOT_IMPL /* GetByteArrayElements */,
273   NOT_IMPL /* GetCharArrayElements */,
274   NOT_IMPL /* GetShortArrayElements */,
275   NOT_IMPL /* GetIntArrayElements */,
276   NOT_IMPL /* GetLongArrayElements */,
277   NOT_IMPL /* GetFloatArrayElements */,
278   NOT_IMPL /* GetDoubleArrayElements */,
279   NOT_IMPL /* ReleaseBooleanArrayElements */,
280   NOT_IMPL /* ReleaseByteArrayElements */,
281   NOT_IMPL /* ReleaseCharArrayElements */,
282   NOT_IMPL /* ReleaseShortArrayElements */,
283   NOT_IMPL /* ReleaseIntArrayElements */,
284   NOT_IMPL /* ReleaseLongArrayElements */,
285   NOT_IMPL /* ReleaseFloatArrayElements */,
286   NOT_IMPL /* ReleaseDoubleArrayElements */,
287   NOT_IMPL /* GetBooleanArrayRegion */,
288   NOT_IMPL /* GetByteArrayRegion */,
289   NOT_IMPL /* GetCharArrayRegion */,
290   NOT_IMPL /* GetShortArrayRegion */,
291   NOT_IMPL /* GetIntArrayRegion */,
292   NOT_IMPL /* GetLongArrayRegion */,
293   NOT_IMPL /* GetFloatArrayRegion */,
294   NOT_IMPL /* GetDoubleArrayRegion */,
295   NOT_IMPL /* SetBooleanArrayRegion */,
296   NOT_IMPL /* SetByteArrayRegion */,
297   NOT_IMPL /* SetCharArrayRegion */,
298   NOT_IMPL /* SetShortArrayRegion */,
299   NOT_IMPL /* SetIntArrayRegion */,
300   NOT_IMPL /* SetLongArrayRegion */,
301   NOT_IMPL /* SetFloatArrayRegion */,
302   NOT_IMPL /* SetDoubleArrayRegion */,
303   NOT_IMPL /* RegisterNatives */,
304   NOT_IMPL /* UnregisterNatives */,
305   NOT_IMPL /* MonitorEnter */,
306   NOT_IMPL /* MonitorExit */,
307   NOT_IMPL /* GetJavaVM */,
308 };