You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/08 14:39:00 UTC
svn commit: r763218 -
/commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
Author: mturk
Date: Wed Apr 8 12:38:59 2009
New Revision: 763218
URL: http://svn.apache.org/viewvc?rev=763218&view=rev
Log:
Implement missing methods for win32/os
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c?rev=763218&r1=763217&r2=763218&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c Wed Apr 8 12:38:59 2009
@@ -20,6 +20,8 @@
#define ACR_WANT_LATE_DLL
#include "acr_arch.h"
+static const char unknown[] = "unknown";
+
ACR_JNI_EXPORT_DECLARE(jboolean, OS, is)(ACR_JNISTDARGS, jint type)
{
UNREFERENCED_STDARGS;
@@ -39,6 +41,16 @@
return JNI_FALSE;
}
+ACR_JNI_EXPORT_DECLARE(jint, OS, type)(ACR_JNISTDARGS)
+{
+ UNREFERENCED_STDARGS;
+#ifdef _WIN64
+ return ACR_OS_WIN64;
+#else
+ return ACR_OS_WINDOWS;
+#endif
+}
+
ACR_JNI_EXPORT_DECLARE(jstring, OS, getSysname)(ACR_JNISTDARGS)
{
return CSTR_TO_JSTRING("Windows");
@@ -66,7 +78,9 @@
strcpy(buf, "VISTA");
}
else {
- strcpy(buf, "UNKNOWN");
+ sprintf(buf, "%d.%d",
+ acr_osver->dwMajorVersion,
+ acr_osver->dwMinorVersion);
}
if (acr_osver->szCSDVersion[0]) {
strcat(buf, " (");
@@ -106,7 +120,7 @@
}
}
else
- return NULL;
+ return CSTR_TO_JSTRING(unknown);
return CSTR_TO_JSTRING(buf);
}
@@ -119,6 +133,34 @@
return CSTR_TO_JSTRING(buf);
}
else {
- return NULL;
+ return CSTR_TO_JSTRING(unknown);
}
}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getProcessor)(ACR_JNISTDARGS)
+{
+ char buf[32];
+
+ if (acr_osinf->wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+ strcpy(buf, "amd64");
+ else if (acr_osinf->wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
+ strcpy(buf, "ia64");
+ else if (acr_osinf->wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
+#ifdef _WIN64
+ strcpy(buf, "emt64");
+#else
+ strcpy(buf, "ia32");
+#endif
+ }
+ else
+ strcpy(buf, unknown);
+ return CSTR_TO_JSTRING(buf);
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getHardwarePlatform)(ACR_JNISTDARGS)
+{
+ if (acr_osinf->wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+ return CSTR_TO_JSTRING("amd64");
+ else
+ return CSTR_TO_JSTRING("intel");
+}