[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/test.c Test.java
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sat Dec 11 19:14:09 PST 2004
Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:
test.c updated: 1.3 -> 1.4
Test.java updated: 1.3 -> 1.4
---
Log message:
Print a byte array as a string.
---
Diffs of the changes: (+11 -0)
Index: llvm-java/test/Programs/SingleSource/UnitTests/test.c
diff -u llvm-java/test/Programs/SingleSource/UnitTests/test.c:1.3 llvm-java/test/Programs/SingleSource/UnitTests/test.c:1.4
--- llvm-java/test/Programs/SingleSource/UnitTests/test.c:1.3 Sat Dec 11 17:31:49 2004
+++ llvm-java/test/Programs/SingleSource/UnitTests/test.c Sat Dec 11 21:13:59 2004
@@ -29,3 +29,12 @@
{
printf("%f\n", aDouble);
}
+
+void Java_Test_println___3B(JNIEnv *env, jclass clazz, jbyteArray array)
+{
+ jint size = (*env)->GetArrayLength(env, array);
+ jbyte* elements = (*env)->GetByteArrayElements(env, array, NULL);
+ printf("%.*s\n", size, elements);
+ // Since we didn't modify the array there is no point in copying it back
+ (*env)->ReleaseByteArrayElements(env, array, elements, JNI_ABORT);
+}
Index: llvm-java/test/Programs/SingleSource/UnitTests/Test.java
diff -u llvm-java/test/Programs/SingleSource/UnitTests/Test.java:1.3 llvm-java/test/Programs/SingleSource/UnitTests/Test.java:1.4
--- llvm-java/test/Programs/SingleSource/UnitTests/Test.java:1.3 Sat Dec 11 17:31:49 2004
+++ llvm-java/test/Programs/SingleSource/UnitTests/Test.java Sat Dec 11 21:13:59 2004
@@ -9,6 +9,8 @@
public static native void println(long l);
public static native void println(float f);
public static native void println(double d);
+ public static void println(String s) { println(s.getBytes()); }
+ private static native void println(byte[] a);
public static void main(String[] args) {
println(true);
More information about the llvm-commits
mailing list