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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
#include <stdlib.h>
2
#include <assert.h>
3
#include <jni.h>
4
 
5
static int
6
twentythree (JNIEnv *env, jclass k)
7
{
8
  return 23;
9
}
10
 
11
static int
12
oneninetyseven (JNIEnv *env, jclass k)
13
{
14
  return 197;
15
}
16
 
17
JNIEXPORT jint JNICALL
18
JNI_OnLoad (JavaVM *vm, void *nothing)
19
{
20
  JNIEnv *env;
21
  JNINativeMethod meth;
22
  jclass k;
23
  jint r;
24
 
25
  r = (*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2);
26
  assert (r == JNI_OK);
27
  k = (*env)->FindClass (env, "register2$I1");
28
  assert (k != NULL);
29
 
30
  meth.name = "doit";
31
  meth.signature = "()I";
32
  meth.fnPtr = twentythree;
33
 
34
  r = (*env)->RegisterNatives (env, k, &meth, 1);
35
  assert (r == JNI_OK);
36
 
37
  k = (*env)->FindClass (env, "register2$I2");
38
  assert (k != NULL);
39
 
40
  meth.name = "doit";
41
  meth.signature = "()I";
42
  meth.fnPtr = oneninetyseven;
43
 
44
  r = (*env)->RegisterNatives (env, k, &meth, 1);
45
  assert (r == JNI_OK);
46
 
47
  return JNI_VERSION_1_2;
48
}

powered by: WebSVN 2.1.0

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