gcc/libjava/testsuite/libjava.jni/calls.c
Ranjit Mathew 38997f1bf5 calls.c (Java_calls_docall): Define with JNIEXPORT and JNICALL method attributes.
2003-01-24  Ranjit Mathew  <rmathew@hotmail.com>

	* libjava.jni/calls.c (Java_calls_docall): Define with
	JNIEXPORT and JNICALL method attributes.
	* libjava.jni/field.c (Java_field_fetch): Likewise.
	* libjava.jni/final_method.c (Java_final_1method_meth): Likewise.
	* libjava.jni/findclass.c (Java_findclass_doit): Likewise.
	* libjava.jni/invoke.c (Java_invoke_val): Likewise.
	* libjava.jni/martin.c (Java_martin_myNative): Likewise.
	* libjava.jni/noclass.c (Java_noclass_find_1it): Likewise.
	* libjava.jni/overload.c (Java_overload_over__I): Likewise.
	(Java_overload_over__II): Likewise.
	* libjava.jni/register.c (JNI_OnLoad): Likewise.
	* libjava.jni/simple_int.c (Java_simple_1int_nat): Likewise.
	* libjava.jni/throwit.c (Java_throwit_throwit): Likewise.
	* libjava.jni/virtual.c (Java_virtual_equals): Likewise.

From-SVN: r61720
2003-01-24 17:39:49 +00:00

70 lines
1.6 KiB
C

#include <stdio.h>
#include <calls.h>
JNIEXPORT jint JNICALL
Java_calls_docall (JNIEnv *env, jobject _this)
{
jmethodID method;
jclass klass, super;
jbyte b;
jshort s;
jchar c;
jint i;
jlong l;
jfloat f;
jdouble d;
jvalue val;
jint fails = 0;
klass = (*env)->GetObjectClass (env, _this);
super = (*env)->GetSuperclass (env, klass);
method = (*env)->GetMethodID (env, klass, "byte_f", "()B");
b = (*env)->CallByteMethod (env, _this, method);
if (b != 23)
++fails;
method = (*env)->GetMethodID (env, klass, "char_f", "(I)C");
val.i = 10;
c = (*env)->CallCharMethodA (env, _this, method, &val);
if (c != ('a' + 10))
++fails;
method = (*env)->GetMethodID (env, super, "int_f", "()I");
i = (*env)->CallNonvirtualIntMethod (env, _this, super, method);
if (i != 27)
++fails;
i = (*env)->CallIntMethod (env, _this, method);
if (i != 1023)
++fails;
method = (*env)->GetStaticMethodID (env, klass, "long_f", "(J)J");
l = (*env)->CallStaticLongMethod (env, klass, method, (jlong) 10);
if (l != 2033)
++fails;
method = (*env)->GetMethodID (env, klass, "void_f", "()V");
(*env)->CallVoidMethod (env, _this, method);
method = (*env)->GetStaticMethodID (env, klass, "short_f", "()S");
s = (*env)->CallStaticShortMethod (env, klass, method);
if (s != 2)
++fails;
method = (*env)->GetMethodID (env, klass, "double_f", "()D");
d = (*env)->CallDoubleMethod (env, _this, method);
if (d != -1.0)
++fails;
method = (*env)->GetMethodID (env, klass, "float_f", "()F");
f = (*env)->CallFloatMethod (env, _this, method);
if (f != 1.0)
++fails;
return fails;
}