OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jni/] [iface.c] - Blame information for rev 781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
#include <stdlib.h>
2
#include <stdio.h>
3
#include <iface.h>
4
 
5
void check (JNIEnv *);
6
 
7
void check(JNIEnv *env)
8
{
9
  if ((*env)->ExceptionCheck(env) != JNI_FALSE)
10
    {
11
      fprintf(stderr, "UNEXPECTED EXCEPTION\n");
12
      exit(-1);
13
    }
14
}
15
 
16
void
17
Java_iface_doCalls (JNIEnv *env, jobject self, jobject other)
18
{
19
  jclass iface_class, comparable_class;
20
  jmethodID iface_meth, comparable_meth;
21
  jvalue args[1];
22
 
23
  iface_class = (*env)->FindClass(env, "iface");
24
  check (env);
25
  comparable_class = (*env)->FindClass (env, "mycomp");
26
  check (env);
27
 
28
  iface_meth = (*env)->GetMethodID (env, iface_class, "compareTo",
29
                                    "(Ljava/lang/Object;)I");
30
  check (env);
31
  comparable_meth = (*env)->GetMethodID (env, comparable_class, "compareTo",
32
                                         "(Ljava/lang/Object;)I");
33
  check (env);
34
 
35
  args[0].l = other;
36
  (*env)->CallObjectMethodA (env, self, iface_meth, args);
37
  check (env);
38
  (*env)->CallObjectMethodA (env, self, comparable_meth, args);
39
  check (env);
40
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.