Mercurial > projects > dwt2
diff com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | ebefa5c2eab4 |
children |
line wrap: on
line diff
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d Sun Apr 17 17:58:36 2011 +0200 +++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d Sat Jul 09 15:50:20 2011 +0300 @@ -88,6 +88,7 @@ com.ibm.icu.mangoicu.UString; public import com.ibm.icu.mangoicu.ULocale; +private import java.lang.util; /******************************************************************************* @@ -168,7 +169,7 @@ ***********************************************************************/ - this (inout ULocale locale, char[] path = null) + this (ref ULocale locale, char[] path = null) { UErrorCode e; @@ -387,7 +388,7 @@ ***********************************************************************/ - void getVersion (inout Version info) + void getVersion (ref Version info) { ures_getVersion (handle, info); } @@ -398,11 +399,11 @@ ***********************************************************************/ - void getLocale (inout ULocale locale) + void getLocale (ref ULocale locale) { UErrorCode e; - locale.name = toArray (ures_getLocale (handle, e)); + locale.name = cast(String) toArray (ures_getLocale (handle, e)); testError (e, "failed to get resource locale"); } @@ -438,7 +439,7 @@ ***********************************************************************/ - private static final UResourceBundle get (Handle handle, inout UErrorCode e) + private static final UResourceBundle get (Handle handle, ref UErrorCode e) { testError (e, "failed to create resource bundle"); if (handle) @@ -455,90 +456,38 @@ ***********************************************************************/ - private static void* library; - - /*********************************************************************** - - ***********************************************************************/ - - private static extern (C) - { - Handle function (char*, char*, inout UErrorCode) ures_open; - void function (Handle) ures_close; - char* function (Handle, inout UErrorCode) ures_getLocale; - void function (Handle, inout Version) ures_getVersion; - uint function (Handle) ures_getSize; - int function (Handle, inout UErrorCode) ures_getInt; - wchar* function (Handle, inout uint, inout UErrorCode) ures_getString; - wchar* function (Handle, uint, inout uint, inout UErrorCode) ures_getStringByIndex; - wchar* function (Handle, char*, inout uint, inout UErrorCode) ures_getStringByKey; - void* function (Handle, inout uint, inout UErrorCode) ures_getBinary; - int* function (Handle, inout uint, inout UErrorCode) ures_getIntVector; - byte function (Handle) ures_hasNext; - void function (Handle) ures_resetIterator; - wchar* function (Handle, inout uint, inout char*, inout UErrorCode) ures_getNextString; - char* function (Handle) ures_getKey; - int function (Handle) ures_getType; - Handle function (Handle, Handle, inout UErrorCode) ures_getNextResource; - Handle function (Handle, uint, Handle, inout UErrorCode) ures_getByIndex; - Handle function (Handle, char*, Handle, inout UErrorCode) ures_getByKey; - } + mixin(genICUNative!("uc" + ,"Handle function (char*, char*, ref UErrorCode)", "ures_open" + ,"void function (Handle)", "ures_close" + ,"char* function (Handle, ref UErrorCode)", "ures_getLocale" + ,"void function (Handle, ref Version)", "ures_getVersion" + ,"uint function (Handle)", "ures_getSize" + ,"int function (Handle, ref UErrorCode)", "ures_getInt" + ,"wchar* function (Handle, ref uint, ref UErrorCode)", "ures_getString" + ,"wchar* function (Handle, uint, ref uint, ref UErrorCode)", "ures_getStringByIndex" + ,"wchar* function (Handle, char*, ref uint, ref UErrorCode)", "ures_getStringByKey" + ,"void* function (Handle, ref uint, ref UErrorCode)", "ures_getBinary" + ,"int* function (Handle, ref uint, ref UErrorCode)", "ures_getIntVector" + ,"byte function (Handle)", "ures_hasNext" + ,"void function (Handle)", "ures_resetIterator" + ,"wchar* function (Handle, ref uint, ref char*, ref UErrorCode)", "ures_getNextString" + ,"char* function (Handle)", "ures_getKey" + ,"int function (Handle)", "ures_getType" + ,"Handle function (Handle, Handle, ref UErrorCode)", "ures_getNextResource" + ,"Handle function (Handle, uint, Handle, ref UErrorCode)", "ures_getByIndex" + ,"Handle function (Handle, char*, Handle, ref UErrorCode)", "ures_getByKey" + )); /*********************************************************************** ***********************************************************************/ - static FunctionLoader.Bind[] targets = - [ - {cast(void**) &ures_open, "ures_open"}, - {cast(void**) &ures_close, "ures_close"}, - {cast(void**) &ures_getLocale, "ures_getLocale"}, - {cast(void**) &ures_getVersion, "ures_getVersion"}, - {cast(void**) &ures_getSize, "ures_getSize"}, - {cast(void**) &ures_getInt, "ures_getInt"}, - {cast(void**) &ures_getString, "ures_getString"}, - {cast(void**) &ures_getStringByIndex, "ures_getStringByIndex"}, - {cast(void**) &ures_getStringByKey, "ures_getStringByKey"}, - {cast(void**) &ures_getBinary, "ures_getBinary"}, - {cast(void**) &ures_hasNext, "ures_hasNext"}, - {cast(void**) &ures_resetIterator, "ures_resetIterator"}, - {cast(void**) &ures_getNextString, "ures_getNextString"}, - {cast(void**) &ures_getKey, "ures_getKey"}, - {cast(void**) &ures_getType, "ures_getType"}, - {cast(void**) &ures_getNextResource, "ures_getNextResource"}, - {cast(void**) &ures_getByIndex, "ures_getByIndex"}, - {cast(void**) &ures_getByKey, "ures_getByKey"}, - ]; - - /*********************************************************************** - - ***********************************************************************/ - - static this () - { - library = FunctionLoader.bind (icuuc, targets); - //test (); - } - - /*********************************************************************** - - ***********************************************************************/ - - static ~this () - { - FunctionLoader.unbind (library); - } - - /*********************************************************************** - - ***********************************************************************/ - - static void test() + /*static void test() { UResourceBundle b = new UResourceBundle (ULocale.Default); UStringView t = b.getNextString(); UResourceBundle b1 = b.getNextResource (); - } + }*/ }