aboutsummaryrefslogtreecommitdiff
path: root/libjava/include/win32.h
diff options
context:
space:
mode:
authorMohan Embar <gnustuff@thisiscool.com>2003-12-02 22:26:50 +0000
committerMohan Embar <membar@gcc.gnu.org>2003-12-02 22:26:50 +0000
commit83c02e38a3bf8e6d547a292754a581096021b594 (patch)
tree4db34f47c7611b5c83b79334f47f1a5411fbbc44 /libjava/include/win32.h
parent5f8a45f75c9e3785bb7146721910d6ffe4e9d7e6 (diff)
configure.in: Added new MinGW-specific configure flag --with-win32-nlsapi.
* configure.in: Added new MinGW-specific configure flag --with-win32-nlsapi. Added new AC_DEFINE MINGW_LIBGCJ_UNICODE. Add -lunicows to MinGW SYSTEMSPEC if --with-win32-nlsapi is set to unicows. * configure: Rebuilt. * include/config.h.in: Rebuilt. * win32.cc (_Jv_Win32NewString): Implemented. (nativeToUnicode): New helper function defined only for non-UNICODE builds. (unicodeToNative): Likewise. (_Jv_Win32TempString): Implemented. (lots): Refactored using tchar.h macros. (WSAEventWrapper): Use _Jv_Win32NewString. (_Jv_platform_initialize): Use GetModuleFileNameA instead of GetModuleFileName. (_Jv_platform_initProperties): Use _Jv_Win32NewString. Use temporary stack buffer instead of a heap buffer. * include/win32.h Added defines for UNICODE and _UNICODE if MINGW_LIBGCJ_UNICODE is defined; added tchar.h include. (_Jv_Win32TempString): Declared new helper class. (JV_TEMP_STRING_WIN32): New helper macro. (_Jv_Win32NewString): Declared new helper method. * java/io/natFileDescriptorWin32.cc (open): Use JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING. (write): Reformatted slightly. * java/io/natFileWin32.cc (lots): Use tchar.h macros; use JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING. (getCanonicalPath): Use _Jv_Win32NewString instead of JvNewStringUTF. (performList): Likewise. * java/lang/natWin32Process.cc (ChildProcessPipe): Use tchar.h macros. (startProcess): Use tchar.h macros, JV_TEMP_STRING_WIN32, and UNICODE environment flag for CreateProcess. * java/net/natNetworkInterfaceWin32.cc (winsock2GetRealNetworkInterfaces): Use tchar.h macros and _Jv_Win32NewString. From-SVN: r74201
Diffstat (limited to 'libjava/include/win32.h')
-rw-r--r--libjava/include/win32.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libjava/include/win32.h b/libjava/include/win32.h
index 479ed53f00e..3de6f11b9ef 100644
--- a/libjava/include/win32.h
+++ b/libjava/include/win32.h
@@ -11,6 +11,16 @@ details. */
#ifndef __JV_WIN32_H__
#define __JV_WIN32_H__
+// Enable UNICODE Support.?
+
+#ifdef MINGW_LIBGCJ_UNICODE
+#define UNICODE
+#define _UNICODE
+#endif // MINGW_LIBGCJ_UNICODE
+
+#include <tchar.h>
+
+// Includes
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
@@ -23,6 +33,43 @@ details. */
#include <io.h>
+/* Begin UNICODE Support Classes and Functions */
+
+/* Helper class which creates a temporary, null-terminated,
+ wide-character C string. */
+class _Jv_Win32TempString
+{
+public:
+ _Jv_Win32TempString(jstring jstr);
+ ~_Jv_Win32TempString();
+
+// Accessors
+ operator LPCTSTR() const
+ {
+ return buf_;
+ }
+ LPCTSTR buf() const
+ {
+ return buf_;
+ }
+ LPTSTR buf()
+ {
+ return buf_;
+ }
+
+private:
+ TCHAR stackbuf_[500];
+ LPTSTR buf_;
+};
+
+// Mimics the JV_TEMP_STRING_UTF macro in jvm.h
+#define JV_TEMP_STRING_WIN32(x,y) _Jv_Win32TempString x(y);
+
+// Creates a jstring from a LPCTSTR
+extern jstring _Jv_Win32NewString (LPCTSTR pcsz);
+
+/* End UNICODE Helpers */
+
// Prefix and suffix for shared libraries.
#define _Jv_platform_solib_prefix ""
#define _Jv_platform_solib_suffix ".dll"