comparison com.ibm.icu/src/com/ibm/icu/mangoicu/UCalendar.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
comparison
equal deleted inserted replaced
119:d00e8db0a568 120:536e43f63c81
240 Open a UCalendar. A UCalendar may be used to convert a 240 Open a UCalendar. A UCalendar may be used to convert a
241 millisecond value to a year, month, and day 241 millisecond value to a year, month, and day
242 242
243 ***********************************************************************/ 243 ***********************************************************************/
244 244
245 this (inout UTimeZone zone, inout ULocale locale, Type type = Type.Traditional) 245 this (ref UTimeZone zone, ref ULocale locale, Type type = Type.Traditional)
246 { 246 {
247 UErrorCode e; 247 UErrorCode e;
248 248
249 handle = ucal_open (cast(wchar*)zone.name.ptr, zone.name.length, ICU.toString(locale.name), type, e); 249 handle = ucal_open (cast(wchar*)zone.name.ptr, zone.name.length, ICU.toString(locale.name), type, e);
250 testError (e, "failed to open calendar"); 250 testError (e, "failed to open calendar");
276 276
277 Set the TimeZone used by a UCalendar 277 Set the TimeZone used by a UCalendar
278 278
279 ***********************************************************************/ 279 ***********************************************************************/
280 280
281 void setTimeZone (inout UTimeZone zone) 281 void setTimeZone (ref UTimeZone zone)
282 { 282 {
283 UErrorCode e; 283 UErrorCode e;
284 284
285 ucal_setTimeZone (handle, cast(wchar*)zone.name.ptr, zone.name.length, e); 285 ucal_setTimeZone (handle, cast(wchar*)zone.name.ptr, zone.name.length, e);
286 testError (e, "failed to set calendar time zone"); 286 testError (e, "failed to set calendar time zone");
290 290
291 Get display name of the TimeZone used by this UCalendar 291 Get display name of the TimeZone used by this UCalendar
292 292
293 ***********************************************************************/ 293 ***********************************************************************/
294 294
295 void getTimeZoneName (UString s, inout ULocale locale, DisplayNameType type=DisplayNameType.Standard) 295 void getTimeZoneName (UString s, ref ULocale locale, DisplayNameType type=DisplayNameType.Standard)
296 { 296 {
297 uint format (wchar* dst, uint length, inout ICU.UErrorCode e) 297 uint format (wchar* dst, uint length, ref ICU.UErrorCode e)
298 { 298 {
299 return ucal_getTimeZoneDisplayName (handle, type, toString(locale.name), dst, length, e); 299 return ucal_getTimeZoneDisplayName (handle, type, toString(locale.name), dst, length, e);
300 } 300 }
301 301
302 s.format (&format, "failed to get time zone name"); 302 s.format (&format, "failed to get time zone name");
583 complicated by the issues regarding D and DLLs on the 583 complicated by the issues regarding D and DLLs on the
584 Windows platform 584 Windows platform
585 585
586 ***********************************************************************/ 586 ***********************************************************************/
587 587
588 private static void* library; 588 mixin(genICUNative!("in"
589 589 ,"Handle function (wchar*, uint, char*, Type, ref UErrorCode)", "ucal_open"
590 /*********************************************************************** 590 ,"void function (Handle)", "ucal_close"
591 591 ,"UDate function ()", "ucal_getNow"
592 ***********************************************************************/ 592 ,"UDate function (Handle, ref UErrorCode)", "ucal_getMillis"
593 593 ,"void function (Handle, UDate, ref UErrorCode)", "ucal_setMillis"
594 private static extern (C) 594 ,"void function (Handle, uint, uint, uint, ref UErrorCode)", "ucal_setDate"
595 { 595 ,"void function (Handle, uint, uint, uint, uint, uint, uint, ref UErrorCode)", "ucal_setDateTime"
596 Handle function (wchar*, uint, char*, Type, inout UErrorCode) ucal_open; 596 ,"byte function (Handle, Handle)", "ucal_equivalentTo"
597 void function (Handle) ucal_close; 597 ,"void function (Handle, uint, uint, ref UErrorCode)", "ucal_add"
598 UDate function () ucal_getNow; 598 ,"void function (Handle, uint, uint, ref UErrorCode)", "ucal_roll"
599 UDate function (Handle, inout UErrorCode) ucal_getMillis; 599 ,"uint function (Handle, uint, ref UErrorCode)", "ucal_get"
600 void function (Handle, UDate, inout UErrorCode) ucal_setMillis; 600 ,"void function (Handle, uint, uint)", "ucal_set"
601 void function (Handle, uint, uint, uint, inout UErrorCode) ucal_setDate; 601 ,"byte function (Handle, uint)", "ucal_isSet"
602 void function (Handle, uint, uint, uint, uint, uint, uint, inout UErrorCode) ucal_setDateTime; 602 ,"void function (Handle, uint)", "ucal_clearField"
603 byte function (Handle, Handle) ucal_equivalentTo; 603 ,"void function (Handle)", "ucal_clear"
604 void function (Handle, uint, uint, inout UErrorCode) ucal_add; 604 ,"uint function (Handle, uint, uint, ref UErrorCode)", "ucal_getLimit"
605 void function (Handle, uint, uint, inout UErrorCode) ucal_roll; 605 ,"void function (Handle, wchar*, uint, ref UErrorCode)", "ucal_setTimeZone"
606 uint function (Handle, uint, inout UErrorCode) ucal_get; 606 ,"byte function (Handle, uint)", "ucal_inDaylightTime"
607 void function (Handle, uint, uint) ucal_set; 607 ,"uint function (Handle, uint)", "ucal_getAttribute"
608 byte function (Handle, uint) ucal_isSet; 608 ,"void function (Handle, uint, uint)", "ucal_setAttribute"
609 void function (Handle, uint) ucal_clearField; 609 ,"uint function (Handle, uint, char*, wchar*, uint, ref UErrorCode)", "ucal_getTimeZoneDisplayName"
610 void function (Handle) ucal_clear; 610 ));
611 uint function (Handle, uint, uint, inout UErrorCode) ucal_getLimit;
612 void function (Handle, wchar*, uint, inout UErrorCode) ucal_setTimeZone;
613 byte function (Handle, uint) ucal_inDaylightTime;
614 uint function (Handle, uint) ucal_getAttribute;
615 void function (Handle, uint, uint) ucal_setAttribute;
616 uint function (Handle, uint, char*, wchar*, uint, inout UErrorCode) ucal_getTimeZoneDisplayName;
617 }
618
619 /***********************************************************************
620
621 ***********************************************************************/
622
623 static FunctionLoader.Bind[] targets =
624 [
625 {cast(void**) &ucal_open, "ucal_open"},
626 {cast(void**) &ucal_close, "ucal_close"},
627 {cast(void**) &ucal_getNow, "ucal_getNow"},
628 {cast(void**) &ucal_getMillis, "ucal_getMillis"},
629 {cast(void**) &ucal_setMillis, "ucal_setMillis"},
630 {cast(void**) &ucal_setDate, "ucal_setDate"},
631 {cast(void**) &ucal_setDateTime, "ucal_setDateTime"},
632 {cast(void**) &ucal_equivalentTo, "ucal_equivalentTo"},
633 {cast(void**) &ucal_add, "ucal_add"},
634 {cast(void**) &ucal_roll, "ucal_roll"},
635 {cast(void**) &ucal_get, "ucal_get"},
636 {cast(void**) &ucal_set, "ucal_set"},
637 {cast(void**) &ucal_clearField, "ucal_clearField"},
638 {cast(void**) &ucal_clear, "ucal_clear"},
639 {cast(void**) &ucal_getLimit, "ucal_getLimit"},
640 {cast(void**) &ucal_setTimeZone, "ucal_setTimeZone"},
641 {cast(void**) &ucal_inDaylightTime, "ucal_inDaylightTime"},
642 {cast(void**) &ucal_getAttribute, "ucal_getAttribute"},
643 {cast(void**) &ucal_setAttribute, "ucal_setAttribute"},
644 {cast(void**) &ucal_isSet, "ucal_isSet"},
645 {cast(void**) &ucal_getTimeZoneDisplayName, "ucal_getTimeZoneDisplayName"},
646 ];
647
648 /***********************************************************************
649
650 ***********************************************************************/
651
652 static this ()
653 {
654 library = FunctionLoader.bind (icuin, targets);
655 }
656
657 /***********************************************************************
658
659 ***********************************************************************/
660
661 static ~this ()
662 {
663 FunctionLoader.unbind (library);
664 }
665
666 } 611 }