mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/win32ole/win32ole.c (load_conv_function51932): support
CP51932 on cygwin and mingw32. thanks to arton. * test/win32ole/test_win32ole.rb (test_cp51932): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ed35ae793
commit
80a5a3f9dc
3 changed files with 23 additions and 22 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Oct 13 08:59:08 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||||
|
|
||||||
|
* ext/win32ole/win32ole.c (load_conv_function51932): support
|
||||||
|
CP51932 on cygwin and mingw32. thanks to arton.
|
||||||
|
|
||||||
|
* test/win32ole/test_win32ole.rb (test_cp51932): ditto.
|
||||||
|
|
||||||
Mon Oct 13 07:54:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Oct 13 07:54:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* ruby.c (proc_options): add -U command line option to specify
|
* ruby.c (proc_options): add -U command line option to specify
|
||||||
|
|
|
@ -82,6 +82,15 @@
|
||||||
#define V_UINTREF(X) V_UNION(X, puintVal)
|
#define V_UINTREF(X) V_UNION(X, puintVal)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* unfortunately IID_IMultiLanguage2 is not included in any libXXX.a
|
||||||
|
* in Cygwin(mingw32).
|
||||||
|
*/
|
||||||
|
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||||
|
#undef IID_IMultiLanguage2
|
||||||
|
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
|
#define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
|
||||||
|
|
||||||
#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
|
#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
|
||||||
|
@ -119,7 +128,7 @@
|
||||||
|
|
||||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||||
|
|
||||||
#define WIN32OLE_VERSION "1.3.5"
|
#define WIN32OLE_VERSION "1.3.6"
|
||||||
|
|
||||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||||
|
@ -965,15 +974,8 @@ load_conv_function51932()
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
void *p;
|
void *p;
|
||||||
if (!pIMultiLanguage2) {
|
if (!pIMultiLanguage2) {
|
||||||
#ifdef _MSC_VER
|
|
||||||
hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
|
hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
|
||||||
&IID_IMultiLanguage2, &p);
|
&IID_IMultiLanguage2, &p);
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* unfortunately, fail to link IID_IMultiLanguage2 on Cygwin or mingw32.
|
|
||||||
*/
|
|
||||||
hr = E_FAIL;
|
|
||||||
#endif
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
rb_raise(eWIN32OLERuntimeError, "fail to load convert function for CP51932");
|
rb_raise(eWIN32OLERuntimeError, "fail to load convert function for CP51932");
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,20 +365,12 @@ if defined?(WIN32OLE)
|
||||||
cp = WIN32OLE.codepage
|
cp = WIN32OLE.codepage
|
||||||
begin
|
begin
|
||||||
obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8"))
|
obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8"))
|
||||||
# mswin32 ruby only supports CP51932
|
begin
|
||||||
if /mswin/ =~ RUBY_PLATFORM
|
WIN32OLE.codepage = 51932
|
||||||
begin
|
rescue
|
||||||
WIN32OLE.codepage = 51932
|
end
|
||||||
rescue
|
if WIN32OLE.codepage == 51932
|
||||||
end
|
assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value)
|
||||||
if WIN32OLE.codepage == 51932
|
|
||||||
assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# cygwin, mingw32 ruby does not support CP51932
|
|
||||||
assert_raise(WIN32OLERuntimeError) {
|
|
||||||
WIN32OLE.codepage = 51932
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
WIN32OLE.codepage = cp
|
WIN32OLE.codepage = cp
|
||||||
|
|
Loading…
Reference in a new issue