corda/classpath/java/lang/System.cpp

35 lines
765 B
C++
Raw Normal View History

2007-06-25 01:34:07 +00:00
#include "stdio.h"
2007-07-07 23:47:35 +00:00
#include "string.h"
2007-06-25 01:34:07 +00:00
#include "jni.h"
2007-06-29 16:42:39 +00:00
#undef JNIEXPORT
#define JNIEXPORT __attribute__ ((visibility("default")))
2007-06-25 01:34:07 +00:00
extern "C" JNIEXPORT void JNICALL
2007-07-07 23:47:35 +00:00
Java_java_lang_System_00024Output_print(JNIEnv* e, jobject, jstring s)
2007-06-25 01:34:07 +00:00
{
jboolean isCopy;
const char* chars = e->GetStringUTFChars(s, &isCopy);
if (chars) {
2007-07-07 23:47:35 +00:00
printf("%s", chars);
2007-06-25 01:34:07 +00:00
}
e->ReleaseStringUTFChars(s, chars);
}
2007-07-07 23:47:35 +00:00
extern "C" JNIEXPORT jstring JNICALL
Java_java_lang_System_getProperty(JNIEnv* e, jstring key)
{
jstring value = 0;
jboolean isCopy;
const char* chars = e->GetStringUTFChars(key, &isCopy);
if (chars) {
if (strcmp(chars, "line.separator") == 0) {
value = e->NewStringUTF("\n");
}
}
e->ReleaseStringUTFChars(key, chars);
return value;
}