summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/i18n
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/icu-xetex/i18n')
-rw-r--r--Build/source/libs/icu-xetex/i18n/Makefile.in38
-rw-r--r--Build/source/libs/icu-xetex/i18n/anytrans.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/anytrans.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/astro.cpp48
-rw-r--r--Build/source/libs/icu-xetex/i18n/astro.h22
-rw-r--r--Build/source/libs/icu-xetex/i18n/calendar.cpp26
-rw-r--r--Build/source/libs/icu-xetex/i18n/choicfmt.cpp33
-rw-r--r--Build/source/libs/icu-xetex/i18n/coleitr.cpp540
-rw-r--r--Build/source/libs/icu-xetex/i18n/cpdtrans.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/csdetect.cpp387
-rw-r--r--Build/source/libs/icu-xetex/i18n/csdetect.h56
-rw-r--r--Build/source/libs/icu-xetex/i18n/csmatch.cpp61
-rw-r--r--Build/source/libs/icu-xetex/i18n/csmatch.h44
-rw-r--r--Build/source/libs/icu-xetex/i18n/csr2022.cpp172
-rw-r--r--Build/source/libs/icu-xetex/i18n/csr2022.h86
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrecog.cpp28
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrecog.h42
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrmbcs.cpp517
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrmbcs.h205
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrsbcs.cpp1099
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrsbcs.h364
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrucode.cpp146
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrucode.h106
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrutf8.cpp111
-rw-r--r--Build/source/libs/icu-xetex/i18n/csrutf8.h42
-rw-r--r--Build/source/libs/icu-xetex/i18n/datefmt.cpp26
-rw-r--r--Build/source/libs/icu-xetex/i18n/dcfmtsym.cpp44
-rw-r--r--Build/source/libs/icu-xetex/i18n/decimfmt.cpp40
-rw-r--r--Build/source/libs/icu-xetex/i18n/digitlst.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/dtfmtsym.cpp1225
-rw-r--r--Build/source/libs/icu-xetex/i18n/esctrn.cpp28
-rw-r--r--Build/source/libs/icu-xetex/i18n/esctrn.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/fmtable.cpp23
-rw-r--r--Build/source/libs/icu-xetex/i18n/gregocal.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/hebrwcal.cpp19
-rw-r--r--Build/source/libs/icu-xetex/i18n/hebrwcal.h10
-rw-r--r--Build/source/libs/icu-xetex/i18n/i18n.vcproj132
-rw-r--r--Build/source/libs/icu-xetex/i18n/inputext.cpp162
-rw-r--r--Build/source/libs/icu-xetex/i18n/inputext.h59
-rw-r--r--Build/source/libs/icu-xetex/i18n/name2uni.cpp5
-rw-r--r--Build/source/libs/icu-xetex/i18n/name2uni.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/nfrlist.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/nfrule.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/nfsubs.h16
-rw-r--r--Build/source/libs/icu-xetex/i18n/nortrans.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/nultrans.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/numfmt.cpp67
-rw-r--r--Build/source/libs/icu-xetex/i18n/olsontz.cpp79
-rw-r--r--Build/source/libs/icu-xetex/i18n/olsontz.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/quant.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbnf.cpp5
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbt.cpp11
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbt_data.cpp34
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbt_data.h9
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbt_pars.cpp313
-rw-r--r--Build/source/libs/icu-xetex/i18n/rbt_pars.h52
-rw-r--r--Build/source/libs/icu-xetex/i18n/regexcmp.cpp34
-rw-r--r--Build/source/libs/icu-xetex/i18n/regexcmp.h11
-rw-r--r--Build/source/libs/icu-xetex/i18n/regeximp.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/rematch.cpp12
-rw-r--r--Build/source/libs/icu-xetex/i18n/remtrans.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/repattrn.cpp5
-rw-r--r--Build/source/libs/icu-xetex/i18n/simpletz.cpp7
-rw-r--r--Build/source/libs/icu-xetex/i18n/smpdtfmt.cpp424
-rw-r--r--Build/source/libs/icu-xetex/i18n/sortkey.cpp10
-rw-r--r--Build/source/libs/icu-xetex/i18n/stsearch.cpp199
-rw-r--r--Build/source/libs/icu-xetex/i18n/tblcoll.cpp107
-rw-r--r--Build/source/libs/icu-xetex/i18n/timezone.cpp43
-rw-r--r--Build/source/libs/icu-xetex/i18n/titletrn.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/tolowtrn.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/toupptrn.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/translit.cpp78
-rw-r--r--Build/source/libs/icu-xetex/i18n/transreg.cpp53
-rw-r--r--Build/source/libs/icu-xetex/i18n/transreg.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/tridpars.cpp10
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucal.cpp29
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucln_in.c6
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucln_in.h3
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol.cpp957
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_bld.cpp36
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_cnt.cpp337
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_cnt.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_elm.cpp155
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_elm.h14
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_imp.h26
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_res.cpp296
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_sit.cpp14
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_tok.cpp8
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_tok.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucol_wgt.c4
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucoleitr.cpp29
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucsdet.cpp234
-rw-r--r--Build/source/libs/icu-xetex/i18n/ucurr.cpp21
-rw-r--r--Build/source/libs/icu-xetex/i18n/udat.cpp248
-rw-r--r--Build/source/libs/icu-xetex/i18n/ulocdata.c25
-rw-r--r--Build/source/libs/icu-xetex/i18n/umsg.cpp166
-rw-r--r--Build/source/libs/icu-xetex/i18n/unesctrn.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/uni2name.h6
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/calendar.h14
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/coll.h16
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/curramt.h24
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/currunit.h22
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h22
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h28
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h236
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/fmtable.h45
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/format.h5
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/gregocal.h5
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measfmt.h10
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measunit.h12
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measure.h22
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h4
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/numfmt.h17
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/rbnf.h33
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/regex.h8
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/simpletz.h2
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h33
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/sortkey.h8
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/stsearch.h7
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h22
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/timezone.h18
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/translit.h49
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucal.h282
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucol.h106
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h350
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucurr.h30
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/udat.h95
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h58
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/umsg.h56
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/unum.h123
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/uregex.h132
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/utmscale.h98
-rw-r--r--Build/source/libs/icu-xetex/i18n/uregex.cpp7
-rw-r--r--Build/source/libs/icu-xetex/i18n/usearch.cpp4
-rw-r--r--Build/source/libs/icu-xetex/i18n/utmscale.c120
-rw-r--r--Build/source/libs/icu-xetex/i18n/windtfmt.cpp315
-rw-r--r--Build/source/libs/icu-xetex/i18n/windtfmt.h148
-rw-r--r--Build/source/libs/icu-xetex/i18n/winnmfmt.cpp345
-rw-r--r--Build/source/libs/icu-xetex/i18n/winnmfmt.h168
139 files changed, 10252 insertions, 3096 deletions
diff --git a/Build/source/libs/icu-xetex/i18n/Makefile.in b/Build/source/libs/icu-xetex/i18n/Makefile.in
index 96db8281fb7..eba8f2a8b30 100644
--- a/Build/source/libs/icu-xetex/i18n/Makefile.in
+++ b/Build/source/libs/icu-xetex/i18n/Makefile.in
@@ -1,6 +1,6 @@
#******************************************************************************
#
-# Copyright (C) 1998-2005, International Business Machines
+# Copyright (C) 1998-2006, International Business Machines
# Corporation and others. All Rights Reserved.
#
#******************************************************************************
@@ -15,7 +15,6 @@ top_builddir = ..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
--include Makefile.local
## Build directory information
subdir = i18n
@@ -33,7 +32,7 @@ endif
ifneq ($(ENABLE_SHARED),)
SO_TARGET = $(LIBDIR)/$(LIBICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).$(SO)
-ALL_SO_TARGETS = $(SO_TARGET) $(MIDDLE_SO_TARGET) $(FINAL_SO_TARGET)
+ALL_SO_TARGETS = $(SO_TARGET) $(MIDDLE_SO_TARGET) $(FINAL_SO_TARGET) $(SHARED_OBJECT)
ifeq ($(ENABLE_SO_VERSION_DATA),1)
SO_VERSION_DATA = i18n.res
@@ -42,9 +41,9 @@ endif
ifeq ($(OS390BATCH),1)
BATCH_TARGET = $(BATCH_I18N_TARGET)
BATCH_LIBS = $(BATCH_LIBICUUC) -lm
-endif # OS390BATCH
+endif # OS390BATCH
-endif # ENABLE_SHARED
+endif # ENABLE_SHARED
ALL_TARGETS = $(TARGET) $(ALL_SO_TARGETS) $(BATCH_TARGET)
@@ -52,18 +51,21 @@ DYNAMICCPPFLAGS = $(SHAREDLIBCPPFLAGS)
DYNAMICCFLAGS = $(SHAREDLIBCFLAGS)
DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS)
-LDFLAGS += $(LDFLAGSICUI18N)
-CPPFLAGS += -I$(srcdir) -I$(top_builddir)/common -I$(top_srcdir)/common $(LIBCPPFLAGS)
+ifneq ($(top_builddir),$(top_srcdir))
+CPPFLAGS += -I$(top_builddir)/common
+endif
+CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/common $(LIBCPPFLAGS)
DEFS += -DU_I18N_IMPLEMENTATION
+LDFLAGS += $(LDFLAGSICUI18N)
LIBS = $(LIBICUUC) $(DEFAULT_LIBS)
OBJECTS = ucln_in.o \
fmtable.o format.o msgfmt.o umsg.o numfmt.o unum.o decimfmt.o dcfmtsym.o \
ucurr.o digitlst.o fmtable_cnv.o \
choicfmt.o datefmt.o smpdtfmt.o dtfmtsym.o udat.o \
-nfrs.o nfrule.o nfsubs.o rbnf.o \
+nfrs.o nfrule.o nfsubs.o rbnf.o ucsdet.o \
ucal.o calendar.o gregocal.o timezone.o simpletz.o olsontz.o \
-astro.o buddhcal.o islamcal.o japancal.o gregoimp.o hebrwcal.o chnsecal.o \
+astro.o buddhcal.o islamcal.o japancal.o gregoimp.o hebrwcal.o \
coleitr.o coll.o tblcoll.o sortkey.o bocsu.o ucoleitr.o \
ucol.o ucol_res.o ucol_bld.o ucol_sit.o ucol_tok.o ucol_wgt.o ucol_cnt.o ucol_elm.o \
strmatch.o usearch.o search.o stsearch.o \
@@ -72,15 +74,18 @@ cpdtrans.o rbt.o rbt_data.o rbt_pars.o rbt_rule.o rbt_set.o \
nultrans.o remtrans.o casetrn.o titletrn.o tolowtrn.o toupptrn.o anytrans.o \
name2uni.o uni2name.o nortrans.o quant.o transreg.o \
regexcmp.o rematch.o repattrn.o regexst.o uregex.o uregexc.o \
-ulocdata.o measfmt.o currfmt.o curramt.o currunit.o measure.o utmscale.o
+ulocdata.o measfmt.o currfmt.o curramt.o currunit.o measure.o utmscale.o \
+csdetect.o csmatch.o csr2022.o csrecog.o csrmbcs.o csrsbcs.o csrucode.o csrutf8.o inputext.o \
+windtfmt.o winnmfmt.o
+## Header files to install
+HEADERS = $(srcdir)/unicode/*.h
STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))
DEPS = $(OBJECTS:.o=.d)
-## Header files to install
-HEADERS= $(srcdir)/unicode/*.h
+-include Makefile.local
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \
@@ -100,7 +105,7 @@ check: all check-local
all-local: $(ALL_TARGETS)
-install-local: install-headers install-library
+install-local: install-headers install-library
install-library: all-local
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
@@ -154,14 +159,14 @@ $(TARGET): $(TARGET)($(STATIC_OBJECTS))
endif
ifneq ($(ENABLE_SHARED),)
-$(FINAL_SO_TARGET): $(OBJECTS) $(SO_VERSION_DATA)
+$(SHARED_OBJECT): $(OBJECTS) $(SO_VERSION_DATA)
$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
ifeq ($(OS390BATCH),1)
$(BATCH_TARGET):$(OBJECTS)
$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(BATCH_LIBS)
-endif # OS390BATCH
-endif
+endif # OS390BATCH
+endif # ENABLE_SHARED
ifeq (,$(MAKECMDGOALS))
-include $(DEPS)
@@ -170,3 +175,4 @@ ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
-include $(DEPS)
endif
endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/anytrans.cpp b/Build/source/libs/icu-xetex/i18n/anytrans.cpp
index d46668ec910..bd76fe148a7 100644
--- a/Build/source/libs/icu-xetex/i18n/anytrans.cpp
+++ b/Build/source/libs/icu-xetex/i18n/anytrans.cpp
@@ -182,7 +182,7 @@ AnyTransliterator::AnyTransliterator(const UnicodeString& id,
Transliterator(id, NULL),
targetScript(theTargetScript)
{
- cache = uhash_open(uhash_hashLong, uhash_compareLong, &ec);
+ cache = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &ec);
uhash_setValueDeleter(cache, _deleteTransliterator);
target = theTarget;
@@ -205,7 +205,7 @@ AnyTransliterator::AnyTransliterator(const AnyTransliterator& o) :
{
// Don't copy the cache contents
UErrorCode ec = U_ZERO_ERROR;
- cache = uhash_open(uhash_hashLong, uhash_compareLong, &ec);
+ cache = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &ec);
uhash_setValueDeleter(cache, _deleteTransliterator);
}
diff --git a/Build/source/libs/icu-xetex/i18n/anytrans.h b/Build/source/libs/icu-xetex/i18n/anytrans.h
index 4a7d8f2ef68..f37675a83e9 100644
--- a/Build/source/libs/icu-xetex/i18n/anytrans.h
+++ b/Build/source/libs/icu-xetex/i18n/anytrans.h
@@ -1,6 +1,6 @@
/*
***********************************************************************
-* Copyright (c) 2002-2005, International Business Machines Corporation
+* Copyright (c) 2002-2006, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************
* Date Name Description
@@ -74,15 +74,11 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/astro.cpp b/Build/source/libs/icu-xetex/i18n/astro.cpp
index 16fd0f2e397..457176c8a15 100644
--- a/Build/source/libs/icu-xetex/i18n/astro.cpp
+++ b/Build/source/libs/icu-xetex/i18n/astro.cpp
@@ -1,5 +1,5 @@
/************************************************************************
- * Copyright (C) 1996-2004, International Business Machines Corporation *
+ * Copyright (C) 1996-2006, International Business Machines Corporation *
* and others. All Rights Reserved. *
************************************************************************
* 2003-nov-07 srl Port from Java
@@ -617,9 +617,9 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::getSunPosition(CalendarAstro
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-double CalendarAstronomer::VERNAL_EQUINOX() {
+/*double CalendarAstronomer::VERNAL_EQUINOX() {
return 0;
-}
+}*/
/**
* Constant representing the summer solstice.
@@ -639,9 +639,9 @@ double CalendarAstronomer::SUMMER_SOLSTICE() {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-double CalendarAstronomer::AUTUMN_EQUINOX() {
+/*double CalendarAstronomer::AUTUMN_EQUINOX() {
return (CalendarAstronomer::PI);
-}
+}*/
/**
* Constant representing the winter solstice.
@@ -650,9 +650,11 @@ double CalendarAstronomer::AUTUMN_EQUINOX() {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-double CalendarAstronomer::WINTER_SOLSTICE() {
+/*double CalendarAstronomer::WINTER_SOLSTICE() {
return ((CalendarAstronomer::PI*3)/2);
-}
+}*/
+
+CalendarAstronomer::AngleFunc::~AngleFunc() {}
/**
* Find the next time at which the sun's ecliptic longitude will have
@@ -675,6 +677,8 @@ UDate CalendarAstronomer::getSunTime(double desired, UBool next)
next);
}
+CalendarAstronomer::CoordFunc::~CoordFunc() {}
+
class RiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { a.getSunPosition(result); }
@@ -1124,9 +1128,9 @@ double CalendarAstronomer::getMoonPhase() {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
+/*const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
return CalendarAstronomer::MoonAge(0);
-}
+}*/
/**
* Constant representing the moon's first quarter.
@@ -1134,9 +1138,9 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER() {
+/*const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER() {
return CalendarAstronomer::MoonAge(CalendarAstronomer::PI/2);
-}
+}*/
/**
* Constant representing a full moon.
@@ -1159,9 +1163,9 @@ public:
virtual double eval(CalendarAstronomer&a) { return a.getMoonAge(); }
};
-const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
+/*const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
return CalendarAstronomer::MoonAge((CalendarAstronomer::PI*3)/2);
-}
+}*/
/**
* Find the next or previous time at which the Moon's ecliptic
@@ -1421,7 +1425,7 @@ void CalendarAstronomer::clearCache() {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
-UDate CalendarAstronomer::local(UDate localMillis) {
+/*UDate CalendarAstronomer::local(UDate localMillis) {
// TODO - srl ?
TimeZone *tz = TimeZone::createDefault();
int32_t rawOffset;
@@ -1430,7 +1434,7 @@ UDate CalendarAstronomer::local(UDate localMillis) {
tz->getOffset(localMillis, TRUE, rawOffset, dstOffset, status);
delete tz;
return localMillis - rawOffset;
-}
+}*/
// Debugging functions
UnicodeString CalendarAstronomer::Ecliptic::toString() const
@@ -1488,13 +1492,14 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
void CalendarCache::createCache(CalendarCache** cache, UErrorCode& status) {
ucln_i18n_registerCleanup(UCLN_I18N_ASTRO_CALENDAR, calendar_astro_cleanup);
- *cache = new CalendarCache(32, status);
if(cache == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
- }
- if(U_FAILURE(status)) {
- delete *cache;
- *cache = NULL;
+ } else {
+ *cache = new CalendarCache(32, status);
+ if(U_FAILURE(status)) {
+ delete *cache;
+ *cache = NULL;
+ }
}
}
@@ -1522,7 +1527,6 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu
}
void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErrorCode &status) {
-
if(U_FAILURE(status)) {
return;
}
@@ -1543,7 +1547,7 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro
}
CalendarCache::CalendarCache(int32_t size, UErrorCode &status) {
- fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, size, &status);
+ fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, size, &status);
U_DEBUG_ASTRO_MSG(("%p: Opening.\n", fTable));
}
diff --git a/Build/source/libs/icu-xetex/i18n/astro.h b/Build/source/libs/icu-xetex/i18n/astro.h
index 8291d60eda6..18e6aa55ca9 100644
--- a/Build/source/libs/icu-xetex/i18n/astro.h
+++ b/Build/source/libs/icu-xetex/i18n/astro.h
@@ -1,5 +1,5 @@
/************************************************************************
- * Copyright (C) 1996-2003, International Business Machines Corporation *
+ * Copyright (C) 1996-2006, International Business Machines Corporation *
* and others. All Rights Reserved. *
************************************************************************
* 2003-nov-07 srl Port from Java
@@ -497,7 +497,7 @@ public:
* Note: In this case, "vernal" refers to the northern hemisphere's seasons.
* @internal
*/
- static double VERNAL_EQUINOX();
+// static double VERNAL_EQUINOX();
/**
* Constant representing the summer solstice.
@@ -513,7 +513,7 @@ public:
* Note: In this case, "autumn" refers to the northern hemisphere's seasons.
* @internal
*/
- static double AUTUMN_EQUINOX();
+// static double AUTUMN_EQUINOX();
/**
* Constant representing the winter solstice.
@@ -521,7 +521,7 @@ public:
* Note: In this case, "winter" refers to the northern hemisphere's seasons.
* @internal
*/
- static double WINTER_SOLSTICE();
+// static double WINTER_SOLSTICE();
/**
* Find the next time at which the sun's ecliptic longitude will have
@@ -596,14 +596,14 @@ public:
* For use with {@link #getMoonTime getMoonTime}
* @internal
*/
- static const MoonAge NEW_MOON();
+// static const MoonAge NEW_MOON();
/**
* Constant representing the moon's first quarter.
* For use with {@link #getMoonTime getMoonTime}
* @internal
*/
- static const MoonAge FIRST_QUARTER();
+// static const MoonAge FIRST_QUARTER();
/**
* Constant representing a full moon.
@@ -617,7 +617,7 @@ public:
* For use with {@link #getMoonTime getMoonTime}
* @internal
*/
- static const MoonAge LAST_QUARTER();
+// static const MoonAge LAST_QUARTER();
/**
* Find the next or previous time at which the Moon's ecliptic
@@ -643,18 +643,20 @@ public:
//-------------------------------------------------------------------------
// private
- class U_I18N_API AngleFunc : public UMemory {
+ class AngleFunc : public UMemory {
public:
virtual double eval(CalendarAstronomer&) = 0;
+ virtual ~AngleFunc();
};
friend class AngleFunc;
UDate timeOfAngle(AngleFunc& func, double desired,
double periodDays, double epsilon, UBool next);
- class U_I18N_API CoordFunc : public UMemory {
+ class CoordFunc : public UMemory {
public:
virtual void eval(Equatorial& result, CalendarAstronomer&) = 0;
+ virtual ~CoordFunc();
};
friend class CoordFunc;
@@ -757,7 +759,7 @@ private:
/**
* @internal
*/
- UDate local(UDate localMillis);
+// UDate local(UDate localMillis);
};
U_NAMESPACE_END
diff --git a/Build/source/libs/icu-xetex/i18n/calendar.cpp b/Build/source/libs/icu-xetex/i18n/calendar.cpp
index ae801310bef..6e537028833 100644
--- a/Build/source/libs/icu-xetex/i18n/calendar.cpp
+++ b/Build/source/libs/icu-xetex/i18n/calendar.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -34,7 +34,7 @@
#include "japancal.h"
#include "islamcal.h"
#include "hebrwcal.h"
-#include "chnsecal.h"
+//#include "chnsecal.h"
#include "unicode/calendar.h"
#include "cpputils.h"
#include "servloc.h"
@@ -111,7 +111,7 @@ static const char* fldName(UCalendarDateFields f) {
}
-
+#if UCAL_DEBUG_DUMP
// from CalendarTest::calToStr - but doesn't modify contents.
void ucal_dump(const Calendar &cal) {
cal.dump();
@@ -147,7 +147,7 @@ void Calendar::dump() const {
U_CFUNC void ucal_dump(UCalendar* cal) {
ucal_dump( *((Calendar*)cal) );
}
-
+#endif
#endif
@@ -685,20 +685,24 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
else
#endif
{
+ UErrorCode feErr;
char calLocaleType[ULOC_FULLNAME_CAPACITY];
calLocaleType[0] = 0; // NULL terminate
int32_t keywordCapacity = aLocale.getKeywordValue("calendar", calLocaleType, sizeof(calLocaleType)-1, success);
if (keywordCapacity == 0) {
char funcEquiv[ULOC_FULLNAME_CAPACITY];
+ feErr = success;
+
// fetch default calendar id
ures_getFunctionalEquivalent(funcEquiv, sizeof(funcEquiv)-1,
NULL, "calendar", "calendar",
aLocale.getName(),
- NULL, FALSE, &success);
+ NULL, FALSE, &feErr);
keywordCapacity = uloc_getKeywordValue(funcEquiv, "calendar", calLocaleType,
- sizeof(calLocaleType)-1, &success);
- if (keywordCapacity == 0 || U_FAILURE(success)) {
+ sizeof(calLocaleType)-1, &feErr); // This can fail if there is no data.
+ // Don't want to stop calendar construction just because we couldn't get this type.
+ if (keywordCapacity == 0 || U_FAILURE(feErr)) {
// no calendar type. Default to nothing.
calLocaleType[0] = 0;
}
@@ -2723,15 +2727,15 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w
int32_t minDays = getMinimalDaysInFirstWeek();
UBool jan1InPrevYear = FALSE; // January 1st in the year of WOY is the 1st week? (i.e. first week is < minimal )
- UBool nextJan1InPrevYear = FALSE; // January 1st of Year of WOY + 1 is in the first week?
+ //UBool nextJan1InPrevYear = FALSE; // January 1st of Year of WOY + 1 is in the first week?
if((7 - first) < minDays) {
jan1InPrevYear = TRUE;
}
- if((7 - nextFirst) < minDays) {
- nextJan1InPrevYear = TRUE;
- }
+// if((7 - nextFirst) < minDays) {
+// nextJan1InPrevYear = TRUE;
+// }
switch(bestField) {
case UCAL_WEEK_OF_YEAR:
diff --git a/Build/source/libs/icu-xetex/i18n/choicfmt.cpp b/Build/source/libs/icu-xetex/i18n/choicfmt.cpp
index eeac7f381ca..b9caa9a3b9c 100644
--- a/Build/source/libs/icu-xetex/i18n/choicfmt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/choicfmt.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2004, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -31,9 +31,10 @@
#include "unicode/numfmt.h"
#include "unicode/locid.h"
#include "cpputils.h"
-#include "ustrfmt.h"
#include "cstring.h"
#include "putilimp.h"
+#include <stdio.h>
+#include <float.h>
// *****************************************************************************
// class ChoiceFormat
@@ -210,9 +211,33 @@ UnicodeString&
ChoiceFormat::dtos(double value,
UnicodeString& string)
{
- char temp[256];
+ /* Buffer to contain the digits and any extra formatting stuff. */
+ char temp[DBL_DIG + 16];
+ char *itrPtr = temp;
+ char *startPtr;
+
+ sprintf(temp, "%.*f", DBL_DIG, value);
+
+ /* Find and convert the decimal point.
+ Using setlocale on some machines will cause sprintf to use a comma for certain locales.
+ */
+ while (*itrPtr && (*itrPtr == '-' || isdigit(*itrPtr))) {
+ itrPtr++;
+ }
+ if (*itrPtr) {
+ *itrPtr = '.';
+ }
- uprv_dtostr(value, temp, 3, TRUE);
+ /* remove trailing zeros, except the one after '.' */
+ startPtr = itrPtr + 1;
+ itrPtr = uprv_strchr(startPtr, 0);
+ while(--itrPtr > startPtr){
+ if(*itrPtr == '0'){
+ *itrPtr = 0;
+ }else{
+ break;
+ }
+ }
string = UnicodeString(temp, -1, US_INV); /* invariant codepage */
return string;
}
diff --git a/Build/source/libs/icu-xetex/i18n/coleitr.cpp b/Build/source/libs/icu-xetex/i18n/coleitr.cpp
index f7ec8d449d0..8c1b87f4960 100644
--- a/Build/source/libs/icu-xetex/i18n/coleitr.cpp
+++ b/Build/source/libs/icu-xetex/i18n/coleitr.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines Corporation and *
+* Copyright (C) 1996-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -46,25 +46,25 @@ CollationElementIterator::CollationElementIterator(
const CollationElementIterator& other)
: UObject(other), isDataOwned_(TRUE)
{
- UErrorCode status = U_ZERO_ERROR;
- m_data_ = ucol_openElements(other.m_data_->iteratordata_.coll, NULL, 0,
- &status);
+ UErrorCode status = U_ZERO_ERROR;
+ m_data_ = ucol_openElements(other.m_data_->iteratordata_.coll, NULL, 0,
+ &status);
- *this = other;
+ *this = other;
}
CollationElementIterator::~CollationElementIterator()
{
- if (isDataOwned_) {
- ucol_closeElements(m_data_);
- }
+ if (isDataOwned_) {
+ ucol_closeElements(m_data_);
+ }
}
/* CollationElementIterator public methods --------------------------------- */
int32_t CollationElementIterator::getOffset() const
{
- return ucol_getOffset(m_data_);
+ return ucol_getOffset(m_data_);
}
/**
@@ -74,13 +74,13 @@ int32_t CollationElementIterator::getOffset() const
*/
int32_t CollationElementIterator::next(UErrorCode& status)
{
- return ucol_next(m_data_, &status);
+ return ucol_next(m_data_, &status);
}
UBool CollationElementIterator::operator!=(
const CollationElementIterator& other) const
{
- return !(*this == other);
+ return !(*this == other);
}
UBool CollationElementIterator::operator==(
@@ -152,7 +152,7 @@ UBool CollationElementIterator::operator==(
*/
int32_t CollationElementIterator::previous(UErrorCode& status)
{
- return ucol_previous(m_data_, &status);
+ return ucol_previous(m_data_, &status);
}
/**
@@ -160,13 +160,13 @@ int32_t CollationElementIterator::previous(UErrorCode& status)
*/
void CollationElementIterator::reset()
{
- ucol_reset(m_data_);
+ ucol_reset(m_data_);
}
void CollationElementIterator::setOffset(int32_t newOffset,
UErrorCode& status)
{
- ucol_setOffset(m_data_, newOffset, &status);
+ ucol_setOffset(m_data_, newOffset, &status);
}
/**
@@ -175,96 +175,96 @@ void CollationElementIterator::setOffset(int32_t newOffset,
void CollationElementIterator::setText(const UnicodeString& source,
UErrorCode& status)
{
- if (U_FAILURE(status)) {
- return;
- }
-
- int32_t length = source.length();
- UChar *string = NULL;
- if (m_data_->isWritable && m_data_->iteratordata_.string != NULL) {
- uprv_free(m_data_->iteratordata_.string);
- }
- m_data_->isWritable = TRUE;
- if (length > 0) {
- string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
- /* test for NULL */
- if (string == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
+ if (U_FAILURE(status)) {
return;
}
- u_memcpy(string, source.getBuffer(), length);
- }
- else {
- string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
- /* test for NULL */
- if (string == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
+
+ int32_t length = source.length();
+ UChar *string = NULL;
+ if (m_data_->isWritable && m_data_->iteratordata_.string != NULL) {
+ uprv_free(m_data_->iteratordata_.string);
+ }
+ m_data_->isWritable = TRUE;
+ if (length > 0) {
+ string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
+ /* test for NULL */
+ if (string == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ u_memcpy(string, source.getBuffer(), length);
+ }
+ else {
+ string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
+ /* test for NULL */
+ if (string == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ *string = 0;
}
- *string = 0;
- }
- uprv_init_collIterate(m_data_->iteratordata_.coll, string, length,
- &m_data_->iteratordata_);
+ uprv_init_collIterate(m_data_->iteratordata_.coll, string, length,
+ &m_data_->iteratordata_);
- m_data_->reset_ = TRUE;
+ m_data_->reset_ = TRUE;
}
// Sets the source to the new character iterator.
void CollationElementIterator::setText(CharacterIterator& source,
UErrorCode& status)
{
- if (U_FAILURE(status))
- return;
-
- int32_t length = source.getLength();
- UChar *buffer = NULL;
-
- if (length == 0) {
- buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
- /* test for NULL */
- if (buffer == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
+ if (U_FAILURE(status))
return;
+
+ int32_t length = source.getLength();
+ UChar *buffer = NULL;
+
+ if (length == 0) {
+ buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
+ /* test for NULL */
+ if (buffer == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ *buffer = 0;
}
- *buffer = 0;
- }
- else {
- buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
- /* test for NULL */
- if (buffer == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- /*
- Using this constructor will prevent buffer from being removed when
- string gets removed
- */
- UnicodeString string;
- source.getText(string);
- u_memcpy(buffer, string.getBuffer(), length);
- }
-
- if (m_data_->isWritable && m_data_->iteratordata_.string != NULL) {
- uprv_free(m_data_->iteratordata_.string);
- }
- m_data_->isWritable = TRUE;
- uprv_init_collIterate(m_data_->iteratordata_.coll, buffer, length,
- &m_data_->iteratordata_);
- m_data_->reset_ = TRUE;
+ else {
+ buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
+ /* test for NULL */
+ if (buffer == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ /*
+ Using this constructor will prevent buffer from being removed when
+ string gets removed
+ */
+ UnicodeString string;
+ source.getText(string);
+ u_memcpy(buffer, string.getBuffer(), length);
+ }
+
+ if (m_data_->isWritable && m_data_->iteratordata_.string != NULL) {
+ uprv_free(m_data_->iteratordata_.string);
+ }
+ m_data_->isWritable = TRUE;
+ uprv_init_collIterate(m_data_->iteratordata_.coll, buffer, length,
+ &m_data_->iteratordata_);
+ m_data_->reset_ = TRUE;
}
int32_t CollationElementIterator::strengthOrder(int32_t order) const
{
- UCollationStrength s = ucol_getStrength(m_data_->iteratordata_.coll);
- // Mask off the unwanted differences.
- if (s == UCOL_PRIMARY) {
- order &= RuleBasedCollator::PRIMARYDIFFERENCEONLY;
- }
- else if (s == UCOL_SECONDARY) {
- order &= RuleBasedCollator::SECONDARYDIFFERENCEONLY;
- }
-
- return order;
+ UCollationStrength s = ucol_getStrength(m_data_->iteratordata_.coll);
+ // Mask off the unwanted differences.
+ if (s == UCOL_PRIMARY) {
+ order &= RuleBasedCollator::PRIMARYDIFFERENCEONLY;
+ }
+ else if (s == UCOL_SECONDARY) {
+ order &= RuleBasedCollator::SECONDARYDIFFERENCEONLY;
+ }
+
+ return order;
}
/* CollationElementIterator private constructors/destructors --------------- */
@@ -279,42 +279,42 @@ CollationElementIterator::CollationElementIterator(
UErrorCode& status)
: isDataOwned_(TRUE)
{
- if (U_FAILURE(status)) {
- return;
- }
-
- int32_t length = sourceText.length();
- UChar *string = NULL;
-
- if (length > 0) {
- string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
- /* test for NULL */
- if (string == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- /*
- Using this constructor will prevent buffer from being removed when
- string gets removed
- */
- u_memcpy(string, sourceText.getBuffer(), length);
- }
- else {
- string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
- /* test for NULL */
- if (string == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
+ if (U_FAILURE(status)) {
return;
- }
- *string = 0;
- }
- m_data_ = ucol_openElements(order->ucollator, string, length, &status);
-
- /* Test for buffer overflows */
- if (U_FAILURE(status)) {
- return;
- }
- m_data_->isWritable = TRUE;
+ }
+
+ int32_t length = sourceText.length();
+ UChar *string = NULL;
+
+ if (length > 0) {
+ string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
+ /* test for NULL */
+ if (string == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ /*
+ Using this constructor will prevent buffer from being removed when
+ string gets removed
+ */
+ u_memcpy(string, sourceText.getBuffer(), length);
+ }
+ else {
+ string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
+ /* test for NULL */
+ if (string == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ *string = 0;
+ }
+ m_data_ = ucol_openElements(order->ucollator, string, length, &status);
+
+ /* Test for buffer overflows */
+ if (U_FAILURE(status)) {
+ return;
+ }
+ m_data_->isWritable = TRUE;
}
/**
@@ -327,62 +327,62 @@ CollationElementIterator::CollationElementIterator(
UErrorCode& status)
: isDataOwned_(TRUE)
{
- if (U_FAILURE(status))
- return;
-
- // **** should I just drop this test? ****
- /*
- if ( sourceText.endIndex() != 0 )
- {
- // A CollationElementIterator is really a two-layered beast.
- // Internally it uses a Normalizer to munge the source text into a form
- // where all "composed" Unicode characters (such as \u00FC) are split into a
- // normal character and a combining accent character.
- // Afterward, CollationElementIterator does its own processing to handle
- // expanding and contracting collation sequences, ignorables, and so on.
-
- Normalizer::EMode decomp = order->getStrength() == Collator::IDENTICAL
- ? Normalizer::NO_OP : order->getDecomposition();
-
- text = new Normalizer(sourceText, decomp);
- if (text == NULL)
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- */
- int32_t length = sourceText.getLength();
- UChar *buffer;
- if (length > 0) {
- buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
- /* test for NULL */
- if (buffer == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
+ if (U_FAILURE(status))
return;
- }
- /*
- Using this constructor will prevent buffer from being removed when
- string gets removed
- */
- UnicodeString string(buffer, length, length);
- ((CharacterIterator &)sourceText).getText(string);
- const UChar *temp = string.getBuffer();
- u_memcpy(buffer, temp, length);
- }
- else {
- buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
- /* test for NULL */
- if (buffer == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
+
+ // **** should I just drop this test? ****
+ /*
+ if ( sourceText.endIndex() != 0 )
+ {
+ // A CollationElementIterator is really a two-layered beast.
+ // Internally it uses a Normalizer to munge the source text into a form
+ // where all "composed" Unicode characters (such as \u00FC) are split into a
+ // normal character and a combining accent character.
+ // Afterward, CollationElementIterator does its own processing to handle
+ // expanding and contracting collation sequences, ignorables, and so on.
+
+ Normalizer::EMode decomp = order->getStrength() == Collator::IDENTICAL
+ ? Normalizer::NO_OP : order->getDecomposition();
+
+ text = new Normalizer(sourceText, decomp);
+ if (text == NULL)
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ */
+ int32_t length = sourceText.getLength();
+ UChar *buffer;
+ if (length > 0) {
+ buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
+ /* test for NULL */
+ if (buffer == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ /*
+ Using this constructor will prevent buffer from being removed when
+ string gets removed
+ */
+ UnicodeString string(buffer, length, length);
+ ((CharacterIterator &)sourceText).getText(string);
+ const UChar *temp = string.getBuffer();
+ u_memcpy(buffer, temp, length);
+ }
+ else {
+ buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
+ /* test for NULL */
+ if (buffer == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ *buffer = 0;
+ }
+ m_data_ = ucol_openElements(order->ucollator, buffer, length, &status);
+
+ /* Test for buffer overflows */
+ if (U_FAILURE(status)) {
return;
- }
- *buffer = 0;
- }
- m_data_ = ucol_openElements(order->ucollator, buffer, length, &status);
-
- /* Test for buffer overflows */
- if (U_FAILURE(status)) {
- return;
- }
- m_data_->isWritable = TRUE;
+ }
+ m_data_->isWritable = TRUE;
}
/* CollationElementIterator protected methods ----------------------------- */
@@ -390,98 +390,100 @@ CollationElementIterator::CollationElementIterator(
const CollationElementIterator& CollationElementIterator::operator=(
const CollationElementIterator& other)
{
- if (this != &other)
- {
- UCollationElements *ucolelem = this->m_data_;
- UCollationElements *otherucolelem = other.m_data_;
- collIterate *coliter = &(ucolelem->iteratordata_);
- collIterate *othercoliter = &(otherucolelem->iteratordata_);
- int length = 0;
-
- // checking only UCOL_ITER_HASLEN is not enough here as we may be in
- // the normalization buffer
- length = othercoliter->endp - othercoliter->string;
-
- ucolelem->reset_ = otherucolelem->reset_;
- ucolelem->isWritable = TRUE;
-
- /* create a duplicate of string */
- if (length > 0) {
- coliter->string = (UChar *)uprv_malloc(length * U_SIZEOF_UCHAR);
- if(coliter->string != NULL) {
- uprv_memcpy(coliter->string, othercoliter->string,
- length * U_SIZEOF_UCHAR);
- } else { // Error: couldn't allocate memory. No copying should be done
- length = 0;
- }
- }
- else {
- coliter->string = NULL;
- }
-
- /* start and end of string */
- coliter->endp = coliter->string + length;
-
- /* handle writable buffer here */
-
- if (othercoliter->flags & UCOL_ITER_INNORMBUF) {
- uint32_t wlength = u_strlen(othercoliter->writableBuffer) + 1;
- if (wlength < coliter->writableBufSize) {
- uprv_memcpy(coliter->stackWritableBuffer,
- othercoliter->stackWritableBuffer,
- othercoliter->writableBufSize * U_SIZEOF_UCHAR);
- }
- else {
- if (coliter->writableBuffer != coliter->stackWritableBuffer) {
- uprv_free(coliter->writableBuffer);
- }
- coliter->writableBuffer = (UChar *)uprv_malloc(
- wlength * U_SIZEOF_UCHAR);
- if(coliter->writableBuffer != NULL) {
- uprv_memcpy(coliter->writableBuffer,
- othercoliter->writableBuffer,
- wlength * U_SIZEOF_UCHAR);
- coliter->writableBufSize = wlength;
- } else { // Error: couldn't allocate memory for writableBuffer
- coliter->writableBufSize = 0;
- }
- }
- }
-
- /* current position */
- if (othercoliter->pos >= othercoliter->string &&
- othercoliter->pos <= othercoliter->endp) {
- coliter->pos = coliter->string +
- (othercoliter->pos - othercoliter->string);
- }
- else {
- coliter->pos = coliter->writableBuffer +
- (othercoliter->pos - othercoliter->writableBuffer);
- }
-
- /* CE buffer */
- uprv_memcpy(coliter->CEs, othercoliter->CEs,
- UCOL_EXPAND_CE_BUFFER_SIZE * sizeof(uint32_t));
- coliter->toReturn = coliter->CEs +
- (othercoliter->toReturn - othercoliter->CEs);
- coliter->CEpos = coliter->CEs +
- (othercoliter->CEpos - othercoliter->CEs);
-
- if (othercoliter->fcdPosition != NULL) {
- coliter->fcdPosition = coliter->string +
- (othercoliter->fcdPosition
- - othercoliter->string);
- }
- else {
- coliter->fcdPosition = NULL;
- }
- coliter->flags = othercoliter->flags/*| UCOL_ITER_HASLEN*/;
- coliter->origFlags = othercoliter->origFlags;
- coliter->coll = othercoliter->coll;
- this->isDataOwned_ = TRUE;
- }
-
- return *this;
+ if (this != &other)
+ {
+ UCollationElements *ucolelem = this->m_data_;
+ UCollationElements *otherucolelem = other.m_data_;
+ collIterate *coliter = &(ucolelem->iteratordata_);
+ collIterate *othercoliter = &(otherucolelem->iteratordata_);
+ int length = 0;
+
+ // checking only UCOL_ITER_HASLEN is not enough here as we may be in
+ // the normalization buffer
+ length = othercoliter->endp - othercoliter->string;
+
+ ucolelem->reset_ = otherucolelem->reset_;
+ ucolelem->isWritable = TRUE;
+
+ /* create a duplicate of string */
+ if (length > 0) {
+ coliter->string = (UChar *)uprv_malloc(length * U_SIZEOF_UCHAR);
+ if(coliter->string != NULL) {
+ uprv_memcpy(coliter->string, othercoliter->string,
+ length * U_SIZEOF_UCHAR);
+ } else { // Error: couldn't allocate memory. No copying should be done
+ length = 0;
+ }
+ }
+ else {
+ coliter->string = NULL;
+ }
+
+ /* start and end of string */
+ coliter->endp = coliter->string + length;
+
+ /* handle writable buffer here */
+
+ if (othercoliter->flags & UCOL_ITER_INNORMBUF) {
+ uint32_t wlength = u_strlen(othercoliter->writableBuffer) + 1;
+ if (wlength < coliter->writableBufSize) {
+ uprv_memcpy(coliter->stackWritableBuffer,
+ othercoliter->stackWritableBuffer,
+ wlength * U_SIZEOF_UCHAR);
+ }
+ else {
+ if (coliter->writableBuffer != coliter->stackWritableBuffer) {
+ uprv_free(coliter->writableBuffer);
+ }
+ coliter->writableBuffer = (UChar *)uprv_malloc(
+ wlength * U_SIZEOF_UCHAR);
+ if(coliter->writableBuffer != NULL) {
+ uprv_memcpy(coliter->writableBuffer,
+ othercoliter->writableBuffer,
+ wlength * U_SIZEOF_UCHAR);
+ coliter->writableBufSize = wlength;
+ } else { // Error: couldn't allocate memory for writableBuffer
+ coliter->writableBufSize = 0;
+ }
+ }
+ }
+
+ /* current position */
+ if (othercoliter->pos >= othercoliter->string &&
+ othercoliter->pos <= othercoliter->endp)
+ {
+ coliter->pos = coliter->string +
+ (othercoliter->pos - othercoliter->string);
+ }
+ else {
+ coliter->pos = coliter->writableBuffer +
+ (othercoliter->pos - othercoliter->writableBuffer);
+ }
+
+ /* CE buffer */
+ int32_t CEsize = (int32_t)(othercoliter->CEpos - othercoliter->CEs);
+ if (CEsize > 0) {
+ uprv_memcpy(coliter->CEs, othercoliter->CEs, CEsize);
+ }
+ coliter->toReturn = coliter->CEs +
+ (othercoliter->toReturn - othercoliter->CEs);
+ coliter->CEpos = coliter->CEs + CEsize;
+
+ if (othercoliter->fcdPosition != NULL) {
+ coliter->fcdPosition = coliter->string +
+ (othercoliter->fcdPosition
+ - othercoliter->string);
+ }
+ else {
+ coliter->fcdPosition = NULL;
+ }
+ coliter->flags = othercoliter->flags/*| UCOL_ITER_HASLEN*/;
+ coliter->origFlags = othercoliter->origFlags;
+ coliter->coll = othercoliter->coll;
+ this->isDataOwned_ = TRUE;
+ }
+
+ return *this;
}
U_NAMESPACE_END
diff --git a/Build/source/libs/icu-xetex/i18n/cpdtrans.cpp b/Build/source/libs/icu-xetex/i18n/cpdtrans.cpp
index c20241e2ac5..afd1fdbf8bd 100644
--- a/Build/source/libs/icu-xetex/i18n/cpdtrans.cpp
+++ b/Build/source/libs/icu-xetex/i18n/cpdtrans.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -20,7 +20,7 @@
#include "cmemory.h"
// keep in sync with Transliterator
-static const UChar ID_SEP = 0x002D; /*-*/
+//static const UChar ID_SEP = 0x002D; /*-*/
static const UChar ID_DELIM = 0x003B; /*;*/
static const UChar NEWLINE = 10;
diff --git a/Build/source/libs/icu-xetex/i18n/csdetect.cpp b/Build/source/libs/icu-xetex/i18n/csdetect.cpp
new file mode 100644
index 00000000000..812bc65ebf4
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csdetect.cpp
@@ -0,0 +1,387 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucsdet.h"
+
+#include "csdetect.h"
+#include "csmatch.h"
+#include "uenumimp.h"
+
+#include "cmemory.h"
+#include "cstring.h"
+#include "umutex.h"
+#include "ucln_in.h"
+#include "uarrsort.h"
+#include "inputext.h"
+#include "csrsbcs.h"
+#include "csrmbcs.h"
+#include "csrutf8.h"
+#include "csrucode.h"
+#include "csr2022.h"
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
+#define DELETE_ARRAY(array) uprv_free((void *) (array))
+
+U_CDECL_BEGIN
+static CharsetRecognizer **fCSRecognizers = NULL;
+
+static int32_t fCSRecognizers_size = 0;
+
+static UBool U_CALLCONV csdet_cleanup(void)
+{
+ if (fCSRecognizers != NULL) {
+ for(int32_t r = 0; r < fCSRecognizers_size; r += 1) {
+ delete fCSRecognizers[r];
+ fCSRecognizers[r] = NULL;
+ }
+
+ DELETE_ARRAY(fCSRecognizers);
+ fCSRecognizers = NULL;
+ fCSRecognizers_size = 0;
+ }
+
+ return TRUE;
+}
+
+static int32_t U_CALLCONV
+charsetMatchComparator(const void *context, const void *left, const void *right)
+{
+ const CharsetMatch **csm_l = (const CharsetMatch **) left;
+ const CharsetMatch **csm_r = (const CharsetMatch **) right;
+
+ // NOTE: compare is backwards to sort from highest to lowest.
+ return (*csm_r)->getConfidence() - (*csm_l)->getConfidence();
+}
+
+U_CDECL_END
+
+U_NAMESPACE_BEGIN
+
+void CharsetDetector::setRecognizers(UErrorCode &status)
+{
+ UBool needsInit;
+ CharsetRecognizer **recognizers;
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ umtx_lock(NULL);
+ needsInit = (UBool) (fCSRecognizers == NULL);
+ umtx_unlock(NULL);
+
+ if (needsInit) {
+ CharsetRecognizer *tempArray[] = {
+ new CharsetRecog_UTF8(),
+
+ new CharsetRecog_UTF_16_BE(),
+ new CharsetRecog_UTF_16_LE(),
+ new CharsetRecog_UTF_32_BE(),
+ new CharsetRecog_UTF_32_LE(),
+
+ new CharsetRecog_8859_1_en(),
+ new CharsetRecog_8859_1_da(),
+ new CharsetRecog_8859_1_de(),
+ new CharsetRecog_8859_1_es(),
+ new CharsetRecog_8859_1_fr(),
+ new CharsetRecog_8859_1_it(),
+ new CharsetRecog_8859_1_nl(),
+ new CharsetRecog_8859_1_no(),
+ new CharsetRecog_8859_1_pt(),
+ new CharsetRecog_8859_1_sv(),
+ new CharsetRecog_8859_2_cs(),
+ new CharsetRecog_8859_2_hu(),
+ new CharsetRecog_8859_2_pl(),
+ new CharsetRecog_8859_2_ro(),
+ new CharsetRecog_8859_5_ru(),
+ new CharsetRecog_8859_6_ar(),
+ new CharsetRecog_8859_7_el(),
+ new CharsetRecog_8859_8_I_he(),
+ new CharsetRecog_8859_8_he(),
+ new CharsetRecog_windows_1251(),
+ new CharsetRecog_windows_1256(),
+ new CharsetRecog_KOI8_R(),
+ new CharsetRecog_8859_9_tr(),
+ new CharsetRecog_sjis(),
+ new CharsetRecog_gb_18030(),
+ new CharsetRecog_euc_jp(),
+ new CharsetRecog_euc_kr(),
+ new CharsetRecog_big5(),
+
+ new CharsetRecog_2022JP(),
+ new CharsetRecog_2022KR(),
+ new CharsetRecog_2022CN()
+ };
+ int32_t rCount = ARRAY_SIZE(tempArray);
+ int32_t r;
+
+ recognizers = NEW_ARRAY(CharsetRecognizer *, rCount);
+
+ if (recognizers == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ for (r = 0; r < rCount; r += 1) {
+ recognizers[r] = tempArray[r];
+
+ if (recognizers[r] == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ }
+ }
+
+ if (U_SUCCESS(status)) {
+ umtx_lock(NULL);
+ if (fCSRecognizers == NULL) {
+ fCSRecognizers = recognizers;
+ fCSRecognizers_size = rCount;
+ }
+ umtx_unlock(NULL);
+ }
+
+ if (fCSRecognizers != recognizers) {
+ for (r = 0; r < rCount; r += 1) {
+ delete recognizers[r];
+ recognizers[r] = NULL;
+ }
+
+ DELETE_ARRAY(recognizers);
+ }
+
+ recognizers = NULL;
+ ucln_i18n_registerCleanup(UCLN_I18N_CSDET, csdet_cleanup);
+ }
+}
+
+CharsetDetector::CharsetDetector(UErrorCode &status)
+ : textIn(new InputText()), resultCount(0), fStripTags(FALSE), fFreshTextSet(FALSE)
+{
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ setRecognizers(status);
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ resultArray = (CharsetMatch **)uprv_malloc(sizeof(CharsetMatch *)*fCSRecognizers_size);
+
+ if (resultArray == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ for(int32_t i = 0; i < fCSRecognizers_size; i += 1) {
+ resultArray[i] = new CharsetMatch();
+
+ if (resultArray[i] == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ }
+}
+
+CharsetDetector::~CharsetDetector()
+{
+ delete textIn;
+
+ for(int32_t i = 0; i < fCSRecognizers_size; i += 1) {
+ delete resultArray[i];
+ }
+
+ uprv_free(resultArray);
+}
+
+void CharsetDetector::setText(const char *in, int32_t len)
+{
+ textIn->setText(in, len);
+ fFreshTextSet = TRUE;
+}
+
+UBool CharsetDetector::setStripTagsFlag(UBool flag)
+{
+ UBool temp = fStripTags;
+ fStripTags = flag;
+ fFreshTextSet = TRUE;
+ return temp;
+}
+
+UBool CharsetDetector::getStripTagsFlag() const
+{
+ return fStripTags;
+}
+
+void CharsetDetector::setDeclaredEncoding(const char *encoding, int32_t len) const
+{
+ textIn->setDeclaredEncoding(encoding,len);
+}
+
+int32_t CharsetDetector::getDetectableCount()
+{
+ UErrorCode status = U_ZERO_ERROR;
+
+ setRecognizers(status);
+
+ return fCSRecognizers_size;
+}
+
+const CharsetMatch *CharsetDetector::detect(UErrorCode &status)
+{
+ int32_t maxMatchesFound = 0;
+
+ detectAll(maxMatchesFound, status);
+
+ if(maxMatchesFound > 0) {
+ return resultArray[0];
+ } else {
+ return NULL;
+ }
+}
+
+const CharsetMatch * const *CharsetDetector::detectAll(int32_t &maxMatchesFound, UErrorCode &status)
+{
+ if(!textIn->isSet()) {
+ status = U_MISSING_RESOURCE_ERROR;// TODO: Need to set proper status code for input text not set
+
+ return NULL;
+ } else if(fFreshTextSet) {
+ CharsetRecognizer *csr;
+ int32_t detectResults;
+ int32_t confidence;
+
+ textIn->MungeInput(fStripTags);
+
+ // Iterate over all possible charsets, remember all that
+ // give a match quality > 0.
+ resultCount = 0;
+ for (int32_t i = 0; i < fCSRecognizers_size; i += 1) {
+ csr = fCSRecognizers[i];
+ detectResults = csr->match(textIn);
+ confidence = detectResults;
+
+ if (confidence > 0) {
+ resultArray[resultCount++]->set(textIn, csr, confidence);
+ }
+ }
+
+ for(int32_t i = resultCount; i < fCSRecognizers_size; i += 1) {
+ resultArray[i]->set(textIn, 0, 0);
+ }
+
+ uprv_sortArray(resultArray, resultCount, sizeof resultArray[0], charsetMatchComparator, NULL, TRUE, &status);
+ ////Bubble sort
+ //for(int32_t i = resultCount; i > 1; i -= 1) {
+ // for(int32_t j = 0; j < i-1; j += 1) {
+ // if(resultArray[j]->getConfidence() < resultArray[j+1]->getConfidence()) {
+ // CharsetMatch *temp = resultArray[j];
+ // resultArray[j] = resultArray[j+1];
+ // resultArray[j+1] = temp;
+ // }
+ // }
+ //}
+
+ fFreshTextSet = FALSE;
+ }
+
+ maxMatchesFound = resultCount;
+
+ return resultArray;
+}
+
+const char *CharsetDetector::getCharsetName(int32_t index, UErrorCode &status) const
+{
+ if( index > fCSRecognizers_size-1 || index < 0) {
+ status = U_INDEX_OUTOFBOUNDS_ERROR;
+
+ return 0;
+ } else {
+ return fCSRecognizers[index]->getName();
+ }
+}
+
+U_NAMESPACE_END
+
+U_CDECL_BEGIN
+typedef struct {
+ int32_t currIndex;
+} Context;
+
+
+
+static void U_CALLCONV
+enumClose(UEnumeration *en) {
+ if(en->context != NULL) {
+ DELETE_ARRAY(en->context);
+ }
+
+ DELETE_ARRAY(en);
+}
+
+static int32_t U_CALLCONV
+enumCount(UEnumeration *, UErrorCode *) {
+ return fCSRecognizers_size;
+}
+
+static const char* U_CALLCONV
+enumNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
+ if(((Context *)en->context)->currIndex >= fCSRecognizers_size) {
+ if(resultLength != NULL) {
+ *resultLength = 0;
+ }
+ return NULL;
+ }
+ const char *currName = fCSRecognizers[((Context *)en->context)->currIndex]->getName();
+ if(resultLength != NULL) {
+ *resultLength = (int32_t)uprv_strlen(currName);
+ }
+ ((Context *)en->context)->currIndex++;
+
+ return currName;
+}
+
+static void U_CALLCONV
+enumReset(UEnumeration *en, UErrorCode *) {
+ ((Context *)en->context)->currIndex = 0;
+}
+
+static const UEnumeration gCSDetEnumeration = {
+ NULL,
+ NULL,
+ enumClose,
+ enumCount,
+ uenum_unextDefault,
+ enumNext,
+ enumReset
+};
+
+U_CAPI UEnumeration * U_EXPORT2
+ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return 0;
+ }
+
+ /* Initialize recognized charsets. */
+ CharsetDetector::getDetectableCount();
+
+ UEnumeration *en = NEW_ARRAY(UEnumeration, 1);
+ memcpy(en, &gCSDetEnumeration, sizeof(UEnumeration));
+ en->context = (void*)NEW_ARRAY(Context, 1);
+ uprv_memset(en->context, 0, sizeof(Context));
+ return en;
+}
+U_CDECL_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csdetect.h b/Build/source/libs/icu-xetex/i18n/csdetect.h
new file mode 100644
index 00000000000..1cf323e30a6
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csdetect.h
@@ -0,0 +1,56 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSDETECT_H
+#define __CSDETECT_H
+
+#include "unicode/uobject.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+U_NAMESPACE_BEGIN
+
+class InputText;
+class CharsetRecognizer;
+class CharsetMatch;
+
+class CharsetDetector : public UMemory
+{
+private:
+ InputText *textIn;
+ CharsetMatch **resultArray;
+ int32_t resultCount;
+ UBool fStripTags; // If true, setText() will strip tags from input text.
+ UBool fFreshTextSet;
+ static void setRecognizers(UErrorCode &status);
+
+public:
+ CharsetDetector(UErrorCode &status);
+
+ ~CharsetDetector();
+
+ void setText(const char *in, int32_t len);
+
+ const CharsetMatch * const *detectAll(int32_t &maxMatchesFound, UErrorCode &status);
+
+ const CharsetMatch *detect(UErrorCode& status);
+
+ void setDeclaredEncoding(const char *encoding, int32_t len) const;
+
+ UBool setStripTagsFlag(UBool flag);
+
+ UBool getStripTagsFlag() const;
+
+ const char *getCharsetName(int32_t index, UErrorCode& status) const;
+
+ static int32_t getDetectableCount();
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSDETECT_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csmatch.cpp b/Build/source/libs/icu-xetex/i18n/csmatch.cpp
new file mode 100644
index 00000000000..f1d25d2dde9
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csmatch.cpp
@@ -0,0 +1,61 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+#include "unicode/unistr.h"
+#include "unicode/ucnv.h"
+
+#include "csmatch.h"
+
+#include "csrecog.h"
+#include "inputext.h"
+
+U_NAMESPACE_BEGIN
+
+CharsetMatch::CharsetMatch()
+ : csr(0), confidence(0)
+{
+ // nothing else to do.
+}
+
+void CharsetMatch::set(InputText *input, CharsetRecognizer *cr, int32_t conf)
+{
+ textIn = input;
+ csr = cr;
+ confidence = conf;
+}
+
+const char* CharsetMatch::getName()const
+{
+ return csr->getName();
+}
+
+const char* CharsetMatch::getLanguage()const
+{
+ return csr->getLanguage();
+}
+
+int32_t CharsetMatch::getConfidence()const
+{
+ return confidence;
+}
+
+int32_t CharsetMatch::getUChars(UChar *buf, int32_t cap, UErrorCode *status) const
+{
+ UConverter *conv = ucnv_open(getName(), status);
+ int32_t result = ucnv_toUChars(conv, buf, cap, (const char *) textIn->fRawInput, textIn->fRawLength, status);
+
+ ucnv_close(conv);
+
+ return result;
+}
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csmatch.h b/Build/source/libs/icu-xetex/i18n/csmatch.h
new file mode 100644
index 00000000000..50b78a3a1dc
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csmatch.h
@@ -0,0 +1,44 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSMATCH_H
+#define __CSMATCH_H
+
+#include "unicode/uobject.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+U_NAMESPACE_BEGIN
+
+class InputText;
+class CharsetRecognizer;
+
+class CharsetMatch : public UMemory
+{
+ private:
+ CharsetRecognizer *csr;
+ InputText *textIn;
+ int32_t confidence;
+
+ public:
+ CharsetMatch();
+
+ void set(InputText *input, CharsetRecognizer *cr, int32_t conf);
+
+ const char *getName()const;
+
+ const char *getLanguage()const;
+
+ int32_t getConfidence()const;
+
+ int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const;
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSMATCH_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csr2022.cpp b/Build/source/libs/icu-xetex/i18n/csr2022.cpp
new file mode 100644
index 00000000000..c7165f1c0d3
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csr2022.cpp
@@ -0,0 +1,172 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "cstring.h"
+
+#include "csr2022.h"
+
+U_NAMESPACE_BEGIN
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+/**
+ * Matching function shared among the 2022 detectors JP, CN and KR
+ * Counts up the number of legal an unrecognized escape sequences in
+ * the sample of text, and computes a score based on the total number &
+ * the proportion that fit the encoding.
+ *
+ *
+ * @param text the byte buffer containing text to analyse
+ * @param textLen the size of the text in the byte.
+ * @param escapeSequences the byte escape sequences to test for.
+ * @return match quality, in the range of 0-100.
+ */
+int32_t CharsetRecog_2022::match_2022(const uint8_t *text, int32_t textLen, const uint8_t escapeSequences[][5], int32_t escapeSequences_length)
+{
+ int32_t i, j;
+ int32_t escN;
+ int32_t hits = 0;
+ int32_t misses = 0;
+ int32_t shifts = 0;
+ int32_t quality;
+
+ i = 0;
+ while(i < textLen) {
+ if(text[i] == 0x1B) {
+ escN = 0;
+ while(escN < escapeSequences_length) {
+ int32_t seq_length = uprv_strlen((const char *) escapeSequences[escN]);
+ const uint8_t *seq = escapeSequences[escN];
+
+ j = 1;
+ while(j < seq_length) {
+ if(seq[j] != text[i+j]) {
+ goto checkEscapes;
+ }
+
+ j += 1;
+ }
+
+ hits += 1;
+ i += seq_length-1;
+ goto scanInput;
+checkEscapes:
+ escN += 1;
+ }
+
+ misses += 1;
+ }
+
+ if( text[i]== 0x0e || text[i] == 0x0f){
+ shifts += 1;
+ }
+
+scanInput:
+ i += 1;
+ }
+
+ if (hits == 0) {
+ return 0;
+ }
+
+ //
+ // Initial quality is based on relative proportion of recongized vs.
+ // unrecognized escape sequences.
+ // All good: quality = 100;
+ // half or less good: quality = 0;
+ // linear inbetween.
+ quality = (100*hits - 100*misses) / (hits + misses);
+
+ // Back off quality if there were too few escape sequences seen.
+ // Include shifts in this computation, so that KR does not get penalized
+ // for having only a single Escape sequence, but many shifts.
+ if (hits+shifts < 5) {
+ quality -= (5-(hits+shifts))*10;
+ }
+
+ if (quality < 0) {
+ quality = 0;
+ }
+
+ return quality;
+}
+
+
+static const uint8_t escapeSequences_2022JP[][5] = {
+ {0x1b, 0x24, 0x28, 0x43, 0x00}, // KS X 1001:1992
+ {0x1b, 0x24, 0x28, 0x44, 0x00}, // JIS X 212-1990
+ {0x1b, 0x24, 0x40, 0x00, 0x00}, // JIS C 6226-1978
+ {0x1b, 0x24, 0x41, 0x00, 0x00}, // GB 2312-80
+ {0x1b, 0x24, 0x42, 0x00, 0x00}, // JIS X 208-1983
+ {0x1b, 0x26, 0x40, 0x00, 0x00}, // JIS X 208 1990, 1997
+ {0x1b, 0x28, 0x42, 0x00, 0x00}, // ASCII
+ {0x1b, 0x28, 0x48, 0x00, 0x00}, // JIS-Roman
+ {0x1b, 0x28, 0x49, 0x00, 0x00}, // Half-width katakana
+ {0x1b, 0x28, 0x4a, 0x00, 0x00}, // JIS-Roman
+ {0x1b, 0x2e, 0x41, 0x00, 0x00}, // ISO 8859-1
+ {0x1b, 0x2e, 0x46, 0x00, 0x00} // ISO 8859-7
+};
+
+static const uint8_t escapeSequences_2022KR[][5] = {
+ {0x1b, 0x24, 0x29, 0x43, 0x00}
+};
+
+static const uint8_t escapeSequences_2022CN[][5] = {
+ {0x1b, 0x24, 0x29, 0x41, 0x00}, // GB 2312-80
+ {0x1b, 0x24, 0x29, 0x47, 0x00}, // CNS 11643-1992 Plane 1
+ {0x1b, 0x24, 0x2A, 0x48, 0x00}, // CNS 11643-1992 Plane 2
+ {0x1b, 0x24, 0x29, 0x45, 0x00}, // ISO-IR-165
+ {0x1b, 0x24, 0x2B, 0x49, 0x00}, // CNS 11643-1992 Plane 3
+ {0x1b, 0x24, 0x2B, 0x4A, 0x00}, // CNS 11643-1992 Plane 4
+ {0x1b, 0x24, 0x2B, 0x4B, 0x00}, // CNS 11643-1992 Plane 5
+ {0x1b, 0x24, 0x2B, 0x4C, 0x00}, // CNS 11643-1992 Plane 6
+ {0x1b, 0x24, 0x2B, 0x4D, 0x00}, // CNS 11643-1992 Plane 7
+ {0x1b, 0x4e, 0x00, 0x00, 0x00}, // SS2
+ {0x1b, 0x4f, 0x00, 0x00, 0x00}, // SS3
+};
+
+const char *CharsetRecog_2022JP::getName() const
+{
+ return "ISO-2022-JP";
+}
+
+int32_t CharsetRecog_2022JP::match(InputText *textIn)
+{
+ return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022JP, ARRAY_SIZE(escapeSequences_2022JP));
+}
+
+const char *CharsetRecog_2022KR::getName() const
+{
+ return "ISO-2022-KR";
+}
+
+int32_t CharsetRecog_2022KR::match(InputText *textIn)
+{
+ return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022KR, ARRAY_SIZE(escapeSequences_2022KR));
+}
+
+const char *CharsetRecog_2022CN::getName() const
+{
+ return "ISO-2022-CN";
+}
+
+int32_t CharsetRecog_2022CN::match(InputText *textIn)
+{
+ return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022CN, ARRAY_SIZE(escapeSequences_2022CN));
+}
+
+CharsetRecog_2022::~CharsetRecog_2022()
+{
+ // nothing to do
+}
+
+U_NAMESPACE_END
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csr2022.h b/Build/source/libs/icu-xetex/i18n/csr2022.h
new file mode 100644
index 00000000000..5d34711bdc3
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csr2022.h
@@ -0,0 +1,86 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSR2022_H
+#define __CSR2022_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * class CharsetRecog_2022 part of the ICU charset detection imlementation.
+ * This is a superclass for the individual detectors for
+ * each of the detectable members of the ISO 2022 family
+ * of encodings.
+ *
+ * The separate classes are nested within this class.
+ *
+ * @internal
+ */
+class CharsetRecog_2022 : public CharsetRecognizer
+{
+
+public:
+ virtual ~CharsetRecog_2022() = 0;
+
+protected:
+
+ /**
+ * Matching function shared among the 2022 detectors JP, CN and KR
+ * Counts up the number of legal an unrecognized escape sequences in
+ * the sample of text, and computes a score based on the total number &
+ * the proportion that fit the encoding.
+ *
+ *
+ * @param text the byte buffer containing text to analyse
+ * @param textLen the size of the text in the byte.
+ * @param escapeSequences the byte escape sequences to test for.
+ * @return match quality, in the range of 0-100.
+ */
+ int32_t match_2022(const uint8_t *text, int32_t textLen, const uint8_t escapeSequences[][5], int32_t escapeSequences_length);
+
+};
+
+class CharsetRecog_2022JP :public CharsetRecog_2022
+{
+public:
+ virtual ~CharsetRecog_2022JP() {}
+
+ const char *getName() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_2022KR :public CharsetRecog_2022 {
+public:
+ virtual ~CharsetRecog_2022KR() {}
+
+ const char *getName() const;
+
+ int32_t match(InputText *textIn);
+
+};
+
+class CharsetRecog_2022CN :public CharsetRecog_2022
+{
+public:
+ virtual ~CharsetRecog_2022CN() {}
+
+ const char* getName() const;
+
+ int32_t match(InputText *textIn);
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSR2022_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csrecog.cpp b/Build/source/libs/icu-xetex/i18n/csrecog.cpp
new file mode 100644
index 00000000000..ba70b1547f8
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrecog.cpp
@@ -0,0 +1,28 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+CharsetRecognizer::~CharsetRecognizer()
+{
+ // nothing to do.
+}
+
+const char *CharsetRecognizer::getLanguage() const
+{
+ return "";
+}
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csrecog.h b/Build/source/libs/icu-xetex/i18n/csrecog.h
new file mode 100644
index 00000000000..75cf94f49f4
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrecog.h
@@ -0,0 +1,42 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSRECOG_H
+#define __CSRECOG_H
+
+#include "unicode/uobject.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "inputext.h"
+
+U_NAMESPACE_BEGIN
+
+class CharsetRecognizer : public UMemory
+{
+ public:
+ /**
+ * Get the IANA name of this charset.
+ * @return the charset name.
+ */
+ virtual const char *getName() const = 0;
+
+ /**
+ * Get the ISO language code for this charset.
+ * @return the language code, or <code>null</code> if the language cannot be determined.
+ */
+ virtual const char *getLanguage() const;
+
+ virtual int32_t match(InputText *textIn) = 0;
+
+ virtual ~CharsetRecognizer();
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSRECOG_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csrmbcs.cpp b/Build/source/libs/icu-xetex/i18n/csrmbcs.cpp
new file mode 100644
index 00000000000..11f70a78861
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrmbcs.cpp
@@ -0,0 +1,517 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrmbcs.h"
+
+#include <math.h>
+
+U_NAMESPACE_BEGIN
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#define min(x,y) (((x)<(y))?(x):(y))
+
+const int32_t commonChars_sjis [] = {
+// TODO: This set of data comes from the character frequency-
+// of-occurence analysis tool. The data needs to be moved
+// into a resource and loaded from there.
+0x8140, 0x8141, 0x8142, 0x8145, 0x815b, 0x8169, 0x816a, 0x8175, 0x8176, 0x82a0,
+0x82a2, 0x82a4, 0x82a9, 0x82aa, 0x82ab, 0x82ad, 0x82af, 0x82b1, 0x82b3, 0x82b5,
+0x82b7, 0x82bd, 0x82be, 0x82c1, 0x82c4, 0x82c5, 0x82c6, 0x82c8, 0x82c9, 0x82cc,
+0x82cd, 0x82dc, 0x82e0, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82f0, 0x82f1, 0x8341,
+0x8343, 0x834e, 0x834f, 0x8358, 0x835e, 0x8362, 0x8367, 0x8375, 0x8376, 0x8389,
+0x838a, 0x838b, 0x838d, 0x8393, 0x8e96, 0x93fa, 0x95aa};
+
+const int32_t commonChars_euc_jp[] = {
+// TODO: This set of data comes from the character frequency-
+// of-occurence analysis tool. The data needs to be moved
+// into a resource and loaded from there.
+0xa1a1, 0xa1a2, 0xa1a3, 0xa1a6, 0xa1bc, 0xa1ca, 0xa1cb, 0xa1d6, 0xa1d7, 0xa4a2,
+0xa4a4, 0xa4a6, 0xa4a8, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4af, 0xa4b1, 0xa4b3,
+0xa4b5, 0xa4b7, 0xa4b9, 0xa4bb, 0xa4bd, 0xa4bf, 0xa4c0, 0xa4c1, 0xa4c3, 0xa4c4,
+0xa4c6, 0xa4c7, 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb, 0xa4ce, 0xa4cf, 0xa4d0, 0xa4de,
+0xa4df, 0xa4e1, 0xa4e2, 0xa4e4, 0xa4e8, 0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ef,
+0xa4f2, 0xa4f3, 0xa5a2, 0xa5a3, 0xa5a4, 0xa5a6, 0xa5a7, 0xa5aa, 0xa5ad, 0xa5af,
+0xa5b0, 0xa5b3, 0xa5b5, 0xa5b7, 0xa5b8, 0xa5b9, 0xa5bf, 0xa5c3, 0xa5c6, 0xa5c7,
+0xa5c8, 0xa5c9, 0xa5cb, 0xa5d0, 0xa5d5, 0xa5d6, 0xa5d7, 0xa5de, 0xa5e0, 0xa5e1,
+0xa5e5, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5f3, 0xb8a9, 0xb9d4, 0xbaee,
+0xbbc8, 0xbef0, 0xbfb7, 0xc4ea, 0xc6fc, 0xc7bd, 0xcab8, 0xcaf3, 0xcbdc, 0xcdd1};
+
+const int32_t commonChars_euc_kr[] = {
+// TODO: This set of data comes from the character frequency-
+// of-occurence analysis tool. The data needs to be moved
+// into a resource and loaded from there.
+0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa, 0xb0fc,
+0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2, 0xb4cf, 0xb4d9,
+0xb4eb, 0xb5a5, 0xb5b5, 0xb5bf, 0xb5c7, 0xb5e9, 0xb6f3, 0xb7af, 0xb7c2, 0xb7ce,
+0xb8a6, 0xb8ae, 0xb8b6, 0xb8b8, 0xb8bb, 0xb8e9, 0xb9ab, 0xb9ae, 0xb9cc, 0xb9ce,
+0xb9fd, 0xbab8, 0xbace, 0xbad0, 0xbaf1, 0xbbe7, 0xbbf3, 0xbbfd, 0xbcad, 0xbcba,
+0xbcd2, 0xbcf6, 0xbdba, 0xbdc0, 0xbdc3, 0xbdc5, 0xbec6, 0xbec8, 0xbedf, 0xbeee,
+0xbef8, 0xbefa, 0xbfa1, 0xbfa9, 0xbfc0, 0xbfe4, 0xbfeb, 0xbfec, 0xbff8, 0xc0a7,
+0xc0af, 0xc0b8, 0xc0ba, 0xc0bb, 0xc0bd, 0xc0c7, 0xc0cc, 0xc0ce, 0xc0cf, 0xc0d6,
+0xc0da, 0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6,
+0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5, 0xc8ad};
+
+const int32_t commonChars_big5[] = {
+// TODO: This set of data comes from the character frequency-
+// of-occurence analysis tool. The data needs to be moved
+// into a resource and loaded from there.
+0xa140, 0xa141, 0xa142, 0xa143, 0xa147, 0xa149, 0xa175, 0xa176, 0xa440, 0xa446,
+0xa447, 0xa448, 0xa451, 0xa454, 0xa457, 0xa464, 0xa46a, 0xa46c, 0xa477, 0xa4a3,
+0xa4a4, 0xa4a7, 0xa4c1, 0xa4ce, 0xa4d1, 0xa4df, 0xa4e8, 0xa4fd, 0xa540, 0xa548,
+0xa558, 0xa569, 0xa5cd, 0xa5e7, 0xa657, 0xa661, 0xa662, 0xa668, 0xa670, 0xa6a8,
+0xa6b3, 0xa6b9, 0xa6d3, 0xa6db, 0xa6e6, 0xa6f2, 0xa740, 0xa751, 0xa759, 0xa7da,
+0xa8a3, 0xa8a5, 0xa8ad, 0xa8d1, 0xa8d3, 0xa8e4, 0xa8fc, 0xa9c0, 0xa9d2, 0xa9f3,
+0xaa6b, 0xaaba, 0xaabe, 0xaacc, 0xaafc, 0xac47, 0xac4f, 0xacb0, 0xacd2, 0xad59,
+0xaec9, 0xafe0, 0xb0ea, 0xb16f, 0xb2b3, 0xb2c4, 0xb36f, 0xb44c, 0xb44e, 0xb54c,
+0xb5a5, 0xb5bd, 0xb5d0, 0xb5d8, 0xb671, 0xb7ed, 0xb867, 0xb944, 0xbad8, 0xbb44,
+0xbba1, 0xbdd1, 0xc2c4, 0xc3b9, 0xc440, 0xc45f};
+
+const int32_t commonChars_gb_18030[] = {
+// TODO: This set of data comes from the character frequency-
+// of-occurence analysis tool. The data needs to be moved
+// into a resource and loaded from there.
+0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1b0, 0xa1b1, 0xa1f1, 0xa1f3, 0xa3a1, 0xa3ac,
+0xa3ba, 0xb1a8, 0xb1b8, 0xb1be, 0xb2bb, 0xb3c9, 0xb3f6, 0xb4f3, 0xb5bd, 0xb5c4,
+0xb5e3, 0xb6af, 0xb6d4, 0xb6e0, 0xb7a2, 0xb7a8, 0xb7bd, 0xb7d6, 0xb7dd, 0xb8b4,
+0xb8df, 0xb8f6, 0xb9ab, 0xb9c9, 0xb9d8, 0xb9fa, 0xb9fd, 0xbacd, 0xbba7, 0xbbd6,
+0xbbe1, 0xbbfa, 0xbcbc, 0xbcdb, 0xbcfe, 0xbdcc, 0xbecd, 0xbedd, 0xbfb4, 0xbfc6,
+0xbfc9, 0xc0b4, 0xc0ed, 0xc1cb, 0xc2db, 0xc3c7, 0xc4dc, 0xc4ea, 0xc5cc, 0xc6f7,
+0xc7f8, 0xc8ab, 0xc8cb, 0xc8d5, 0xc8e7, 0xc9cf, 0xc9fa, 0xcab1, 0xcab5, 0xcac7,
+0xcad0, 0xcad6, 0xcaf5, 0xcafd, 0xccec, 0xcdf8, 0xceaa, 0xcec4, 0xced2, 0xcee5,
+0xcfb5, 0xcfc2, 0xcfd6, 0xd0c2, 0xd0c5, 0xd0d0, 0xd0d4, 0xd1a7, 0xd2aa, 0xd2b2,
+0xd2b5, 0xd2bb, 0xd2d4, 0xd3c3, 0xd3d0, 0xd3fd, 0xd4c2, 0xd4da, 0xd5e2, 0xd6d0};
+
+static int32_t binarySearch(const int32_t *array, int32_t len, int32_t value)
+{
+ int32_t start = 0, end = len-1;
+ int32_t mid = (start+end)/2;
+
+ while(start <= end) {
+ if(array[mid] == value) {
+ return mid;
+ }
+
+ if(array[mid] < value){
+ start = mid+1;
+ } else {
+ end = mid-1;
+ }
+
+ mid = (start+end)/2;
+ }
+
+ return -1;
+}
+
+IteratedChar::IteratedChar():charValue(0), index(0), nextIndex(0), error(FALSE), done(FALSE)
+{
+ // nothing else to do.
+}
+
+void IteratedChar::reset()
+{
+ charValue = 0;
+ index = -1;
+ nextIndex = 0;
+ error = FALSE;
+ done = FALSE;
+}
+
+int32_t IteratedChar::nextByte(InputText *det)
+{
+ if (nextIndex >= det->fRawLength) {
+ done = TRUE;
+
+ return -1;
+ }
+
+ return det->fRawInput[nextIndex++];
+}
+
+CharsetRecog_mbcs::~CharsetRecog_mbcs()
+{
+ // nothing to do.
+}
+
+int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const int32_t commonChars[], int32_t commonCharsLen) {
+ int singleByteCharCount = 0;
+ int doubleByteCharCount = 0;
+ int commonCharCount = 0;
+ int badCharCount = 0;
+ int totalCharCount = 0;
+ int confidence = 0;
+ IteratedChar *iter = new IteratedChar();
+
+ // {
+ for (iter->reset(); nextChar(iter, det);) {
+ totalCharCount += 1;
+
+ if (iter->error) {
+ badCharCount += 1;
+ } else {
+ if (iter->charValue <= 0xFF) {
+ singleByteCharCount += 1;
+ } else {
+ doubleByteCharCount += 1;
+
+ if (commonChars != 0) {
+ if (binarySearch(commonChars, commonCharsLen, iter->charValue) >= 0){
+ commonCharCount += 1;
+ }
+ }
+ }
+ }
+
+
+ if (badCharCount >= 2 && badCharCount*5 >= doubleByteCharCount) {
+ // Bail out early if the byte data is not matching the encoding scheme.
+ // break detectBlock;
+ delete iter;
+ return confidence;
+ }
+ }
+
+ delete iter;
+
+ if (doubleByteCharCount <= 10 && badCharCount == 0) {
+ // Not many multi-byte chars.
+ // ASCII or ISO file? It's probably not our encoding,
+ // but is not incompatible with our encoding, so don't give it a zero.
+ confidence = 10;
+
+ return confidence;
+ }
+
+ //
+ // No match if there are too many characters that don't fit the encoding scheme.
+ // (should we have zero tolerance for these?)
+ //
+ if (doubleByteCharCount < 20*badCharCount) {
+ confidence = 0;
+
+ return confidence;
+ }
+
+ if (commonChars == 0) {
+ // We have no statistics on frequently occuring characters.
+ // Assess confidence purely on having a reasonable number of
+ // multi-byte characters (the more the better)
+ confidence = 30 + doubleByteCharCount - 20*badCharCount;
+
+ if (confidence > 100) {
+ confidence = 100;
+ }
+ } else {
+ //
+ // Frequency of occurence statistics exist.
+ //
+
+ double maxVal = log10((double)doubleByteCharCount / 4); /*(float)?*/
+ double scaleFactor = 90.0 / maxVal;
+ confidence = (int32_t)(log10((double)commonCharCount+1) * scaleFactor + 10.0);
+
+ confidence = min(confidence, 100);
+ }
+
+ if (confidence < 0) {
+ confidence = 0;
+ }
+
+ return confidence;
+}
+
+CharsetRecog_sjis::~CharsetRecog_sjis()
+{
+ // nothing to do
+}
+
+UBool CharsetRecog_sjis::nextChar(IteratedChar* it, InputText* det) {
+ it->index = it->nextIndex;
+ it->error = FALSE;
+
+ int32_t firstByte = it->charValue = it->nextByte(det);
+
+ if (firstByte < 0) {
+ return FALSE;
+ }
+
+ if (firstByte <= 0x7F || (firstByte > 0xA0 && firstByte <= 0xDF)) {
+ return TRUE;
+ }
+
+ int32_t secondByte = it->nextByte(det);
+
+ if (secondByte < 0) {
+ return FALSE;
+ }
+ it->charValue = (firstByte << 8) | secondByte;
+ if (! ((secondByte >= 0x40 && secondByte <= 0x7F) || (secondByte >= 0x80 && secondByte <= 0xFE))) {
+ // Illegal second byte value.
+ it->error = TRUE;
+ }
+
+ return TRUE;
+}
+
+int32_t CharsetRecog_sjis::match(InputText* det)
+{
+ return match_mbcs(det, commonChars_sjis, ARRAY_SIZE(commonChars_sjis));
+}
+
+const char *CharsetRecog_sjis::getName() const
+{
+ return "Shift_JIS";
+}
+
+const char *CharsetRecog_sjis::getLanguage() const
+{
+ return "ja";
+}
+
+CharsetRecog_euc::~CharsetRecog_euc()
+{
+ // nothing to do
+}
+
+UBool CharsetRecog_euc::nextChar(IteratedChar* it, InputText* det) {
+ int32_t firstByte = 0;
+ int32_t secondByte = 0;
+ int32_t thirdByte = 0;
+ // int32_t fourthByte = 0;
+
+ it->index = it->nextIndex;
+ it->error = FALSE;
+ firstByte = it->charValue = it->nextByte(det);
+
+ if (firstByte < 0) {
+ // Ran off the end of the input data
+ it->done = TRUE;
+
+ return (! it->done);
+ }
+
+ if (firstByte <= 0x8D) {
+ // single byte char
+ return (! it->done);
+ }
+
+ secondByte = it->nextByte(det);
+ it->charValue = (it->charValue << 8) | secondByte;
+
+ if (firstByte >= 0xA1 && firstByte <= 0xFE) {
+ // Two byte Char
+ if (secondByte < 0xA1) {
+ it->error = TRUE;
+ }
+
+ return (! it->done);
+ }
+
+ if (firstByte == 0x8E) {
+ // Code Set 2.
+ // In EUC-JP, total char size is 2 bytes, only one byte of actual char value.
+ // In EUC-TW, total char size is 4 bytes, three bytes contribute to char value.
+ // We don't know which we've got.
+ // Treat it like EUC-JP. If the data really was EUC-TW, the following two
+ // bytes will look like a well formed 2 byte char.
+ if (secondByte < 0xA1) {
+ it->error = TRUE;
+ }
+
+ return (! it->done);
+ }
+
+ if (firstByte == 0x8F) {
+ // Code set 3.
+ // Three byte total char size, two bytes of actual char value.
+ thirdByte = it->nextByte(det);
+ it->charValue = (it->charValue << 8) | thirdByte;
+
+ if (thirdByte < 0xa1) {
+ it->error = TRUE;
+ }
+ }
+
+ return (! it->done);
+
+}
+
+CharsetRecog_euc_jp::~CharsetRecog_euc_jp()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_euc_jp::getName() const
+{
+ return "EUC-JP";
+}
+
+const char *CharsetRecog_euc_jp::getLanguage() const
+{
+ return "ja";
+}
+
+int32_t CharsetRecog_euc_jp::match(InputText *det)
+{
+ return match_mbcs(det, commonChars_euc_jp, ARRAY_SIZE(commonChars_euc_jp));
+}
+
+CharsetRecog_euc_kr::~CharsetRecog_euc_kr()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_euc_kr::getName() const
+{
+ return "EUC-KR";
+}
+
+const char *CharsetRecog_euc_kr::getLanguage() const
+{
+ return "ko";
+}
+
+int32_t CharsetRecog_euc_kr::match(InputText *det)
+{
+ return match_mbcs(det, commonChars_euc_kr, ARRAY_SIZE(commonChars_euc_kr));
+}
+
+CharsetRecog_big5::~CharsetRecog_big5()
+{
+ // nothing to do
+}
+
+UBool CharsetRecog_big5::nextChar(IteratedChar* it, InputText* det)
+{
+ int32_t firstByte;
+
+ it->index = it->nextIndex;
+ it->error = FALSE;
+ firstByte = it->charValue = it->nextByte(det);
+
+ if (firstByte < 0) {
+ return FALSE;
+ }
+
+ if (firstByte <= 0x7F || firstByte == 0xFF) {
+ // single byte character.
+ return TRUE;
+ }
+
+ int32_t secondByte = it->nextByte(det);
+
+ if (secondByte < 0) {
+ return FALSE;
+ }
+
+ it->charValue = (it->charValue << 8) | secondByte;
+
+ if (secondByte < 0x40 ||
+ secondByte == 0x7F ||
+ secondByte == 0xFF) {
+ it->error = TRUE;
+ }
+
+ return TRUE;
+}
+
+const char *CharsetRecog_big5::getName() const
+{
+ return "Big5";
+}
+
+const char *CharsetRecog_big5::getLanguage() const
+{
+ return "zh";
+}
+
+int32_t CharsetRecog_big5::match(InputText *det)
+{
+ return match_mbcs(det, commonChars_big5, ARRAY_SIZE(commonChars_big5));
+}
+
+CharsetRecog_gb_18030::~CharsetRecog_gb_18030()
+{
+ // nothing to do
+}
+
+UBool CharsetRecog_gb_18030::nextChar(IteratedChar* it, InputText* det) {
+ int32_t firstByte = 0;
+ int32_t secondByte = 0;
+ int32_t thirdByte = 0;
+ int32_t fourthByte = 0;
+
+ it->index = it->nextIndex;
+ it->error = FALSE;
+ firstByte = it->charValue = it->nextByte(det);
+
+ if (firstByte < 0) {
+ // Ran off the end of the input data
+ it->done = TRUE;
+
+ return (! it->done);
+ }
+
+ if (firstByte <= 0x80) {
+ // single byte char
+ return (! it->done);
+ }
+
+ secondByte = it->nextByte(det);
+ it->charValue = (it->charValue << 8) | secondByte;
+
+ if (firstByte >= 0x81 && firstByte <= 0xFE) {
+ // Two byte Char
+ if ((secondByte >= 0x40 && secondByte <= 0x7E) || (secondByte >=80 && secondByte <= 0xFE)) {
+ return (! it->done);
+ }
+
+ // Four byte char
+ if (secondByte >= 0x30 && secondByte <= 0x39) {
+ thirdByte = it->nextByte(det);
+
+ if (thirdByte >= 0x81 && thirdByte <= 0xFE) {
+ fourthByte = it->nextByte(det);
+
+ if (fourthByte >= 0x30 && fourthByte <= 0x39) {
+ it->charValue = (it->charValue << 16) | (thirdByte << 8) | fourthByte;
+
+ return (! it->done);
+ }
+ }
+ }
+
+ it->error = TRUE;
+
+ return (! it->done);
+ }
+
+ return (! it->done);
+}
+
+const char *CharsetRecog_gb_18030::getName() const
+{
+ return "GB18030";
+}
+
+const char *CharsetRecog_gb_18030::getLanguage() const
+{
+ return "zh";
+}
+
+int32_t CharsetRecog_gb_18030::match(InputText *det)
+{
+ return match_mbcs(det, commonChars_gb_18030, ARRAY_SIZE(commonChars_gb_18030));
+}
+
+U_NAMESPACE_END
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csrmbcs.h b/Build/source/libs/icu-xetex/i18n/csrmbcs.h
new file mode 100644
index 00000000000..69457f6c22a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrmbcs.h
@@ -0,0 +1,205 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSRMBCS_H
+#define __CSRMBCS_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+// "Character" iterated character class.
+// Recognizers for specific mbcs encodings make their "characters" available
+// by providing a nextChar() function that fills in an instance of IteratedChar
+// with the next char from the input.
+// The returned characters are not converted to Unicode, but remain as the raw
+// bytes (concatenated into an int) from the codepage data.
+//
+// For Asian charsets, use the raw input rather than the input that has been
+// stripped of markup. Detection only considers multi-byte chars, effectively
+// stripping markup anyway, and double byte chars do occur in markup too.
+//
+class IteratedChar : public UMemory
+{
+public:
+ int32_t charValue; // 1-4 bytes from the raw input data
+ int32_t index;
+ int32_t nextIndex;
+ UBool error;
+ UBool done;
+
+public:
+ IteratedChar();
+ void reset();
+ int32_t nextByte(InputText* det);
+};
+
+
+class CharsetRecog_mbcs : public CharsetRecognizer {
+
+protected:
+ /**
+ * Test the match of this charset with the input text data
+ * which is obtained via the CharsetDetector object.
+ *
+ * @param det The CharsetDetector, which contains the input text
+ * to be checked for being in this charset.
+ * @return Two values packed into one int (Damn java, anyhow)
+ * <br/>
+ * bits 0-7: the match confidence, ranging from 0-100
+ * <br/>
+ * bits 8-15: The match reason, an enum-like value.
+ */
+ int32_t match_mbcs(InputText* det, const int32_t commonChars[], int32_t commonCharsLen);
+
+public:
+
+ virtual ~CharsetRecog_mbcs();
+
+ /**
+ * Get the IANA name of this charset.
+ * @return the charset name.
+ */
+
+ const char *getName() const = 0;
+ const char *getLanguage() const = 0;
+ int32_t match(InputText* det) = 0;
+
+ /**
+ * Get the next character (however many bytes it is) from the input data
+ * Subclasses for specific charset encodings must implement this function
+ * to get characters according to the rules of their encoding scheme.
+ *
+ * This function is not a method of class IteratedChar only because
+ * that would require a lot of extra derived classes, which is awkward.
+ * @param it The IteratedChar "struct" into which the returned char is placed.
+ * @param det The charset detector, which is needed to get at the input byte data
+ * being iterated over.
+ * @return True if a character was returned, false at end of input.
+ */
+ virtual UBool nextChar(IteratedChar *it, InputText *textIn) = 0;
+
+};
+
+
+/**
+ * Shift-JIS charset recognizer.
+ *
+ */
+class CharsetRecog_sjis : public CharsetRecog_mbcs {
+public:
+ virtual ~CharsetRecog_sjis();
+
+ UBool nextChar(IteratedChar *it, InputText *det);
+
+ int32_t match(InputText *det);
+
+ const char *getName() const;
+ const char *getLanguage() const;
+
+};
+
+
+/**
+ * EUC charset recognizers. One abstract class that provides the common function
+ * for getting the next character according to the EUC encoding scheme,
+ * and nested derived classes for EUC_KR, EUC_JP, EUC_CN.
+ *
+ */
+class CharsetRecog_euc : public CharsetRecog_mbcs
+{
+public:
+ virtual ~CharsetRecog_euc();
+
+ const char *getName() const = 0;
+ const char *getLanguage() const = 0;
+
+ int32_t match(InputText* det) = 0;
+ /*
+ * (non-Javadoc)
+ * Get the next character value for EUC based encodings.
+ * Character "value" is simply the raw bytes that make up the character
+ * packed into an int.
+ */
+ UBool nextChar(IteratedChar *it, InputText *det);
+};
+
+/**
+ * The charset recognize for EUC-JP. A singleton instance of this class
+ * is created and kept by the public CharsetDetector class
+ */
+class CharsetRecog_euc_jp : public CharsetRecog_euc
+{
+public:
+ virtual ~CharsetRecog_euc_jp();
+
+ const char *getName() const;
+ const char *getLanguage() const;
+
+ int32_t match(InputText *det);
+};
+
+/**
+ * The charset recognize for EUC-KR. A singleton instance of this class
+ * is created and kept by the public CharsetDetector class
+ */
+class CharsetRecog_euc_kr : public CharsetRecog_euc
+{
+public:
+ virtual ~CharsetRecog_euc_kr();
+
+ const char *getName() const;
+ const char *getLanguage() const;
+
+ int32_t match(InputText *det);
+};
+
+/**
+ *
+ * Big5 charset recognizer.
+ *
+ */
+class CharsetRecog_big5 : public CharsetRecog_mbcs
+{
+public:
+ virtual ~CharsetRecog_big5();
+
+ UBool nextChar(IteratedChar* it, InputText* det);
+
+ const char *getName() const;
+ const char *getLanguage() const;
+
+ int32_t match(InputText *det);
+};
+
+
+/**
+ *
+ * GB-18030 recognizer. Uses simplified Chinese statistics.
+ *
+ */
+class CharsetRecog_gb_18030 : public CharsetRecog_mbcs
+{
+public:
+ virtual ~CharsetRecog_gb_18030();
+
+ UBool nextChar(IteratedChar* it, InputText* det);
+
+ const char *getName() const;
+ const char *getLanguage() const;
+
+ int32_t match(InputText *det);
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSRMBCS_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csrsbcs.cpp b/Build/source/libs/icu-xetex/i18n/csrsbcs.cpp
new file mode 100644
index 00000000000..ddf5aedf520
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrsbcs.cpp
@@ -0,0 +1,1099 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+#include "csrsbcs.h"
+
+#include <stdio.h>
+
+#define N_GRAM_SIZE 3
+#define N_GRAM_MASK 0xFFFFFF
+
+U_NAMESPACE_BEGIN
+
+NGramParser::NGramParser(const int32_t *theNgramList, const uint8_t *theCharMap)
+ :byteIndex(0), ngram(0)
+{
+ ngramList = theNgramList;
+ charMap = theCharMap;
+
+ ngramCount = hitCount = 0;
+}
+
+/*
+ * Binary search for value in table, which must have exactly 64 entries.
+ */
+
+int32_t NGramParser::search(const int32_t *table, int32_t value)
+{
+ int32_t index = 0;
+
+ if (table[index + 32] <= value) {
+ index += 32;
+ }
+
+ if (table[index + 16] <= value) {
+ index += 16;
+ }
+
+ if (table[index + 8] <= value) {
+ index += 8;
+ }
+
+ if (table[index + 4] <= value) {
+ index += 4;
+ }
+
+ if (table[index + 2] <= value) {
+ index += 2;
+ }
+
+ if (table[index + 1] <= value) {
+ index += 1;
+ }
+
+ if (table[index] > value) {
+ index -= 1;
+ }
+
+ if (index < 0 || table[index] != value) {
+ return -1;
+ }
+
+ return index;
+}
+
+void NGramParser::lookup(int32_t thisNgram)
+{
+ ngramCount += 1;
+
+ if (search(ngramList, thisNgram) >= 0) {
+ hitCount += 1;
+ }
+
+}
+
+void NGramParser::addByte(int32_t b)
+{
+ ngram = ((ngram << 8) + b) & N_GRAM_MASK;
+ lookup(ngram);
+}
+
+int32_t NGramParser::nextByte(InputText *det)
+{
+ if (byteIndex >= det->fInputLen) {
+ return -1;
+ }
+
+ return det->fInputBytes[byteIndex++];
+}
+
+int32_t NGramParser::parse(InputText *det)
+{
+ int32_t b;
+ bool ignoreSpace = FALSE;
+
+ while ((b = nextByte(det)) >= 0) {
+ uint8_t mb = charMap[b];
+
+ // TODO: 0x20 might not be a space in all character sets...
+ if (mb != 0) {
+ if (!(mb == 0x20 && ignoreSpace)) {
+ addByte(mb);
+ }
+
+ ignoreSpace = (mb == 0x20);
+ }
+ }
+
+ // TODO: Is this OK? The buffer could have ended in the middle of a word...
+ addByte(0x20);
+
+ double rawPercent = (double) hitCount / (double) ngramCount;
+
+ // if (rawPercent <= 2.0) {
+ // return 0;
+ // }
+
+ // TODO - This is a bit of a hack to take care of a case
+ // were we were getting a confidence of 135...
+ if (rawPercent > 0.33) {
+ return 98;
+ }
+
+ return (int32_t) (rawPercent * 300.0);
+}
+
+CharsetRecog_sbcs::CharsetRecog_sbcs()
+: haveC1Bytes(FALSE)
+{
+ // nothing else to do
+}
+
+CharsetRecog_sbcs::~CharsetRecog_sbcs()
+{
+ // nothing to do
+}
+
+int32_t CharsetRecog_sbcs::match_sbcs(InputText *det, const int32_t ngrams[], const uint8_t byteMap[])
+{
+ NGramParser *parser = new NGramParser(ngrams, byteMap);
+ int32_t result;
+
+ haveC1Bytes = det->fC1Bytes;
+ result = parser->parse(det);
+ delete parser;
+
+ return result;
+}
+
+static const uint8_t charMap_8859_1[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
+ 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
+};
+
+static const uint8_t charMap_8859_2[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0x20,
+ 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF,
+ 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0xB7,
+ 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20,
+};
+
+static const uint8_t charMap_8859_5[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF,
+};
+
+static const uint8_t charMap_8859_6[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+};
+
+static const uint8_t charMap_8859_7[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0xA1, 0xA2, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xDC, 0x20,
+ 0xDD, 0xDE, 0xDF, 0x20, 0xFC, 0x20, 0xFD, 0xFE,
+ 0xC0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0x20, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20,
+};
+
+static const uint8_t charMap_8859_8[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0x20, 0x20, 0x20, 0x20, 0x20,
+};
+
+static const uint8_t charMap_8859_9[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
+ 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x69, 0xFE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
+};
+
+static const int32_t ngrams_windows_1251[] = {
+ 0x20E220, 0x20E2EE, 0x20E4EE, 0x20E7E0, 0x20E820, 0x20EAE0, 0x20EAEE, 0x20EDE0, 0x20EDE5, 0x20EEE1, 0x20EFEE, 0x20EFF0, 0x20F0E0, 0x20F1EE, 0x20F1F2, 0x20F2EE,
+ 0x20F7F2, 0x20FDF2, 0xE0EDE8, 0xE0F2FC, 0xE3EE20, 0xE5EBFC, 0xE5EDE8, 0xE5F1F2, 0xE5F220, 0xE820EF, 0xE8E520, 0xE8E820, 0xE8FF20, 0xEBE5ED, 0xEBE820, 0xEBFCED,
+ 0xEDE020, 0xEDE520, 0xEDE8E5, 0xEDE8FF, 0xEDEE20, 0xEDEEE2, 0xEE20E2, 0xEE20EF, 0xEE20F1, 0xEEE220, 0xEEE2E0, 0xEEE3EE, 0xEEE920, 0xEEEBFC, 0xEEEC20, 0xEEF1F2,
+ 0xEFEEEB, 0xEFF0E5, 0xEFF0E8, 0xEFF0EE, 0xF0E0E2, 0xF0E5E4, 0xF1F2E0, 0xF1F2E2, 0xF1F2E8, 0xF1FF20, 0xF2E5EB, 0xF2EE20, 0xF2EEF0, 0xF2FC20, 0xF7F2EE, 0xFBF520,
+};
+
+static const uint8_t charMap_windows_1251[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x90, 0x83, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F,
+ 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F,
+ 0x20, 0xA2, 0xA2, 0xBC, 0x20, 0xB4, 0x20, 0x20,
+ 0xB8, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0xBF,
+ 0x20, 0x20, 0xB3, 0xB3, 0xB4, 0xB5, 0x20, 0x20,
+ 0xB8, 0x20, 0xBA, 0x20, 0xBC, 0xBE, 0xBE, 0xBF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
+};
+
+static const int32_t ngrams_windows_1256[] = {
+ 0x20C7E1, 0x20C7E4, 0x20C8C7, 0x20DAE1, 0x20DDED, 0x20E1E1, 0x20E3E4, 0x20E6C7, 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E120, 0xC7E1C3, 0xC7E1C7, 0xC7E1C8,
+ 0xC7E1CA, 0xC7E1CC, 0xC7E1CD, 0xC7E1CF, 0xC7E1D3, 0xC7E1DA, 0xC7E1DE, 0xC7E1E3, 0xC7E1E6, 0xC7E1ED, 0xC7E320, 0xC7E420, 0xC7E4CA, 0xC820C7, 0xC920C7, 0xC920DD,
+ 0xC920E1, 0xC920E3, 0xC920E6, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920, 0xD320C7, 0xDA20C7, 0xDAE1EC, 0xDDED20, 0xE120C7, 0xE1C920, 0xE1EC20, 0xE1ED20,
+ 0xE320C7, 0xE3C720, 0xE3C920, 0xE3E420, 0xE420C7, 0xE520C7, 0xE5C720, 0xE6C7E1, 0xE6E420, 0xEC20C7, 0xED20C7, 0xED20E3, 0xED20E6, 0xEDC920, 0xEDD120, 0xEDE420,
+};
+
+static const uint8_t charMap_windows_1256[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x81, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20,
+ 0x88, 0x20, 0x8A, 0x20, 0x9C, 0x8D, 0x8E, 0x8F,
+ 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x98, 0x20, 0x9A, 0x20, 0x9C, 0x20, 0x20, 0x9F,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0x20,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0x20, 0x20, 0x20, 0x20, 0xF4, 0x20, 0x20, 0x20,
+ 0x20, 0xF9, 0x20, 0xFB, 0xFC, 0x20, 0x20, 0xFF,
+};
+
+static const int32_t ngrams_KOI8_R[] = {
+ 0x20C4CF, 0x20C920, 0x20CBC1, 0x20CBCF, 0x20CEC1, 0x20CEC5, 0x20CFC2, 0x20D0CF, 0x20D0D2, 0x20D2C1, 0x20D3CF, 0x20D3D4, 0x20D4CF, 0x20D720, 0x20D7CF, 0x20DAC1,
+ 0x20DCD4, 0x20DED4, 0xC1CEC9, 0xC1D4D8, 0xC5CCD8, 0xC5CEC9, 0xC5D3D4, 0xC5D420, 0xC7CF20, 0xC920D0, 0xC9C520, 0xC9C920, 0xC9D120, 0xCCC5CE, 0xCCC920, 0xCCD8CE,
+ 0xCEC120, 0xCEC520, 0xCEC9C5, 0xCEC9D1, 0xCECF20, 0xCECFD7, 0xCF20D0, 0xCF20D3, 0xCF20D7, 0xCFC7CF, 0xCFCA20, 0xCFCCD8, 0xCFCD20, 0xCFD3D4, 0xCFD720, 0xCFD7C1,
+ 0xD0CFCC, 0xD0D2C5, 0xD0D2C9, 0xD0D2CF, 0xD2C1D7, 0xD2C5C4, 0xD3D120, 0xD3D4C1, 0xD3D4C9, 0xD3D4D7, 0xD4C5CC, 0xD4CF20, 0xD4CFD2, 0xD4D820, 0xD9C820, 0xDED4CF,
+};
+
+static const uint8_t charMap_KOI8_R[] = {
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+};
+
+//ISO-8859-1,2,5,6,7,8,9 Ngrams
+static const int32_t ngrams_8859_1_en[] = {
+ 0x206120, 0x20616E, 0x206265, 0x20636F, 0x20666F, 0x206861, 0x206865, 0x20696E, 0x206D61, 0x206F66, 0x207072, 0x207265, 0x207361, 0x207374, 0x207468, 0x20746F,
+ 0x207768, 0x616964, 0x616C20, 0x616E20, 0x616E64, 0x617320, 0x617420, 0x617465, 0x617469, 0x642061, 0x642074, 0x652061, 0x652073, 0x652074, 0x656420, 0x656E74,
+ 0x657220, 0x657320, 0x666F72, 0x686174, 0x686520, 0x686572, 0x696420, 0x696E20, 0x696E67, 0x696F6E, 0x697320, 0x6E2061, 0x6E2074, 0x6E6420, 0x6E6720, 0x6E7420,
+ 0x6F6620, 0x6F6E20, 0x6F7220, 0x726520, 0x727320, 0x732061, 0x732074, 0x736169, 0x737420, 0x742074, 0x746572, 0x746861, 0x746865, 0x74696F, 0x746F20, 0x747320,
+};
+
+static const int32_t ngrams_8859_1_da[] = {
+ 0x206166, 0x206174, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920, 0x206D65, 0x206F67, 0x2070E5, 0x207369, 0x207374, 0x207469, 0x207669, 0x616620,
+ 0x616E20, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646572, 0x646574, 0x652073, 0x656420, 0x656465, 0x656E20, 0x656E64, 0x657220, 0x657265, 0x657320,
+ 0x657420, 0x666F72, 0x676520, 0x67656E, 0x676572, 0x696765, 0x696C20, 0x696E67, 0x6B6520, 0x6B6B65, 0x6C6572, 0x6C6967, 0x6C6C65, 0x6D6564, 0x6E6465, 0x6E6520,
+ 0x6E6720, 0x6E6765, 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722064, 0x722065, 0x722073, 0x726520, 0x737465, 0x742073, 0x746520, 0x746572, 0x74696C, 0x766572,
+};
+
+static const int32_t ngrams_8859_1_de[] = {
+ 0x20616E, 0x206175, 0x206265, 0x206461, 0x206465, 0x206469, 0x206569, 0x206765, 0x206861, 0x20696E, 0x206D69, 0x207363, 0x207365, 0x20756E, 0x207665, 0x20766F,
+ 0x207765, 0x207A75, 0x626572, 0x636820, 0x636865, 0x636874, 0x646173, 0x64656E, 0x646572, 0x646965, 0x652064, 0x652073, 0x65696E, 0x656974, 0x656E20, 0x657220,
+ 0x657320, 0x67656E, 0x68656E, 0x687420, 0x696368, 0x696520, 0x696E20, 0x696E65, 0x697420, 0x6C6963, 0x6C6C65, 0x6E2061, 0x6E2064, 0x6E2073, 0x6E6420, 0x6E6465,
+ 0x6E6520, 0x6E6720, 0x6E6765, 0x6E7465, 0x722064, 0x726465, 0x726569, 0x736368, 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x756E64, 0x756E67, 0x766572,
+};
+
+static const int32_t ngrams_8859_1_es[] = {
+ 0x206120, 0x206361, 0x20636F, 0x206465, 0x20656C, 0x20656E, 0x206573, 0x20696E, 0x206C61, 0x206C6F, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365,
+ 0x20756E, 0x207920, 0x612063, 0x612064, 0x612065, 0x61206C, 0x612070, 0x616369, 0x61646F, 0x616C20, 0x617220, 0x617320, 0x6369F3, 0x636F6E, 0x646520, 0x64656C,
+ 0x646F20, 0x652064, 0x652065, 0x65206C, 0x656C20, 0x656E20, 0x656E74, 0x657320, 0x657374, 0x69656E, 0x69F36E, 0x6C6120, 0x6C6F73, 0x6E2065, 0x6E7465, 0x6F2064,
+ 0x6F2065, 0x6F6E20, 0x6F7220, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573, 0x732064, 0x732065, 0x732070, 0x736520, 0x746520, 0x746F20, 0x756520, 0xF36E20,
+};
+
+static const int32_t ngrams_8859_1_fr[] = {
+ 0x206175, 0x20636F, 0x206461, 0x206465, 0x206475, 0x20656E, 0x206574, 0x206C61, 0x206C65, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207365, 0x20736F, 0x20756E,
+ 0x20E020, 0x616E74, 0x617469, 0x636520, 0x636F6E, 0x646520, 0x646573, 0x647520, 0x652061, 0x652063, 0x652064, 0x652065, 0x65206C, 0x652070, 0x652073, 0x656E20,
+ 0x656E74, 0x657220, 0x657320, 0x657420, 0x657572, 0x696F6E, 0x697320, 0x697420, 0x6C6120, 0x6C6520, 0x6C6573, 0x6D656E, 0x6E2064, 0x6E6520, 0x6E7320, 0x6E7420,
+ 0x6F6E20, 0x6F6E74, 0x6F7572, 0x717565, 0x72206C, 0x726520, 0x732061, 0x732064, 0x732065, 0x73206C, 0x732070, 0x742064, 0x746520, 0x74696F, 0x756520, 0x757220,
+};
+
+static const int32_t ngrams_8859_1_it[] = {
+ 0x20616C, 0x206368, 0x20636F, 0x206465, 0x206469, 0x206520, 0x20696C, 0x20696E, 0x206C61, 0x207065, 0x207072, 0x20756E, 0x612063, 0x612064, 0x612070, 0x612073,
+ 0x61746F, 0x636865, 0x636F6E, 0x64656C, 0x646920, 0x652061, 0x652063, 0x652064, 0x652069, 0x65206C, 0x652070, 0x652073, 0x656C20, 0x656C6C, 0x656E74, 0x657220,
+ 0x686520, 0x692061, 0x692063, 0x692064, 0x692073, 0x696120, 0x696C20, 0x696E20, 0x696F6E, 0x6C6120, 0x6C6520, 0x6C6920, 0x6C6C61, 0x6E6520, 0x6E6920, 0x6E6F20,
+ 0x6E7465, 0x6F2061, 0x6F2064, 0x6F2069, 0x6F2073, 0x6F6E20, 0x6F6E65, 0x706572, 0x726120, 0x726520, 0x736920, 0x746120, 0x746520, 0x746920, 0x746F20, 0x7A696F,
+};
+
+static const int32_t ngrams_8859_1_nl[] = {
+ 0x20616C, 0x206265, 0x206461, 0x206465, 0x206469, 0x206565, 0x20656E, 0x206765, 0x206865, 0x20696E, 0x206D61, 0x206D65, 0x206F70, 0x207465, 0x207661, 0x207665,
+ 0x20766F, 0x207765, 0x207A69, 0x61616E, 0x616172, 0x616E20, 0x616E64, 0x617220, 0x617420, 0x636874, 0x646520, 0x64656E, 0x646572, 0x652062, 0x652076, 0x65656E,
+ 0x656572, 0x656E20, 0x657220, 0x657273, 0x657420, 0x67656E, 0x686574, 0x696520, 0x696E20, 0x696E67, 0x697320, 0x6E2062, 0x6E2064, 0x6E2065, 0x6E2068, 0x6E206F,
+ 0x6E2076, 0x6E6465, 0x6E6720, 0x6F6E64, 0x6F6F72, 0x6F7020, 0x6F7220, 0x736368, 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x76616E, 0x766572, 0x766F6F,
+};
+
+static const int32_t ngrams_8859_1_no[] = {
+ 0x206174, 0x206176, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920, 0x206D65, 0x206F67, 0x2070E5, 0x207365, 0x20736B, 0x20736F, 0x207374, 0x207469,
+ 0x207669, 0x20E520, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646574, 0x652073, 0x656420, 0x656E20, 0x656E65, 0x657220, 0x657265, 0x657420, 0x657474,
+ 0x666F72, 0x67656E, 0x696B6B, 0x696C20, 0x696E67, 0x6B6520, 0x6B6B65, 0x6C6520, 0x6C6C65, 0x6D6564, 0x6D656E, 0x6E2073, 0x6E6520, 0x6E6720, 0x6E6765, 0x6E6E65,
+ 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722073, 0x726520, 0x736F6D, 0x737465, 0x742073, 0x746520, 0x74656E, 0x746572, 0x74696C, 0x747420, 0x747465, 0x766572,
+};
+
+static const int32_t ngrams_8859_1_pt[] = {
+ 0x206120, 0x20636F, 0x206461, 0x206465, 0x20646F, 0x206520, 0x206573, 0x206D61, 0x206E6F, 0x206F20, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365,
+ 0x20756D, 0x612061, 0x612063, 0x612064, 0x612070, 0x616465, 0x61646F, 0x616C20, 0x617220, 0x617261, 0x617320, 0x636F6D, 0x636F6E, 0x646120, 0x646520, 0x646F20,
+ 0x646F73, 0x652061, 0x652064, 0x656D20, 0x656E74, 0x657320, 0x657374, 0x696120, 0x696361, 0x6D656E, 0x6E7465, 0x6E746F, 0x6F2061, 0x6F2063, 0x6F2064, 0x6F2065,
+ 0x6F2070, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573, 0x732061, 0x732064, 0x732065, 0x732070, 0x737461, 0x746520, 0x746F20, 0x756520, 0xE36F20, 0xE7E36F,
+};
+
+static const int32_t ngrams_8859_1_sv[] = {
+ 0x206174, 0x206176, 0x206465, 0x20656E, 0x2066F6, 0x206861, 0x206920, 0x20696E, 0x206B6F, 0x206D65, 0x206F63, 0x2070E5, 0x20736B, 0x20736F, 0x207374, 0x207469,
+ 0x207661, 0x207669, 0x20E472, 0x616465, 0x616E20, 0x616E64, 0x617220, 0x617474, 0x636820, 0x646520, 0x64656E, 0x646572, 0x646574, 0x656420, 0x656E20, 0x657220,
+ 0x657420, 0x66F672, 0x67656E, 0x696C6C, 0x696E67, 0x6B6120, 0x6C6C20, 0x6D6564, 0x6E2073, 0x6E6120, 0x6E6465, 0x6E6720, 0x6E6765, 0x6E696E, 0x6F6368, 0x6F6D20,
+ 0x6F6E20, 0x70E520, 0x722061, 0x722073, 0x726120, 0x736B61, 0x736F6D, 0x742073, 0x746120, 0x746520, 0x746572, 0x74696C, 0x747420, 0x766172, 0xE47220, 0xF67220,
+};
+
+static const int32_t ngrams_8859_2_cs[] = {
+ 0x206120, 0x206279, 0x20646F, 0x206A65, 0x206E61, 0x206E65, 0x206F20, 0x206F64, 0x20706F, 0x207072, 0x2070F8, 0x20726F, 0x207365, 0x20736F, 0x207374, 0x20746F,
+ 0x207620, 0x207679, 0x207A61, 0x612070, 0x636520, 0x636820, 0x652070, 0x652073, 0x652076, 0x656D20, 0x656EED, 0x686F20, 0x686F64, 0x697374, 0x6A6520, 0x6B7465,
+ 0x6C6520, 0x6C6920, 0x6E6120, 0x6EE920, 0x6EEC20, 0x6EED20, 0x6F2070, 0x6F646E, 0x6F6A69, 0x6F7374, 0x6F7520, 0x6F7661, 0x706F64, 0x706F6A, 0x70726F, 0x70F865,
+ 0x736520, 0x736F75, 0x737461, 0x737469, 0x73746E, 0x746572, 0x746EED, 0x746F20, 0x752070, 0xBE6520, 0xE16EED, 0xE9686F, 0xED2070, 0xED2073, 0xED6D20, 0xF86564,
+};
+
+static const int32_t ngrams_8859_2_hu[] = {
+ 0x206120, 0x20617A, 0x206265, 0x206567, 0x20656C, 0x206665, 0x206861, 0x20686F, 0x206973, 0x206B65, 0x206B69, 0x206BF6, 0x206C65, 0x206D61, 0x206D65, 0x206D69,
+ 0x206E65, 0x20737A, 0x207465, 0x20E973, 0x612061, 0x61206B, 0x61206D, 0x612073, 0x616B20, 0x616E20, 0x617A20, 0x62616E, 0x62656E, 0x656779, 0x656B20, 0x656C20,
+ 0x656C65, 0x656D20, 0x656E20, 0x657265, 0x657420, 0x657465, 0x657474, 0x677920, 0x686F67, 0x696E74, 0x697320, 0x6B2061, 0x6BF67A, 0x6D6567, 0x6D696E, 0x6E2061,
+ 0x6E616B, 0x6E656B, 0x6E656D, 0x6E7420, 0x6F6779, 0x732061, 0x737A65, 0x737A74, 0x737AE1, 0x73E967, 0x742061, 0x747420, 0x74E173, 0x7A6572, 0xE16E20, 0xE97320,
+};
+
+static const int32_t ngrams_8859_2_pl[] = {
+ 0x20637A, 0x20646F, 0x206920, 0x206A65, 0x206B6F, 0x206D61, 0x206D69, 0x206E61, 0x206E69, 0x206F64, 0x20706F, 0x207072, 0x207369, 0x207720, 0x207769, 0x207779,
+ 0x207A20, 0x207A61, 0x612070, 0x612077, 0x616E69, 0x636820, 0x637A65, 0x637A79, 0x646F20, 0x647A69, 0x652070, 0x652073, 0x652077, 0x65207A, 0x65676F, 0x656A20,
+ 0x656D20, 0x656E69, 0x676F20, 0x696120, 0x696520, 0x69656A, 0x6B6120, 0x6B6920, 0x6B6965, 0x6D6965, 0x6E6120, 0x6E6961, 0x6E6965, 0x6F2070, 0x6F7761, 0x6F7769,
+ 0x706F6C, 0x707261, 0x70726F, 0x70727A, 0x727A65, 0x727A79, 0x7369EA, 0x736B69, 0x737461, 0x776965, 0x796368, 0x796D20, 0x7A6520, 0x7A6965, 0x7A7920, 0xF37720,
+};
+
+static const int32_t ngrams_8859_2_ro[] = {
+ 0x206120, 0x206163, 0x206361, 0x206365, 0x20636F, 0x206375, 0x206465, 0x206469, 0x206C61, 0x206D61, 0x207065, 0x207072, 0x207365, 0x2073E3, 0x20756E, 0x20BA69,
+ 0x20EE6E, 0x612063, 0x612064, 0x617265, 0x617420, 0x617465, 0x617520, 0x636172, 0x636F6E, 0x637520, 0x63E320, 0x646520, 0x652061, 0x652063, 0x652064, 0x652070,
+ 0x652073, 0x656120, 0x656920, 0x656C65, 0x656E74, 0x657374, 0x692061, 0x692063, 0x692064, 0x692070, 0x696520, 0x696920, 0x696E20, 0x6C6120, 0x6C6520, 0x6C6F72,
+ 0x6C7569, 0x6E6520, 0x6E7472, 0x6F7220, 0x70656E, 0x726520, 0x726561, 0x727520, 0x73E320, 0x746520, 0x747275, 0x74E320, 0x756920, 0x756C20, 0xBA6920, 0xEE6E20,
+};
+
+static const int32_t ngrams_8859_5_ru[] = {
+ 0x20D220, 0x20D2DE, 0x20D4DE, 0x20D7D0, 0x20D820, 0x20DAD0, 0x20DADE, 0x20DDD0, 0x20DDD5, 0x20DED1, 0x20DFDE, 0x20DFE0, 0x20E0D0, 0x20E1DE, 0x20E1E2, 0x20E2DE,
+ 0x20E7E2, 0x20EDE2, 0xD0DDD8, 0xD0E2EC, 0xD3DE20, 0xD5DBEC, 0xD5DDD8, 0xD5E1E2, 0xD5E220, 0xD820DF, 0xD8D520, 0xD8D820, 0xD8EF20, 0xDBD5DD, 0xDBD820, 0xDBECDD,
+ 0xDDD020, 0xDDD520, 0xDDD8D5, 0xDDD8EF, 0xDDDE20, 0xDDDED2, 0xDE20D2, 0xDE20DF, 0xDE20E1, 0xDED220, 0xDED2D0, 0xDED3DE, 0xDED920, 0xDEDBEC, 0xDEDC20, 0xDEE1E2,
+ 0xDFDEDB, 0xDFE0D5, 0xDFE0D8, 0xDFE0DE, 0xE0D0D2, 0xE0D5D4, 0xE1E2D0, 0xE1E2D2, 0xE1E2D8, 0xE1EF20, 0xE2D5DB, 0xE2DE20, 0xE2DEE0, 0xE2EC20, 0xE7E2DE, 0xEBE520,
+};
+
+static const int32_t ngrams_8859_6_ar[] = {
+ 0x20C7E4, 0x20C7E6, 0x20C8C7, 0x20D9E4, 0x20E1EA, 0x20E4E4, 0x20E5E6, 0x20E8C7, 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E420, 0xC7E4C3, 0xC7E4C7, 0xC7E4C8,
+ 0xC7E4CA, 0xC7E4CC, 0xC7E4CD, 0xC7E4CF, 0xC7E4D3, 0xC7E4D9, 0xC7E4E2, 0xC7E4E5, 0xC7E4E8, 0xC7E4EA, 0xC7E520, 0xC7E620, 0xC7E6CA, 0xC820C7, 0xC920C7, 0xC920E1,
+ 0xC920E4, 0xC920E5, 0xC920E8, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920, 0xD320C7, 0xD920C7, 0xD9E4E9, 0xE1EA20, 0xE420C7, 0xE4C920, 0xE4E920, 0xE4EA20,
+ 0xE520C7, 0xE5C720, 0xE5C920, 0xE5E620, 0xE620C7, 0xE720C7, 0xE7C720, 0xE8C7E4, 0xE8E620, 0xE920C7, 0xEA20C7, 0xEA20E5, 0xEA20E8, 0xEAC920, 0xEAD120, 0xEAE620,
+};
+
+static const int32_t ngrams_8859_7_el[] = {
+ 0x20E1ED, 0x20E1F0, 0x20E3E9, 0x20E4E9, 0x20E5F0, 0x20E720, 0x20EAE1, 0x20ECE5, 0x20EDE1, 0x20EF20, 0x20F0E1, 0x20F0EF, 0x20F0F1, 0x20F3F4, 0x20F3F5, 0x20F4E7,
+ 0x20F4EF, 0xDFE120, 0xE120E1, 0xE120F4, 0xE1E920, 0xE1ED20, 0xE1F0FC, 0xE1F220, 0xE3E9E1, 0xE5E920, 0xE5F220, 0xE720F4, 0xE7ED20, 0xE7F220, 0xE920F4, 0xE9E120,
+ 0xE9EADE, 0xE9F220, 0xEAE1E9, 0xEAE1F4, 0xECE520, 0xED20E1, 0xED20E5, 0xED20F0, 0xEDE120, 0xEFF220, 0xEFF520, 0xF0EFF5, 0xF0F1EF, 0xF0FC20, 0xF220E1, 0xF220E5,
+ 0xF220EA, 0xF220F0, 0xF220F4, 0xF3E520, 0xF3E720, 0xF3F4EF, 0xF4E120, 0xF4E1E9, 0xF4E7ED, 0xF4E7F2, 0xF4E9EA, 0xF4EF20, 0xF4EFF5, 0xF4F9ED, 0xF9ED20, 0xFEED20,
+};
+
+static const int32_t ngrams_8859_8_I_he[] = {
+ 0x20E0E5, 0x20E0E7, 0x20E0E9, 0x20E0FA, 0x20E1E9, 0x20E1EE, 0x20E4E0, 0x20E4E5, 0x20E4E9, 0x20E4EE, 0x20E4F2, 0x20E4F9, 0x20E4FA, 0x20ECE0, 0x20ECE4, 0x20EEE0,
+ 0x20F2EC, 0x20F9EC, 0xE0FA20, 0xE420E0, 0xE420E1, 0xE420E4, 0xE420EC, 0xE420EE, 0xE420F9, 0xE4E5E0, 0xE5E020, 0xE5ED20, 0xE5EF20, 0xE5F820, 0xE5FA20, 0xE920E4,
+ 0xE9E420, 0xE9E5FA, 0xE9E9ED, 0xE9ED20, 0xE9EF20, 0xE9F820, 0xE9FA20, 0xEC20E0, 0xEC20E4, 0xECE020, 0xECE420, 0xED20E0, 0xED20E1, 0xED20E4, 0xED20EC, 0xED20EE,
+ 0xED20F9, 0xEEE420, 0xEF20E4, 0xF0E420, 0xF0E920, 0xF0E9ED, 0xF2EC20, 0xF820E4, 0xF8E9ED, 0xF9EC20, 0xFA20E0, 0xFA20E1, 0xFA20E4, 0xFA20EC, 0xFA20EE, 0xFA20F9,
+};
+
+static const int32_t ngrams_8859_8_he[] = {
+ 0x20E0E5, 0x20E0EC, 0x20E4E9, 0x20E4EC, 0x20E4EE, 0x20E4F0, 0x20E9F0, 0x20ECF2, 0x20ECF9, 0x20EDE5, 0x20EDE9, 0x20EFE5, 0x20EFE9, 0x20F8E5, 0x20F8E9, 0x20FAE0,
+ 0x20FAE5, 0x20FAE9, 0xE020E4, 0xE020EC, 0xE020ED, 0xE020FA, 0xE0E420, 0xE0E5E4, 0xE0EC20, 0xE0EE20, 0xE120E4, 0xE120ED, 0xE120FA, 0xE420E4, 0xE420E9, 0xE420EC,
+ 0xE420ED, 0xE420EF, 0xE420F8, 0xE420FA, 0xE4EC20, 0xE5E020, 0xE5E420, 0xE7E020, 0xE9E020, 0xE9E120, 0xE9E420, 0xEC20E4, 0xEC20ED, 0xEC20FA, 0xECF220, 0xECF920,
+ 0xEDE9E9, 0xEDE9F0, 0xEDE9F8, 0xEE20E4, 0xEE20ED, 0xEE20FA, 0xEEE120, 0xEEE420, 0xF2E420, 0xF920E4, 0xF920ED, 0xF920FA, 0xF9E420, 0xFAE020, 0xFAE420, 0xFAE5E9,
+};
+
+static const int32_t ngrams_8859_9_tr[] = {
+ 0x206261, 0x206269, 0x206275, 0x206461, 0x206465, 0x206765, 0x206861, 0x20696C, 0x206B61, 0x206B6F, 0x206D61, 0x206F6C, 0x207361, 0x207461, 0x207665, 0x207961,
+ 0x612062, 0x616B20, 0x616C61, 0x616D61, 0x616E20, 0x616EFD, 0x617220, 0x617261, 0x6172FD, 0x6173FD, 0x617961, 0x626972, 0x646120, 0x646520, 0x646920, 0x652062,
+ 0x65206B, 0x656469, 0x656E20, 0x657220, 0x657269, 0x657369, 0x696C65, 0x696E20, 0x696E69, 0x697220, 0x6C616E, 0x6C6172, 0x6C6520, 0x6C6572, 0x6E2061, 0x6E2062,
+ 0x6E206B, 0x6E6461, 0x6E6465, 0x6E6520, 0x6E6920, 0x6E696E, 0x6EFD20, 0x72696E, 0x72FD6E, 0x766520, 0x796120, 0x796F72, 0xFD6E20, 0xFD6E64, 0xFD6EFD, 0xFDF0FD,
+};
+
+CharsetRecog_8859_1::~CharsetRecog_8859_1()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1::getName() const
+{
+ return haveC1Bytes? "windows-1252" : "ISO-8859-1";
+}
+
+const char *CharsetRecog_8859_1_en::getLanguage() const
+{
+ return "en";
+}
+
+CharsetRecog_8859_1_en::~CharsetRecog_8859_1_en()
+{
+ // nothing to do
+}
+
+int32_t CharsetRecog_8859_1_en::match(InputText *textIn)
+{
+ int32_t result = match_sbcs(textIn, ngrams_8859_1_en, charMap_8859_1);
+
+ // printf("8859_1_en: result = %d\n", result);
+ return result; //match_sbcs(textIn, ngrams, charMap);
+}
+
+CharsetRecog_8859_1_da::~CharsetRecog_8859_1_da()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_da::getLanguage() const
+{
+ return "da";
+}
+
+int32_t CharsetRecog_8859_1_da::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_da, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_de::~CharsetRecog_8859_1_de() {}
+
+const char *CharsetRecog_8859_1_de::getLanguage() const
+{
+ return "de";
+}
+
+int32_t CharsetRecog_8859_1_de::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_de, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_es::~CharsetRecog_8859_1_es()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_es::getLanguage() const
+{
+ return "es";
+}
+
+int32_t CharsetRecog_8859_1_es::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_es, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_fr::~CharsetRecog_8859_1_fr()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_fr::getLanguage() const
+{
+ return "fr";
+}
+
+int32_t CharsetRecog_8859_1_fr::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_fr, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_it::~CharsetRecog_8859_1_it()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_it::getLanguage() const
+{
+ return "it";
+}
+
+int32_t CharsetRecog_8859_1_it::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_it, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_nl::~CharsetRecog_8859_1_nl()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_nl::getLanguage() const
+{
+ return "nl";
+}
+
+int32_t CharsetRecog_8859_1_nl::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_nl, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_no::~CharsetRecog_8859_1_no() {}
+
+const char *CharsetRecog_8859_1_no::getLanguage() const
+{
+ return "no";
+}
+
+int32_t CharsetRecog_8859_1_no::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_no, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_pt::~CharsetRecog_8859_1_pt()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_1_pt::getLanguage() const
+{
+ return "pt";
+}
+
+int32_t CharsetRecog_8859_1_pt::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_pt, charMap_8859_1);
+}
+
+CharsetRecog_8859_1_sv::~CharsetRecog_8859_1_sv() {}
+
+const char *CharsetRecog_8859_1_sv::getLanguage() const
+{
+ return "sv";
+}
+
+int32_t CharsetRecog_8859_1_sv::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_1_sv, charMap_8859_1);
+}
+
+CharsetRecog_8859_2::~CharsetRecog_8859_2()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_2::getName() const
+{
+ return haveC1Bytes? "windows-1250" : "ISO-8859-2";
+}
+
+CharsetRecog_8859_2_cs::~CharsetRecog_8859_2_cs()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_2_cs::getLanguage() const
+{
+ return "cs";
+}
+
+int32_t CharsetRecog_8859_2_cs::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_2_cs, charMap_8859_2);
+}
+
+CharsetRecog_8859_2_hu::~CharsetRecog_8859_2_hu()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_2_hu::getLanguage() const
+{
+ return "hu";
+}
+
+int32_t CharsetRecog_8859_2_hu::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_2_hu, charMap_8859_2);
+}
+
+CharsetRecog_8859_2_pl::~CharsetRecog_8859_2_pl()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_2_pl::getLanguage() const
+{
+ return "pl";
+}
+
+int32_t CharsetRecog_8859_2_pl::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_2_pl, charMap_8859_2);
+}
+
+CharsetRecog_8859_2_ro::~CharsetRecog_8859_2_ro()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_2_ro::getLanguage() const
+{
+ return "ro";
+}
+
+int32_t CharsetRecog_8859_2_ro::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_2_ro, charMap_8859_2);
+}
+
+CharsetRecog_8859_5::~CharsetRecog_8859_5()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_5::getName() const
+{
+ return "ISO-8859-5";
+}
+
+CharsetRecog_8859_5_ru::~CharsetRecog_8859_5_ru()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_5_ru::getLanguage() const
+{
+ return "ru";
+}
+
+int32_t CharsetRecog_8859_5_ru::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_5_ru, charMap_8859_5);
+}
+
+CharsetRecog_8859_6::~CharsetRecog_8859_6()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_6::getName() const
+{
+ return "ISO-8859-6";
+}
+
+CharsetRecog_8859_6_ar::~CharsetRecog_8859_6_ar()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_6_ar::getLanguage() const
+{
+ return "ar";
+}
+
+int32_t CharsetRecog_8859_6_ar::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_6_ar, charMap_8859_6);
+}
+
+CharsetRecog_8859_7::~CharsetRecog_8859_7()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_7::getName() const
+{
+ return haveC1Bytes? "windows-1253" : "ISO-8859-7";
+}
+
+CharsetRecog_8859_7_el::~CharsetRecog_8859_7_el()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_7_el::getLanguage() const
+{
+ return "el";
+}
+
+int32_t CharsetRecog_8859_7_el::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_7_el, charMap_8859_7);
+}
+
+CharsetRecog_8859_8::~CharsetRecog_8859_8()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_8::getName() const
+{
+ return haveC1Bytes? "windows-1255" : "ISO-8859-8";
+}
+
+CharsetRecog_8859_8_I_he::~CharsetRecog_8859_8_I_he ()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_8_I_he::getName() const
+{
+ return haveC1Bytes? "windows-1255" : "ISO-8859-8-I";
+}
+
+const char *CharsetRecog_8859_8_I_he::getLanguage() const
+{
+ return "he";
+}
+
+int32_t CharsetRecog_8859_8_I_he::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_8_I_he, charMap_8859_8);
+}
+
+CharsetRecog_8859_8_he::~CharsetRecog_8859_8_he()
+{
+ // od ot gnihton
+}
+
+const char *CharsetRecog_8859_8_he::getLanguage() const
+{
+ return "he";
+}
+
+int32_t CharsetRecog_8859_8_he::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_8_he, charMap_8859_8);
+}
+
+CharsetRecog_8859_9::~CharsetRecog_8859_9()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_9::getName() const
+{
+ return haveC1Bytes? "windows-1254" : "ISO-8859-9";
+}
+
+CharsetRecog_8859_9_tr::~CharsetRecog_8859_9_tr ()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_8859_9_tr::getLanguage() const
+{
+ return "tr";
+}
+
+int32_t CharsetRecog_8859_9_tr::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_8859_9_tr, charMap_8859_9);
+}
+
+CharsetRecog_windows_1256::~CharsetRecog_windows_1256()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_windows_1256::getName() const
+{
+ return "windows-1256";
+}
+
+const char *CharsetRecog_windows_1256::getLanguage() const
+{
+ return "ar";
+}
+
+int32_t CharsetRecog_windows_1256::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_windows_1256, charMap_windows_1256);
+}
+
+CharsetRecog_windows_1251::~CharsetRecog_windows_1251()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_windows_1251::getName() const
+{
+ return "windows-1251";
+}
+
+const char *CharsetRecog_windows_1251::getLanguage() const
+{
+ return "ru";
+}
+
+int32_t CharsetRecog_windows_1251::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_windows_1251, charMap_windows_1251);
+}
+
+CharsetRecog_KOI8_R::~CharsetRecog_KOI8_R()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_KOI8_R::getName() const
+{
+ return "KOI8-R";
+}
+
+const char *CharsetRecog_KOI8_R::getLanguage() const
+{
+ return "ru";
+}
+
+int32_t CharsetRecog_KOI8_R::match(InputText *textIn)
+{
+ return match_sbcs(textIn, ngrams_KOI8_R, charMap_KOI8_R);
+}
+
+U_NAMESPACE_END
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/csrsbcs.h b/Build/source/libs/icu-xetex/i18n/csrsbcs.h
new file mode 100644
index 00000000000..456fc4dff43
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrsbcs.h
@@ -0,0 +1,364 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSRSBCS_H
+#define __CSRSBCS_H
+
+#include "unicode/uobject.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+class NGramParser : public UMemory
+{
+private:
+ int32_t byteIndex;
+ int32_t ngram;
+
+ const int32_t *ngramList;
+ const uint8_t *charMap;
+
+ int32_t ngramCount;
+ int32_t hitCount;
+
+public:
+ NGramParser(const int32_t *theNgramList, const uint8_t *theCharMap);
+
+private:
+ /*
+ * Binary search for value in table, which must have exactly 64 entries.
+ */
+ int32_t search(const int32_t *table, int32_t value);
+
+ void lookup(int32_t thisNgram);
+ void addByte(int32_t b);
+ int32_t nextByte(InputText *det);
+
+public:
+ int32_t parse(InputText *det);
+
+};
+
+class CharsetRecog_sbcs : public CharsetRecognizer
+{
+protected:
+ UBool haveC1Bytes;
+
+public:
+ CharsetRecog_sbcs();
+
+ virtual ~CharsetRecog_sbcs();
+
+ virtual const char *getName() const = 0;
+
+ virtual int32_t match(InputText *det) = 0;
+
+ int32_t match_sbcs(InputText *det, const int32_t ngrams[], const uint8_t charMap[]);
+};
+
+class CharsetRecog_8859_1 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_1();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_2 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_2();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_5 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_5();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_6 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_6();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_7 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_7();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_8 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_8();
+
+ virtual const char *getName() const;
+};
+
+class CharsetRecog_8859_9 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_8859_9();
+
+ const char *getName() const;
+};
+
+class CharsetRecog_8859_1_en : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_en();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_da : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_da();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_de : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_de();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_es : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_es();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_fr : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_fr();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_it : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_it();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_nl : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_nl();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_no : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_no();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_pt : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_pt();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_1_sv : public CharsetRecog_8859_1
+{
+public:
+ virtual ~CharsetRecog_8859_1_sv();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_2_cs : public CharsetRecog_8859_2
+{
+public:
+ virtual ~CharsetRecog_8859_2_cs();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_2_hu : public CharsetRecog_8859_2
+{
+public:
+ virtual ~CharsetRecog_8859_2_hu();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_2_pl : public CharsetRecog_8859_2
+{
+public:
+ virtual ~CharsetRecog_8859_2_pl();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_2_ro : public CharsetRecog_8859_2
+{
+public:
+ virtual ~CharsetRecog_8859_2_ro();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_5_ru : public CharsetRecog_8859_5
+{
+public:
+ virtual ~CharsetRecog_8859_5_ru();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_6_ar : public CharsetRecog_8859_6
+{
+public:
+ virtual ~CharsetRecog_8859_6_ar();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_7_el : public CharsetRecog_8859_7
+{
+public:
+ virtual ~CharsetRecog_8859_7_el();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_8_I_he : public CharsetRecog_8859_8
+{
+public:
+ virtual ~CharsetRecog_8859_8_I_he();
+
+ const char *getName() const;
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_8_he : public CharsetRecog_8859_8
+{
+public:
+ virtual ~CharsetRecog_8859_8_he ();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_8859_9_tr : public CharsetRecog_8859_9
+{
+public:
+ virtual ~CharsetRecog_8859_9_tr ();
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_windows_1256 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_windows_1256();
+
+ const char *getName() const;
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+class CharsetRecog_windows_1251 : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_windows_1251();
+
+ const char *getName() const;
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+
+class CharsetRecog_KOI8_R : public CharsetRecog_sbcs
+{
+public:
+ virtual ~CharsetRecog_KOI8_R();
+
+ const char *getName() const;
+
+ const char *getLanguage() const;
+
+ int32_t match(InputText *textIn);
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSRSBCS_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csrucode.cpp b/Build/source/libs/icu-xetex/i18n/csrucode.cpp
new file mode 100644
index 00000000000..99a76d850e6
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrucode.cpp
@@ -0,0 +1,146 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrucode.h"
+
+U_NAMESPACE_BEGIN
+
+CharsetRecog_Unicode::~CharsetRecog_Unicode()
+{
+ // nothing to do
+}
+
+CharsetRecog_UTF_16_BE::~CharsetRecog_UTF_16_BE()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_UTF_16_BE::getName() const
+{
+ return "UTF-16BE";
+}
+
+int32_t CharsetRecog_UTF_16_BE::match(InputText* textIn)
+{
+ const uint8_t *input = textIn->fRawInput;
+
+ if (input[0] == 0xFE && input[1] == 0xFF) {
+ return 100;
+ }
+
+ // TODO: Do some statastics to check for unsigned UTF-16BE
+ return 0;
+}
+
+CharsetRecog_UTF_16_LE::~CharsetRecog_UTF_16_LE()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_UTF_16_LE::getName() const
+{
+ return "UTF-16LE";
+}
+
+int32_t CharsetRecog_UTF_16_LE::match(InputText* textIn)
+{
+ const uint8_t *input = textIn->fRawInput;
+
+ if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
+ return 100;
+ }
+
+ // TODO: Do some statastics to check for unsigned UTF-16LE
+ return 0;
+}
+
+CharsetRecog_UTF_32::~CharsetRecog_UTF_32()
+{
+ // nothing to do
+}
+
+int32_t CharsetRecog_UTF_32::match(InputText* textIn)
+{
+ const uint8_t *input = textIn->fRawInput;
+ int32_t limit = (textIn->fRawLength / 4) * 4;
+ int32_t numValid = 0;
+ int32_t numInvalid = 0;
+ bool hasBOM = FALSE;
+ int32_t confidence = 0;
+
+ if (getChar(input, 0) == 0x0000FEFFUL) {
+ hasBOM = TRUE;
+ }
+
+ for(int32_t i = 0; i < limit; i += 4) {
+ int32_t ch = getChar(input, i);
+
+ if (ch < 0 || ch >= 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF)) {
+ numInvalid += 1;
+ } else {
+ numValid += 1;
+ }
+ }
+
+
+ // Cook up some sort of confidence score, based on presense of a BOM
+ // and the existence of valid and/or invalid multi-byte sequences.
+ if (hasBOM && numInvalid==0) {
+ confidence = 100;
+ } else if (hasBOM && numValid > numInvalid*10) {
+ confidence = 80;
+ } else if (numValid > 3 && numInvalid == 0) {
+ confidence = 100;
+ } else if (numValid > 0 && numInvalid == 0) {
+ confidence = 80;
+ } else if (numValid > numInvalid*10) {
+ // Probably corruput UTF-32BE data. Valid sequences aren't likely by chance.
+ confidence = 25;
+ }
+
+ return confidence;
+}
+
+CharsetRecog_UTF_32_BE::~CharsetRecog_UTF_32_BE()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_UTF_32_BE::getName() const
+{
+ return "UTF-32BE";
+}
+
+int32_t CharsetRecog_UTF_32_BE::getChar(const uint8_t *input, int32_t index) const
+{
+ return input[index + 0] << 24 | input[index + 1] << 16 |
+ input[index + 2] << 8 | input[index + 3];
+}
+
+CharsetRecog_UTF_32_LE::~CharsetRecog_UTF_32_LE()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_UTF_32_LE::getName() const
+{
+ return "UTF-32LE";
+}
+
+int32_t CharsetRecog_UTF_32_LE::getChar(const uint8_t *input, int32_t index) const
+{
+ return input[index + 3] << 24 | input[index + 2] << 16 |
+ input[index + 1] << 8 | input[index + 0];
+}
+
+U_NAMESPACE_END
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/csrucode.h b/Build/source/libs/icu-xetex/i18n/csrucode.h
new file mode 100644
index 00000000000..315bad6b25e
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrucode.h
@@ -0,0 +1,106 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSRUCODE_H
+#define __CSRUCODE_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * This class matches UTF-16 and UTF-32, both big- and little-endian. The
+ * BOM will be used if it is present.
+ *
+ * @internal
+ */
+class CharsetRecog_Unicode : public CharsetRecognizer
+{
+
+public:
+
+ virtual ~CharsetRecog_Unicode();
+ /* (non-Javadoc)
+ * @see com.ibm.icu.text.CharsetRecognizer#getName()
+ */
+ const char* getName() const = 0;
+
+ /* (non-Javadoc)
+ * @see com.ibm.icu.text.CharsetRecognizer#match(com.ibm.icu.text.CharsetDetector)
+ */
+ int32_t match(InputText* textIn) = 0;
+};
+
+
+class CharsetRecog_UTF_16_BE : public CharsetRecog_Unicode
+{
+public:
+
+ virtual ~CharsetRecog_UTF_16_BE();
+
+ const char *getName() const;
+
+ int32_t match(InputText* textIn);
+};
+
+class CharsetRecog_UTF_16_LE : public CharsetRecog_Unicode
+{
+public:
+
+ virtual ~CharsetRecog_UTF_16_LE();
+
+ const char *getName() const;
+
+ int32_t match(InputText* textIn);
+};
+
+class CharsetRecog_UTF_32 : public CharsetRecog_Unicode
+{
+protected:
+ virtual int32_t getChar(const uint8_t *input, int32_t index) const = 0;
+public:
+
+ virtual ~CharsetRecog_UTF_32();
+
+ const char* getName() const = 0;
+
+ int32_t match(InputText* textIn);
+};
+
+
+class CharsetRecog_UTF_32_BE : public CharsetRecog_UTF_32
+{
+protected:
+ int32_t getChar(const uint8_t *input, int32_t index) const;
+
+public:
+
+ virtual ~CharsetRecog_UTF_32_BE();
+
+ const char *getName() const;
+};
+
+
+class CharsetRecog_UTF_32_LE : public CharsetRecog_UTF_32
+{
+protected:
+ int32_t getChar(const uint8_t *input, int32_t index) const;
+
+public:
+ virtual ~CharsetRecog_UTF_32_LE();
+
+ const char* getName() const;
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSRUCODE_H */
diff --git a/Build/source/libs/icu-xetex/i18n/csrutf8.cpp b/Build/source/libs/icu-xetex/i18n/csrutf8.cpp
new file mode 100644
index 00000000000..8af5307bdc3
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrutf8.cpp
@@ -0,0 +1,111 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrutf8.h"
+
+U_NAMESPACE_BEGIN
+
+CharsetRecog_UTF8::~CharsetRecog_UTF8()
+{
+ // nothing to do
+}
+
+const char *CharsetRecog_UTF8::getName() const
+{
+ return "UTF-8";
+}
+
+int32_t CharsetRecog_UTF8::match(InputText* det) {
+ bool hasBOM = FALSE;
+ int32_t numValid = 0;
+ int32_t numInvalid = 0;
+ const uint8_t *input = det->fRawInput;
+ int32_t i;
+ int32_t trailBytes = 0;
+ int32_t confidence;
+
+ if (det->fRawLength >= 3 &&
+ input[0] == 0xEF && input[1] == 0xBB && input[2] == 0xBF) {
+ hasBOM = TRUE;
+ }
+
+ // Scan for multi-byte sequences
+ for (i=0; i < det->fRawLength; i += 1) {
+ int32_t b = input[i];
+
+ if ((b & 0x80) == 0) {
+ continue; // ASCII
+ }
+
+ // Hi bit on char found. Figure out how long the sequence should be
+ if ((b & 0x0E0) == 0x0C0) {
+ trailBytes = 1;
+ } else if ((b & 0x0F0) == 0x0E0) {
+ trailBytes = 2;
+ } else if ((b & 0x0F8) == 0xF0) {
+ trailBytes = 3;
+ } else {
+ numInvalid += 1;
+
+ if (numInvalid > 5) {
+ break;
+ }
+
+ trailBytes = 0;
+ }
+
+ // Verify that we've got the right number of trail bytes in the sequence
+ for (;;) {
+ i += 1;
+
+ if (i >= det->fRawLength) {
+ break;
+ }
+
+ b = input[i];
+
+ if ((b & 0xC0) != 0x080) {
+ numInvalid += 1;
+ break;
+ }
+
+ if (--trailBytes == 0) {
+ numValid += 1;
+ break;
+ }
+ }
+
+ }
+
+ // Cook up some sort of confidence score, based on presense of a BOM
+ // and the existence of valid and/or invalid multi-byte sequences.
+ confidence = 0;
+ if (hasBOM && numInvalid == 0) {
+ confidence = 100;
+ } else if (hasBOM && numValid > numInvalid*10) {
+ confidence = 80;
+ } else if (numValid > 3 && numInvalid == 0) {
+ confidence = 100;
+ } else if (numValid > 0 && numInvalid == 0) {
+ confidence = 80;
+ } else if (numValid == 0 && numInvalid == 0) {
+ // Plain ASCII.
+ confidence = 10;
+ } else if (numValid > numInvalid*10) {
+ // Probably corruput utf-8 data. Valid sequences aren't likely by chance.
+ confidence = 25;
+ }
+
+ return confidence;
+}
+
+U_NAMESPACE_END
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/csrutf8.h b/Build/source/libs/icu-xetex/i18n/csrutf8.h
new file mode 100644
index 00000000000..10fe287a435
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/csrutf8.h
@@ -0,0 +1,42 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __CSRUTF8_H
+#define __CSRUTF8_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "csrecog.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Charset recognizer for UTF-8
+ *
+ * @internal
+ */
+class CharsetRecog_UTF8: public CharsetRecognizer {
+
+ public:
+
+ virtual ~CharsetRecog_UTF8();
+
+ const char *getName() const;
+
+ /* (non-Javadoc)
+ * @see com.ibm.icu.text.CharsetRecognizer#match(com.ibm.icu.text.CharsetDetector)
+ */
+ int32_t match(InputText *det);
+
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __CSRUTF8_H */
diff --git a/Build/source/libs/icu-xetex/i18n/datefmt.cpp b/Build/source/libs/icu-xetex/i18n/datefmt.cpp
index b2b758168d4..b07622c39e8 100644
--- a/Build/source/libs/icu-xetex/i18n/datefmt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/datefmt.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2004, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -13,7 +13,7 @@
* 03/31/97 aliu Modified extensively to work with 50 locales.
* 04/01/97 aliu Added support for centuries.
* 08/12/97 aliu Fixed operator== to use Calendar::equivalentTo.
-* 07/20/98 stephen Changed ParsePosition initialization
+* 07/20/98 stephen Changed ParsePosition initialization
********************************************************************************
*/
@@ -25,6 +25,9 @@
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
+#include "cstring.h"
+#include "windtfmt.h"
+
#if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL)
#include <stdio.h>
#endif
@@ -267,8 +270,25 @@ DateFormat::createInstance()
DateFormat* U_EXPORT2
DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale)
{
- // Try to create a SimpleDateFormat of the desired style.
UErrorCode status = U_ZERO_ERROR;
+#ifdef U_WINDOWS
+ char buffer[8];
+ int32_t count = locale.getKeywordValue("compat", buffer, sizeof(buffer), status);
+
+ // if the locale has "@compat=host", create a host-specific DateFormat...
+ if (count > 0 && uprv_strcmp(buffer, "host") == 0) {
+ Win32DateFormat *f = new Win32DateFormat(timeStyle, dateStyle, locale, status);
+
+ if (U_SUCCESS(status)) {
+ return f;
+ }
+
+ delete f;
+ }
+#endif
+
+
+ // Try to create a SimpleDateFormat of the desired style.
SimpleDateFormat *f = new SimpleDateFormat(timeStyle, dateStyle, locale, status);
if (U_SUCCESS(status)) return f;
delete f;
diff --git a/Build/source/libs/icu-xetex/i18n/dcfmtsym.cpp b/Build/source/libs/icu-xetex/i18n/dcfmtsym.cpp
index d9b4d484d82..34074750ad2 100644
--- a/Build/source/libs/icu-xetex/i18n/dcfmtsym.cpp
+++ b/Build/source/libs/icu-xetex/i18n/dcfmtsym.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2004, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -29,7 +29,7 @@
#include "ucurrimp.h"
#include "cstring.h"
#include "locbased.h"
-
+#include "uresimp.h"
// *****************************************************************************
// class DecimalFormatSymbols
// *****************************************************************************
@@ -120,13 +120,13 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
UBool useLastResortData)
{
*validLocale = *actualLocale = 0;
-
+ currPattern = NULL;
if (U_FAILURE(status))
return;
-
+
const char* locStr = loc.getName();
UResourceBundle *resource = ures_open((char *)0, locStr, &status);
- UResourceBundle *numberElementsRes = ures_getByKey(resource, gNumberElements, resource, &status);
+ UResourceBundle *numberElementsRes = ures_getByKey(resource, gNumberElements, NULL, &status);
if (U_FAILURE(status))
{
// Initializes with last resort data if necessary.
@@ -183,7 +183,40 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
ures_getLocaleByType(numberElementsRes,
ULOC_ACTUAL_LOCALE, &status));
}
+ //load the currency data
+ UChar ucc[4]={0}; //Currency Codes are always 3 chars long
+ int32_t uccLen = 4;
+ const char* locName = loc.getName();
+ uccLen = ucurr_forLocale(locName, ucc, uccLen, &status);
+ if(U_SUCCESS(status) && uccLen > 0) {
+ char cc[4]={0};
+ u_UCharsToChars(ucc, cc, uccLen);
+ /* An explicit currency was requested */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ UResourceBundle *currency = ures_getByKeyWithFallback(resource, "Currencies", NULL, &localStatus);
+ currency = ures_getByKeyWithFallback(currency, cc, currency, &localStatus);
+ if(U_SUCCESS(localStatus) && ures_getSize(currency)>2) { // the length is 3 if more data is present
+ currency = ures_getByIndex(currency, 2, currency, &localStatus);
+ int32_t currPatternLen = 0;
+ currPattern = ures_getStringByIndex(currency, (int32_t)0, &currPatternLen, &localStatus);
+ UnicodeString decimalSep = ures_getStringByIndex(currency, (int32_t)1, NULL, &localStatus);
+ UnicodeString groupingSep = ures_getStringByIndex(currency, (int32_t)2, NULL, &localStatus);
+ if(U_SUCCESS(localStatus)){
+ fSymbols[kMonetaryGroupingSeparatorSymbol] = groupingSep;
+ fSymbols[kMonetarySeparatorSymbol] = decimalSep;
+ //pattern.setTo(TRUE, currPattern, currPatternLen);
+ status = localStatus;
+ }
+ }
+ ures_close(currency);
+ /* else An explicit currency was requested and is unknown or locale data is malformed. */
+ /* ucurr_* API will get the correct value later on. */
+ }else{
+ // ignore the error if no currency
+ status = U_ZERO_ERROR;
+ }
}
+ ures_close(resource);
ures_close(numberElementsRes);
}
@@ -222,6 +255,7 @@ DecimalFormatSymbols::initialize(const UChar** numberElements, int32_t *numberEl
// TODO: read from locale data, if this makes it into CLDR
fSymbols[kSignificantDigitSymbol] = (UChar)0x0040; // '@' significant digit
fSymbols[kPadEscapeSymbol] = (UChar)0x002a; // TODO: '*' Hard coded for now; get from resource later
+ fSymbols[kMonetaryGroupingSeparatorSymbol] = fSymbols[kGroupingSeparatorSymbol];
}
// initialize with default values
diff --git a/Build/source/libs/icu-xetex/i18n/decimfmt.cpp b/Build/source/libs/icu-xetex/i18n/decimfmt.cpp
index 70ed5e0b1fe..4d447c62d5c 100644
--- a/Build/source/libs/icu-xetex/i18n/decimfmt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/decimfmt.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -325,31 +325,18 @@ DecimalFormat::construct(UErrorCode& status,
if (pattern->indexOf((UChar)kCurrencySign) >= 0) {
// If it looks like we are going to use a currency pattern
// then do the time consuming lookup.
- if (symbolsToAdopt == NULL) {
- setCurrencyForLocale(uloc_getDefault(), status);
- } else {
- setCurrencyForSymbols();
- }
+ setCurrencyForSymbols();
} else {
setCurrency(NULL, status);
}
applyPattern(*pattern, FALSE /*not localized*/,parseErr, status);
-}
-
-/**
- * Sets our currency to be the default currency for the given locale.
- */
-void DecimalFormat::setCurrencyForLocale(const char* locale, UErrorCode& ec) {
- const UChar* c = NULL;
- if (U_SUCCESS(ec)) {
- // Trap an error in mapping locale to currency. If we can't
- // map, then don't fail and set the currency to "".
- UErrorCode ec2 = U_ZERO_ERROR;
- UChar c[4];
- ucurr_forLocale(locale, c, 4, &ec2);
+
+ // If it was a currency format, apply the appropriate rounding by
+ // resetting the currency. NOTE: this copies fCurrency on top of itself.
+ if (fIsCurrencyFormat) {
+ setCurrency(getCurrency(), status);
}
- setCurrency(c, ec);
}
//------------------------------------------------------------------------------
@@ -832,7 +819,12 @@ DecimalFormat::subformat(UnicodeString& appendTo,
// Gets the localized zero Unicode character.
UChar32 zero = getConstSymbol(DecimalFormatSymbols::kZeroDigitSymbol).char32At(0);
int32_t zeroDelta = zero - '0'; // '0' is the DigitList representation of zero
- const UnicodeString *grouping = &getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
+ const UnicodeString *grouping ;
+ if(fIsCurrencyFormat) {
+ grouping = &getConstSymbol(DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol);
+ }else{
+ grouping = &getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
+ }
const UnicodeString *decimal;
if(fIsCurrencyFormat) {
decimal = &getConstSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol);
@@ -1764,7 +1756,9 @@ int32_t DecimalFormat::skipUWhiteSpace(const UnicodeString& text, int32_t pos) {
int32_t DecimalFormat::compareComplexAffix(const UnicodeString& affixPat,
const UnicodeString& text,
int32_t pos,
- UChar* currency) const {
+ UChar* currency) const
+{
+ int32_t start = pos;
U_ASSERT(currency != NULL ||
(fCurrencyChoice != NULL && *getCurrency() != 0));
@@ -1850,7 +1844,7 @@ int32_t DecimalFormat::compareComplexAffix(const UnicodeString& affixPat,
i = skipRuleWhiteSpace(affixPat, i);
}
}
- return pos;
+ return pos - start;
}
/**
diff --git a/Build/source/libs/icu-xetex/i18n/digitlst.cpp b/Build/source/libs/icu-xetex/i18n/digitlst.cpp
index 2ec5a147c11..350e685ae35 100644
--- a/Build/source/libs/icu-xetex/i18n/digitlst.cpp
+++ b/Build/source/libs/icu-xetex/i18n/digitlst.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1997-2004, International Business Machines
+* Copyright (C) 1997-2005, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -51,8 +51,6 @@ static char gDecimal = 0;
static const char LONG_MIN_REP[] = "2147483648";
static const char I64_MIN_REP[] = "9223372036854775808";
-static const int64_t I64_MIN_VALUE = U_INT64_MIN;
-
enum {
LONG_MIN_REP_LENGTH = sizeof(LONG_MIN_REP) - 1, //Ignore the NULL at the end
I64_MIN_REP_LENGTH = sizeof(I64_MIN_REP) - 1 //Ignore the NULL at the end
diff --git a/Build/source/libs/icu-xetex/i18n/dtfmtsym.cpp b/Build/source/libs/icu-xetex/i18n/dtfmtsym.cpp
index 30ebbebcf81..b710170916f 100644
--- a/Build/source/libs/icu-xetex/i18n/dtfmtsym.cpp
+++ b/Build/source/libs/icu-xetex/i18n/dtfmtsym.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -16,6 +16,7 @@
* 11/16/99 weiv Added 'Y' and 'e' to fgPatternChars
* 03/27/00 weiv Keeping resource bundle around!
* 06/30/05 emmons Added eraNames, narrow month/day, standalone context
+* 10/12/05 emmons Added setters for eraNames, month/day by width/context
*******************************************************************************
*/
@@ -25,13 +26,16 @@
#include "unicode/dtfmtsym.h"
#include "unicode/smpdtfmt.h"
+#include "cpputils.h"
#include "ucln_in.h"
#include "mutex.h"
#include "cmemory.h"
#include "cstring.h"
#include "locbased.h"
#include "gregoimp.h"
-
+#include "hash.h"
+#include "uresimp.h"
+
// *****************************************************************************
// class DateFormatSymbols
// *****************************************************************************
@@ -40,19 +44,22 @@
* resource data.
*/
-#define PATTERN_CHARS_LEN 24
+#define PATTERN_CHARS_LEN 26
/**
* Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All
* locales use the same these unlocalized pattern characters.
*/
static const UChar gPatternChars[] = {
- // GyMdkHmsSEDFwWahKzYeugAZvcL
+ // GyMdkHmsSEDFwWahKzYeugAZvcLQq
0x47, 0x79, 0x4D, 0x64, 0x6B, 0x48, 0x6D, 0x73, 0x53, 0x45,
0x44, 0x46, 0x77, 0x57, 0x61, 0x68, 0x4B, 0x7A, 0x59, 0x65,
- 0x75, 0x67, 0x41, 0x5A, 0x76, 0x63, 0x4c, 0
+ 0x75, 0x67, 0x41, 0x5A, 0x76, 0x63, 0x4c, 0x51, 0x71, 0
};
+/* length of an array */
+#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
+
//------------------------------------------------------
// Strings of last resort. These are only used if we have no resource
// files. They aren't designed for actual use, just for backup.
@@ -78,7 +85,7 @@ static const UChar gLastResortMonthNames[13][3] =
// These are the weekday names and abbreviations of last resort.
static const UChar gLastResortDayNames[8][2] =
{
- {0x0000, 0x0000}, /* "" */
+ {0x0030, 0x0000}, /* "0" */
{0x0031, 0x0000}, /* "1" */
{0x0032, 0x0000}, /* "2" */
{0x0033, 0x0000}, /* "3" */
@@ -88,6 +95,15 @@ static const UChar gLastResortDayNames[8][2] =
{0x0037, 0x0000} /* "7" */
};
+// These are the quarter names and abbreviations of last resort.
+static const UChar gLastResortQuarters[4][2] =
+{
+ {0x0031, 0x0000}, /* "1" */
+ {0x0032, 0x0000}, /* "2" */
+ {0x0033, 0x0000}, /* "3" */
+ {0x0034, 0x0000}, /* "4" */
+};
+
// These are the am/pm and BC/AD markers of last resort.
static const UChar gLastResortAmPmMarkers[2][3] =
{
@@ -103,12 +119,14 @@ static const UChar gLastResortEras[2][3] =
// These are the zone strings of last resort.
-static const UChar gLastResortZoneStrings[5][4] =
+static const UChar gLastResortZoneStrings[7][4] =
{
{0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
{0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
{0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
{0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
+ {0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
+ {0x0047, 0x004D, 0x0054, 0x0000}, /* "GMT" */
{0x0047, 0x004D, 0x0054, 0x0000} /* "GMT" */
};
@@ -123,6 +141,9 @@ typedef enum LastResortSize {
kAmPmNum = 2,
kAmPmLen = 3,
+ kQuarterNum = 4,
+ kQuarterLen = 2,
+
kEraNum = 2,
kEraLen = 3,
@@ -138,22 +159,37 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateFormatSymbols)
* These are the tags we expect to see in normal resource bundle files associated
* with a locale and calendar
*/
-const char gErasTag[]="eras";
-const char gAbbreviatedTag[] = "abbreviated";
-const char gMonthNamesTag[]="monthNames";
-const char gDayNamesTag[]="dayNames";
-const char gNamesWideTag[]="wide";
-const char gNamesAbbrTag[]="abbreviated";
-const char gNamesNarrowTag[]="narrow";
-const char gNamesStandaloneTag[]="stand-alone";
-const char gAmPmMarkersTag[]="AmPmMarkers";
+static const char gErasTag[]="eras";
+static const char gAbbreviatedTag[] = "abbreviated";
+static const char gMonthNamesTag[]="monthNames";
+static const char gDayNamesTag[]="dayNames";
+static const char gNamesWideTag[]="wide";
+static const char gNamesAbbrTag[]="abbreviated";
+static const char gNamesNarrowTag[]="narrow";
+static const char gNamesStandaloneTag[]="stand-alone";
+static const char gAmPmMarkersTag[]="AmPmMarkers";
+static const char gQuartersTag[]="quarters";
/**
* These are the tags we expect to see in time zone data resource bundle files
* associated with a locale.
*/
-const char gZoneStringsTag[]="zoneStrings";
-const char gLocalPatternCharsTag[]="localPatternChars";
+static const char gZoneStringsTag[]="zoneStrings";
+static const char gLocalPatternCharsTag[]="localPatternChars";
+
+static UMTX LOCK;
+
+/*
+ * Keep this variable in synch with max length of display strings
+ */
+#define UTZ_MAX_DISPLAY_STRINGS_LENGTH 7
+#define UTZ_SHORT_GENERIC "sg"
+#define UTZ_SHORT_STANDARD "ss"
+#define UTZ_SHORT_DAYLIGHT "sd"
+#define UTZ_LONG_GENERIC "lg"
+#define UTZ_LONG_STANDARD "ls"
+#define UTZ_LONG_DAYLIGHT "ld"
+#define UTZ_EXEMPLAR_CITY "ec"
/**
* Jitterbug 2974: MSVC has a bug whereby new X[0] behaves badly.
@@ -163,6 +199,12 @@ static inline UnicodeString* newUnicodeStringArray(size_t count) {
return new UnicodeString[count ? count : 1];
}
+U_CDECL_BEGIN
+static void deleteUnicodeStringArray(void* obj) {
+ delete[] (UnicodeString*)obj;
+}
+U_CDECL_END
+
//------------------------------------------------------
DateFormatSymbols::DateFormatSymbols(const Locale& locale,
@@ -268,10 +310,29 @@ DateFormatSymbols::copyData(const DateFormatSymbols& other) {
assignArray(fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, other.fStandaloneShortWeekdays, other.fStandaloneShortWeekdaysCount);
assignArray(fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount, other.fStandaloneNarrowWeekdays, other.fStandaloneNarrowWeekdaysCount);
assignArray(fAmPms, fAmPmsCount, other.fAmPms, other.fAmPmsCount);
-
- fZoneStringsRowCount = other.fZoneStringsRowCount;
- fZoneStringsColCount = other.fZoneStringsColCount;
- createZoneStrings((const UnicodeString**)other.fZoneStrings);
+ assignArray(fQuarters, fQuartersCount, other.fQuarters, other.fQuartersCount);
+ assignArray(fShortQuarters, fShortQuartersCount, other.fShortQuarters, other.fShortQuartersCount);
+ assignArray(fStandaloneQuarters, fStandaloneQuartersCount, other.fStandaloneQuarters, other.fStandaloneQuartersCount);
+ assignArray(fStandaloneShortQuarters, fStandaloneShortQuartersCount, other.fStandaloneShortQuarters, other.fStandaloneShortQuartersCount);
+ // the zoneStrings data is initialized on demand
+ //fZoneStringsRowCount = other.fZoneStringsRowCount;
+ //fZoneStringsColCount = other.fZoneStringsColCount;
+ //createZoneStrings((const UnicodeString**)other.fZoneStrings);
+ // initialize on demand
+ fZoneStringsHash = NULL;
+ fZoneIDEnumeration = NULL;
+ fZoneStrings = NULL;
+ fZoneStringsColCount = 0;
+ fZoneStringsRowCount = 0;
+ fResourceBundle = NULL;
+ if(other.fZoneStringsHash!=NULL){
+ fZoneStringsHash = createZoneStringsHash(other.fZoneStringsHash);
+ fZoneIDEnumeration = other.fZoneIDEnumeration->clone();
+ }else{
+ UErrorCode status =U_ZERO_ERROR;
+ fResourceBundle = ures_clone(other.fResourceBundle, &status);
+ // TODO: what should be done in case of error?
+ }
// fastCopyFrom() - see assignArray comments
fLocalPatternChars.fastCopyFrom(other.fLocalPatternChars);
@@ -310,6 +371,10 @@ void DateFormatSymbols::dispose()
if (fStandaloneShortWeekdays) delete[] fStandaloneShortWeekdays;
if (fStandaloneNarrowWeekdays) delete[] fStandaloneNarrowWeekdays;
if (fAmPms) delete[] fAmPms;
+ if (fQuarters) delete[] fQuarters;
+ if (fShortQuarters) delete[] fShortQuarters;
+ if (fStandaloneQuarters) delete[] fStandaloneQuarters;
+ if (fStandaloneShortQuarters) delete[] fStandaloneShortQuarters;
disposeZoneStrings();
}
@@ -320,7 +385,17 @@ void DateFormatSymbols::disposeZoneStrings()
for (int32_t row=0; row<fZoneStringsRowCount; ++row)
delete[] fZoneStrings[row];
uprv_free(fZoneStrings);
+ }
+ if(fZoneStringsHash){
+ delete fZoneStringsHash;
+ fZoneStringsHash = NULL;
}
+ if(fZoneIDEnumeration){
+ delete fZoneIDEnumeration;
+ fZoneIDEnumeration = NULL;
+ }
+ ures_close(fResourceBundle);
+ fResourceBundle = NULL;
}
UBool
@@ -359,8 +434,10 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const
fStandaloneShortWeekdaysCount == other.fStandaloneShortWeekdaysCount &&
fStandaloneNarrowWeekdaysCount == other.fStandaloneNarrowWeekdaysCount &&
fAmPmsCount == other.fAmPmsCount &&
- fZoneStringsRowCount == other.fZoneStringsRowCount &&
- fZoneStringsColCount == other.fZoneStringsColCount)
+ fQuartersCount == other.fQuartersCount &&
+ fShortQuartersCount == other.fShortQuartersCount &&
+ fStandaloneQuartersCount == other.fStandaloneQuartersCount &&
+ fStandaloneShortQuartersCount == other.fStandaloneShortQuartersCount)
{
// Now compare the arrays themselves
if (arrayCompare(fEras, other.fEras, fErasCount) &&
@@ -377,15 +454,28 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const
arrayCompare(fStandaloneWeekdays, other.fStandaloneWeekdays, fStandaloneWeekdaysCount) &&
arrayCompare(fStandaloneShortWeekdays, other.fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount) &&
arrayCompare(fStandaloneNarrowWeekdays, other.fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount) &&
- arrayCompare(fAmPms, other.fAmPms, fAmPmsCount))
+ arrayCompare(fAmPms, other.fAmPms, fAmPmsCount) &&
+ arrayCompare(fQuarters, other.fQuarters, fQuartersCount) &&
+ arrayCompare(fShortQuarters, other.fShortQuarters, fShortQuartersCount) &&
+ arrayCompare(fStandaloneQuarters, other.fStandaloneQuarters, fStandaloneQuartersCount) &&
+ arrayCompare(fStandaloneShortQuarters, other.fStandaloneShortQuarters, fStandaloneShortQuartersCount))
{
- if (fZoneStrings == other.fZoneStrings) return TRUE;
-
- for (int32_t row=0; row<fZoneStringsRowCount; ++row)
- {
- if (!arrayCompare(fZoneStrings[row], other.fZoneStrings[row], fZoneStringsColCount))
+
+ if(fZoneStringsHash == NULL || other.fZoneStringsHash == NULL){
+ // fZoneStringsHash is not initialized compare the resource bundles
+ if(ures_equal(fResourceBundle, other.fResourceBundle)== FALSE){
+ return FALSE;
+ }
+ }else{
+ if(fZoneStringsHash->equals(*other.fZoneStringsHash) == FALSE){
return FALSE;
+ }
+ // we always make sure that we update the enumeration when the hash is
+ // updated. So we can be sure that once we compare the hashes the
+ // enumerations are also equal
}
+ // since fZoneStrings data member is deprecated .. and may not be initialized
+ // so don't compare them
return TRUE;
}
}
@@ -428,38 +518,44 @@ DateFormatSymbols::getMonths(int32_t &count, DtContextType context, DtWidthType
UnicodeString *returnValue = NULL;
switch (context) {
- case FORMAT :
- switch(width) {
- case WIDE :
- count = fMonthsCount;
- returnValue = fMonths;
- break;
- case ABBREVIATED :
- count = fShortMonthsCount;
- returnValue = fShortMonths;
- break;
- case NARROW :
- count = fNarrowMonthsCount;
- returnValue = fNarrowMonths;
- break;
- }
- break;
- case STANDALONE :
- switch(width) {
- case WIDE :
- count = fStandaloneMonthsCount;
- returnValue = fStandaloneMonths;
- break;
- case ABBREVIATED :
- count = fStandaloneShortMonthsCount;
- returnValue = fStandaloneShortMonths;
- break;
- case NARROW :
- count = fStandaloneNarrowMonthsCount;
- returnValue = fStandaloneNarrowMonths;
- break;
- }
- break;
+ case FORMAT :
+ switch(width) {
+ case WIDE :
+ count = fMonthsCount;
+ returnValue = fMonths;
+ break;
+ case ABBREVIATED :
+ count = fShortMonthsCount;
+ returnValue = fShortMonths;
+ break;
+ case NARROW :
+ count = fNarrowMonthsCount;
+ returnValue = fNarrowMonths;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch(width) {
+ case WIDE :
+ count = fStandaloneMonthsCount;
+ returnValue = fStandaloneMonths;
+ break;
+ case ABBREVIATED :
+ count = fStandaloneShortMonthsCount;
+ returnValue = fStandaloneShortMonths;
+ break;
+ case NARROW :
+ count = fStandaloneNarrowMonthsCount;
+ returnValue = fStandaloneNarrowMonths;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
}
return returnValue;
}
@@ -483,38 +579,92 @@ DateFormatSymbols::getWeekdays(int32_t &count, DtContextType context, DtWidthTyp
{
UnicodeString *returnValue = NULL;
switch (context) {
- case FORMAT :
- switch(width) {
- case WIDE :
+ case FORMAT :
+ switch(width) {
+ case WIDE :
count = fWeekdaysCount;
returnValue = fWeekdays;
break;
- case ABBREVIATED :
+ case ABBREVIATED :
count = fShortWeekdaysCount;
returnValue = fShortWeekdays;
break;
- case NARROW :
+ case NARROW :
count = fNarrowWeekdaysCount;
returnValue = fNarrowWeekdays;
break;
- }
- break;
- case STANDALONE :
- switch(width) {
- case WIDE :
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch(width) {
+ case WIDE :
count = fStandaloneWeekdaysCount;
returnValue = fStandaloneWeekdays;
break;
- case ABBREVIATED :
+ case ABBREVIATED :
count = fStandaloneShortWeekdaysCount;
returnValue = fStandaloneShortWeekdays;
break;
- case NARROW :
+ case NARROW :
count = fStandaloneNarrowWeekdaysCount;
returnValue = fStandaloneNarrowWeekdays;
break;
- }
- break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
+ }
+ return returnValue;
+}
+
+const UnicodeString*
+DateFormatSymbols::getQuarters(int32_t &count, DtContextType context, DtWidthType width ) const
+{
+ UnicodeString *returnValue = NULL;
+
+ switch (context) {
+ case FORMAT :
+ switch(width) {
+ case WIDE :
+ count = fQuartersCount;
+ returnValue = fQuarters;
+ break;
+ case ABBREVIATED :
+ count = fShortQuartersCount;
+ returnValue = fShortQuarters;
+ break;
+ case NARROW :
+ count = 0;
+ returnValue = NULL;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch(width) {
+ case WIDE :
+ count = fStandaloneQuartersCount;
+ returnValue = fStandaloneQuarters;
+ break;
+ case ABBREVIATED :
+ count = fStandaloneShortQuartersCount;
+ returnValue = fStandaloneShortQuarters;
+ break;
+ case NARROW :
+ count = 0;
+ returnValue = NULL;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
}
return returnValue;
}
@@ -532,7 +682,8 @@ void
DateFormatSymbols::setEras(const UnicodeString* erasArray, int32_t count)
{
// delete the old list if we own it
- if (fEras) delete[] fEras;
+ if (fEras)
+ delete[] fEras;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
@@ -542,10 +693,25 @@ DateFormatSymbols::setEras(const UnicodeString* erasArray, int32_t count)
}
void
+DateFormatSymbols::setEraNames(const UnicodeString* eraNamesArray, int32_t count)
+{
+ // delete the old list if we own it
+ if (fEraNames)
+ delete[] fEraNames;
+
+ // we always own the new list, which we create here (we duplicate rather
+ // than adopting the list passed in)
+ fEraNames = newUnicodeStringArray(count);
+ uprv_arrayCopy(eraNamesArray,fEraNames, count);
+ fEraNamesCount = count;
+}
+
+void
DateFormatSymbols::setMonths(const UnicodeString* monthsArray, int32_t count)
{
// delete the old list if we own it
- if (fMonths) delete[] fMonths;
+ if (fMonths)
+ delete[] fMonths;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
@@ -558,7 +724,8 @@ void
DateFormatSymbols::setShortMonths(const UnicodeString* shortMonthsArray, int32_t count)
{
// delete the old list if we own it
- if (fShortMonths) delete[] fShortMonths;
+ if (fShortMonths)
+ delete[] fShortMonths;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
@@ -567,10 +734,78 @@ DateFormatSymbols::setShortMonths(const UnicodeString* shortMonthsArray, int32_t
fShortMonthsCount = count;
}
+void
+DateFormatSymbols::setMonths(const UnicodeString* monthsArray, int32_t count, DtContextType context, DtWidthType width)
+{
+ // delete the old list if we own it
+ // we always own the new list, which we create here (we duplicate rather
+ // than adopting the list passed in)
+
+ switch (context) {
+ case FORMAT :
+ switch (width) {
+ case WIDE :
+ if (fMonths)
+ delete[] fMonths;
+ fMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fMonths,count);
+ fMonthsCount = count;
+ break;
+ case ABBREVIATED :
+ if (fShortMonths)
+ delete[] fShortMonths;
+ fShortMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fShortMonths,count);
+ fShortMonthsCount = count;
+ break;
+ case NARROW :
+ if (fNarrowMonths)
+ delete[] fNarrowMonths;
+ fNarrowMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fNarrowMonths,count);
+ fNarrowMonthsCount = count;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch (width) {
+ case WIDE :
+ if (fStandaloneMonths)
+ delete[] fStandaloneMonths;
+ fStandaloneMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fStandaloneMonths,count);
+ fStandaloneMonthsCount = count;
+ break;
+ case ABBREVIATED :
+ if (fStandaloneShortMonths)
+ delete[] fStandaloneShortMonths;
+ fStandaloneShortMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fStandaloneShortMonths,count);
+ fStandaloneShortMonthsCount = count;
+ break;
+ case NARROW :
+ if (fStandaloneNarrowMonths)
+ delete[] fStandaloneNarrowMonths;
+ fStandaloneNarrowMonths = newUnicodeStringArray(count);
+ uprv_arrayCopy( monthsArray,fStandaloneNarrowMonths,count);
+ fStandaloneNarrowMonthsCount = count;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
+ }
+}
+
void DateFormatSymbols::setWeekdays(const UnicodeString* weekdaysArray, int32_t count)
{
// delete the old list if we own it
- if (fWeekdays) delete[] fWeekdays;
+ if (fWeekdays)
+ delete[] fWeekdays;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
@@ -583,16 +818,155 @@ void
DateFormatSymbols::setShortWeekdays(const UnicodeString* shortWeekdaysArray, int32_t count)
{
// delete the old list if we own it
- if (fShortWeekdays) delete[] fShortWeekdays;
+ if (fShortWeekdays)
+ delete[] fShortWeekdays;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
fShortWeekdays = newUnicodeStringArray(count);
- uprv_arrayCopy( shortWeekdaysArray,fShortWeekdays,count);
+ uprv_arrayCopy(shortWeekdaysArray, fShortWeekdays, count);
fShortWeekdaysCount = count;
}
void
+DateFormatSymbols::setWeekdays(const UnicodeString* weekdaysArray, int32_t count, DtContextType context, DtWidthType width)
+{
+ // delete the old list if we own it
+ // we always own the new list, which we create here (we duplicate rather
+ // than adopting the list passed in)
+
+ switch (context) {
+ case FORMAT :
+ switch (width) {
+ case WIDE :
+ if (fWeekdays)
+ delete[] fWeekdays;
+ fWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fWeekdays, count);
+ fWeekdaysCount = count;
+ break;
+ case ABBREVIATED :
+ if (fShortWeekdays)
+ delete[] fShortWeekdays;
+ fShortWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fShortWeekdays, count);
+ fShortWeekdaysCount = count;
+ break;
+ case NARROW :
+ if (fNarrowWeekdays)
+ delete[] fNarrowWeekdays;
+ fNarrowWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fNarrowWeekdays, count);
+ fNarrowWeekdaysCount = count;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch (width) {
+ case WIDE :
+ if (fStandaloneWeekdays)
+ delete[] fStandaloneWeekdays;
+ fStandaloneWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fStandaloneWeekdays, count);
+ fStandaloneWeekdaysCount = count;
+ break;
+ case ABBREVIATED :
+ if (fStandaloneShortWeekdays)
+ delete[] fStandaloneShortWeekdays;
+ fStandaloneShortWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fStandaloneShortWeekdays, count);
+ fStandaloneShortWeekdaysCount = count;
+ break;
+ case NARROW :
+ if (fStandaloneNarrowWeekdays)
+ delete[] fStandaloneNarrowWeekdays;
+ fStandaloneNarrowWeekdays = newUnicodeStringArray(count);
+ uprv_arrayCopy(weekdaysArray, fStandaloneNarrowWeekdays, count);
+ fStandaloneNarrowWeekdaysCount = count;
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
+ }
+}
+
+void
+DateFormatSymbols::setQuarters(const UnicodeString* quartersArray, int32_t count, DtContextType context, DtWidthType width)
+{
+ // delete the old list if we own it
+ // we always own the new list, which we create here (we duplicate rather
+ // than adopting the list passed in)
+
+ switch (context) {
+ case FORMAT :
+ switch (width) {
+ case WIDE :
+ if (fQuarters)
+ delete[] fQuarters;
+ fQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fQuarters,count);
+ fQuartersCount = count;
+ break;
+ case ABBREVIATED :
+ if (fShortQuarters)
+ delete[] fShortQuarters;
+ fShortQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fShortQuarters,count);
+ fShortQuartersCount = count;
+ break;
+ case NARROW :
+ /*
+ if (fNarrowQuarters)
+ delete[] fNarrowQuarters;
+ fNarrowQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fNarrowQuarters,count);
+ fNarrowQuartersCount = count;
+ */
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case STANDALONE :
+ switch (width) {
+ case WIDE :
+ if (fStandaloneQuarters)
+ delete[] fStandaloneQuarters;
+ fStandaloneQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fStandaloneQuarters,count);
+ fStandaloneQuartersCount = count;
+ break;
+ case ABBREVIATED :
+ if (fStandaloneShortQuarters)
+ delete[] fStandaloneShortQuarters;
+ fStandaloneShortQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fStandaloneShortQuarters,count);
+ fStandaloneShortQuartersCount = count;
+ break;
+ case NARROW :
+ /*
+ if (fStandaloneNarrowQuarters)
+ delete[] fStandaloneNarrowQuarters;
+ fStandaloneNarrowQuarters = newUnicodeStringArray(count);
+ uprv_arrayCopy( quartersArray,fStandaloneNarrowQuarters,count);
+ fStandaloneNarrowQuartersCount = count;
+ */
+ break;
+ case DT_WIDTH_COUNT :
+ break;
+ }
+ break;
+ case DT_CONTEXT_COUNT :
+ break;
+ }
+}
+
+void
DateFormatSymbols::setAmPmStrings(const UnicodeString* amPmsArray, int32_t count)
{
// delete the old list if we own it
@@ -610,8 +984,18 @@ DateFormatSymbols::setAmPmStrings(const UnicodeString* amPmsArray, int32_t count
const UnicodeString**
DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const
{
+ umtx_lock(&LOCK);
+ UErrorCode status = U_ZERO_ERROR;
+ if(fZoneStrings==NULL){
+ // cast away const to get around the problem for lazy initialization
+ ((DateFormatSymbols*)this)->initZoneStringsArray(status);
+ if(U_FAILURE(status)){
+ return NULL;
+ }
+ }
rowCount = fZoneStringsRowCount;
columnCount = fZoneStringsColCount;
+ umtx_unlock(&LOCK);
return (const UnicodeString**)fZoneStrings; // Compiler requires cast
}
@@ -621,12 +1005,13 @@ DateFormatSymbols::setZoneStrings(const UnicodeString* const *strings, int32_t r
// since deleting a 2-d array is a pain in the butt, we offload that task to
// a separate function
disposeZoneStrings();
-
+ UErrorCode status = U_ZERO_ERROR;
// we always own the new list, which we create here (we duplicate rather
// than adopting the list passed in)
fZoneStringsRowCount = rowCount;
fZoneStringsColCount = columnCount;
createZoneStrings((const UnicodeString**)strings);
+ initZoneStrings((const UnicodeString**)strings, rowCount,columnCount, status);
}
//------------------------------------------------------
@@ -701,7 +1086,6 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
int32_t i;
int32_t len = 0;
const UChar *resStr;
-
/* In case something goes wrong, initialize all of the data to NULL. */
fEras = NULL;
fErasCount = 0;
@@ -733,11 +1117,22 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
fStandaloneNarrowWeekdaysCount=0;
fAmPms = NULL;
fAmPmsCount=0;
+ fQuarters = NULL;
+ fQuartersCount = 0;
+ fShortQuarters = NULL;
+ fShortQuartersCount = 0;
+ fStandaloneQuarters = NULL;
+ fStandaloneQuartersCount = 0;
+ fStandaloneShortQuarters = NULL;
+ fStandaloneShortQuartersCount = 0;
fZoneStringsRowCount = 0;
fZoneStringsColCount = 0;
fZoneStrings = NULL;
-
-
+ fZoneStringsHash = NULL;
+ fZoneIDEnumeration = NULL;
+ fResourceBundle = NULL;
+
+
if (U_FAILURE(status)) return;
/**
@@ -746,7 +1141,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
* these.
*/
CalendarData calData(locale, type, status);
- UResourceBundle *nonCalendarData = ures_open((char*)0, locale.getName(), &status);
+ fResourceBundle = ures_open((char*)0, locale.getName(), &status);
// load the first data item
UResourceBundle *erasMain = calData.getByKey(gErasTag, status);
@@ -764,8 +1159,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
UResourceBundle *standaloneWeekdaysData = NULL; // Data closed by calData
UResourceBundle *standaloneShortWeekdaysData = NULL; // Data closed by calData
UResourceBundle *standaloneNarrowWeekdaysData = NULL; // Data closed by calData
- UResourceBundle *zoneArray = ures_getByKey(nonCalendarData, gZoneStringsTag, NULL, &status);
- UResourceBundle *zoneRow = ures_getByIndex(zoneArray, (int32_t)0, NULL, &status);
+
U_LOCALE_BASED(locBased, *this);
if (U_FAILURE(status))
{
@@ -793,14 +1187,10 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
initField(&fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status);
initField(&fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status);
initField(&fAmPms, fAmPmsCount, (const UChar *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status);
-
- fZoneStrings = (UnicodeString **)uprv_malloc(sizeof(UnicodeString *));
- /* test for NULL */
- if (fZoneStrings == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- fZoneStringsRowCount = 1;
- initField(fZoneStrings, fZoneStringsColCount, (const UChar *)gLastResortZoneStrings, kZoneNum, kZoneLen, status);
+ initField(&fQuarters, fQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status);
+ initField(&fShortQuarters, fShortQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status);
+ initField(&fStandaloneQuarters, fStandaloneQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status);
+ initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status);
fLocalPatternChars = gPatternChars;
}
goto cleanup;
@@ -811,15 +1201,23 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
// are stored in a separate file
locBased.setLocaleIDs(ures_getLocaleByType(eras, ULOC_VALID_LOCALE, &status),
ures_getLocaleByType(eras, ULOC_ACTUAL_LOCALE, &status));
+
initField(&fEras, fErasCount, eras, status);
initField(&fEraNames, fEraNamesCount, eraNames, status);
+
initField(&fMonths, fMonthsCount, calData.getByKey2(gMonthNamesTag, gNamesWideTag, status), status);
initField(&fShortMonths, fShortMonthsCount, calData.getByKey2(gMonthNamesTag, gNamesAbbrTag, status), status);
+
initField(&fNarrowMonths, fNarrowMonthsCount, calData.getByKey2(gMonthNamesTag, gNamesNarrowTag, status), status);
+ if(status == U_MISSING_RESOURCE_ERROR) {
+ status = U_ZERO_ERROR;
+ initField(&fNarrowMonths, fNarrowMonthsCount, calData.getByKey3(gMonthNamesTag, gNamesStandaloneTag, gNamesNarrowTag, status), status);
+ }
if ( status == U_MISSING_RESOURCE_ERROR ) { /* If format/narrow not available, use format/abbreviated */
status = U_ZERO_ERROR;
initField(&fNarrowMonths, fNarrowMonthsCount, calData.getByKey2(gMonthNamesTag, gNamesAbbrTag, status), status);
}
+
initField(&fStandaloneMonths, fStandaloneMonthsCount, calData.getByKey3(gMonthNamesTag, gNamesStandaloneTag, gNamesWideTag, status), status);
if ( status == U_MISSING_RESOURCE_ERROR ) { /* If standalone/wide not available, use format/wide */
status = U_ZERO_ERROR;
@@ -841,8 +1239,23 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
}
initField(&fAmPms, fAmPmsCount, calData.getByKey(gAmPmMarkersTag, status), status);
+ initField(&fQuarters, fQuartersCount, calData.getByKey2(gQuartersTag, gNamesWideTag, status), status);
+ initField(&fShortQuarters, fShortQuartersCount, calData.getByKey2(gQuartersTag, gNamesAbbrTag, status), status);
+
+ initField(&fStandaloneQuarters, fStandaloneQuartersCount, calData.getByKey3(gQuartersTag, gNamesStandaloneTag, gNamesWideTag, status), status);
+ if(status == U_MISSING_RESOURCE_ERROR) {
+ status = U_ZERO_ERROR;
+ initField(&fStandaloneQuarters, fStandaloneQuartersCount, calData.getByKey2(gQuartersTag, gNamesWideTag, status), status);
+ }
+
+ initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, calData.getByKey3(gQuartersTag, gNamesStandaloneTag, gNamesAbbrTag, status), status);
+ if(status == U_MISSING_RESOURCE_ERROR) {
+ status = U_ZERO_ERROR;
+ initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, calData.getByKey2(gQuartersTag, gNamesAbbrTag, status), status);
+ }
+
// fastCopyFrom()/setTo() - see assignArray comments
- resStr = ures_getStringByKey(nonCalendarData, gLocalPatternCharsTag, &len, &status);
+ resStr = ures_getStringByKey(fResourceBundle, gLocalPatternCharsTag, &len, &status);
fLocalPatternChars.setTo(TRUE, resStr, len);
// If the locale data does not include new pattern chars, use the defaults
// TODO: Consider making this an error, since this may add conflicting characters.
@@ -850,39 +1263,12 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
fLocalPatternChars.append(UnicodeString(TRUE, &gPatternChars[len], PATTERN_CHARS_LEN-len));
}
- /* TODO: Fix the case where the zoneStrings is not a perfect square array of information. */
- fZoneStringsRowCount = ures_getSize(zoneArray);
- fZoneStringsColCount = ures_getSize(zoneRow);
- fZoneStrings = (UnicodeString **)uprv_malloc(fZoneStringsRowCount * sizeof(UnicodeString *));
- /* test for NULL */
- if (fZoneStrings == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- goto cleanup;
- }
- for(i = 0; i<fZoneStringsRowCount; i++) {
- *(fZoneStrings+i) = newUnicodeStringArray(fZoneStringsColCount);
- /* test for NULL */
- if ((*(fZoneStrings+i)) == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- goto cleanup;
- }
- zoneRow = ures_getByIndex(zoneArray, i, zoneRow, &status);
- // compute the size of the array dynamically. Don't assume
- // that all rows of zone strings are of the same size.
- int32_t size = ures_getSize(zoneRow);
- for(int32_t j = 0; j<size; j++) {
- resStr = ures_getStringByIndex(zoneRow, j, &len, &status);
- // setTo() - see assignArray comments
- fZoneStrings[i][j].setTo(TRUE, resStr, len);
- }
- }
-
// {sfb} fixed to handle 1-based weekdays
weekdaysData = calData.getByKey2(gDayNamesTag, gNamesWideTag, status);
fWeekdaysCount = ures_getSize(weekdaysData);
fWeekdays = new UnicodeString[fWeekdaysCount+1];
- /* test for NULL */
- if (fWeekdays == 0) {
+ /* pin the blame on system. If we cannot get a chunk of memory .. the system is dying!*/
+ if (fWeekdays == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
goto cleanup;
}
@@ -911,6 +1297,10 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
fShortWeekdaysCount++;
narrowWeekdaysData = calData.getByKey2(gDayNamesTag, gNamesNarrowTag, status);
+ if(status == U_MISSING_RESOURCE_ERROR) {
+ status = U_ZERO_ERROR;
+ narrowWeekdaysData = calData.getByKey3(gDayNamesTag, gNamesStandaloneTag, gNamesNarrowTag, status);
+ }
if ( status == U_MISSING_RESOURCE_ERROR ) {
status = U_ZERO_ERROR;
narrowWeekdaysData = calData.getByKey2(gDayNamesTag, gNamesAbbrTag, status);
@@ -997,9 +1387,6 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
cleanup:
ures_close(eras);
ures_close(eraNames);
- ures_close(zoneRow);
- ures_close(zoneArray);
- ures_close(nonCalendarData);
}
/**
@@ -1057,6 +1444,584 @@ DateFormatSymbols::getLocale(ULocDataLocaleType type, UErrorCode& status) const
return locBased.getLocale(type, status);
}
+class TimeZoneKeysEnumeration : public StringEnumeration {
+private:
+ UnicodeString* strings;
+ int32_t length;
+ int32_t current;
+ int32_t capacity;
+ TimeZoneKeysEnumeration(UnicodeString* oldStrs, int32_t count){
+ strings = newUnicodeStringArray(count);
+ if(strings==NULL){
+ return;
+ }
+ capacity = count;
+ current = 0;
+ for(length = 0; length<capacity; length++){
+ strings[length].setTo(oldStrs[length]);
+ }
+ }
+public:
+ static UClassID U_EXPORT2 getStaticClassID(void);
+ virtual UClassID getDynamicClassID(void) const;
+
+ TimeZoneKeysEnumeration(int32_t count, UErrorCode status){
+ strings = newUnicodeStringArray(count);
+ if(strings == NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ length = 0;
+ current = 0;
+ capacity = count;
+ }
+
+ void put(const UnicodeString& str, UErrorCode& status){
+ if(length < capacity){
+ strings[length++].setTo(str);
+ }else{
+ status = U_INDEX_OUTOFBOUNDS_ERROR;
+ }
+ }
+ virtual ~TimeZoneKeysEnumeration() {
+ delete[] strings;
+ }
+
+ virtual StringEnumeration * clone() const
+ {
+ return new TimeZoneKeysEnumeration(strings, length);
+ }
+
+ virtual int32_t count(UErrorCode &/*status*/) const {
+ return length;
+ }
+ virtual const UChar* unext(int32_t *resultLength, UErrorCode& /*status*/){
+ if(current < length){
+ const UChar* ret = strings[current].getBuffer();
+ *resultLength = strings[current].length();
+ current++;
+ return ret;
+ }
+ return NULL;
+ }
+
+ virtual const UnicodeString* snext(UErrorCode& status) {
+ if(U_FAILURE(status)){
+ return NULL;
+ }
+ if(current < length){
+ return &strings[current++];
+ }
+ return NULL;
+ }
+ /* this method is for thread safe iteration */
+ const UnicodeString* snext(int32_t& pos, UErrorCode& status)const {
+ if(U_FAILURE(status)){
+ return NULL;
+ }
+ if(pos < length){
+ return &strings[pos++];
+ }
+ return NULL;
+ }
+
+ virtual void reset(UErrorCode& /*status*/) {
+ current = 0;
+
+ }
+private:
+ UBool equals(const StringEnumeration& other) const{
+ if (other.getDynamicClassID() != TimeZoneKeysEnumeration::getStaticClassID()) {
+ return FALSE;
+ }
+ TimeZoneKeysEnumeration& enum2 = (TimeZoneKeysEnumeration&)(other);
+ UErrorCode status = U_ZERO_ERROR;
+
+ int32_t count1 = count(status);
+ int32_t count2 = other.count(status);
+ if(count1 != count2){
+ return FALSE;
+ }
+ int32_t pos1 = 0;
+ int32_t pos2 = 0;
+ const UnicodeString* str1 = NULL;
+ const UnicodeString* str2 = NULL;
+
+ while((str1 = snext(pos1, status))!=NULL){
+ str2 = enum2.snext(pos2, status);
+ if(U_FAILURE(status)){
+ return FALSE;
+ }
+ if(*str1 != *str2){
+ // bail out at the first failure
+ return FALSE;
+ }
+
+ }
+ // if we reached here that means that the enumerations are equal
+ return TRUE;
+ }
+public:
+ virtual UBool operator==(const StringEnumeration& that)const{
+ return ((this == &that) ||
+ (getDynamicClassID() == that.getDynamicClassID() &&
+ StringEnumeration::operator==(that) &&
+ equals(that)));
+ }
+};
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZoneKeysEnumeration)
+
+void
+DateFormatSymbols::initZoneStringsArray(UErrorCode& status){
+ if(fZoneStringsHash == NULL){
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return;
+ }
+ fZoneStringsRowCount = fZoneIDEnumeration->count(status);
+ fZoneStringsColCount = 8;
+ fZoneStrings = (UnicodeString **)uprv_malloc(fZoneStringsRowCount * sizeof(UnicodeString *));
+ /* if we can't get a chunk of heap then the system is going down. Pin the blame on system*/
+ if (fZoneStrings == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ const UnicodeString *zid = NULL;
+ TimeZoneKeysEnumeration *keys = (TimeZoneKeysEnumeration*) fZoneIDEnumeration;
+ int32_t pos = 0;
+ int32_t i = 0;
+ while((zid=keys->snext(pos,status))!=NULL){
+ *(fZoneStrings+i) = newUnicodeStringArray(fZoneStringsColCount);
+ /* test for NULL */
+ if ((*(fZoneStrings+i)) == 0) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ UnicodeString* strings = (UnicodeString*)fZoneStringsHash->get(*zid);
+ fZoneStrings[i][0].setTo(*zid);
+ fZoneStrings[i][1].setTo(strings[TIMEZONE_LONG_STANDARD]);
+ fZoneStrings[i][2].setTo(strings[TIMEZONE_SHORT_STANDARD]);
+ fZoneStrings[i][3].setTo(strings[TIMEZONE_LONG_DAYLIGHT]);
+ fZoneStrings[i][4].setTo(strings[TIMEZONE_SHORT_DAYLIGHT]);
+ fZoneStrings[i][5].setTo(strings[TIMEZONE_EXEMPLAR_CITY]);
+ if(fZoneStrings[i][5].length()==0){
+ fZoneStrings[i][5].setTo(strings[TIMEZONE_LONG_GENERIC]);
+ }else{
+ fZoneStrings[i][6].setTo(strings[TIMEZONE_LONG_GENERIC]);
+ }
+ if(fZoneStrings[i][6].length()==0){
+ fZoneStrings[i][6].setTo(strings[TIMEZONE_LONG_GENERIC]);
+ }else{
+ fZoneStrings[i][7].setTo(strings[TIMEZONE_LONG_GENERIC]);
+ }
+ i++;
+ }
+}
+
+U_CDECL_BEGIN
+static UBool U_CALLCONV
+compareTZHashValues(const UHashTok val1, const UHashTok val2){
+
+ const UnicodeString* array1 = (UnicodeString*) val1.pointer;
+ const UnicodeString* array2 = (UnicodeString*) val2.pointer;
+ if(array1==array2){
+ return TRUE;
+ }
+ if(array1==NULL || array2==NULL){
+ return FALSE;
+ }
+ for(int32_t j=0; j< UTZ_MAX_DISPLAY_STRINGS_LENGTH; j++){
+ if(array1[j] != array2[j]){
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+U_CDECL_END
+
+void
+DateFormatSymbols::initZoneStrings(UErrorCode &status){
+ if(U_FAILURE(status)){
+ return;
+ }
+
+ if(fZoneStringsHash != NULL){
+ return;
+ }
+ int32_t i;
+
+ fZoneStringsHash = new Hashtable(uhash_compareUnicodeString, compareTZHashValues, status);
+ if(fZoneStringsHash==NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fZoneStringsHash->setValueDeleter(deleteUnicodeStringArray);
+
+ if(fResourceBundle != NULL){
+ UnicodeString solidus = UNICODE_STRING_SIMPLE("/");
+ UnicodeString colon = UNICODE_STRING_SIMPLE(":");
+ UResourceBundle zoneArray,zoneItem;
+ ures_initStackObject(&zoneItem);
+ ures_initStackObject(&zoneArray);
+ for(const UResourceBundle* rb = fResourceBundle; rb!=NULL; rb=ures_getParentBundle(rb)){
+ ures_getByKey(rb, gZoneStringsTag, &zoneArray, &status);
+ if(U_FAILURE(status)){
+ break;
+ }
+ while(ures_hasNext(&zoneArray)){
+ UErrorCode tempStatus = U_ZERO_ERROR;
+ UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
+ ures_getNextResource(&zoneArray, &zoneItem, &status);
+ UnicodeString key(ures_getKey(&zoneItem), -1, US_INV);
+ key.findAndReplace(colon, solidus);
+ int32_t len = 0;
+ //fetch the strings with fine grained fallback
+ const UChar* str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_STANDARD, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_SHORT_STANDARD].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_GENERIC, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_SHORT_GENERIC].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_DAYLIGHT, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_SHORT_DAYLIGHT].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_STANDARD, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_LONG_STANDARD].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_GENERIC, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_LONG_GENERIC].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_DAYLIGHT, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_LONG_DAYLIGHT].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_EXEMPLAR_CITY, &len, &tempStatus);
+ if(U_SUCCESS(tempStatus)){
+ array[TIMEZONE_EXEMPLAR_CITY].setTo(TRUE, str, len);
+ }else{
+ tempStatus = U_ZERO_ERROR;
+ }
+ // store the strings in hash
+ fZoneStringsHash->put(key, array, status);
+ }
+ ures_close(&zoneItem);
+ ures_close(&zoneArray);
+ }
+ int32_t length = fZoneStringsHash->count();
+ TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(length, status);
+ fZoneIDEnumeration = keysEnum;
+ if(fZoneIDEnumeration==NULL){
+ delete fZoneStringsHash;
+ fZoneStringsHash = NULL;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ int32_t pos=-1;
+ const UnicodeString* key;
+ const UHashElement* elem = NULL;
+ while((elem = fZoneStringsHash->nextElement(pos))!= NULL){
+ const UHashTok keyTok = elem->key;
+ key = (const UnicodeString*)keyTok.pointer;
+ keysEnum->put(*key, status);
+ }
+ }else{
+ //last resort strings
+ UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
+ if(array==NULL){
+ delete fZoneStringsHash;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ int32_t length = ARRAY_LENGTH(gLastResortZoneStrings);
+ UnicodeString key(gLastResortZoneStrings[0]);
+ TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(length, status);
+ fZoneIDEnumeration = keysEnum;
+ if(fZoneIDEnumeration==NULL){
+ delete fZoneStringsHash;
+ delete[] array;
+ fZoneStringsHash = NULL;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ keysEnum->put(key, status);
+ int32_t j=1;
+ for(i=0; i< length; ){
+ array[i++].setTo(gLastResortZoneStrings[j++]);
+ }
+ fZoneStringsHash->put(key, array, status);
+ }
+}
+void
+DateFormatSymbols::initZoneStrings(const UnicodeString** strings, int32_t rowCount, int32_t columnCount, UErrorCode& status){
+ if(strings==NULL || rowCount<0 || columnCount<0){
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(rowCount, status);
+ fZoneIDEnumeration = keysEnum;
+ if(U_FAILURE(status)){
+ return;
+ }
+ if(fZoneIDEnumeration==NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fZoneStringsHash = new Hashtable(uhash_compareUnicodeString, compareTZHashValues, status);
+ if(U_FAILURE(status)){
+ return;
+ }
+ if(fZoneStringsHash==NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fZoneStringsHash->setValueDeleter(deleteUnicodeStringArray);
+ for (int32_t row=0; row<rowCount; ++row){
+ // the first string in the array is the key.
+ UnicodeString key = strings[row][0];
+ keysEnum->put(key, status);
+ UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
+ if(array==NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t col=1; col<columnCount; ++col) {
+ // fastCopyFrom() - see assignArray comments
+ switch (col){
+ case 1:
+ array[TIMEZONE_LONG_STANDARD].setTo(strings[row][col]);
+ break;
+ case 2:
+ array[TIMEZONE_SHORT_STANDARD].setTo(strings[row][col]);
+ break;
+ case 3:
+ array[TIMEZONE_LONG_DAYLIGHT].setTo(strings[row][col]);
+ break;
+ case 4:
+ array[TIMEZONE_LONG_DAYLIGHT].setTo(strings[row][col]);
+ break;
+ case 5:
+ if(fZoneStringsColCount==6 || fZoneStringsColCount==8){
+ array[TIMEZONE_EXEMPLAR_CITY].setTo(strings[row][col]);
+ }else{
+ array[TIMEZONE_LONG_GENERIC].setTo(strings[row][col]);
+ }
+ break;
+ case 6:
+ if(fZoneStringsColCount==8){
+ array[TIMEZONE_LONG_GENERIC].setTo(strings[row][col]);
+ }else{
+ array[TIMEZONE_SHORT_GENERIC].setTo(strings[row][col]);
+ }
+ break;
+ case 7:
+ array[TIMEZONE_SHORT_GENERIC].setTo(strings[row][col]);
+ break;
+ default:
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ // populate the hash table
+ fZoneStringsHash->put(strings[row][0], array, status);
+ }
+ }
+
+}
+
+UnicodeString&
+DateFormatSymbols::getZoneString(const UnicodeString &zid, const TimeZoneTranslationType type,
+ UnicodeString &result, UErrorCode &status){
+
+ if(fZoneStringsHash == NULL){
+ //lazy initialization
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return result;
+ }
+ UnicodeString* stringsArray = (UnicodeString*)fZoneStringsHash->get(zid);
+ if(stringsArray != NULL){
+ result.setTo(stringsArray[type],0);
+ }
+
+ return result;
+}
+
+StringEnumeration*
+DateFormatSymbols::createZoneStringIDs(UErrorCode &status){
+ if(U_FAILURE(status)){
+ return NULL;
+ }
+ if(fZoneStringsHash == NULL){
+ //lazy initialization
+ initZoneStrings(status);
+ }
+ return fZoneIDEnumeration->clone();
+}
+
+/**
+ * Sets timezone strings.
+ * @draft ICU 3.6
+ */
+void
+DateFormatSymbols::setZoneString(const UnicodeString &zid, const TimeZoneTranslationType type,
+ const UnicodeString &value, UErrorCode &status){
+ if(fZoneStringsHash == NULL){
+ //lazy initialization
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return;
+ }
+ UnicodeString* stringsArray = (UnicodeString*)fZoneStringsHash->get(zid);
+ if(stringsArray != NULL){
+ stringsArray[type].setTo(value);
+ }else{
+ stringsArray = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
+ if(stringsArray==NULL){
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ stringsArray[type].setTo(value);
+ fZoneStringsHash->put(zid, stringsArray, status);
+ TimeZoneKeysEnumeration* keys = (TimeZoneKeysEnumeration*) fZoneIDEnumeration;
+ keys->put(zid, status);
+ }
+}
+
+Hashtable*
+DateFormatSymbols::createZoneStringsHash(const Hashtable* otherHash){
+ UErrorCode status = U_ZERO_ERROR;
+ Hashtable* hash = new Hashtable(uhash_compareUnicodeString, compareTZHashValues, status);
+ if(hash==NULL){
+ return NULL;
+ }
+ if(U_FAILURE(status)){
+ return NULL;
+ }
+ hash->setValueDeleter(deleteUnicodeStringArray);
+ int32_t pos = -1;
+ const UHashElement* elem = NULL;
+ // walk through the hash table and create a deep clone
+ while((elem = otherHash->nextElement(pos))!= NULL){
+ const UHashTok otherKeyTok = elem->key;
+ const UHashTok otherValueTok = elem->value;
+ UnicodeString* otherKey = (UnicodeString*)otherKeyTok.pointer;
+ UnicodeString* otherArray = (UnicodeString*)otherValueTok.pointer;
+ UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
+ if(array==NULL){
+ return NULL;
+ }
+ UnicodeString key(*otherKey);
+ for(int32_t i=0; i<UTZ_MAX_DISPLAY_STRINGS_LENGTH; i++){
+ array[i].setTo(otherArray[i]);
+ }
+ hash->put(key, array, status);
+ if(U_FAILURE(status)){
+ delete[] array;
+ return NULL;
+ }
+ }
+ return hash;
+}
+
+
+UnicodeString&
+DateFormatSymbols::getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status){
+ if(fZoneStringsHash == NULL){
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return result;
+ }
+ UnicodeString* strings = (UnicodeString*)fZoneStringsHash->get(zid);
+ if (strings != NULL) {
+ return result.setTo(zid,0);
+ }
+
+ // Do a search through the equivalency group for the given ID
+ int32_t n = TimeZone::countEquivalentIDs(zid);
+ if (n > 1) {
+ int32_t i;
+ for (i=0; i<n; ++i) {
+ UnicodeString equivID = TimeZone::getEquivalentID(zid, i);
+ if (equivID != zid) {
+ strings = (UnicodeString*)fZoneStringsHash->get(equivID);
+ if (strings != NULL) {
+ return result.setTo(equivID,0);
+ }
+ }
+ }
+ }else{
+ result.setTo(zid);
+ }
+ return result;
+}
+
+void
+DateFormatSymbols::getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start,
+ TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status){
+ if(fZoneStringsHash == NULL){
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return;
+ }
+ type = TIMEZONE_COUNT;
+ UnicodeString* strings = (UnicodeString*)fZoneStringsHash->get(zid);
+ if(strings != NULL){
+ for(int32_t j=0; j<UTZ_MAX_DISPLAY_STRINGS_LENGTH; j++){
+ if(strings[j].length() >0 && text.caseCompare(start, strings[j].length(), strings[j], 0)==0){
+ type = (TimeZoneTranslationType)j;
+ value.setTo(strings[j]);
+ return;
+ }
+ }
+ }
+}
+void
+DateFormatSymbols::findZoneIDTypeValue( UnicodeString& zid, const UnicodeString& text, int32_t start,
+ TimeZoneTranslationType& type, UnicodeString& value,
+ UErrorCode& status){
+ if(fZoneStringsHash == NULL){
+ initZoneStrings(status);
+ }
+ if(U_FAILURE(status)){
+ return;
+ }
+ const UnicodeString* myKey = NULL;
+ int32_t pos = 0;
+ TimeZoneKeysEnumeration *keys = (TimeZoneKeysEnumeration*)fZoneIDEnumeration;
+ while( (myKey=keys->snext(pos, status))!= NULL){
+ UnicodeString* strings = (UnicodeString*)fZoneStringsHash->get(*myKey);
+ if(strings != NULL){
+ for(int32_t j=0; j<UTZ_MAX_DISPLAY_STRINGS_LENGTH; j++){
+ if(strings[j].length()>0 && text.caseCompare(start, strings[j].length(), strings[j], 0)==0){
+ type = (TimeZoneTranslationType)j;
+ value.setTo(strings[j]);
+ zid.setTo(*myKey);
+ return;
+ }
+ }
+ }
+ }
+}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/esctrn.cpp b/Build/source/libs/icu-xetex/i18n/esctrn.cpp
index 4a7406a23f5..93f13f5816c 100644
--- a/Build/source/libs/icu-xetex/i18n/esctrn.cpp
+++ b/Build/source/libs/icu-xetex/i18n/esctrn.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2001-2004, International Business Machines
+* Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -32,28 +32,28 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EscapeTransliterator)
/**
* Factory methods
*/
-static Transliterator* _createUnicode(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscUnicode(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Unicode: "U+10FFFF" hex, min=4, max=6
return new EscapeTransliterator(ID, UNIPRE, EMPTY, 16, 4, TRUE, NULL);
}
-static Transliterator* _createJava(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscJava(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Java: "\\uFFFF" hex, min=4, max=4
return new EscapeTransliterator(ID, BS_u, EMPTY, 16, 4, FALSE, NULL);
}
-static Transliterator* _createC(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscC(const UnicodeString& ID, Transliterator::Token /*context*/) {
// C: "\\uFFFF" hex, min=4, max=4; \\U0010FFFF hex, min=8, max=8
return new EscapeTransliterator(ID, BS_u, EMPTY, 16, 4, TRUE,
new EscapeTransliterator(EMPTY, BS_U, EMPTY, 16, 8, TRUE, NULL));
}
-static Transliterator* _createXML(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscXML(const UnicodeString& ID, Transliterator::Token /*context*/) {
// XML: "&#x10FFFF;" hex, min=1, max=6
return new EscapeTransliterator(ID, XMLPRE, SEMI, 16, 1, TRUE, NULL);
}
-static Transliterator* _createXML10(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscXML10(const UnicodeString& ID, Transliterator::Token /*context*/) {
// XML10: "&1114111;" dec, min=1, max=7 (not really "Any-Hex")
return new EscapeTransliterator(ID, XML10PRE, SEMI, 10, 1, TRUE, NULL);
}
-static Transliterator* _createPerl(const UnicodeString& ID, Transliterator::Token /*context*/) {
+static Transliterator* _createEscPerl(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Perl: "\\x{263A}" hex, min=1, max=6
return new EscapeTransliterator(ID, PERLPRE, RBRACE, 16, 1, TRUE, NULL);
}
@@ -65,19 +65,19 @@ static Transliterator* _createPerl(const UnicodeString& ID, Transliterator::Toke
void EscapeTransliterator::registerIDs() {
Token t = integerToken(0);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Unicode"), _createUnicode, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Unicode"), _createEscUnicode, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Java"), _createJava, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Java"), _createEscJava, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/C"), _createC, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/C"), _createEscC, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/XML"), _createXML, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/XML"), _createEscXML, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/XML10"), _createXML10, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/XML10"), _createEscXML10, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Perl"), _createPerl, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex/Perl"), _createEscPerl, t);
- Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex"), _createJava, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Any-Hex"), _createEscJava, t);
}
/**
diff --git a/Build/source/libs/icu-xetex/i18n/esctrn.h b/Build/source/libs/icu-xetex/i18n/esctrn.h
index ce207e1f509..6dae51b8774 100644
--- a/Build/source/libs/icu-xetex/i18n/esctrn.h
+++ b/Build/source/libs/icu-xetex/i18n/esctrn.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2001-2004, International Business Machines
+* Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -117,15 +117,11 @@ class U_I18N_API EscapeTransliterator : public Transliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/fmtable.cpp b/Build/source/libs/icu-xetex/i18n/fmtable.cpp
index b3a882e9056..b767b332166 100644
--- a/Build/source/libs/icu-xetex/i18n/fmtable.cpp
+++ b/Build/source/libs/icu-xetex/i18n/fmtable.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -43,30 +43,43 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Formattable)
// of the Measure class, which is true as of 3.0. [alan]
// Return TRUE if *a == *b.
-inline UBool objectEquals(const UObject* a, const UObject* b) {
+static inline UBool objectEquals(const UObject* a, const UObject* b) {
// LATER: return *a == *b;
return *((const Measure*) a) == *((const Measure*) b);
}
// Return a clone of *a.
-inline UObject* objectClone(const UObject* a) {
+static inline UObject* objectClone(const UObject* a) {
// LATER: return a->clone();
return ((const Measure*) a)->clone();
}
// Return TRUE if *a is an instance of Measure.
-inline UBool instanceOfMeasure(const UObject* a) {
+static inline UBool instanceOfMeasure(const UObject* a) {
// LATER: return a->instanceof(Measure::getStaticClassID());
return a->getDynamicClassID() ==
CurrencyAmount::getStaticClassID();
}
+/**
+ * Creates a new Formattable array and copies the values from the specified
+ * original.
+ * @param array the original array
+ * @param count the original array count
+ * @return the new Formattable array.
+ */
+static inline Formattable* createArrayCopy(const Formattable* array, int32_t count) {
+ Formattable *result = new Formattable[count];
+ for (int32_t i=0; i<count; ++i) result[i] = array[i]; // Don't memcpy!
+ return result;
+}
+
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
/**
* Set 'ec' to 'err' only if 'ec' is not already set to a failing UErrorCode.
*/
-inline void setError(UErrorCode& ec, UErrorCode err) {
+static inline void setError(UErrorCode& ec, UErrorCode err) {
if (U_SUCCESS(ec)) {
ec = err;
}
diff --git a/Build/source/libs/icu-xetex/i18n/gregocal.cpp b/Build/source/libs/icu-xetex/i18n/gregocal.cpp
index bcc82a1bfdf..45807bfd958 100644
--- a/Build/source/libs/icu-xetex/i18n/gregocal.cpp
+++ b/Build/source/libs/icu-xetex/i18n/gregocal.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2004, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -144,7 +144,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GregorianCalendar)
//const UDate GregorianCalendar::kPapalCutover = -12219292800000L;
static const uint32_t kCutoverJulianDay = 2299161;
static const UDate kPapalCutover = (2299161.0 - kEpochStartAsJulianDay) * U_MILLIS_PER_DAY;
-static const UDate kPapalCutoverJulian = (2299161.0 - kEpochStartAsJulianDay);
+//static const UDate kPapalCutoverJulian = (2299161.0 - kEpochStartAsJulianDay);
// -------------------------------------
diff --git a/Build/source/libs/icu-xetex/i18n/hebrwcal.cpp b/Build/source/libs/icu-xetex/i18n/hebrwcal.cpp
index 551c553397d..1814272b0ce 100644
--- a/Build/source/libs/icu-xetex/i18n/hebrwcal.cpp
+++ b/Build/source/libs/icu-xetex/i18n/hebrwcal.cpp
@@ -1,9 +1,10 @@
/*
- * Copyright (C) 2003-2004, International Business Machines Corporation
- * and others. All Rights Reserved.
- ******************************************************************************
+******************************************************************************
+* Copyright (C) 2003-2006, International Business Machines Corporation
+* and others. All Rights Reserved.
+******************************************************************************
*
- * File HEBRWCAL.H
+ * File HEBRWCAL.CPP
*
* Modification History:
*
@@ -31,7 +32,7 @@
* time of day in sync with that of the Gregorian calendar, we use
* midnight, rather than sunset the day before.
*/
-static const double EPOCH_MILLIS = -180799862400000.; // 1/1/1 HY
+//static const double EPOCH_MILLIS = -180799862400000.; // 1/1/1 HY
static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = {
// Minimum Greatest Least Maximum
@@ -264,6 +265,14 @@ void HebrewCalendar::add(UCalendarDateFields field, int32_t amount, UErrorCode&
}
/**
+ * @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields
+ */
+void HebrewCalendar::add(EDateFields field, int32_t amount, UErrorCode& status)
+{
+ add((UCalendarDateFields)field, amount, status);
+}
+
+/**
* Rolls (up/down) a specified amount time on the given field. For
* example, to roll the current date up by three days, you can call
* <code>roll(Calendar.DATE, 3)</code>. If the
diff --git a/Build/source/libs/icu-xetex/i18n/hebrwcal.h b/Build/source/libs/icu-xetex/i18n/hebrwcal.h
index a9ac8446685..64d19e8a276 100644
--- a/Build/source/libs/icu-xetex/i18n/hebrwcal.h
+++ b/Build/source/libs/icu-xetex/i18n/hebrwcal.h
@@ -1,6 +1,8 @@
/*
-* Copyright (C) 2003-2004, International Business Machines Corporation and others. All Rights Reserved.
-********************************************************************************
+******************************************************************************
+* Copyright (C) 2003-2006, International Business Machines Corporation
+* and others. All Rights Reserved.
+******************************************************************************
*
* File HEBRWCAL.H
*
@@ -9,7 +11,7 @@
* Date Name Description
* 05/13/2003 srl copied from gregocal.h
* 11/26/2003 srl copied from buddhcal.h
-********************************************************************************
+******************************************************************************
*/
#ifndef HEBRWCAL_H
@@ -242,7 +244,7 @@ public:
/**
* @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields
*/
- inline virtual void add(EDateFields field, int32_t amount, UErrorCode& status) { add((UCalendarDateFields)field, amount, status); }
+ virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
/**
diff --git a/Build/source/libs/icu-xetex/i18n/i18n.vcproj b/Build/source/libs/icu-xetex/i18n/i18n.vcproj
index 3ff90c0f6d0..b4a9e712e08 100644
--- a/Build/source/libs/icu-xetex/i18n/i18n.vcproj
+++ b/Build/source/libs/icu-xetex/i18n/i18n.vcproj
@@ -27,6 +27,7 @@
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
DisableLanguageExtensions="TRUE"
+ TreatWChar_tAsBuiltInType="TRUE"
PrecompiledHeaderFile=".\Release/i18n.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
@@ -39,10 +40,10 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- OutputFile="..\..\bin\icuin34.dll"
+ OutputFile="..\..\bin\icuin36.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
- ProgramDatabaseFile=".\..\..\lib\icuin34.pdb"
+ ProgramDatabaseFile=".\..\..\lib\icuin36.pdb"
EnableCOMDATFolding="2"
BaseAddress="0x4a900000"
ImportLibrary="..\..\lib\icuin.lib"/>
@@ -93,6 +94,7 @@
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE"
+ TreatWChar_tAsBuiltInType="TRUE"
PrecompiledHeaderFile=".\Debug/i18n.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
@@ -106,11 +108,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- OutputFile="..\..\bin\icuin34d.dll"
+ OutputFile="..\..\bin\icuin36d.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\..\..\lib\icuin34d.pdb"
+ ProgramDatabaseFile=".\..\..\lib\icuin36d.pdb"
BaseAddress="0x4a900000"
ImportLibrary="..\..\lib\icuind.lib"/>
<Tool
@@ -434,12 +436,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\chnsecal.cpp">
- </File>
- <File
- RelativePath=".\chnsecal.h">
- </File>
- <File
RelativePath=".\choicfmt.cpp">
</File>
<File
@@ -1091,6 +1087,42 @@
Outputs="..\..\include\unicode\$(InputFileName)"/>
</FileConfiguration>
</File>
+ <File
+ RelativePath=".\windtfmt.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableLanguageExtensions="FALSE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableLanguageExtensions="FALSE"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\windtfmt.h">
+ </File>
+ <File
+ RelativePath=".\winnmfmt.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableLanguageExtensions="FALSE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableLanguageExtensions="FALSE"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\winnmfmt.h">
+ </File>
</Filter>
<Filter
Name="misc"
@@ -1388,6 +1420,86 @@
</FileConfiguration>
</File>
</Filter>
+ <Filter
+ Name="charset detect"
+ Filter="">
+ <File
+ RelativePath=".\csdetect.cpp">
+ </File>
+ <File
+ RelativePath=".\csdetect.h">
+ </File>
+ <File
+ RelativePath=".\csmatch.cpp">
+ </File>
+ <File
+ RelativePath=".\csmatch.h">
+ </File>
+ <File
+ RelativePath=".\csr2022.cpp">
+ </File>
+ <File
+ RelativePath=".\csr2022.h">
+ </File>
+ <File
+ RelativePath=".\csrecog.cpp">
+ </File>
+ <File
+ RelativePath=".\csrecog.h">
+ </File>
+ <File
+ RelativePath=".\csrmbcs.cpp">
+ </File>
+ <File
+ RelativePath=".\csrmbcs.h">
+ </File>
+ <File
+ RelativePath=".\csrsbcs.cpp">
+ </File>
+ <File
+ RelativePath=".\csrsbcs.h">
+ </File>
+ <File
+ RelativePath=".\csrucode.cpp">
+ </File>
+ <File
+ RelativePath=".\csrucode.h">
+ </File>
+ <File
+ RelativePath=".\csrutf8.cpp">
+ </File>
+ <File
+ RelativePath=".\csrutf8.h">
+ </File>
+ <File
+ RelativePath=".\inputext.cpp">
+ </File>
+ <File
+ RelativePath=".\inputext.h">
+ </File>
+ <File
+ RelativePath=".\ucsdet.cpp">
+ </File>
+ <File
+ RelativePath=".\unicode\ucsdet.h">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\unicode
+"
+ Outputs="..\..\include\unicode\$(InputFileName)"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\unicode
+"
+ Outputs="..\..\include\unicode\$(InputFileName)"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/Build/source/libs/icu-xetex/i18n/inputext.cpp b/Build/source/libs/icu-xetex/i18n/inputext.cpp
new file mode 100644
index 00000000000..a36a931ab55
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/inputext.cpp
@@ -0,0 +1,162 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "inputext.h"
+
+#include "cmemory.h"
+#include "cstring.h"
+
+#include <string.h>
+
+U_NAMESPACE_BEGIN
+
+#define BUFFER_SIZE 8192
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
+#define DELETE_ARRAY(array) uprv_free((void *) (array))
+
+InputText::InputText()
+ : fInputBytes(NEW_ARRAY(uint8_t, BUFFER_SIZE)), // The text to be checked. Markup will have been
+ // removed if appropriate.
+ fByteStats(NEW_ARRAY(int16_t, 256)), // byte frequency statistics for the input text.
+ // Value is percent, not absolute.
+ fDeclaredEncoding(0),
+ fRawInput(0),
+ fRawLength(0)
+{
+
+}
+
+InputText::~InputText()
+{
+ DELETE_ARRAY(fDeclaredEncoding);
+ DELETE_ARRAY(fByteStats);
+ DELETE_ARRAY(fInputBytes);
+}
+
+void InputText::setText(const char *in, int32_t len)
+{
+ fInputLen = 0;
+ fC1Bytes = FALSE;
+ fRawInput = (const uint8_t *) in;
+ fRawLength = len == -1? uprv_strlen(in) : len;
+}
+
+void InputText::setDeclaredEncoding(const char* encoding, int32_t len)
+{
+ if(encoding) {
+ if (len == -1) {
+ len = uprv_strlen(encoding);
+ }
+
+ len += 1; // to make place for the \0 at the end.
+ uprv_free(fDeclaredEncoding);
+ fDeclaredEncoding = NEW_ARRAY(char, len);
+ uprv_strncpy(fDeclaredEncoding, encoding, len);
+ }
+}
+
+UBool InputText::isSet() const
+{
+ return fRawInput != NULL;
+}
+
+/**
+* MungeInput - after getting a set of raw input data to be analyzed, preprocess
+* it by removing what appears to be html markup.
+*
+* @internal
+*/
+void InputText::MungeInput(UBool fStripTags) {
+ int srci = 0;
+ int dsti = 0;
+ uint8_t b;
+ bool inMarkup = FALSE;
+ int32_t openTags = 0;
+ int32_t badTags = 0;
+
+ //
+ // html / xml markup stripping.
+ // quick and dirty, not 100% accurate, but hopefully good enough, statistically.
+ // discard everything within < brackets >
+ // Count how many total '<' and illegal (nested) '<' occur, so we can make some
+ // guess as to whether the input was actually marked up at all.
+ // TODO: Think about how this interacts with EBCDIC charsets that are detected.
+ if (fStripTags) {
+ for (srci = 0; srci < fRawLength && dsti < BUFFER_SIZE; srci += 1) {
+ b = fRawInput[srci];
+
+ if (b == (uint8_t)0x3C) { /* Check for the ASCII '<' */
+ if (inMarkup) {
+ badTags += 1;
+ }
+
+ inMarkup = TRUE;
+ openTags += 1;
+ }
+
+ if (! inMarkup) {
+ fInputBytes[dsti++] = b;
+ }
+
+ if (b == (uint8_t)0x3E) { /* Check for the ASCII '>' */
+ inMarkup = FALSE;
+ }
+ }
+
+ fInputLen = dsti;
+ }
+
+ //
+ // If it looks like this input wasn't marked up, or if it looks like it's
+ // essentially nothing but markup abandon the markup stripping.
+ // Detection will have to work on the unstripped input.
+ //
+ if (openTags<5 || openTags/5 < badTags ||
+ (fInputLen < 100 && fRawLength>600))
+ {
+ int32_t limit = fRawLength;
+
+ if (limit > BUFFER_SIZE) {
+ limit = BUFFER_SIZE;
+ }
+
+ for (srci=0; srci<limit; srci++) {
+ fInputBytes[srci] = fRawInput[srci];
+ }
+
+ fInputLen = srci;
+ }
+
+ //
+ // Tally up the byte occurence statistics.
+ // These are available for use by the various detectors.
+ //
+
+ uprv_memset(fByteStats, 0, (sizeof fByteStats[0]) * 256);
+
+ for (srci = 0; srci < fInputLen; srci += 1) {
+ fByteStats[fInputBytes[srci]] += 1;
+ }
+
+ for (int32_t i = 0x80; i <= 0x9F; i += 1) {
+ if (fByteStats[i] != 0) {
+ fC1Bytes = TRUE;
+ break;
+ }
+ }
+}
+
+U_NAMESPACE_END
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/inputext.h b/Build/source/libs/icu-xetex/i18n/inputext.h
new file mode 100644
index 00000000000..1528f48e63f
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/inputext.h
@@ -0,0 +1,59 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+
+#ifndef __INPUTEXT_H
+#define __INPUTEXT_H
+
+/**
+ * \file
+ * \internal
+ *
+ * This is an internal header for the Character Set Detection code. The
+ * name is probably too generic...
+ */
+
+
+#include "unicode/uobject.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+U_NAMESPACE_BEGIN
+
+class InputText : public UMemory
+{
+public:
+ InputText();
+ ~InputText();
+
+ void setText(const char *in, int32_t len);
+ void setDeclaredEncoding(const char *encoding, int32_t len);
+ UBool isSet() const;
+ void MungeInput(UBool fStripTags);
+
+ // The text to be checked. Markup will have been
+ // removed if appropriate.
+ uint8_t *fInputBytes;
+ int32_t fInputLen; // Length of the byte data in fInputBytes.
+ // byte frequency statistics for the input text.
+ // Value is percent, not absolute.
+ // Value is rounded up, so zero really means zero occurences.
+ int16_t *fByteStats;
+ UBool fC1Bytes; // True if any bytes in the range 0x80 - 0x9F are in the input;false by default
+ char *fDeclaredEncoding;
+
+ const uint8_t *fRawInput; // Original, untouched input bytes.
+ // If user gave us a byte array, this is it.
+ // If user gave us a stream, it's read to a
+ // buffer here.
+ int32_t fRawLength; // Length of data in fRawInput array.
+
+};
+
+U_NAMESPACE_END
+
+#endif
+#endif /* __INPUTEXT_H */
diff --git a/Build/source/libs/icu-xetex/i18n/name2uni.cpp b/Build/source/libs/icu-xetex/i18n/name2uni.cpp
index 4690b666162..d2b898d8932 100644
--- a/Build/source/libs/icu-xetex/i18n/name2uni.cpp
+++ b/Build/source/libs/icu-xetex/i18n/name2uni.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2005, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -58,9 +58,10 @@ U_CDECL_END
NameUnicodeTransliterator::NameUnicodeTransliterator(UnicodeFilter* adoptedFilter) :
Transliterator(UNICODE_STRING("Name-Any", 8), adoptedFilter) {
+ UnicodeSet *legalPtr = &legal;
// Get the legal character set
USetAdder sa = {
- (USet *)&legal, // USet* == UnicodeSet*
+ (USet *)legalPtr, // USet* == UnicodeSet*
_set_add,
_set_addRange,
_set_addString,
diff --git a/Build/source/libs/icu-xetex/i18n/name2uni.h b/Build/source/libs/icu-xetex/i18n/name2uni.h
index 96f337bfc7d..74f6cd2a660 100644
--- a/Build/source/libs/icu-xetex/i18n/name2uni.h
+++ b/Build/source/libs/icu-xetex/i18n/name2uni.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -56,15 +56,11 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/nfrlist.h b/Build/source/libs/icu-xetex/i18n/nfrlist.h
index e60ee579902..1a334085802 100644
--- a/Build/source/libs/icu-xetex/i18n/nfrlist.h
+++ b/Build/source/libs/icu-xetex/i18n/nfrlist.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1997-2001, International Business Machines
+* Copyright (C) 1997-2005, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrlist.h
@@ -36,7 +36,7 @@ protected:
uint32_t fCount;
uint32_t fCapacity;
public:
- NFRuleList(int capacity = 10)
+ NFRuleList(uint32_t capacity = 10)
: fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : NULL)
, fCount(0)
, fCapacity(capacity) {};
diff --git a/Build/source/libs/icu-xetex/i18n/nfrule.cpp b/Build/source/libs/icu-xetex/i18n/nfrule.cpp
index 29c150ef9f4..d6cf1850f48 100644
--- a/Build/source/libs/icu-xetex/i18n/nfrule.cpp
+++ b/Build/source/libs/icu-xetex/i18n/nfrule.cpp
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrule.cpp
@@ -58,7 +58,7 @@ static const UChar gLessThan = 0x003c;
static const UChar gComma = 0x002c;
static const UChar gDot = 0x002e;
static const UChar gTick = 0x0027;
-static const UChar gMinus = 0x002d;
+//static const UChar gMinus = 0x002d;
static const UChar gSemicolon = 0x003b;
static const UChar gMinusX[] = {0x2D, 0x78, 0}; /* "-x" */
diff --git a/Build/source/libs/icu-xetex/i18n/nfsubs.h b/Build/source/libs/icu-xetex/i18n/nfsubs.h
index dc7ec0ee13b..14c60e78825 100644
--- a/Build/source/libs/icu-xetex/i18n/nfsubs.h
+++ b/Build/source/libs/icu-xetex/i18n/nfsubs.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfsubs.h
@@ -472,6 +472,13 @@ class NumeratorSubstitution : public NFSubstitution {
int64_t ldenominator;
UBool withZeros;
public:
+ static inline UnicodeString fixdesc(const UnicodeString& desc) {
+ if (desc.endsWith(LTLT, 2)) {
+ UnicodeString result(desc, 0, desc.length()-1);
+ return result;
+ }
+ return desc;
+ }
NumeratorSubstitution(int32_t _pos,
double _denominator,
const NFRuleSet* _ruleSet,
@@ -504,13 +511,6 @@ public:
private:
static const char fgClassID;
static const UChar LTLT[2];
- static UnicodeString fixdesc(const UnicodeString& desc) {
- if (desc.endsWith(LTLT, 2)) {
- UnicodeString result(desc, 0, desc.length()-1);
- return result;
- }
- return desc;
- }
public:
static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
diff --git a/Build/source/libs/icu-xetex/i18n/nortrans.h b/Build/source/libs/icu-xetex/i18n/nortrans.h
index e157a58d282..4dc9f271c0d 100644
--- a/Build/source/libs/icu-xetex/i18n/nortrans.h
+++ b/Build/source/libs/icu-xetex/i18n/nortrans.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -60,15 +60,11 @@ class U_I18N_API NormalizationTransliterator : public Transliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/nultrans.h b/Build/source/libs/icu-xetex/i18n/nultrans.h
index 996a743e8e8..30d81594788 100644
--- a/Build/source/libs/icu-xetex/i18n/nultrans.h
+++ b/Build/source/libs/icu-xetex/i18n/nultrans.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2000-2005, International Business Machines
+* Copyright (c) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -54,15 +54,11 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/numfmt.cpp b/Build/source/libs/icu-xetex/i18n/numfmt.cpp
index 8a6a4c116a6..d0f4109bd82 100644
--- a/Build/source/libs/icu-xetex/i18n/numfmt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/numfmt.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -28,12 +28,13 @@
#include "unicode/numfmt.h"
#include "unicode/locid.h"
-#include "unicode/ures.h"
#include "unicode/dcfmtsym.h"
#include "unicode/decimfmt.h"
#include "unicode/ustring.h"
#include "unicode/ucurr.h"
#include "unicode/curramt.h"
+#include "winnmfmt.h"
+#include "uresimp.h"
#include "uhash.h"
#include "cmemory.h"
#include "servloc.h"
@@ -825,6 +826,36 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
return NULL;
}
+#ifdef U_WINDOWS
+ char buffer[8];
+ int32_t count = desiredLocale.getKeywordValue("compat", buffer, sizeof(buffer), status);
+
+ // if the locale has "@compat=host", create a host-specific NumberFormat
+ if (count > 0 && uprv_strcmp(buffer, "host") == 0) {
+ Win32NumberFormat *f = NULL;
+ UBool curr = TRUE;
+
+ switch (style) {
+ case kNumberStyle:
+ curr = FALSE;
+ // fall-through
+
+ case kCurrencyStyle:
+ f = new Win32NumberFormat(desiredLocale, curr, status);
+
+ if (U_SUCCESS(status)) {
+ return f;
+ }
+
+ delete f;
+ break;
+
+ default:
+ break;
+ }
+ }
+#endif
+
NumberFormat* f = NULL;
DecimalFormatSymbols* symbolsToAdopt = NULL;
UnicodeString pattern;
@@ -859,37 +890,11 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
if (U_FAILURE(status) || symbolsToAdopt == NULL) {
goto cleanup;
}
-
- // Here we assume that the locale passed in is in the canonical
- // form, e.g: pt_PT_@currency=PTE not pt_PT_PREEURO
if(style==kCurrencyStyle){
- char currencyCode[8]={0};
- int32_t currencyCodeCap = sizeof(currencyCode);
- const char* locName = desiredLocale.getName();
- currencyCodeCap = uloc_getKeywordValue(locName, "currency", currencyCode, currencyCodeCap, &status);
- if(U_SUCCESS(status) && currencyCodeCap > 0) {
- /* An explicit currency was requested */
- UErrorCode localStatus = U_ZERO_ERROR;
- UResourceBundle *currency = ures_getByKeyWithFallback(resource, "Currencies", NULL, &localStatus);
- currency = ures_getByKeyWithFallback(currency, currencyCode, currency, &localStatus);
- if(U_SUCCESS(localStatus) && ures_getSize(currency)>2) {
- currency = ures_getByIndex(currency, 2, currency, &localStatus);
- int32_t currPatternLen = 0;
- const UChar *currPattern = ures_getStringByIndex(currency, (int32_t)0, &currPatternLen, &localStatus);
- UnicodeString decimalSep = ures_getStringByIndex(currency, (int32_t)1, NULL, &localStatus);
- UnicodeString groupingSep = ures_getStringByIndex(currency, (int32_t)2, NULL, &localStatus);
- if(U_SUCCESS(localStatus)){
- symbolsToAdopt->setSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol, groupingSep);
- symbolsToAdopt->setSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol, decimalSep);
- pattern.setTo(TRUE, currPattern, currPatternLen);
- status = localStatus;
- }
- }
- ures_close(currency);
- /* else An explicit currency was requested and is unknown or locale data is malformed. */
- /* ucurr_* API will get the correct value later on. */
+ const UChar* currPattern = symbolsToAdopt->getCurrencyPattern();
+ if(currPattern!=NULL){
+ pattern.setTo(currPattern, u_strlen(currPattern));
}
- /* else no currency keyword used. */
}
f = new DecimalFormat(pattern, symbolsToAdopt, status);
if (U_FAILURE(status) || f == NULL) {
diff --git a/Build/source/libs/icu-xetex/i18n/olsontz.cpp b/Build/source/libs/icu-xetex/i18n/olsontz.cpp
index d31fa4d30be..43adcb16bbc 100644
--- a/Build/source/libs/icu-xetex/i18n/olsontz.cpp
+++ b/Build/source/libs/icu-xetex/i18n/olsontz.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2003-2005, International Business Machines
+* Copyright (c) 2003-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -133,10 +133,18 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
if(U_SUCCESS(ec)) {
int32_t jj;
for(jj=0;jj<transitionCount;jj++) {
- U_DEBUG_TZ_MSG((" Transition %d: time %d, typedata%d\n", jj, transitionTimes[jj], typeData[jj]));
- }
- for(jj=0;jj<transitionCount;jj++) {
- U_DEBUG_TZ_MSG((" Type %d: offset%d\n", jj, typeOffsets[jj]));
+ int32_t year, month, dom, dow;
+ double millis=0;
+ double days = Math::floorDivide(((double)transitionTimes[jj])*1000.0, (double)U_MILLIS_PER_DAY, millis);
+
+ Grego::dayToFields(days, year, month, dom, dow);
+ U_DEBUG_TZ_MSG((" Transition %d: time %d (%04d.%02d.%02d+%.1fh), typedata%d\n", jj, transitionTimes[jj],
+ year, month+1, dom, (millis/kOneHour), typeData[jj]));
+// U_DEBUG_TZ_MSG((" offset%d\n", typeOffsets[jj]));
+ int16_t f = jj;
+ f <<= 1;
+ U_DEBUG_TZ_MSG((" offsets[%d+%d]=(%d+%d)=(%d==%d)\n", (int)f,(int)f+1,(int)typeOffsets[f],(int)typeOffsets[f+1],(int)zoneOffset(jj),
+ (int)typeOffsets[f]+(int)typeOffsets[f+1]));
}
}
#endif
@@ -174,7 +182,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
data = ures_getIntVector(r, &len, &ec);
if (U_SUCCESS(ec) && len == 11) {
UnicodeString emptyStr;
- U_DEBUG_TZ_MSG(("zone%s, rule%s: {%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d}", zKey, ures_getKey(r),
+ U_DEBUG_TZ_MSG(("zone%s, rule%s: {%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d}\n", zKey, ures_getKey(r),
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10]));
finalZone = new SimpleTimeZone(rawOffset, emptyStr,
(int8_t)data[0], (int8_t)data[1], (int8_t)data[2],
@@ -393,6 +401,18 @@ int32_t OlsonTimeZone::getRawOffset() const {
return raw;
}
+#if defined U_DEBUG_TZ
+void printTime(double ms) {
+ int32_t year, month, dom, dow;
+ double millis=0;
+ double days = Math::floorDivide(((double)ms), (double)U_MILLIS_PER_DAY, millis);
+
+ Grego::dayToFields(days, year, month, dom, dow);
+ U_DEBUG_TZ_MSG((" findTransition: time %.1f (%04d.%02d.%02d+%.1fh)\n", ms,
+ year, month+1, dom, (millis/kOneHour)));
+ }
+#endif
+
/**
* Find the smallest i (in 0..transitionCount-1) such that time >=
* transition(i), where transition(i) is either the GMT or the local
@@ -406,6 +426,10 @@ int32_t OlsonTimeZone::getRawOffset() const {
*/
int16_t OlsonTimeZone::findTransition(double time, UBool local) const {
int16_t i = 0;
+ U_DEBUG_TZ_MSG(("findTransition(%.1f, %s)\n", time, local?"T":"F"));
+#if defined U_DEBUG_TZ
+ printTime(time*1000.0);
+#endif
if (transitionCount != 0) {
// Linear search from the end is the fastest approach, since
@@ -413,10 +437,41 @@ int16_t OlsonTimeZone::findTransition(double time, UBool local) const {
for (i = transitionCount - 1; i > 0; --i) {
int32_t transition = transitionTimes[i];
if (local) {
- transition += zoneOffset(typeData[i]);
+ int32_t zoneOffsetPrev = zoneOffset(typeData[i-1]);
+ int32_t zoneOffsetCurr = zoneOffset(typeData[i]);
+
+ // use the lowest offset ( == standard time ). as per tzregts.cpp which says:
+
+ /**
+ * @bug 4084933
+ * The expected behavior of TimeZone around the boundaries is:
+ * (Assume transition time of 2:00 AM)
+ * day of onset 1:59 AM STD = display name 1:59 AM ST
+ * 2:00 AM STD = display name 3:00 AM DT
+ * day of end 0:59 AM STD = display name 1:59 AM DT
+ * 1:00 AM STD = display name 1:00 AM ST
+ */
+ if(zoneOffsetPrev<zoneOffsetCurr) {
+ transition += zoneOffsetPrev;
+ } else {
+ transition += zoneOffsetCurr;
+ }
}
if (time >= transition) {
+ U_DEBUG_TZ_MSG(("Found@%d: time=%.1f, localtransition=%d (orig %d) dz %d\n", i, time, transition, transitionTimes[i],
+ zoneOffset(typeData[i-1])));
+#if defined U_DEBUG_TZ
+ printTime(transition*1000.0);
+ printTime(transitionTimes[i]*1000.0);
+#endif
break;
+ } else {
+ U_DEBUG_TZ_MSG(("miss@%d: time=%.1f, localtransition=%d (orig %d) dz %d\n", i, time, transition, transitionTimes[i],
+ zoneOffset(typeData[i-1])));
+#if defined U_DEBUG_TZ
+ printTime(transition*1000.0);
+ printTime(transitionTimes[i]*1000.0);
+#endif
}
}
@@ -427,11 +482,13 @@ int16_t OlsonTimeZone::findTransition(double time, UBool local) const {
U_ASSERT(local || time < transitionTimes[0] || time >= transitionTimes[i]);
U_ASSERT(local || i == transitionCount-1 || time < transitionTimes[i+1]);
+ U_DEBUG_TZ_MSG(("findTransition(%.1f, %s)= trans %d\n", time, local?"T":"F", i));
i = typeData[i];
}
U_ASSERT(i>=0 && i<typeCount);
+ U_DEBUG_TZ_MSG(("findTransition(%.1f, %s)=%d, offset %d\n", time, local?"T":"F", i, zoneOffset(i)));
return i;
}
@@ -473,7 +530,13 @@ UBool OlsonTimeZone::useDaylightTime() const {
}
return FALSE;
}
-
+int32_t
+OlsonTimeZone::getDSTSavings() const{
+ if(finalZone!=NULL){
+ return finalZone->getDSTSavings();
+ }
+ return TimeZone::getDSTSavings();
+}
/**
* TimeZone API.
*/
diff --git a/Build/source/libs/icu-xetex/i18n/olsontz.h b/Build/source/libs/icu-xetex/i18n/olsontz.h
index ef19ee2a225..6f7d71cdc4c 100644
--- a/Build/source/libs/icu-xetex/i18n/olsontz.h
+++ b/Build/source/libs/icu-xetex/i18n/olsontz.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2003-2004, International Business Machines
+* Copyright (c) 2003-2005, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -209,6 +209,8 @@ class U_I18N_API OlsonTimeZone: public TimeZone {
*/
virtual UBool inDaylightTime(UDate date, UErrorCode& ec) const;
+ virtual int32_t getDSTSavings() const;
+
protected:
/**
* Default constructor. Creates a time zone with an empty ID and
diff --git a/Build/source/libs/icu-xetex/i18n/quant.h b/Build/source/libs/icu-xetex/i18n/quant.h
index 68e43061f1b..e10fb99e3c2 100644
--- a/Build/source/libs/icu-xetex/i18n/quant.h
+++ b/Build/source/libs/icu-xetex/i18n/quant.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2004, International Business Machines Corporation
+ * Copyright (C) 2001-2006, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -18,7 +18,7 @@
U_NAMESPACE_BEGIN
-class Quantifier : public UnicodeFunctor, public UnicodeMatcher {
+class U_I18N_API Quantifier : public UnicodeFunctor, public UnicodeMatcher {
public:
diff --git a/Build/source/libs/icu-xetex/i18n/rbnf.cpp b/Build/source/libs/icu-xetex/i18n/rbnf.cpp
index c60d995cc59..f9a9ae3d671 100644
--- a/Build/source/libs/icu-xetex/i18n/rbnf.cpp
+++ b/Build/source/libs/icu-xetex/i18n/rbnf.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation
+* Copyright (C) 1997-2006, International Business Machines Corporation
* and others. All Rights Reserved.
*******************************************************************************
*/
@@ -1215,9 +1215,10 @@ RuleBasedNumberFormat::initDefaultRuleSet()
void
RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* localizationInfos,
- UParseError& /* pErr */, UErrorCode& status)
+ UParseError& pErr, UErrorCode& status)
{
// TODO: implement UParseError
+ uprv_memset(&pErr, 0, sizeof(UParseError));
// Note: this can leave ruleSets == NULL, so remaining code should check
if (U_FAILURE(status)) {
return;
diff --git a/Build/source/libs/icu-xetex/i18n/rbt.cpp b/Build/source/libs/icu-xetex/i18n/rbt.cpp
index 5cea0c4bd72..c22b2bd7f36 100644
--- a/Build/source/libs/icu-xetex/i18n/rbt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/rbt.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -37,19 +37,20 @@ void RuleBasedTransliterator::_construct(const UnicodeString& rules,
return;
}
- TransliteratorParser parser;
+ TransliteratorParser parser(status);
parser.parse(rules, direction, parseError, status);
if (U_FAILURE(status)) {
return;
}
- if (parser.idBlockVector->size() != 0 ||
- parser.compoundFilter != NULL) {
+ if (parser.idBlockVector.size() != 0 ||
+ parser.compoundFilter != NULL ||
+ parser.dataVector.size() == 0) {
status = U_INVALID_RBT_SYNTAX; // ::ID blocks disallowed in RBT
return;
}
- fData = (TransliterationRuleData*)parser.dataVector->orphanElementAt(0);
+ fData = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
setMaximumContextLength(fData->ruleSet.getMaximumContextLength());
}
diff --git a/Build/source/libs/icu-xetex/i18n/rbt_data.cpp b/Build/source/libs/icu-xetex/i18n/rbt_data.cpp
index 5552ecedef7..bec4b48ce80 100644
--- a/Build/source/libs/icu-xetex/i18n/rbt_data.cpp
+++ b/Build/source/libs/icu-xetex/i18n/rbt_data.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -22,21 +22,13 @@
U_NAMESPACE_BEGIN
TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
- : UMemory(), ruleSet(status),
- variableNames(0), variables(0), variablesAreOwned(TRUE)
+ : UMemory(), ruleSet(status), variableNames(status),
+ variables(0), variablesAreOwned(TRUE)
{
if (U_FAILURE(status)) {
return;
}
- variableNames = new Hashtable(status);
- /* test for NULL */
- if (variableNames == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (U_SUCCESS(status)) {
- variableNames->setValueDeleter(uhash_deleteUnicodeString);
- }
+ variableNames.setValueDeleter(uhash_deleteUnicodeString);
variables = 0;
variablesLength = 0;
}
@@ -48,16 +40,13 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
variablesLength(other.variablesLength)
{
UErrorCode status = U_ZERO_ERROR;
- variableNames = new Hashtable(status);
- if (U_SUCCESS(status)) {
- variableNames->setValueDeleter(uhash_deleteUnicodeString);
- int32_t pos = -1;
- const UHashElement *e;
- while ((e = other.variableNames->nextElement(pos)) != 0) {
- UnicodeString* value =
- new UnicodeString(*(const UnicodeString*)e->value.pointer);
- variableNames->put(*(UnicodeString*)e->key.pointer, value, status);
- }
+ variableNames.setValueDeleter(uhash_deleteUnicodeString);
+ int32_t pos = -1;
+ const UHashElement *e;
+ while ((e = other.variableNames.nextElement(pos)) != 0) {
+ UnicodeString* value =
+ new UnicodeString(*(const UnicodeString*)e->value.pointer);
+ variableNames.put(*(UnicodeString*)e->key.pointer, value, status);
}
variables = 0;
@@ -78,7 +67,6 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
}
TransliterationRuleData::~TransliterationRuleData() {
- delete variableNames;
if (variablesAreOwned && variables != 0) {
for (int32_t i=0; i<variablesLength; ++i) {
delete variables[i];
diff --git a/Build/source/libs/icu-xetex/i18n/rbt_data.h b/Build/source/libs/icu-xetex/i18n/rbt_data.h
index 8d394efcd00..5913460728c 100644
--- a/Build/source/libs/icu-xetex/i18n/rbt_data.h
+++ b/Build/source/libs/icu-xetex/i18n/rbt_data.h
@@ -1,5 +1,7 @@
/*
-* Copyright (C) 1999-2005, International Business Machines Corporation and others. All Rights Reserved.
+**********************************************************************
+* Copyright (C) 1999-2006, International Business Machines Corporation
+* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 11/17/99 aliu Creation.
@@ -15,14 +17,13 @@
#include "unicode/uobject.h"
#include "rbt_set.h"
+#include "hash.h"
U_NAMESPACE_BEGIN
class UnicodeFunctor;
-class UnicodeString;
class UnicodeMatcher;
class UnicodeReplacer;
-class Hashtable;
/**
* The rule data for a RuleBasedTransliterators. RBT objects hold
@@ -61,7 +62,7 @@ public:
* data.variables. The stand-in also represents the UnicodeMatcher in
* the stored rules.
*/
- Hashtable* variableNames;
+ Hashtable variableNames;
/**
* Map category variable (UChar) to set (UnicodeFunctor).
diff --git a/Build/source/libs/icu-xetex/i18n/rbt_pars.cpp b/Build/source/libs/icu-xetex/i18n/rbt_pars.cpp
index edb4a9edf79..f1c2cb97625 100644
--- a/Build/source/libs/icu-xetex/i18n/rbt_pars.cpp
+++ b/Build/source/libs/icu-xetex/i18n/rbt_pars.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
- * Copyright (C) 1999-2005, International Business Machines
+ * Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -279,8 +279,6 @@ public:
UBool anchorStart;
UBool anchorEnd;
-
- UErrorCode ec;
/**
* The segment number from 1..n of the next '(' we see
@@ -296,12 +294,13 @@ public:
RuleHalf(TransliteratorParser& parser);
~RuleHalf();
- int32_t parse(const UnicodeString& rule, int32_t pos, int32_t limit);
+ int32_t parse(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status);
int32_t parseSection(const UnicodeString& rule, int32_t pos, int32_t limit,
UnicodeString& buf,
const UnicodeString& illegal,
- UBool isSegment);
+ UBool isSegment,
+ UErrorCode& status);
/**
* Remove context.
@@ -322,8 +321,9 @@ public:
int syntaxError(UErrorCode code,
const UnicodeString& rule,
- int32_t start) {
- return parser.syntaxError(code, rule, start);
+ int32_t start,
+ UErrorCode& status) {
+ return parser.syntaxError(code, rule, start, status);
}
private:
@@ -333,7 +333,6 @@ private:
};
RuleHalf::RuleHalf(TransliteratorParser& p) :
- ec(U_ZERO_ERROR),
parser(p)
{
cursor = -1;
@@ -354,13 +353,13 @@ RuleHalf::~RuleHalf() {
* @return the index after the terminating character, or
* if limit was reached, limit
*/
-int32_t RuleHalf::parse(const UnicodeString& rule, int32_t pos, int32_t limit) {
+int32_t RuleHalf::parse(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status) {
int32_t start = pos;
text.truncate(0);
- pos = parseSection(rule, pos, limit, text, ILLEGAL_TOP, FALSE);
+ pos = parseSection(rule, pos, limit, text, ILLEGAL_TOP, FALSE, status);
if (cursorOffset > 0 && cursor != cursorOffsetPos) {
- return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start);
+ return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start, status);
}
return pos;
@@ -392,7 +391,7 @@ int32_t RuleHalf::parse(const UnicodeString& rule, int32_t pos, int32_t limit) {
int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t limit,
UnicodeString& buf,
const UnicodeString& illegal,
- UBool isSegment) {
+ UBool isSegment, UErrorCode& status) {
int32_t start = pos;
ParsePosition pp;
UnicodeString scratch;
@@ -416,19 +415,19 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
if (u_strchr(HALF_ENDERS, c) != NULL) {
if (isSegment) {
// Unclosed segment
- return syntaxError(U_UNCLOSED_SEGMENT, rule, start);
+ return syntaxError(U_UNCLOSED_SEGMENT, rule, start, status);
}
break;
}
if (anchorEnd) {
// Text after a presumed end anchor is a syntax err
- return syntaxError(U_MALFORMED_VARIABLE_REFERENCE, rule, start);
+ return syntaxError(U_MALFORMED_VARIABLE_REFERENCE, rule, start, status);
}
if (UnicodeSet::resemblesPattern(rule, pos-1)) {
pp.setIndex(pos-1); // Backup to opening '['
- buf.append(parser.parseSet(rule, pp));
- if (U_FAILURE(parser.status)) {
- return syntaxError(U_MALFORMED_SET, rule, start);
+ buf.append(parser.parseSet(rule, pp, status));
+ if (U_FAILURE(status)) {
+ return syntaxError(U_MALFORMED_SET, rule, start, status);
}
pos = pp.getIndex();
continue;
@@ -436,14 +435,14 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
// Handle escapes
if (c == ESCAPE) {
if (pos == limit) {
- return syntaxError(U_TRAILING_BACKSLASH, rule, start);
+ return syntaxError(U_TRAILING_BACKSLASH, rule, start, status);
}
UChar32 escaped = rule.unescapeAt(pos); // pos is already past '\\'
if (escaped == (UChar32) -1) {
- return syntaxError(U_MALFORMED_UNICODE_ESCAPE, rule, start);
+ return syntaxError(U_MALFORMED_UNICODE_ESCAPE, rule, start, status);
}
if (!parser.checkVariableRange(escaped)) {
- return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start);
+ return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start, status);
}
buf.append(escaped);
continue;
@@ -464,7 +463,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
quoteStart = buf.length();
for (;;) {
if (iq < 0) {
- return syntaxError(U_UNTERMINATED_QUOTE, rule, start);
+ return syntaxError(U_UNTERMINATED_QUOTE, rule, start, status);
}
scratch.truncate(0);
rule.extractBetween(pos, iq, scratch);
@@ -482,7 +481,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
for (iq=quoteStart; iq<quoteLimit; ++iq) {
if (!parser.checkVariableRange(buf.charAt(iq))) {
- return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start);
+ return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start, status);
}
}
}
@@ -490,11 +489,11 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
}
if (!parser.checkVariableRange(c)) {
- return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start);
+ return syntaxError(U_VARIABLE_RANGE_OVERLAP, rule, start, status);
}
if (illegal.indexOf(c) >= 0) {
- syntaxError(U_ILLEGAL_CHARACTER, rule, start);
+ syntaxError(U_ILLEGAL_CHARACTER, rule, start, status);
}
switch (c) {
@@ -507,7 +506,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
anchorStart = TRUE;
} else {
return syntaxError(U_MISPLACED_ANCHOR_START,
- rule, start);
+ rule, start, status);
}
break;
case SEGMENT_OPEN:
@@ -522,7 +521,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
int32_t segmentNumber = nextSegmentNumber++; // 1-based
// Parse the segment
- pos = parseSection(rule, pos, limit, buf, ILLEGAL_SEG, TRUE);
+ pos = parseSection(rule, pos, limit, buf, ILLEGAL_SEG, TRUE, status);
// After parsing a segment, the relevant characters are
// in buf, starting at offset bufSegStart. Extract them
@@ -533,9 +532,9 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
segmentNumber, *parser.curData);
// Record and associate object and segment number
- parser.setSegmentObject(segmentNumber, m);
+ parser.setSegmentObject(segmentNumber, m, status);
buf.truncate(bufSegStart);
- buf.append(parser.getSegmentStandin(segmentNumber));
+ buf.append(parser.getSegmentStandin(segmentNumber, status));
}
break;
case FUNCTION:
@@ -547,13 +546,13 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
// The next character MUST be a segment open
if (single == NULL ||
!ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
- return syntaxError(U_INVALID_FUNCTION, rule, start);
+ return syntaxError(U_INVALID_FUNCTION, rule, start, status);
}
Transliterator *t = single->createInstance();
delete single;
if (t == NULL) {
- return syntaxError(U_INVALID_FUNCTION, rule, start);
+ return syntaxError(U_INVALID_FUNCTION, rule, start, status);
}
// bufSegStart is the offset in buf to the first
@@ -561,7 +560,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
int32_t bufSegStart = buf.length();
// Parse the segment
- pos = parseSection(rule, iref, limit, buf, ILLEGAL_FUNC, TRUE);
+ pos = parseSection(rule, iref, limit, buf, ILLEGAL_FUNC, TRUE, status);
// After parsing a segment, the relevant characters are
// in buf, starting at offset bufSegStart.
@@ -572,7 +571,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
// Replace the buffer contents with a stand-in
buf.truncate(bufSegStart);
- buf.append(parser.generateStandInFor(r));
+ buf.append(parser.generateStandInFor(r, status));
}
break;
case SymbolTable::SYMBOL_REF:
@@ -595,9 +594,9 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
r = ICU_Utility::parseNumber(rule, pos, 10);
if (r < 0) {
return syntaxError(U_UNDEFINED_SEGMENT_REFERENCE,
- rule, start);
+ rule, start, status);
}
- buf.append(parser.getSegmentStandin(r));
+ buf.append(parser.getSegmentStandin(r, status));
} else {
pp.setIndex(pos);
UnicodeString name = parser.parseData->
@@ -617,13 +616,13 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
// that case appendVariableDef() will append the
// special placeholder char variableLimit-1.
varStart = buf.length();
- parser.appendVariableDef(name, buf);
+ parser.appendVariableDef(name, buf, status);
varLimit = buf.length();
}
}
break;
case DOT:
- buf.append(parser.getDotStandIn());
+ buf.append(parser.getDotStandIn(status));
break;
case KLEENE_STAR:
case ONE_OR_MORE:
@@ -637,7 +636,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
{
if (isSegment && buf.length() == bufStart) {
// The */+ immediately follows '('
- return syntaxError(U_MISPLACED_QUANTIFIER, rule, start);
+ return syntaxError(U_MISPLACED_QUANTIFIER, rule, start, status);
}
int32_t qstart, qlimit;
@@ -675,7 +674,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
}
m = new Quantifier(m, min, max);
buf.truncate(qstart);
- buf.append(parser.generateStandInFor(m));
+ buf.append(parser.generateStandInFor(m, status));
}
break;
@@ -693,31 +692,31 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
//------------------------------------------------------
case CONTEXT_ANTE:
if (ante >= 0) {
- return syntaxError(U_MULTIPLE_ANTE_CONTEXTS, rule, start);
+ return syntaxError(U_MULTIPLE_ANTE_CONTEXTS, rule, start, status);
}
ante = buf.length();
break;
case CONTEXT_POST:
if (post >= 0) {
- return syntaxError(U_MULTIPLE_POST_CONTEXTS, rule, start);
+ return syntaxError(U_MULTIPLE_POST_CONTEXTS, rule, start, status);
}
post = buf.length();
break;
case CURSOR_POS:
if (cursor >= 0) {
- return syntaxError(U_MULTIPLE_CURSORS, rule, start);
+ return syntaxError(U_MULTIPLE_CURSORS, rule, start, status);
}
cursor = buf.length();
break;
case CURSOR_OFFSET:
if (cursorOffset < 0) {
if (buf.length() > 0) {
- return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start);
+ return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start, status);
}
--cursorOffset;
} else if (cursorOffset > 0) {
if (buf.length() != cursorOffsetPos || cursor >= 0) {
- return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start);
+ return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start, status);
}
++cursorOffset;
} else {
@@ -727,7 +726,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
cursorOffsetPos = buf.length();
cursorOffset = 1;
} else {
- return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start);
+ return syntaxError(U_MISPLACED_CURSOR_OFFSET, rule, start, status);
}
}
break;
@@ -744,7 +743,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
!((c >= 0x0030/*'0'*/ && c <= 0x0039/*'9'*/) ||
(c >= 0x0041/*'A'*/ && c <= 0x005A/*'Z'*/) ||
(c >= 0x0061/*'a'*/ && c <= 0x007A/*'z'*/))) {
- return syntaxError(U_UNQUOTED_SPECIAL, rule, start);
+ return syntaxError(U_UNQUOTED_SPECIAL, rule, start, status);
}
buf.append(c);
break;
@@ -807,32 +806,29 @@ UBool RuleHalf::isValidInput(TransliteratorParser& transParser) {
/**
* Constructor.
*/
-TransliteratorParser::TransliteratorParser() {
- dataVector = NULL;
- idBlockVector = NULL;
+TransliteratorParser::TransliteratorParser(UErrorCode &statusReturn) :
+dataVector(statusReturn),
+idBlockVector(statusReturn),
+variablesVector(statusReturn),
+segmentObjects(statusReturn)
+{
+ idBlockVector.setDeleter(uhash_deleteUnicodeString);
curData = NULL;
compoundFilter = NULL;
parseData = NULL;
- variablesVector = NULL;
- variableNames = NULL;
- segmentObjects = NULL;
+ variableNames.setValueDeleter(uhash_deleteUnicodeString);
}
/**
* Destructor.
*/
TransliteratorParser::~TransliteratorParser() {
- while (dataVector != NULL && !dataVector->isEmpty())
- delete (TransliterationRuleData*)(dataVector->orphanElementAt(0));
- delete dataVector;
- delete idBlockVector;
+ while (!dataVector.isEmpty())
+ delete (TransliterationRuleData*)(dataVector.orphanElementAt(0));
delete compoundFilter;
delete parseData;
- while (variablesVector != NULL && !variablesVector->isEmpty())
- delete (UnicodeFunctor*)variablesVector->orphanElementAt(0);
- delete variablesVector;
- delete variableNames;
- delete segmentObjects;
+ while (!variablesVector.isEmpty())
+ delete (UnicodeFunctor*)variablesVector.orphanElementAt(0);
}
void
@@ -841,9 +837,8 @@ TransliteratorParser::parse(const UnicodeString& rules,
UParseError& pe,
UErrorCode& ec) {
if (U_SUCCESS(ec)) {
- parseRules(rules, transDirection);
+ parseRules(rules, transDirection, ec);
pe = parseError;
- ec = status;
}
}
@@ -869,55 +864,35 @@ UnicodeSet* TransliteratorParser::orphanCompoundFilter() {
* rules
*/
void TransliteratorParser::parseRules(const UnicodeString& rule,
- UTransDirection theDirection) {
+ UTransDirection theDirection,
+ UErrorCode& status) {
// Clear error struct
parseError.line = parseError.offset = -1;
parseError.preContext[0] = parseError.postContext[0] = (UChar)0;
- status = U_ZERO_ERROR;
UBool parsingIDs = TRUE;
int32_t ruleCount = 0;
- if (dataVector == NULL)
- dataVector = new UVector(status);
- else {
- while (!dataVector->isEmpty())
- delete (TransliterationRuleData*)(dataVector->orphanElementAt(0));
+ while (!dataVector.isEmpty()) {
+ delete (TransliterationRuleData*)(dataVector.orphanElementAt(0));
}
if (U_FAILURE(status)) {
return;
}
- if (idBlockVector == NULL) {
- idBlockVector = new UVector(status);
- idBlockVector->setDeleter(uhash_deleteUnicodeString);
- }
- else
- idBlockVector->removeAllElements();
- if (U_FAILURE(status)) {
- return;
- }
+ idBlockVector.removeAllElements();
curData = NULL;
-
direction = theDirection;
ruleCount = 0;
delete compoundFilter;
compoundFilter = NULL;
- if (variablesVector == NULL) {
- variablesVector = new UVector(status);
- } else {
- while (!variablesVector->isEmpty())
- delete (UnicodeFunctor*)variablesVector->orphanElementAt(0);
- }
- if (variableNames == NULL) {
- variableNames = new Hashtable(status);
- variableNames->setValueDeleter(uhash_deleteUnicodeString);
- } else {
- variableNames->removeAll();
+ while (!variablesVector.isEmpty()) {
+ delete (UnicodeFunctor*)variablesVector.orphanElementAt(0);
}
- parseData = new ParseData(0, variablesVector, variableNames);
+ variableNames.removeAll();
+ parseData = new ParseData(0, &variablesVector, &variableNames);
if (parseData == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -979,9 +954,9 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
if (!parsingIDs) {
if (curData != NULL) {
if (direction == UTRANS_FORWARD)
- dataVector->addElement(curData, status);
+ dataVector.addElement(curData, status);
else
- dataVector->insertElementAt(curData, 0, status);
+ dataVector.insertElementAt(curData, 0, status);
curData = NULL;
}
parsingIDs = TRUE;
@@ -1009,7 +984,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
{
if (compoundFilter != NULL) {
// Multiple compound filters
- syntaxError(U_MULTIPLE_COMPOUND_FILTERS, rule, pos);
+ syntaxError(U_MULTIPLE_COMPOUND_FILTERS, rule, pos, status);
delete f;
} else {
compoundFilter = f;
@@ -1021,7 +996,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
} else {
// Invalid ::id
// Can be parsed as neither an ID nor a global filter
- syntaxError(U_INVALID_ID, rule, pos);
+ syntaxError(U_INVALID_ID, rule, pos, status);
}
}
delete id;
@@ -1029,9 +1004,9 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
} else {
if (parsingIDs) {
if (direction == UTRANS_FORWARD)
- idBlockVector->addElement(new UnicodeString(idBlockResult), status);
+ idBlockVector.addElement(new UnicodeString(idBlockResult), status);
else
- idBlockVector->insertElementAt(new UnicodeString(idBlockResult), 0, status);
+ idBlockVector.insertElementAt(new UnicodeString(idBlockResult), 0, status);
idBlockResult.remove();
parsingIDs = FALSE;
curData = new TransliterationRuleData(status);
@@ -1041,41 +1016,41 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
// E000..F8FF for variables and other stand-ins. Currently
// the range F000..F8FF is typically sufficient. The 'use
// variable range' pragma allows rule sets to modify this.
- setVariableRange(0xF000, 0xF8FF);
+ setVariableRange(0xF000, 0xF8FF, status);
}
if (resemblesPragma(rule, pos, limit)) {
- int32_t ppp = parsePragma(rule, pos, limit);
+ int32_t ppp = parsePragma(rule, pos, limit, status);
if (ppp < 0) {
- syntaxError(U_MALFORMED_PRAGMA, rule, pos);
+ syntaxError(U_MALFORMED_PRAGMA, rule, pos, status);
}
pos = ppp;
// Parse a rule
} else {
- pos = parseRule(rule, pos, limit);
+ pos = parseRule(rule, pos, limit, status);
}
}
}
if (parsingIDs && idBlockResult.length() > 0) {
if (direction == UTRANS_FORWARD)
- idBlockVector->addElement(new UnicodeString(idBlockResult), status);
+ idBlockVector.addElement(new UnicodeString(idBlockResult), status);
else
- idBlockVector->insertElementAt(new UnicodeString(idBlockResult), 0, status);
+ idBlockVector.insertElementAt(new UnicodeString(idBlockResult), 0, status);
}
else if (!parsingIDs && curData != NULL) {
if (direction == UTRANS_FORWARD)
- dataVector->addElement(curData, status);
+ dataVector.addElement(curData, status);
else
- dataVector->insertElementAt(curData, 0, status);
+ dataVector.insertElementAt(curData, 0, status);
}
if (U_SUCCESS(status)) {
// Convert the set vector to an array
- int32_t i, dataVectorSize = dataVector->size();
+ int32_t i, dataVectorSize = dataVector.size();
for (i = 0; i < dataVectorSize; i++) {
- TransliterationRuleData* data = (TransliterationRuleData*)dataVector->elementAt(i);
- data->variablesLength = variablesVector->size();
+ TransliterationRuleData* data = (TransliterationRuleData*)dataVector.elementAt(i);
+ data->variablesLength = variablesVector.size();
if (data->variablesLength == 0) {
data->variables = 0;
} else {
@@ -1085,19 +1060,19 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
for (int32_t j = 0; j < data->variablesLength; j++) {
data->variables[j] =
- ((UnicodeSet*)variablesVector->elementAt(j));
+ ((UnicodeSet*)variablesVector.elementAt(j));
}
- data->variableNames->removeAll();
+ data->variableNames.removeAll();
int32_t pos = -1;
- const UHashElement* he = variableNames->nextElement(pos);
+ const UHashElement* he = variableNames.nextElement(pos);
while (he != NULL) {
- data->variableNames->put(*((UnicodeString*)(he->key.pointer)),
+ data->variableNames.put(*((UnicodeString*)(he->key.pointer)),
((UnicodeString*)(he->value.pointer))->clone(), status);
- he = variableNames->nextElement(pos);
+ he = variableNames.nextElement(pos);
}
}
- variablesVector->removeAllElements(); // keeps them from getting deleted when we succeed
+ variablesVector.removeAllElements(); // keeps them from getting deleted when we succeed
// Index the rules
if (compoundFilter != NULL) {
@@ -1108,11 +1083,11 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
}
for (i = 0; i < dataVectorSize; i++) {
- TransliterationRuleData* data = (TransliterationRuleData*)dataVector->elementAt(i);
+ TransliterationRuleData* data = (TransliterationRuleData*)dataVector.elementAt(i);
data->ruleSet.freeze(parseError, status);
}
- if (idBlockVector->size() == 1 && ((UnicodeString*)idBlockVector->elementAt(0))->isEmpty()) {
- idBlockVector->removeElementAt(0);
+ if (idBlockVector.size() == 1 && ((UnicodeString*)idBlockVector.elementAt(0))->isEmpty()) {
+ idBlockVector.removeElementAt(0);
}
}
}
@@ -1120,14 +1095,14 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
/**
* Set the variable range to [start, end] (inclusive).
*/
-void TransliteratorParser::setVariableRange(int32_t start, int32_t end) {
+void TransliteratorParser::setVariableRange(int32_t start, int32_t end, UErrorCode& status) {
if (start > end || start < 0 || end > 0xFFFF) {
status = U_MALFORMED_PRAGMA;
return;
}
curData->variablesBase = (UChar) start;
- if (dataVector->size() == 0) {
+ if (dataVector.size() == 0) {
variableNext = (UChar) start;
variableLimit = (UChar) (end + 1);
}
@@ -1188,7 +1163,7 @@ UBool TransliteratorParser::resemblesPragma(const UnicodeString& rule, int32_t p
* @return the position index after the final ';' of the pragma,
* or -1 on failure.
*/
-int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos, int32_t limit) {
+int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status) {
int32_t array[2];
// resemblesPragma() has already returned true, so we
@@ -1203,7 +1178,7 @@ int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos
// use nfc rules;
int p = ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_VARIABLE_RANGE, array);
if (p >= 0) {
- setVariableRange(array[0], array[1]);
+ setVariableRange(array[0], array[1], status);
return p;
}
@@ -1242,7 +1217,7 @@ int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos
* indicators. Once it does a lexical breakdown of the rule at pos, it
* creates a rule object and adds it to our rule list.
*/
-int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos, int32_t limit) {
+int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status) {
// Locate the left side, operator, and right side
int32_t start = pos;
UChar op = 0;
@@ -1250,11 +1225,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
// Set up segments data
segmentStandins.truncate(0);
- if (segmentObjects == NULL) {
- segmentObjects = new UVector(status);
- } else {
- segmentObjects->removeAllElements();
- }
+ segmentObjects.removeAllElements();
// Use pointers to automatics to make swapping possible.
RuleHalf _left(*this), _right(*this);
@@ -1262,13 +1233,13 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
RuleHalf* right = &_right;
undefinedVariableName.remove();
- pos = left->parse(rule, pos, limit);
+ pos = left->parse(rule, pos, limit, status);
if (U_FAILURE(status)) {
return start;
}
if (pos == limit || u_strchr(gOPERATORS, (op = rule.charAt(--pos))) == NULL) {
- return syntaxError(U_MISSING_OPERATOR, rule, start);
+ return syntaxError(U_MISSING_OPERATOR, rule, start, status);
}
++pos;
@@ -1292,7 +1263,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
break;
}
- pos = right->parse(rule, pos, limit);
+ pos = right->parse(rule, pos, limit, status);
if (U_FAILURE(status)) {
return start;
}
@@ -1302,7 +1273,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
++pos;
} else {
// RuleHalf parser must have terminated at an operator
- return syntaxError(U_UNQUOTED_SPECIAL, rule, start);
+ return syntaxError(U_UNQUOTED_SPECIAL, rule, start, status);
}
}
@@ -1316,19 +1287,19 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
// defined).
if (undefinedVariableName.length() == 0) {
// "Missing '$' or duplicate definition"
- return syntaxError(U_BAD_VARIABLE_DEFINITION, rule, start);
+ return syntaxError(U_BAD_VARIABLE_DEFINITION, rule, start, status);
}
if (left->text.length() != 1 || left->text.charAt(0) != variableLimit) {
// "Malformed LHS"
- return syntaxError(U_MALFORMED_VARIABLE_DEFINITION, rule, start);
+ return syntaxError(U_MALFORMED_VARIABLE_DEFINITION, rule, start, status);
}
if (left->anchorStart || left->anchorEnd ||
right->anchorStart || right->anchorEnd) {
- return syntaxError(U_MALFORMED_VARIABLE_DEFINITION, rule, start);
+ return syntaxError(U_MALFORMED_VARIABLE_DEFINITION, rule, start, status);
}
// We allow anything on the right, including an empty string.
UnicodeString* value = new UnicodeString(right->text);
- variableNames->put(undefinedVariableName, value, status);
+ variableNames.put(undefinedVariableName, value, status);
++variableLimit;
return pos;
}
@@ -1338,21 +1309,21 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
if (undefinedVariableName.length() != 0) {
return syntaxError(// "Undefined variable $" + undefinedVariableName,
U_UNDEFINED_VARIABLE,
- rule, start);
+ rule, start, status);
}
// Verify segments
- if (segmentStandins.length() > segmentObjects->size()) {
- syntaxError(U_UNDEFINED_SEGMENT_REFERENCE, rule, start);
+ if (segmentStandins.length() > segmentObjects.size()) {
+ syntaxError(U_UNDEFINED_SEGMENT_REFERENCE, rule, start, status);
}
for (i=0; i<segmentStandins.length(); ++i) {
if (segmentStandins.charAt(i) == 0) {
- syntaxError(U_INTERNAL_TRANSLITERATOR_ERROR, rule, start); // will never happen
+ syntaxError(U_INTERNAL_TRANSLITERATOR_ERROR, rule, start, status); // will never happen
}
}
- for (i=0; i<segmentObjects->size(); ++i) {
- if (segmentObjects->elementAt(i) == NULL) {
- syntaxError(U_INTERNAL_TRANSLITERATOR_ERROR, rule, start); // will never happen
+ for (i=0; i<segmentObjects.size(); ++i) {
+ if (segmentObjects.elementAt(i) == NULL) {
+ syntaxError(U_INTERNAL_TRANSLITERATOR_ERROR, rule, start, status); // will never happen
}
}
@@ -1405,21 +1376,21 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
!left->isValidInput(*this) || !right->isValidOutput(*this) ||
left->ante > left->post) {
- return syntaxError(U_MALFORMED_RULE, rule, start);
+ return syntaxError(U_MALFORMED_RULE, rule, start, status);
}
// Flatten segment objects vector to an array
UnicodeFunctor** segmentsArray = NULL;
- if (segmentObjects->size() > 0) {
- segmentsArray = (UnicodeFunctor **)uprv_malloc(segmentObjects->size() * sizeof(UnicodeFunctor *));
- segmentObjects->toArray((void**) segmentsArray);
+ if (segmentObjects.size() > 0) {
+ segmentsArray = (UnicodeFunctor **)uprv_malloc(segmentObjects.size() * sizeof(UnicodeFunctor *));
+ segmentObjects.toArray((void**) segmentsArray);
}
curData->ruleSet.addRule(new TransliterationRule(
left->text, left->ante, left->post,
right->text, right->cursor, right->cursorOffset,
segmentsArray,
- segmentObjects->size(),
+ segmentObjects.size(),
left->anchorStart, left->anchorEnd,
curData,
status), status);
@@ -1437,8 +1408,10 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
* @param start position of first character of current rule
*/
int32_t TransliteratorParser::syntaxError(UErrorCode parseErrorCode,
- const UnicodeString& rule,
- int32_t pos) {
+ const UnicodeString& rule,
+ int32_t pos,
+ UErrorCode& status)
+{
parseError.offset = pos;
parseError.line = 0 ; /* we are not using line numbers */
@@ -1469,23 +1442,24 @@ int32_t TransliteratorParser::syntaxError(UErrorCode parseErrorCode,
* used to represent it.
*/
UChar TransliteratorParser::parseSet(const UnicodeString& rule,
- ParsePosition& pos) {
+ ParsePosition& pos,
+ UErrorCode& status) {
UnicodeSet* set = new UnicodeSet(rule, pos, USET_IGNORE_SPACE, parseData, status);
set->compact();
- return generateStandInFor(set);
+ return generateStandInFor(set, status);
}
/**
* Generate and return a stand-in for a new UnicodeFunctor. Store
* the matcher (adopt it).
*/
-UChar TransliteratorParser::generateStandInFor(UnicodeFunctor* adopted) {
+UChar TransliteratorParser::generateStandInFor(UnicodeFunctor* adopted, UErrorCode& status) {
// assert(obj != null);
// Look up previous stand-in, if any. This is a short list
// (typical n is 0, 1, or 2); linear search is optimal.
- for (int32_t i=0; i<variablesVector->size(); ++i) {
- if (variablesVector->elementAt(i) == adopted) { // [sic] pointer comparison
+ for (int32_t i=0; i<variablesVector.size(); ++i) {
+ if (variablesVector.elementAt(i) == adopted) { // [sic] pointer comparison
return (UChar) (curData->variablesBase + i);
}
}
@@ -1495,14 +1469,14 @@ UChar TransliteratorParser::generateStandInFor(UnicodeFunctor* adopted) {
status = U_VARIABLE_RANGE_EXHAUSTED;
return 0;
}
- variablesVector->addElement(adopted, status);
+ variablesVector.addElement(adopted, status);
return variableNext++;
}
/**
* Return the standin for segment seg (1-based).
*/
-UChar TransliteratorParser::getSegmentStandin(int32_t seg) {
+UChar TransliteratorParser::getSegmentStandin(int32_t seg, UErrorCode& status) {
// Special character used to indicate an empty spot
UChar empty = curData->variablesBase - 1;
while (segmentStandins.length() < seg) {
@@ -1518,7 +1492,7 @@ UChar TransliteratorParser::getSegmentStandin(int32_t seg) {
// Set a placeholder in the master variables vector that will be
// filled in later by setSegmentObject(). We know that we will get
// called first because setSegmentObject() will call us.
- variablesVector->addElement((void*) NULL, status);
+ variablesVector.addElement((void*) NULL, status);
segmentStandins.setCharAt(seg-1, c);
}
return c;
@@ -1527,32 +1501,32 @@ UChar TransliteratorParser::getSegmentStandin(int32_t seg) {
/**
* Set the object for segment seg (1-based).
*/
-void TransliteratorParser::setSegmentObject(int32_t seg, StringMatcher* adopted) {
+void TransliteratorParser::setSegmentObject(int32_t seg, StringMatcher* adopted, UErrorCode& status) {
// Since we call parseSection() recursively, nested
// segments will result in segment i+1 getting parsed
// and stored before segment i; be careful with the
// vector handling here.
- if (segmentObjects->size() < seg) {
- segmentObjects->setSize(seg);
+ if (segmentObjects.size() < seg) {
+ segmentObjects.setSize(seg);
}
- int32_t index = getSegmentStandin(seg) - curData->variablesBase;
- if (segmentObjects->elementAt(seg-1) != NULL ||
- variablesVector->elementAt(index) != NULL) {
+ int32_t index = getSegmentStandin(seg, status) - curData->variablesBase;
+ if (segmentObjects.elementAt(seg-1) != NULL ||
+ variablesVector.elementAt(index) != NULL) {
// should never happen
status = U_INTERNAL_TRANSLITERATOR_ERROR;
return;
}
- segmentObjects->setElementAt(adopted, seg-1);
- variablesVector->setElementAt(adopted, index);
+ segmentObjects.setElementAt(adopted, seg-1);
+ variablesVector.setElementAt(adopted, index);
}
/**
* Return the stand-in for the dot set. It is allocated the first
* time and reused thereafter.
*/
-UChar TransliteratorParser::getDotStandIn() {
+UChar TransliteratorParser::getDotStandIn(UErrorCode& status) {
if (dotStandIn == (UChar) -1) {
- dotStandIn = generateStandInFor(new UnicodeSet(DOT_SET, status));
+ dotStandIn = generateStandInFor(new UnicodeSet(DOT_SET, status), status);
}
return dotStandIn;
}
@@ -1562,8 +1536,9 @@ UChar TransliteratorParser::getDotStandIn() {
* UnicodeString.
*/
void TransliteratorParser::appendVariableDef(const UnicodeString& name,
- UnicodeString& buf) {
- const UnicodeString* s = (const UnicodeString*) variableNames->get(name);
+ UnicodeString& buf,
+ UErrorCode& status) {
+ const UnicodeString* s = (const UnicodeString*) variableNames.get(name);
if (s == NULL) {
// We allow one undefined variable so that variable definition
// statements work. For the first undefined variable we return
diff --git a/Build/source/libs/icu-xetex/i18n/rbt_pars.h b/Build/source/libs/icu-xetex/i18n/rbt_pars.h
index 699e216bf98..a9b11d34837 100644
--- a/Build/source/libs/icu-xetex/i18n/rbt_pars.h
+++ b/Build/source/libs/icu-xetex/i18n/rbt_pars.h
@@ -1,5 +1,7 @@
/*
-* Copyright (C) 1999-2005, International Business Machines Corporation and others. All Rights Reserved.
+**********************************************************************
+* Copyright (C) 1999-2006, International Business Machines Corporation
+* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 11/17/99 aliu Creation.
@@ -17,6 +19,8 @@
#include "unicode/parseerr.h"
#include "unicode/unorm.h"
#include "rbt.h"
+#include "hash.h"
+#include "uvector.h"
U_NAMESPACE_BEGIN
@@ -25,8 +29,6 @@ class UnicodeFunctor;
class ParseData;
class RuleHalf;
class ParsePosition;
-class UVector;
-class Hashtable;
class StringMatcher;
class TransliteratorParser : public UMemory {
@@ -37,13 +39,13 @@ class TransliteratorParser : public UMemory {
* A Vector of TransliterationRuleData objects, one for each discrete group
* of rules in the rule set
*/
- UVector* dataVector;
+ UVector dataVector;
/**
* PUBLIC data member.
* A Vector of UnicodeStrings containing all of the ID blocks in the rule set
*/
- UVector* idBlockVector;
+ UVector idBlockVector;
/**
* PUBLIC data member containing the parsed compound filter, if any.
@@ -60,12 +62,6 @@ class TransliteratorParser : public UMemory {
UTransDirection direction;
/**
- * We use a single error code during parsing. Rather than pass it
- * through each API, we keep it here.
- */
- UErrorCode status;
-
- /**
* Parse error information.
*/
UParseError parseError;
@@ -80,13 +76,13 @@ class TransliteratorParser : public UMemory {
* is copied into the array data.variables. As with data.variables,
* element 0 corresponds to character data.variablesBase.
*/
- UVector* variablesVector;
+ UVector variablesVector;
/**
* Temporary table of variable names. When parsing is complete, this is
* copied into data.variableNames.
*/
- Hashtable* variableNames;
+ Hashtable variableNames;
/**
* String of standins for segments. Used during the parsing of a single
@@ -101,7 +97,7 @@ class TransliteratorParser : public UMemory {
* segmentStandins.charAt(0) is the standin for "$1" and corresponds
* to StringMatcher object segmentObjects.elementAt(0), etc.
*/
- UVector* segmentObjects;
+ UVector segmentObjects;
/**
* The next available stand-in for variables. This starts at some point in
@@ -139,7 +135,7 @@ public:
/**
* Constructor.
*/
- TransliteratorParser();
+ TransliteratorParser(UErrorCode &statusReturn);
/**
* Destructor.
@@ -181,7 +177,8 @@ private:
* @param direction either FORWARD or REVERSE.
*/
void parseRules(const UnicodeString& rules,
- UTransDirection direction);
+ UTransDirection direction,
+ UErrorCode& status);
/**
* MAIN PARSER. Parse the next rule in the given rule string, starting
@@ -200,14 +197,14 @@ private:
* @param limit pointer past the last character of the rule.
* @return the index after the last character parsed.
*/
- int32_t parseRule(const UnicodeString& rule, int32_t pos, int32_t limit);
+ int32_t parseRule(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status);
/**
* Set the variable range to [start, end] (inclusive).
* @param start the start value of the range.
* @param end the end value of the range.
*/
- void setVariableRange(int32_t start, int32_t end);
+ void setVariableRange(int32_t start, int32_t end, UErrorCode& status);
/**
* Assert that the given character is NOT within the variable range.
@@ -250,7 +247,7 @@ private:
* @return the position index after the final ';' of the pragma,
* or -1 on failure.
*/
- int32_t parsePragma(const UnicodeString& rule, int32_t pos, int32_t limit);
+ int32_t parsePragma(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status);
/**
* Called by main parser upon syntax error. Search the rule string
@@ -262,7 +259,8 @@ private:
* @param start position of first character of current rule.
* @return start position of first character of current rule.
*/
- int32_t syntaxError(UErrorCode parseErrorCode, const UnicodeString&, int32_t start);
+ int32_t syntaxError(UErrorCode parseErrorCode, const UnicodeString&, int32_t start,
+ UErrorCode& status);
/**
* Parse a UnicodeSet out, store it, and return the stand-in character
@@ -273,7 +271,8 @@ private:
* @return the stand-in character used to represent it.
*/
UChar parseSet(const UnicodeString& rule,
- ParsePosition& pos);
+ ParsePosition& pos,
+ UErrorCode& status);
/**
* Generate and return a stand-in for a new UnicodeFunctor. Store
@@ -281,28 +280,28 @@ private:
* @param adopted the UnicodeFunctor to be adopted.
* @return a stand-in for a new UnicodeFunctor.
*/
- UChar generateStandInFor(UnicodeFunctor* adopted);
+ UChar generateStandInFor(UnicodeFunctor* adopted, UErrorCode& status);
/**
* Return the standin for segment seg (1-based).
* @param seg the given segment.
* @return the standIn character for the given segment.
*/
- UChar getSegmentStandin(int32_t seg);
+ UChar getSegmentStandin(int32_t seg, UErrorCode& status);
/**
* Set the object for segment seg (1-based).
* @param seg the given segment.
* @param adopted the StringMatcher to be adopted.
*/
- void setSegmentObject(int32_t seg, StringMatcher* adopted);
+ void setSegmentObject(int32_t seg, StringMatcher* adopted, UErrorCode& status);
/**
* Return the stand-in for the dot set. It is allocated the first
* time and reused thereafter.
* @return the stand-in for the dot set.
*/
- UChar getDotStandIn();
+ UChar getDotStandIn(UErrorCode& status);
/**
* Append the value of the given variable name to the given
@@ -311,7 +310,8 @@ private:
* @param buf the given UnicodeString to append to.
*/
void appendVariableDef(const UnicodeString& name,
- UnicodeString& buf);
+ UnicodeString& buf,
+ UErrorCode& status);
/**
* Glue method to get around access restrictions in C++.
diff --git a/Build/source/libs/icu-xetex/i18n/regexcmp.cpp b/Build/source/libs/icu-xetex/i18n/regexcmp.cpp
index b669c636cad..5d71d29ffbd 100644
--- a/Build/source/libs/icu-xetex/i18n/regexcmp.cpp
+++ b/Build/source/libs/icu-xetex/i18n/regexcmp.cpp
@@ -2,7 +2,7 @@
//
// file: regexcmp.cpp
//
-// Copyright (C) 2002-2004 International Business Machines Corporation and others.
+// Copyright (C) 2002-2006 International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains the ICU regular expression compiler, which is responsible
@@ -60,7 +60,7 @@ RegexCompile::RegexCompile(RegexPattern *rxp, UErrorCode &status) : fParenStack(
fCharNum = 0;
fQuoteMode = FALSE;
fInBackslashQuote = FALSE;
- fModeFlags = fRXPat->fFlags;
+ fModeFlags = fRXPat->fFlags | 0x80000000;
fEOLComments = TRUE;
fMatchOpenParen = -1;
@@ -339,11 +339,10 @@ UBool RegexCompile::doParseActions(EParseAction action)
fRXPat->fCompiledPat->addElement(URX_BUILD(URX_STATE_SAVE, 2), *fStatus);
fRXPat->fCompiledPat->addElement(URX_BUILD(URX_JMP, 3), *fStatus);
fRXPat->fCompiledPat->addElement(URX_BUILD(URX_FAIL, 0), *fStatus);
- fRXPat->fCompiledPat->addElement(URX_BUILD(URX_NOP, 0), *fStatus);
- fRXPat->fCompiledPat->addElement(URX_BUILD(URX_NOP, 0), *fStatus);
- fParenStack.push(-1, *fStatus); // Begin a Paren Stack Frame
- fParenStack.push( 3, *fStatus); // Push location of first NOP
+ // Standard open nonCapture paren action emits the two NOPs and
+ // sets up the paren stack frame.
+ doParseActions((EParseAction)doOpenNonCaptureParen);
break;
case doPatFinish:
@@ -1333,6 +1332,7 @@ UBool RegexCompile::doParseActions(EParseAction action)
case doSetMatchMode:
// We've got a (?i) or similar. The match mode is being changed, but
// the change is not scoped to a parenthesized block.
+ U_ASSERT(fNewModeFlags < 0);
fModeFlags = fNewModeFlags;
// Prevent any string from spanning across the change of match mode.
@@ -1363,6 +1363,7 @@ UBool RegexCompile::doParseActions(EParseAction action)
fParenStack.push(fRXPat->fCompiledPat->size()-1, *fStatus); // The second NOP
// Set the current mode flags to the new values.
+ U_ASSERT(fNewModeFlags < 0);
fModeFlags = fNewModeFlags;
}
break;
@@ -1620,6 +1621,7 @@ void RegexCompile::insertOp(int32_t where) {
// the compiled pattern. (Negative values are frame boundaries, and don't need fixing.)
for (loc=0; loc<fParenStack.size(); loc++) {
int32_t x = fParenStack.elementAti(loc);
+ U_ASSERT(x < code->size());
if (x>where) {
x++;
fParenStack.setElementAt(x, loc);
@@ -1726,6 +1728,7 @@ void RegexCompile::handleCloseParen() {
// the value they had at the open paren. Saved value is
// at the top of the paren stack.
fModeFlags = fParenStack.popi();
+ U_ASSERT(fModeFlags < 0);
// DO any additional fixups, depending on the specific kind of
// parentesized grouping this is
@@ -2240,7 +2243,7 @@ void RegexCompile::matchStartType() {
// character may have distinct cased forms. Add all of them
// to the set of possible starting match chars.
UnicodeSet s(c, c);
- s.closeOver(USET_CASE);
+ s.closeOver(USET_CASE_INSENSITIVE);
fRXPat->fInitialChars->addAll(s);
} else {
// Char has no case variants. Just add it as-is to the
@@ -2366,7 +2369,7 @@ void RegexCompile::matchStartType() {
int32_t stringStartIdx = URX_VAL(op);
UChar32 c = fRXPat->fLiteralText.char32At(stringStartIdx);
UnicodeSet s(c, c);
- s.closeOver(USET_CASE);
+ s.closeOver(USET_CASE_INSENSITIVE);
fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2; // Matching on an initial string not possible.
}
@@ -2958,8 +2961,8 @@ int32_t RegexCompile::maxMatchLength(int32_t start, int32_t end) {
// End of look-ahead ops should always be consumed by the processing at
// the URX_LA_START op.
- U_ASSERT(FALSE);
- break;
+ // U_ASSERT(FALSE);
+ // break;
case URX_LB_START:
{
@@ -3235,18 +3238,15 @@ static const UChar chCR = 0x0d; // New lines, for terminating c
static const UChar chLF = 0x0a;
static const UChar chNEL = 0x85; // NEL newline variant
static const UChar chLS = 0x2028; // Unicode Line Separator
-static const UChar chApos = 0x27; // single quote, for quoted chars.
static const UChar chPound = 0x23; // '#', introduces a comment.
static const UChar chE = 0x45; // 'E'
+static const UChar chUpperN = 0x4E;
+static const UChar chLowerP = 0x70;
+static const UChar chUpperP = 0x50;
static const UChar chBackSlash = 0x5c; // '\' introduces a char escape
-static const UChar chLParen = 0x28;
-static const UChar chRParen = 0x29;
static const UChar chLBracket = 0x5b;
static const UChar chRBracket = 0x5d;
static const UChar chRBrace = 0x7d;
-static const UChar chUpperN = 0x4E;
-static const UChar chLowerP = 0x70;
-static const UChar chUpperP = 0x50;
//------------------------------------------------------------------------------
@@ -3425,7 +3425,6 @@ void RegexCompile::nextChar(RegexPatternChar &c) {
UnicodeSet *RegexCompile::scanSet() {
UnicodeSet *uset = NULL;
ParsePosition pos;
- int startPos;
int i;
if (U_FAILURE(*fStatus)) {
@@ -3433,7 +3432,6 @@ UnicodeSet *RegexCompile::scanSet() {
}
pos.setIndex(fScanIndex);
- startPos = fScanIndex;
UErrorCode localStatus = U_ZERO_ERROR;
uint32_t usetFlags = 0;
if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
diff --git a/Build/source/libs/icu-xetex/i18n/regexcmp.h b/Build/source/libs/icu-xetex/i18n/regexcmp.h
index 6d93f5a8d75..3f42c87599b 100644
--- a/Build/source/libs/icu-xetex/i18n/regexcmp.h
+++ b/Build/source/libs/icu-xetex/i18n/regexcmp.h
@@ -1,7 +1,7 @@
//
// regexcmp.h
//
-// Copyright (C) 2002-2003, International Business Machines Corporation and others.
+// Copyright (C) 2002-2005, International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains declarations for the class RegexCompile
@@ -130,8 +130,8 @@ private:
UBool fInBackslashQuote; // Scan is between a '\' and the following char.
UBool fEOLComments; // When scan is just after '(?', inhibit #... to
// end of line comments, in favor of (?#...) comments.
- int fLineNum; // Line number in input file.
- int fCharNum; // Char position within the line.
+ int32_t fLineNum; // Line number in input file.
+ int32_t fCharNum; // Char position within the line.
UChar32 fLastChar; // Previous char, needed to count CR-LF
// as a single line, not two.
UChar32 fPeekChar; // Saved char, if we've scanned ahead.
@@ -147,13 +147,16 @@ private:
// parsing. index by p[state][char-class]
uint16_t fStack[kStackSize]; // State stack, holds state pushes
- int fStackPtr; // and pops as specified in the state
+ int32_t fStackPtr; // and pops as specified in the state
// transition rules.
//
// Data associated with the generation of the pcode for the match engine
//
int32_t fModeFlags; // Match Flags. (Case Insensitive, etc.)
+ // Always has high bit (31) set so that flag values
+ // on the paren stack are distinguished from relocatable
+ // pcode addresses.
int32_t fNewModeFlags; // New flags, while compiling (?i, holds state
// until last flag is scanned.
UBool fSetModeFlag; // true for (?ismx, false for (?-ismx
diff --git a/Build/source/libs/icu-xetex/i18n/regeximp.h b/Build/source/libs/icu-xetex/i18n/regeximp.h
index f34aca60a0d..fbf700672ec 100644
--- a/Build/source/libs/icu-xetex/i18n/regeximp.h
+++ b/Build/source/libs/icu-xetex/i18n/regeximp.h
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2002-2004 International Business Machines Corporation
+// Copyright (C) 2002-2005 International Business Machines Corporation
// and others. All rights reserved.
//
// file: regeximp.h
@@ -326,7 +326,7 @@ inline void Regex8BitSet::add(UChar32 c) {
inline void Regex8BitSet::init(const UnicodeSet *s) {
if (s != NULL) {
- for (int i=0; i<=255; i++) {
+ for (int32_t i=0; i<=255; i++) {
if (s->contains(i)) {
this->add(i);
}
diff --git a/Build/source/libs/icu-xetex/i18n/rematch.cpp b/Build/source/libs/icu-xetex/i18n/rematch.cpp
index e26e76c08ab..294833ec718 100644
--- a/Build/source/libs/icu-xetex/i18n/rematch.cpp
+++ b/Build/source/libs/icu-xetex/i18n/rematch.cpp
@@ -271,7 +271,7 @@ int32_t RegexMatcher::end(UErrorCode &err) const {
-int32_t RegexMatcher::end(int group, UErrorCode &err) const {
+int32_t RegexMatcher::end(int32_t group, UErrorCode &err) const {
if (U_FAILURE(err)) {
return -1;
}
@@ -793,7 +793,7 @@ int32_t RegexMatcher::split(const UnicodeString &input,
//
// Loop through the input text, searching for the delimiter pattern
//
- int i;
+ int32_t i;
int32_t numCaptureGroups = fPattern->fGroupMap->size();
for (i=0; ; i++) {
if (i>=destCapacity-1) {
@@ -859,7 +859,7 @@ int32_t RegexMatcher::start(UErrorCode &status) const {
-int32_t RegexMatcher::start(int group, UErrorCode &status) const {
+int32_t RegexMatcher::start(int32_t group, UErrorCode &status) const {
if (U_FAILURE(status)) {
return -1;
}
@@ -911,7 +911,7 @@ REStackFrame *RegexMatcher::resetStack() {
fStack->removeAllElements();
int32_t *iFrame = fStack->reserveBlock(fPattern->fFrameSize, fDeferredStatus);
- int i;
+ int32_t i;
for (i=0; i<fPattern->fFrameSize; i++) {
iFrame[i] = -1;
}
@@ -1049,7 +1049,7 @@ void RegexMatcher::MatchAt(int32_t startIdx, UErrorCode &status) {
{
printf("MatchAt(startIdx=%d)\n", startIdx);
printf("Original Pattern: ");
- int i;
+ int32_t i;
for (i=0; i<fPattern->fPattern.length(); i++) {
printf("%c", fPattern->fPattern.charAt(i));
}
@@ -1181,8 +1181,6 @@ void RegexMatcher::MatchAt(int32_t startIdx, UErrorCode &status) {
break;
}
}
- break;
-
}
break;
diff --git a/Build/source/libs/icu-xetex/i18n/remtrans.h b/Build/source/libs/icu-xetex/i18n/remtrans.h
index c4411d0e164..24633238118 100644
--- a/Build/source/libs/icu-xetex/i18n/remtrans.h
+++ b/Build/source/libs/icu-xetex/i18n/remtrans.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2001-2005, International Business Machines
+* Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -61,15 +61,11 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/repattrn.cpp b/Build/source/libs/icu-xetex/i18n/repattrn.cpp
index 7899ac3ebfb..bcd11078c45 100644
--- a/Build/source/libs/icu-xetex/i18n/repattrn.cpp
+++ b/Build/source/libs/icu-xetex/i18n/repattrn.cpp
@@ -3,7 +3,7 @@
//
/*
***************************************************************************
-* Copyright (C) 2002-2004 International Business Machines Corporation *
+* Copyright (C) 2002-2006 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
*/
@@ -324,6 +324,7 @@ RegexMatcher *RegexPattern::matcher(const UnicodeString &input,
return retMatcher;
}
+#if 0
RegexMatcher *RegexPattern::matcher(const UChar * /*input*/,
UErrorCode &status) const
{
@@ -333,7 +334,7 @@ RegexMatcher *RegexPattern::matcher(const UChar * /*input*/,
}
return NULL;
}
-
+#endif
//---------------------------------------------------------------------
//
diff --git a/Build/source/libs/icu-xetex/i18n/simpletz.cpp b/Build/source/libs/icu-xetex/i18n/simpletz.cpp
index 393d339d285..111ca43f54c 100644
--- a/Build/source/libs/icu-xetex/i18n/simpletz.cpp
+++ b/Build/source/libs/icu-xetex/i18n/simpletz.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2003, International Business Machines Corporation and *
+* Copyright (C) 1997-2005, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -27,6 +27,7 @@
#include "unicode/simpletz.h"
#include "unicode/gregocal.h"
+#include "unicode/smpdtfmt.h"
U_NAMESPACE_BEGIN
@@ -822,7 +823,7 @@ SimpleTimeZone::decodeStartRule(UErrorCode& status)
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- } else if (startDay > STATICMONTHLENGTH[startMonth]) {
+ } else if (startDay<1 || startDay > STATICMONTHLENGTH[startMonth]) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -877,7 +878,7 @@ SimpleTimeZone::decodeEndRule(UErrorCode& status)
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- } else if (endDay > STATICMONTHLENGTH[endMonth]) {
+ } else if (endDay<1 || endDay > STATICMONTHLENGTH[endMonth]) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
diff --git a/Build/source/libs/icu-xetex/i18n/smpdtfmt.cpp b/Build/source/libs/icu-xetex/i18n/smpdtfmt.cpp
index 351973eed03..9ae110321fa 100644
--- a/Build/source/libs/icu-xetex/i18n/smpdtfmt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/smpdtfmt.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -384,13 +384,6 @@ SimpleDateFormat::initialize(const Locale& locale,
{
if (U_FAILURE(status)) return;
- // {sfb} should this be here?
- if (fSymbols->fZoneStringsColCount < 1)
- {
- status = U_INVALID_FORMAT_ERROR; // Check for bogus locale data
- return;
- }
-
// We don't need to check that the row count is >= 1, since all 2d arrays have at
// least one row
fNumberFormat = NumberFormat::createInstance(locale, status);
@@ -542,6 +535,8 @@ SimpleDateFormat::fgPatternIndexToCalendarField[] =
/*v*/ UCAL_ZONE_OFFSET,
/*c*/ UCAL_DAY_OF_WEEK,
/*L*/ UCAL_MONTH,
+ /*Q*/ UCAL_MONTH,
+ /*q*/ UCAL_MONTH,
};
// Map index into pattern character string to DateFormat field number
@@ -558,6 +553,8 @@ SimpleDateFormat::fgPatternIndexToDateFormatField[] = {
/*v*/ UDAT_TIMEZONE_GENERIC_FIELD,
/*c*/ UDAT_STANDALONE_DAY_FIELD,
/*L*/ UDAT_STANDALONE_MONTH_FIELD,
+ /*Q*/ UDAT_QUARTER_FIELD,
+ /*q*/ UDAT_STANDALONE_QUARTER_FIELD,
};
//----------------------------------------------------------------------
@@ -566,15 +563,35 @@ SimpleDateFormat::fgPatternIndexToDateFormatField[] = {
* Append symbols[value] to dst. Make sure the array index is not out
* of bounds.
*/
-inline void
+static inline void
_appendSymbol(UnicodeString& dst,
int32_t value,
const UnicodeString* symbols,
int32_t symbolsCount) {
- U_ASSERT(value >= 0 && value < symbolsCount);
- dst += symbols[value];
+ U_ASSERT(0 <= value && value < symbolsCount);
+ if (0 <= value && value < symbolsCount) {
+ dst += symbols[value];
+ }
+}
+
+//---------------------------------------------------------------------
+inline void SimpleDateFormat::appendGMT(UnicodeString &appendTo, Calendar& cal, UErrorCode& status) const{
+ int32_t value = cal.get(UCAL_ZONE_OFFSET, status) +
+ cal.get(UCAL_DST_OFFSET, status);
+
+ if (value < 0) {
+ appendTo += gGmtMinus;
+ value = -value; // suppress the '-' sign for text display.
+ }else{
+ appendTo += gGmtPlus;
+ }
+
+ zeroPaddingNumber(appendTo, (int32_t)(value/U_MILLIS_PER_HOUR), 2, 2);
+ appendTo += (UChar)0x003A /*':'*/;
+ zeroPaddingNumber(appendTo, (int32_t)((value%U_MILLIS_PER_HOUR)/U_MILLIS_PER_MINUTE), 2, 2);
}
+//---------------------------------------------------------------------
void
SimpleDateFormat::subFormat(UnicodeString &appendTo,
UChar ch,
@@ -748,39 +765,45 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
// then the time zone shows up as "GMT+hh:mm" or "GMT-hh:mm" (where "hh:mm" is the
// offset from GMT) regardless of how many z's were in the pattern symbol
case UDAT_TIMEZONE_FIELD:
- case UDAT_TIMEZONE_GENERIC_FIELD: {
+ case UDAT_TIMEZONE_GENERIC_FIELD: {
UnicodeString str;
- int32_t zoneIndex = fSymbols->getZoneIndex(cal.getTimeZone().getID(str));
- if (zoneIndex == -1) {
- value = cal.get(UCAL_ZONE_OFFSET, status) +
- cal.get(UCAL_DST_OFFSET, status);
-
- if (value < 0) {
- appendTo += gGmtMinus;
- value = -value; // suppress the '-' sign for text display.
- }
- else
- appendTo += gGmtPlus;
-
- zeroPaddingNumber(appendTo, (int32_t)(value/U_MILLIS_PER_HOUR), 2, 2);
- appendTo += (UChar)0x003A /*':'*/;
- zeroPaddingNumber(appendTo, (int32_t)((value%U_MILLIS_PER_HOUR)/U_MILLIS_PER_MINUTE), 2, 2);
+ UnicodeString zid;
+ UnicodeString displayString;
+ zid = fSymbols->getZoneID(cal.getTimeZone().getID(str), zid, status);
+ if(U_FAILURE(status)){
+ break;
+ }
+ if (zid.length() == 0) {
+ appendGMT(appendTo, cal, status);
}
else {
- int ix;
- int zsrc = fSymbols->fZoneStringsColCount;
- if (patternCharIndex == UDAT_TIMEZONE_GENERIC_FIELD && zsrc >= 7) {
- ix = count < 4 ? 6 : 5;
- if (zsrc > 7) {
- ix += 1;
- }
- } else {
- ix = count < 4 ? 2 : 1;
- if (cal.get(UCAL_DST_OFFSET, status) != 0) {
- ix += 2;
- }
- }
- appendTo += fSymbols->fZoneStrings[zoneIndex][ix];
+
+ if (patternCharIndex == UDAT_TIMEZONE_GENERIC_FIELD) {
+ if(count < 4){
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_SHORT_GENERIC, displayString, status);
+ }else{
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_LONG_GENERIC, displayString, status);
+ }
+ } else {
+ if (cal.get(UCAL_DST_OFFSET, status) != 0) {
+ if(count < 4){
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_SHORT_DAYLIGHT, displayString, status);
+ }else{
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_LONG_DAYLIGHT, displayString, status);
+ }
+ }else{
+ if(count < 4){
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_SHORT_STANDARD, displayString, status);
+ }else{
+ fSymbols->getZoneString(zid, DateFormatSymbols::TIMEZONE_LONG_STANDARD, displayString, status);
+ }
+ }
+ }
+ if(displayString.length()==0){
+ appendGMT(appendTo, cal, status);
+ }else{
+ appendTo += displayString;
+ }
}
}
break;
@@ -800,6 +823,29 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
}
break;
+ case UDAT_QUARTER_FIELD:
+ if (count >= 4)
+ _appendSymbol(appendTo, value/3, fSymbols->fQuarters,
+ fSymbols->fQuartersCount);
+ else if (count == 3)
+ _appendSymbol(appendTo, value/3, fSymbols->fShortQuarters,
+ fSymbols->fShortQuartersCount);
+ else
+ zeroPaddingNumber(appendTo, (value/3) + 1, count, maxIntCount);
+ break;
+
+ case UDAT_STANDALONE_QUARTER_FIELD:
+ if (count >= 4)
+ _appendSymbol(appendTo, value/3, fSymbols->fStandaloneQuarters,
+ fSymbols->fStandaloneQuartersCount);
+ else if (count == 3)
+ _appendSymbol(appendTo, value/3, fSymbols->fStandaloneShortQuarters,
+ fSymbols->fStandaloneShortQuartersCount);
+ else
+ zeroPaddingNumber(appendTo, (value/3) + 1, count, maxIntCount);
+ break;
+
+
// all of the other pattern symbols can be formatted as simple numbers with
// appropriate zero padding
default:
@@ -1113,6 +1159,84 @@ SimpleDateFormat::parse(const UnicodeString& text, UErrorCode& status) const
}
//----------------------------------------------------------------------
+int32_t SimpleDateFormat::matchQuarterString(const UnicodeString& text,
+ int32_t start,
+ UCalendarDateFields field,
+ const UnicodeString* data,
+ int32_t dataCount,
+ Calendar& cal) const
+{
+ int32_t i = 0;
+ int32_t count = dataCount;
+
+ // There may be multiple strings in the data[] array which begin with
+ // the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
+ // We keep track of the longest match, and return that. Note that this
+ // unfortunately requires us to test all array elements.
+ int32_t bestMatchLength = 0, bestMatch = -1;
+
+ // {sfb} kludge to support case-insensitive comparison
+ // {markus 2002oct11} do not just use caseCompareBetween because we do not know
+ // the length of the match after case folding
+ // {alan 20040607} don't case change the whole string, since the length
+ // can change
+ // TODO we need a case-insensitive startsWith function
+ UnicodeString lcase, lcaseText;
+ text.extract(start, INT32_MAX, lcaseText);
+ lcaseText.foldCase();
+
+ for (; i < count; ++i)
+ {
+ // Always compare if we have no match yet; otherwise only compare
+ // against potentially better matches (longer strings).
+
+ lcase.fastCopyFrom(data[i]).foldCase();
+ int32_t length = lcase.length();
+
+ if (length > bestMatchLength &&
+ lcaseText.compareBetween(0, length, lcase, 0, length) == 0)
+ {
+ bestMatch = i;
+ bestMatchLength = length;
+ }
+ }
+ if (bestMatch >= 0)
+ {
+ cal.set(field, bestMatch * 3);
+
+ // Once we have a match, we have to determine the length of the
+ // original source string. This will usually be == the length of
+ // the case folded string, but it may differ (e.g. sharp s).
+ lcase.fastCopyFrom(data[bestMatch]).foldCase();
+
+ // Most of the time, the length will be the same as the length
+ // of the string from the locale data. Sometimes it will be
+ // different, in which case we will have to figure it out by
+ // adding a character at a time, until we have a match. We do
+ // this all in one loop, where we try 'len' first (at index
+ // i==0).
+ int32_t len = data[bestMatch].length(); // 99+% of the time
+ int32_t n = text.length() - start;
+ for (i=0; i<=n; ++i) {
+ int32_t j=i;
+ if (i == 0) {
+ j = len;
+ } else if (i == len) {
+ continue; // already tried this when i was 0
+ }
+ text.extract(start, j, lcaseText);
+ lcaseText.foldCase();
+ if (lcase == lcaseText) {
+ return start + j;
+ }
+ }
+ }
+
+ return -start;
+}
+
+//----------------------------------------------------------------------
+
int32_t SimpleDateFormat::matchString(const UnicodeString& text,
int32_t start,
UCalendarDateFields field,
@@ -1253,6 +1377,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
if (patternCharIndex == UDAT_HOUR_OF_DAY1_FIELD ||
patternCharIndex == UDAT_HOUR1_FIELD ||
(patternCharIndex == UDAT_MONTH_FIELD && count <= 2) ||
+ (patternCharIndex == UDAT_STANDALONE_MONTH_FIELD && count <= 2) ||
+ (patternCharIndex == UDAT_QUARTER_FIELD && count <= 2) ||
+ (patternCharIndex == UDAT_STANDALONE_QUARTER_FIELD && count <= 2) ||
patternCharIndex == UDAT_YEAR_FIELD ||
patternCharIndex == UDAT_YEAR_WOY_FIELD ||
patternCharIndex == UDAT_FRACTIONAL_SECOND_FIELD)
@@ -1261,16 +1388,20 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// It would be good to unify this with the obeyCount logic below,
// but that's going to be difficult.
const UnicodeString* src;
+
if (obeyCount) {
if ((start+count) > text.length()) {
return -start;
}
+
text.extractBetween(0, start + count, temp);
src = &temp;
} else {
src = &text;
}
+
parseInt(*src, number, pos, allowNegative);
+
if (pos.getIndex() == parseStart)
return -start;
value = number.getLong();
@@ -1278,7 +1409,12 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
switch (patternCharIndex) {
case UDAT_ERA_FIELD:
+ if (count == 4) {
+ return matchString(text, start, UCAL_ERA, fSymbols->fEraNames, fSymbols->fEraNamesCount, cal);
+ }
+
return matchString(text, start, UCAL_ERA, fSymbols->fEras, fSymbols->fErasCount, cal);
+
case UDAT_YEAR_FIELD:
// If there are 3 or more YEAR pattern characters, this indicates
// that the year value is to be treated literally, without any
@@ -1307,6 +1443,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
cal.set(UCAL_YEAR, value);
return pos.getIndex();
+
case UDAT_YEAR_WOY_FIELD:
// Comment is the same as for UDAT_Year_FIELDs - look above
if (count <= 2 && (pos.getIndex() - start) == 2
@@ -1321,6 +1458,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
cal.set(UCAL_YEAR_WOY, value);
return pos.getIndex();
+
case UDAT_MONTH_FIELD:
if (count <= 2) // i.e., M or MM.
{
@@ -1329,13 +1467,12 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// [We computed 'value' above.]
cal.set(UCAL_MONTH, value - 1);
return pos.getIndex();
- }
- else
- {
+ } else {
// count >= 3 // i.e., MMM or MMMM
// Want to be able to parse both short and long forms.
// Try count == 4 first:
int32_t newStart = 0;
+
if ((newStart = matchString(text, start, UCAL_MONTH,
fSymbols->fMonths, fSymbols->fMonthsCount, cal)) > 0)
return newStart;
@@ -1343,12 +1480,36 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
return matchString(text, start, UCAL_MONTH,
fSymbols->fShortMonths, fSymbols->fShortMonthsCount, cal);
}
+
+ case UDAT_STANDALONE_MONTH_FIELD:
+ if (count <= 2) // i.e., L or LL.
+ {
+ // Don't want to parse the month if it is a string
+ // while pattern uses numeric style: M or MM.
+ // [We computed 'value' above.]
+ cal.set(UCAL_MONTH, value - 1);
+ return pos.getIndex();
+ } else {
+ // count >= 3 // i.e., LLL or LLLL
+ // Want to be able to parse both short and long forms.
+ // Try count == 4 first:
+ int32_t newStart = 0;
+
+ if ((newStart = matchString(text, start, UCAL_MONTH,
+ fSymbols->fStandaloneMonths, fSymbols->fStandaloneMonthsCount, cal)) > 0)
+ return newStart;
+ else // count == 4 failed, now try count == 3
+ return matchString(text, start, UCAL_MONTH,
+ fSymbols->fStandaloneShortMonths, fSymbols->fStandaloneShortMonthsCount, cal);
+ }
+
case UDAT_HOUR_OF_DAY1_FIELD:
// [We computed 'value' above.]
if (value == cal.getMaximum(UCAL_HOUR_OF_DAY) + 1)
value = 0;
cal.set(UCAL_HOUR_OF_DAY, value);
return pos.getIndex();
+
case UDAT_FRACTIONAL_SECOND_FIELD:
// Fractional seconds left-justify
i = pos.getIndex() - start;
@@ -1367,6 +1528,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
cal.set(UCAL_MILLISECOND, value);
return pos.getIndex();
+
case UDAT_DAY_OF_WEEK_FIELD:
{
// Want to be able to parse both short and long forms.
@@ -1379,17 +1541,77 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
return matchString(text, start, UCAL_DAY_OF_WEEK,
fSymbols->fShortWeekdays, fSymbols->fShortWeekdaysCount, cal);
}
+
+ case UDAT_STANDALONE_DAY_FIELD:
+ {
+ // Want to be able to parse both short and long forms.
+ // Try count == 4 (DDDD) first:
+ int32_t newStart = 0;
+ if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
+ fSymbols->fStandaloneWeekdays, fSymbols->fStandaloneWeekdaysCount, cal)) > 0)
+ return newStart;
+ else // DDDD failed, now try DDD
+ return matchString(text, start, UCAL_DAY_OF_WEEK,
+ fSymbols->fStandaloneShortWeekdays, fSymbols->fStandaloneShortWeekdaysCount, cal);
+ }
+
case UDAT_AM_PM_FIELD:
return matchString(text, start, UCAL_AM_PM, fSymbols->fAmPms, fSymbols->fAmPmsCount, cal);
+
case UDAT_HOUR1_FIELD:
// [We computed 'value' above.]
if (value == cal.getLeastMaximum(UCAL_HOUR)+1)
value = 0;
cal.set(UCAL_HOUR, value);
return pos.getIndex();
+
+ case UDAT_QUARTER_FIELD:
+ if (count <= 2) // i.e., Q or QQ.
+ {
+ // Don't want to parse the month if it is a string
+ // while pattern uses numeric style: Q or QQ.
+ // [We computed 'value' above.]
+ cal.set(UCAL_MONTH, (value - 1) * 3);
+ return pos.getIndex();
+ } else {
+ // count >= 3 // i.e., QQQ or QQQQ
+ // Want to be able to parse both short and long forms.
+ // Try count == 4 first:
+ int32_t newStart = 0;
+
+ if ((newStart = matchQuarterString(text, start, UCAL_MONTH,
+ fSymbols->fQuarters, fSymbols->fQuartersCount, cal)) > 0)
+ return newStart;
+ else // count == 4 failed, now try count == 3
+ return matchQuarterString(text, start, UCAL_MONTH,
+ fSymbols->fShortQuarters, fSymbols->fShortQuartersCount, cal);
+ }
+
+ case UDAT_STANDALONE_QUARTER_FIELD:
+ if (count <= 2) // i.e., q or qq.
+ {
+ // Don't want to parse the month if it is a string
+ // while pattern uses numeric style: q or q.
+ // [We computed 'value' above.]
+ cal.set(UCAL_MONTH, (value - 1) * 3);
+ return pos.getIndex();
+ } else {
+ // count >= 3 // i.e., qqq or qqqq
+ // Want to be able to parse both short and long forms.
+ // Try count == 4 first:
+ int32_t newStart = 0;
+
+ if ((newStart = matchQuarterString(text, start, UCAL_MONTH,
+ fSymbols->fStandaloneQuarters, fSymbols->fStandaloneQuartersCount, cal)) > 0)
+ return newStart;
+ else // count == 4 failed, now try count == 3
+ return matchQuarterString(text, start, UCAL_MONTH,
+ fSymbols->fStandaloneShortQuarters, fSymbols->fStandaloneShortQuartersCount, cal);
+ }
+
case UDAT_TIMEZONE_FIELD:
case UDAT_TIMEZONE_RFC_FIELD:
- case UDAT_TIMEZONE_GENERIC_FIELD:
+ case UDAT_TIMEZONE_GENERIC_FIELD:
{
// First try to parse generic forms such as GMT-07:00. Do this first
// in case localized DateFormatZoneData contains the string "GMT"
@@ -1457,7 +1679,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// the locale data from the DateFormatZoneData strings.
// Want to be able to parse both short and long forms.
// !!! side effect, might set parsedZoneString
- int32_t result = subParseZoneString(text, start, cal);
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t result = subParseZoneString(text, start, cal, status);
if (result != 0) {
return result;
}
@@ -1465,8 +1688,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// As a last resort, look for numeric timezones of the form
// [+-]hhmm as specified by RFC 822. This code is actually
// a little more permissive than RFC 822. It will try to do
- // its best with numbers that aren't strictly 4 digits long.
- UErrorCode status = U_ZERO_ERROR;
+ // its best with numbers that aren't strictly 4 digits long
DecimalFormat fmt(UNICODE_STRING_SIMPLE("+####;-####"), status);
if(U_FAILURE(status))
return -start;
@@ -1510,6 +1732,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// All efforts to parse a zone failed.
return -start;
}
+
default:
// Handle "generic" fields
int32_t parseStart = pos.getIndex();
@@ -1532,105 +1755,57 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
}
-int32_t
-SimpleDateFormat::getTimeZoneIndex(const UnicodeString& id) const
-{
- int32_t i = fSymbols->fZoneStringsRowCount;
- while (--i >= 0 && fSymbols->fZoneStrings[i][0] != id);
- return i;
-}
-
int32_t
-SimpleDateFormat::matchZoneString(const UnicodeString& text, int32_t start, int32_t zi) const
-{
- // ### TODO markus 20021014: This use of caseCompare() will fail
- // if the text contains a character that case-folds into multiple
- // characters. In that case, zs->length() may be too long, and it does not match.
- // We need a case-insensitive version of startsWith().
- // There are similar cases of such caseCompare() uses elsewhere in ICU.
-
- int32_t i = fSymbols->fZoneStringsColCount;
- const int32_t zscc = i;
-
- while (--i >= 1) {
- if (i == 5 && (zscc == 6 || zscc >= 8)) { // skip city name if we have it
- continue;
- }
-
- // Checking long and short zones [1 & 2],
- // and long and short daylight [3 & 4],
- // and long and short generic [6 & 7]
- const UnicodeString& zs = fSymbols->fZoneStrings[zi][i];
- if (zs.length() > 0 && 0 == text.caseCompare(start, zs.length(), zs, 0)) {
- break;
- }
- }
- return i;
-}
-
-/**
- * find time zone 'text' matched zoneStrings and set cal.
- * includes optimizations for calendar and default time zones
- */
-int32_t
-SimpleDateFormat::subParseZoneString(const UnicodeString& text, int32_t start, Calendar& cal) const
+SimpleDateFormat::subParseZoneString(const UnicodeString& text, int32_t start, Calendar& cal, UErrorCode& status) const
{
// At this point, check for named time zones by looking through
// the locale data from the DateFormatZoneData strings.
// Want to be able to parse both short and long forms.
- TimeZone *tz = NULL;
- UnicodeString id;
- int32_t zoneIndex = -1;
- int32_t zi;
-
// optimize for calendar's current time zone
- zi = getTimeZoneIndex(getTimeZone().getID(id));
- if (zi != -1) {
- int32_t j = matchZoneString(text, start, zi);
- if (j > 0) {
+ TimeZone *tz = NULL;
+ UnicodeString id;
+ UnicodeString zid, value;
+ DateFormatSymbols::TimeZoneTranslationType type;
+ fSymbols->getZoneID(getTimeZone().getID(id), zid, status);
+ if(zid.length() > 0){
+ fSymbols->getZoneType(zid, text, start, type, value, status);
tz = getTimeZone().clone();
- zoneIndex = j;
- }
}
-
+
// optimize for default time zone, assume different from caller
if (tz == NULL) {
- TimeZone* defaultZone = TimeZone::createDefault();
- zi = getTimeZoneIndex(defaultZone->getID(id));
- if (zi != -1) {
- int32_t j = matchZoneString(text, start, zi);
- if (j > 0) {
- zoneIndex = j;
- tz = defaultZone;
- }
- }
- if (tz == NULL) {
- delete defaultZone;
- }
+ TimeZone* defaultZone = TimeZone::createDefault();
+ fSymbols->getZoneID(defaultZone->getID(id), zid, status);
+ if(zid.length() > 0){
+ fSymbols->getZoneType(zid, text, start, type, value, status);
+ tz = defaultZone;
+ }
+ if (tz == NULL) {
+ delete defaultZone;
+ }
}
// still no luck, check all time zone strings
- if (tz == NULL) {
- for (zi = 0; zi < fSymbols->fZoneStringsRowCount; zi++) {
- int32_t j = matchZoneString(text, start, zi);
- if (j > 0) {
- tz = TimeZone::createTimeZone(fSymbols->fZoneStrings[zi][0]);
- zoneIndex = j;
- break;
+ if(tz == NULL){
+ fSymbols->findZoneIDTypeValue(zid, text, start, type, value, status);
+ if(zid.length() > 0){
+ tz = TimeZone::createTimeZone(zid);
}
- }
}
+ if(U_FAILURE(status)){
+ return 0;
+ }
if (tz != NULL) { // Matched any ?
// always set zone offset, needed to get correct hour in wall time
// when checking daylight savings
cal.set(UCAL_ZONE_OFFSET, tz->getRawOffset());
- if (zoneIndex < 3) {
+ if (type==DateFormatSymbols::TIMEZONE_SHORT_STANDARD || type==DateFormatSymbols::TIMEZONE_LONG_STANDARD ) {
// standard time
cal.set(UCAL_DST_OFFSET, 0);
delete tz; tz = NULL;
- } else if (zoneIndex < 5) {
+ } else if (type==DateFormatSymbols::TIMEZONE_SHORT_DAYLIGHT || type==DateFormatSymbols::TIMEZONE_LONG_DAYLIGHT ) {
// daylight time
// !!! todo - no getDSTSavings() in ICU's timezone
// use the correct DST SAVINGS for the zone.
@@ -1646,9 +1821,10 @@ SimpleDateFormat::subParseZoneString(const UnicodeString& text, int32_t start, C
((SimpleDateFormat*)this)->parsedTimeZone = tz;
}
- return start + fSymbols->fZoneStrings[zi][zoneIndex].length();
+ return start + value.length();
}
+
// complete failure
return 0;
}
diff --git a/Build/source/libs/icu-xetex/i18n/sortkey.cpp b/Build/source/libs/icu-xetex/i18n/sortkey.cpp
index 625468418e3..f6c3cf5f330 100644
--- a/Build/source/libs/icu-xetex/i18n/sortkey.cpp
+++ b/Build/source/libs/icu-xetex/i18n/sortkey.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2003, International Business Machines Corporation and *
+* Copyright (C) 1996-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -392,4 +392,12 @@ CollationKey::hashCode() const
U_NAMESPACE_END
+U_CAPI int32_t U_EXPORT2
+ucol_keyHashCode(const uint8_t *key,
+ int32_t length)
+{
+ CollationKey newKey(key, length);
+ return newKey.hashCode();
+}
+
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/stsearch.cpp b/Build/source/libs/icu-xetex/i18n/stsearch.cpp
index 0b2b08c9d26..7815f08131d 100644
--- a/Build/source/libs/icu-xetex/i18n/stsearch.cpp
+++ b/Build/source/libs/icu-xetex/i18n/stsearch.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2003 IBM and others. All rights reserved.
+* Copyright (C) 2001-2006 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 03/22/2000 helena Creation.
@@ -21,12 +21,12 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringSearch)
// public constructors and destructors -----------------------------------
-StringSearch::StringSearch(const UnicodeString &pattern,
+StringSearch::StringSearch(const UnicodeString &pattern,
const UnicodeString &text,
- const Locale &locale,
+ const Locale &locale,
BreakIterator *breakiter,
UErrorCode &status) :
- SearchIterator(text, breakiter),
+ SearchIterator(text, breakiter),
m_collator_(),
m_pattern_(pattern)
{
@@ -35,9 +35,9 @@ StringSearch::StringSearch(const UnicodeString &pattern,
return;
}
- m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
- m_text_.getBuffer(), m_text_.length(),
- locale.getName(), (UBreakIterator *)breakiter,
+ m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
+ m_text_.getBuffer(), m_text_.length(),
+ locale.getName(), (UBreakIterator *)breakiter,
&status);
uprv_free(m_search_);
m_search_ = NULL;
@@ -46,29 +46,26 @@ StringSearch::StringSearch(const UnicodeString &pattern,
// wrapper around the internal collator and rules, which (here) are
// owned by this stringsearch object. this means 1) it's destructor
// _should not_ delete the ucollator or rules, and 2) changes made
- // to the exposed collator (setStrength etc) _should_ modify the
+ // to the exposed collator (setStrength etc) _should_ modify the
// ucollator. thus the collator is not a copy-on-write alias, and it
// needs to distinguish itself not merely from 'stand alone' colators
// but also from copy-on-write ones. it needs additional state, which
// setUCollator should set.
if (U_SUCCESS(status)) {
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
// m_search_ has been created by the base SearchIterator class
m_search_ = m_strsrch_->search;
}
}
-StringSearch::StringSearch(const UnicodeString &pattern,
+StringSearch::StringSearch(const UnicodeString &pattern,
const UnicodeString &text,
- RuleBasedCollator *coll,
+ RuleBasedCollator *coll,
BreakIterator *breakiter,
UErrorCode &status) :
- SearchIterator(text, breakiter),
+ SearchIterator(text, breakiter),
m_collator_(),
m_pattern_(pattern)
{
@@ -81,32 +78,29 @@ StringSearch::StringSearch(const UnicodeString &pattern,
m_strsrch_ = NULL;
return;
}
- m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
- m_pattern_.length(),
- m_text_.getBuffer(),
- m_text_.length(), coll->ucollator,
- (UBreakIterator *)breakiter,
+ m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
+ m_pattern_.length(),
+ m_text_.getBuffer(),
+ m_text_.length(), coll->ucollator,
+ (UBreakIterator *)breakiter,
&status);
uprv_free(m_search_);
m_search_ = NULL;
if (U_SUCCESS(status)) {
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
// m_search_ has been created by the base SearchIterator class
m_search_ = m_strsrch_->search;
}
}
-StringSearch::StringSearch(const UnicodeString &pattern,
+StringSearch::StringSearch(const UnicodeString &pattern,
CharacterIterator &text,
- const Locale &locale,
+ const Locale &locale,
BreakIterator *breakiter,
UErrorCode &status) :
- SearchIterator(text, breakiter),
+ SearchIterator(text, breakiter),
m_collator_(),
m_pattern_(pattern)
{
@@ -114,19 +108,16 @@ StringSearch::StringSearch(const UnicodeString &pattern,
m_strsrch_ = NULL;
return;
}
- m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
- m_text_.getBuffer(), m_text_.length(),
- locale.getName(), (UBreakIterator *)breakiter,
+ m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
+ m_text_.getBuffer(), m_text_.length(),
+ locale.getName(), (UBreakIterator *)breakiter,
&status);
uprv_free(m_search_);
m_search_ = NULL;
if (U_SUCCESS(status)) {
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
// m_search_ has been created by the base SearchIterator class
m_search_ = m_strsrch_->search;
}
@@ -134,10 +125,10 @@ StringSearch::StringSearch(const UnicodeString &pattern,
StringSearch::StringSearch(const UnicodeString &pattern,
CharacterIterator &text,
- RuleBasedCollator *coll,
+ RuleBasedCollator *coll,
BreakIterator *breakiter,
UErrorCode &status) :
- SearchIterator(text, breakiter),
+ SearchIterator(text, breakiter),
m_collator_(),
m_pattern_(pattern)
{
@@ -150,21 +141,18 @@ StringSearch::StringSearch(const UnicodeString &pattern,
m_strsrch_ = NULL;
return;
}
- m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
- m_pattern_.length(),
- m_text_.getBuffer(),
- m_text_.length(), coll->ucollator,
- (UBreakIterator *)breakiter,
+ m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
+ m_pattern_.length(),
+ m_text_.getBuffer(),
+ m_text_.length(), coll->ucollator,
+ (UBreakIterator *)breakiter,
&status);
uprv_free(m_search_);
m_search_ = NULL;
if (U_SUCCESS(status)) {
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
// m_search_ has been created by the base SearchIterator class
m_search_ = m_strsrch_->search;
}
@@ -176,31 +164,30 @@ StringSearch::StringSearch(const StringSearch &that) :
m_pattern_(that.m_pattern_)
{
UErrorCode status = U_ZERO_ERROR;
+
+ // Free m_search_ from the superclass
+ uprv_free(m_search_);
+ m_search_ = NULL;
+
if (that.m_strsrch_ == NULL) {
+ // This was not a good copy
m_strsrch_ = NULL;
- status = U_ILLEGAL_ARGUMENT_ERROR;
}
else {
- m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
- m_pattern_.length(),
- m_text_.getBuffer(),
- m_text_.length(),
- that.m_strsrch_->collator,
- (UBreakIterator *)that.m_breakiterator_,
+ // Make a deep copy
+ m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
+ m_pattern_.length(),
+ m_text_.getBuffer(),
+ m_text_.length(),
+ that.m_strsrch_->collator,
+ (UBreakIterator *)that.m_breakiterator_,
&status);
- }
- uprv_free(m_search_);
- m_search_ = NULL;
-
- if (U_SUCCESS(status)) {
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
- // m_search_ has been created by the base SearchIterator class
- m_search_ = m_strsrch_->search;
- m_breakiterator_ = that.m_breakiterator_;
+ if (U_SUCCESS(status)) {
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
+ // m_search_ has been created by the base SearchIterator class
+ m_search_ = m_strsrch_->search;
+ }
}
}
@@ -227,17 +214,14 @@ StringSearch & StringSearch::operator=(const StringSearch &that)
m_pattern_ = that.m_pattern_;
// all m_search_ in the parent class is linked up with m_strsrch_
usearch_close(m_strsrch_);
- m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
- m_pattern_.length(),
- m_text_.getBuffer(),
- m_text_.length(),
- that.m_strsrch_->collator,
+ m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
+ m_pattern_.length(),
+ m_text_.getBuffer(),
+ m_text_.length(),
+ that.m_strsrch_->collator,
NULL, &status);
- int32_t length;
- const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
- m_collation_rules_.setTo(rules, length);
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
m_search_ = m_strsrch_->search;
}
return *this;
@@ -276,7 +260,7 @@ void StringSearch::setText(const UnicodeString &text, UErrorCode &status)
usearch_setText(m_strsrch_, text.getBuffer(), text.length(), &status);
}
}
-
+
void StringSearch::setText(CharacterIterator &text, UErrorCode &status)
{
if (U_SUCCESS(status)) {
@@ -289,18 +273,17 @@ RuleBasedCollator * StringSearch::getCollator() const
{
return (RuleBasedCollator *)&m_collator_;
}
-
+
void StringSearch::setCollator(RuleBasedCollator *coll, UErrorCode &status)
{
if (U_SUCCESS(status)) {
usearch_setCollator(m_strsrch_, coll->getUCollator(), &status);
- m_collation_rules_.setTo(coll->getRules());
- m_collator_.setUCollator((UCollator *)m_strsrch_->collator,
- &m_collation_rules_);
+ // Alias the collator
+ m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
}
}
-
-void StringSearch::setPattern(const UnicodeString &pattern,
+
+void StringSearch::setPattern(const UnicodeString &pattern,
UErrorCode &status)
{
if (U_SUCCESS(status)) {
@@ -309,7 +292,7 @@ void StringSearch::setPattern(const UnicodeString &pattern,
&status);
}
}
-
+
const UnicodeString & StringSearch::getPattern() const
{
return m_pattern_;
@@ -325,8 +308,8 @@ void StringSearch::reset()
SearchIterator * StringSearch::safeClone(void) const
{
UErrorCode status = U_ZERO_ERROR;
- StringSearch *result = new StringSearch(m_pattern_, m_text_,
- (RuleBasedCollator *)&m_collator_,
+ StringSearch *result = new StringSearch(m_pattern_, m_text_,
+ (RuleBasedCollator *)&m_collator_,
m_breakiterator_,
status);
/* test for NULL */
@@ -342,7 +325,7 @@ SearchIterator * StringSearch::safeClone(void) const
}
return result;
}
-
+
// protected method -------------------------------------------------
int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
@@ -350,27 +333,27 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
// values passed here are already in the pre-shift position
if (U_SUCCESS(status)) {
if (m_strsrch_->pattern.CELength == 0) {
- m_search_->matchedIndex =
- m_search_->matchedIndex == USEARCH_DONE ?
+ m_search_->matchedIndex =
+ m_search_->matchedIndex == USEARCH_DONE ?
getOffset() : m_search_->matchedIndex + 1;
m_search_->matchedLength = 0;
- ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
+ ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
&status);
if (m_search_->matchedIndex == m_search_->textLength) {
m_search_->matchedIndex = USEARCH_DONE;
}
}
else {
- // looking at usearch.cpp, this part is shifted out to
+ // looking at usearch.cpp, this part is shifted out to
// StringSearch instead of SearchIterator because m_strsrch_ is
// not accessible in SearchIterator
- if (position + m_strsrch_->pattern.defaultShiftSize
+ if (position + m_strsrch_->pattern.defaultShiftSize
> m_search_->textLength) {
setMatchNotFound();
return USEARCH_DONE;
}
if (m_search_->matchedLength <= 0) {
- // the flipping direction issue has already been handled
+ // the flipping direction issue has already been handled
// in next()
// for boundary check purposes. this will ensure that the
// next match will not preceed the current offset
@@ -393,19 +376,19 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
}
if (m_breakiterator_ == NULL
#if !UCONFIG_NO_BREAK_ITERATION
- ||
+ ||
m_search_->matchedIndex == USEARCH_DONE ||
(m_breakiterator_->isBoundary(m_search_->matchedIndex) &&
- m_breakiterator_->isBoundary(m_search_->matchedIndex +
+ m_breakiterator_->isBoundary(m_search_->matchedIndex +
m_search_->matchedLength))
#endif
) {
if (m_search_->matchedIndex == USEARCH_DONE) {
- ucol_setOffset(m_strsrch_->textIter,
+ ucol_setOffset(m_strsrch_->textIter,
m_search_->textLength, &status);
}
else {
- ucol_setOffset(m_strsrch_->textIter,
+ ucol_setOffset(m_strsrch_->textIter,
m_search_->matchedIndex, &status);
}
return m_search_->matchedIndex;
@@ -421,24 +404,24 @@ int32_t StringSearch::handlePrev(int32_t position, UErrorCode &status)
// values passed here are already in the pre-shift position
if (U_SUCCESS(status)) {
if (m_strsrch_->pattern.CELength == 0) {
- m_search_->matchedIndex =
- (m_search_->matchedIndex == USEARCH_DONE ? getOffset() :
+ m_search_->matchedIndex =
+ (m_search_->matchedIndex == USEARCH_DONE ? getOffset() :
m_search_->matchedIndex);
if (m_search_->matchedIndex == 0) {
setMatchNotFound();
}
else {
m_search_->matchedIndex --;
- ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
+ ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
&status);
m_search_->matchedLength = 0;
}
}
else {
- // looking at usearch.cpp, this part is shifted out to
+ // looking at usearch.cpp, this part is shifted out to
// StringSearch instead of SearchIterator because m_strsrch_ is
// not accessible in SearchIterator
- if (!m_search_->isOverlap &&
+ if (!m_search_->isOverlap &&
position - m_strsrch_->pattern.defaultShiftSize < 0) {
setMatchNotFound();
return USEARCH_DONE;
@@ -456,10 +439,10 @@ int32_t StringSearch::handlePrev(int32_t position, UErrorCode &status)
}
if (m_breakiterator_ == NULL
#if !UCONFIG_NO_BREAK_ITERATION
- ||
+ ||
m_search_->matchedIndex == USEARCH_DONE ||
(m_breakiterator_->isBoundary(m_search_->matchedIndex) &&
- m_breakiterator_->isBoundary(m_search_->matchedIndex +
+ m_breakiterator_->isBoundary(m_search_->matchedIndex +
m_search_->matchedLength))
#endif
) {
@@ -467,7 +450,7 @@ int32_t StringSearch::handlePrev(int32_t position, UErrorCode &status)
}
}
}
-
+
return m_search_->matchedIndex;
}
return USEARCH_DONE;
diff --git a/Build/source/libs/icu-xetex/i18n/tblcoll.cpp b/Build/source/libs/icu-xetex/i18n/tblcoll.cpp
index 0884f27ad82..779cf4d1c97 100644
--- a/Build/source/libs/icu-xetex/i18n/tblcoll.cpp
+++ b/Build/source/libs/icu-xetex/i18n/tblcoll.cpp
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines Corporation and *
+* Copyright (C) 1996-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
@@ -80,9 +80,9 @@ RuleBasedCollator::RuleBasedCollator(const RuleBasedCollator& that)
: Collator(that)
, dataIsOwned(FALSE)
, isWriteThroughAlias(FALSE)
-, ucollator(that.ucollator)
-, urulestring(that.urulestring)
+, ucollator(NULL)
{
+ RuleBasedCollator::operator=(that);
}
RuleBasedCollator::RuleBasedCollator(const UnicodeString& rules,
@@ -128,33 +128,25 @@ RuleBasedCollator::RuleBasedCollator(const UnicodeString& rules,
}
RuleBasedCollator::RuleBasedCollator(const uint8_t *bin, int32_t length,
const RuleBasedCollator *base,
- UErrorCode &status) : dataIsOwned(TRUE)
+ UErrorCode &status) :
+dataIsOwned(TRUE),
+isWriteThroughAlias(FALSE)
{
ucollator = ucol_openBinary(bin, length, base->ucollator, &status);
- urulestring = NULL;
}
void
-RuleBasedCollator::setRuleStringFromCollator(UErrorCode& status)
+RuleBasedCollator::setRuleStringFromCollator()
{
- urulestring = NULL;
- if (U_SUCCESS(status))
- {
- int32_t length;
- const UChar *r = ucol_getRules(ucollator, &length);
+ int32_t length;
+ const UChar *r = ucol_getRules(ucollator, &length);
- if (length > 0) {
- // alias the rules string
- urulestring = new UnicodeString(TRUE, r, length);
- }
- else {
- urulestring = new UnicodeString();
- }
- /* test for NULL */
- if (urulestring == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (r && length > 0) {
+ // alias the rules string
+ urulestring.setTo(TRUE, r, length);
+ }
+ else {
+ urulestring.truncate(0); // Clear string.
}
}
@@ -165,7 +157,6 @@ RuleBasedCollator::construct(const UnicodeString& rules,
UColAttributeValue decompositionMode,
UErrorCode& status)
{
- urulestring = 0;
ucollator = ucol_openRules(rules.getBuffer(), rules.length(),
decompositionMode, collationStrength,
NULL, &status);
@@ -173,7 +164,14 @@ RuleBasedCollator::construct(const UnicodeString& rules,
dataIsOwned = TRUE; // since we own a collator now, we need to get rid of it
isWriteThroughAlias = FALSE;
- setRuleStringFromCollator(status);
+ if(ucollator == NULL) {
+ if(U_SUCCESS(status)) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return; // Failure
+ }
+
+ setRuleStringFromCollator();
}
/* RuleBasedCollator public destructor ----------------------------------- */
@@ -183,10 +181,8 @@ RuleBasedCollator::~RuleBasedCollator()
if (dataIsOwned)
{
ucol_close(ucollator);
- delete urulestring;
}
ucollator = 0;
- urulestring = 0;
}
/* RuleBaseCollator public methods --------------------------------------- */
@@ -228,14 +224,19 @@ RuleBasedCollator& RuleBasedCollator::operator=(const RuleBasedCollator& that)
if (dataIsOwned)
{
ucol_close(ucollator);
- ucollator = NULL;
- delete urulestring;
}
- dataIsOwned = FALSE;
+ urulestring.truncate(0); // empty the rule string
+ dataIsOwned = TRUE;
isWriteThroughAlias = FALSE;
- ucollator = that.ucollator;
- urulestring = that.urulestring;
+
+ UErrorCode intStatus = U_ZERO_ERROR;
+ int32_t buffersize = U_COL_SAFECLONE_BUFFERSIZE;
+ ucollator = ucol_safeClone(that.ucollator, NULL, &buffersize,
+ &intStatus);
+ if (U_SUCCESS(intStatus)) {
+ setRuleStringFromCollator();
+ }
}
return *this;
}
@@ -243,7 +244,7 @@ RuleBasedCollator& RuleBasedCollator::operator=(const RuleBasedCollator& that)
// aliasing, not write-through
Collator* RuleBasedCollator::clone() const
{
- return new RuleBasedCollator(*this);
+ return new RuleBasedCollator(*this);
}
CollationElementIterator* RuleBasedCollator::createCollationElementIterator
@@ -289,7 +290,7 @@ CollationElementIterator* RuleBasedCollator::createCollationElementIterator
*/
const UnicodeString& RuleBasedCollator::getRules() const
{
- return (*urulestring);
+ return urulestring;
}
void RuleBasedCollator::getRules(UColRuleOption delta, UnicodeString &buffer)
@@ -532,10 +533,11 @@ Collator* RuleBasedCollator::safeClone(void)
return NULL;
}
- UnicodeString *r = new UnicodeString(*urulestring);
- RuleBasedCollator *result = new RuleBasedCollator(ucol, r);
+ RuleBasedCollator *result = new RuleBasedCollator();
+ result->ucollator = ucol;
result->dataIsOwned = TRUE;
result->isWriteThroughAlias = FALSE;
+ setRuleStringFromCollator();
return result;
}
@@ -616,21 +618,13 @@ RuleBasedCollator::setLocales(const Locale& requestedLocale, const Locale& valid
// RuleBaseCollatorNew private constructor ----------------------------------
RuleBasedCollator::RuleBasedCollator()
- : dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(0), urulestring(0)
+ : dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(NULL)
{
}
-RuleBasedCollator::RuleBasedCollator(UCollator *collator,
- UnicodeString *rule)
- : dataIsOwned(FALSE), isWriteThroughAlias(FALSE), urulestring(0)
-{
- ucollator = collator;
- urulestring = rule;
-}
-
RuleBasedCollator::RuleBasedCollator(const Locale& desiredLocale,
- UErrorCode& status) :
- dataIsOwned(FALSE), ucollator(0), urulestring(0)
+ UErrorCode& status)
+ : dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(NULL)
{
if (U_FAILURE(status))
return;
@@ -672,22 +666,7 @@ RuleBasedCollator::RuleBasedCollator(const Locale& desiredLocale,
if (U_SUCCESS(status))
{
- int32_t length;
- const UChar *r = ucol_getRules(ucollator, &length);
- if (length > 0) {
- // alias the rules string
- urulestring = new UnicodeString(TRUE, r, length);
- }
- else {
- urulestring = new UnicodeString();
- }
- /* test for NULL */
- if (urulestring == 0) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- dataIsOwned = TRUE;
- isWriteThroughAlias = FALSE;
+ setRuleStringFromCollator();
}
}
@@ -710,7 +689,7 @@ RuleBasedCollator::checkOwned() {
if (!(dataIsOwned || isWriteThroughAlias)) {
UErrorCode status = U_ZERO_ERROR;
ucollator = ucol_safeClone(ucollator, NULL, NULL, &status);
- setRuleStringFromCollator(status);
+ setRuleStringFromCollator();
dataIsOwned = TRUE;
isWriteThroughAlias = FALSE;
}
diff --git a/Build/source/libs/icu-xetex/i18n/timezone.cpp b/Build/source/libs/icu-xetex/i18n/timezone.cpp
index 79ecf4feef8..98551f62de4 100644
--- a/Build/source/libs/icu-xetex/i18n/timezone.cpp
+++ b/Build/source/libs/icu-xetex/i18n/timezone.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and *
+* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -527,6 +527,16 @@ TimeZone::initDefault()
hostStrID.truncate(hostStrID.length()-1);
default_zone = createSystemTimeZone(hostStrID);
+ int32_t hostIDLen = hostStrID.length();
+ if (default_zone != NULL && rawOffset != default_zone->getRawOffset()
+ && (3 <= hostIDLen && hostIDLen <= 4))
+ {
+ // Uh oh. This probably wasn't a good id.
+ // It was probably an ambiguous abbreviation
+ delete default_zone;
+ default_zone = NULL;
+ }
+
#if 0
// NOTE: As of ICU 2.8, we no longer have an offsets table, since
// historical zones can change offset over time. If we add
@@ -1073,7 +1083,15 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, UnicodeString& resu
{
return getDisplayName(daylight,style, Locale::getDefault(), result);
}
-
+//--------------------------------------
+int32_t
+TimeZone::getDSTSavings()const {
+ if (useDaylightTime()) {
+ return 3600000;
+ }
+ return 0;
+}
+//---------------------------------------
UnicodeString&
TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const
{
@@ -1100,14 +1118,17 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
// and hence the same display name.
// We don't cache these because they're small and cheap to create.
UnicodeString tempID;
- SimpleTimeZone *tz = daylight ?
- // For the pure-DST zone, we use JANUARY and DECEMBER
-
- new SimpleTimeZone(getRawOffset(), getID(tempID),
- UCAL_JANUARY , 1, 0, 0,
- UCAL_DECEMBER , 31, 0, U_MILLIS_PER_DAY, status) :
- new SimpleTimeZone(getRawOffset(), getID(tempID));
-
+ SimpleTimeZone *tz = NULL;
+ if(daylight && useDaylightTime()){
+ // For the pure-DST zone, we use JANUARY and DECEMBER
+ int savings = getDSTSavings();
+ tz = new SimpleTimeZone(getRawOffset(), getID(tempID),
+ UCAL_JANUARY, 1, 0, 0,
+ UCAL_FEBRUARY, 1, 0, 0,
+ savings, status);
+ }else{
+ tz = new SimpleTimeZone(getRawOffset(), getID(tempID));
+ }
format.applyPattern(style == LONG ? ZZZZ_STR : Z_STR);
Calendar *myCalendar = (Calendar*)format.getCalendar();
myCalendar->setTimeZone(*tz); // copy
@@ -1115,7 +1136,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
delete tz;
FieldPosition pos(FieldPosition::DONT_CARE);
- return format.format(UDate(196262345678.), result, pos); // Must use a valid date here.
+ return format.format(UDate(864000000L), result, pos); // Must use a valid date here.
}
diff --git a/Build/source/libs/icu-xetex/i18n/titletrn.h b/Build/source/libs/icu-xetex/i18n/titletrn.h
index 8493e54d8db..ae08db88f63 100644
--- a/Build/source/libs/icu-xetex/i18n/titletrn.h
+++ b/Build/source/libs/icu-xetex/i18n/titletrn.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -59,15 +59,11 @@ class U_I18N_API TitlecaseTransliterator : public CaseMapTransliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/tolowtrn.h b/Build/source/libs/icu-xetex/i18n/tolowtrn.h
index 6fd3d51ad8c..77af67a6a27 100644
--- a/Build/source/libs/icu-xetex/i18n/tolowtrn.h
+++ b/Build/source/libs/icu-xetex/i18n/tolowtrn.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -57,15 +57,11 @@ class U_I18N_API LowercaseTransliterator : public CaseMapTransliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
};
diff --git a/Build/source/libs/icu-xetex/i18n/toupptrn.h b/Build/source/libs/icu-xetex/i18n/toupptrn.h
index 18a501c7480..e0f4ef5db19 100644
--- a/Build/source/libs/icu-xetex/i18n/toupptrn.h
+++ b/Build/source/libs/icu-xetex/i18n/toupptrn.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -57,15 +57,11 @@ class U_I18N_API UppercaseTransliterator : public CaseMapTransliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
};
diff --git a/Build/source/libs/icu-xetex/i18n/translit.cpp b/Build/source/libs/icu-xetex/i18n/translit.cpp
index 3469fe6feea..8a990f40bcd 100644
--- a/Build/source/libs/icu-xetex/i18n/translit.cpp
+++ b/Build/source/libs/icu-xetex/i18n/translit.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -107,7 +107,7 @@ UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(Transliterator)
* Return TRUE if the given UTransPosition is valid for text of
* the given length.
*/
-inline UBool positionIsValid(UTransPosition& index, int32_t len) {
+static inline UBool positionIsValid(UTransPosition& index, int32_t len) {
return !(index.contextStart < 0 ||
index.start < index.contextStart ||
index.limit < index.start ||
@@ -126,17 +126,20 @@ inline UBool positionIsValid(UTransPosition& index, int32_t len) {
Transliterator::Transliterator(const UnicodeString& theID,
UnicodeFilter* adoptedFilter) :
UObject(), ID(theID), filter(adoptedFilter),
- maximumContextLength(0) {
-
- // NUL-terminate the ID string
- ID.getTerminatedBuffer();
+ maximumContextLength(0)
+{
+ // NUL-terminate the ID string, which is a non-aliased copy.
+ ID.append((UChar)0);
+ ID.truncate(ID.length()-1);
}
/**
* Destructor.
*/
Transliterator::~Transliterator() {
- delete filter;
+ if (filter) {
+ delete filter;
+ }
}
/**
@@ -144,10 +147,11 @@ Transliterator::~Transliterator() {
*/
Transliterator::Transliterator(const Transliterator& other) :
UObject(other), ID(other.ID), filter(0),
- maximumContextLength(other.maximumContextLength) {
-
- // NUL-terminate the ID string
- ID.getTerminatedBuffer();
+ maximumContextLength(other.maximumContextLength)
+{
+ // NUL-terminate the ID string, which is a non-aliased copy.
+ ID.append((UChar)0);
+ ID.truncate(ID.length()-1);
if (other.filter != 0) {
// We own the filter, so we must have our own copy
@@ -155,6 +159,10 @@ Transliterator::Transliterator(const Transliterator& other) :
}
}
+Transliterator* Transliterator::clone() const {
+ return NULL;
+}
+
/**
* Assignment operator.
*/
@@ -990,7 +998,7 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
// Other aliases are handled with TransliteratorAlias::create().
if (alias->isRuleBased()) {
// Step 1. parse
- TransliteratorParser parser;
+ TransliteratorParser parser(ec);
alias->parse(parser, pe, ec);
delete alias;
alias = 0;
@@ -1041,7 +1049,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
{
Transliterator* t = NULL;
- TransliteratorParser parser;
+ TransliteratorParser parser(status);
parser.parse(rules, dir, parseError, status);
if (U_FAILURE(status)) {
@@ -1049,13 +1057,13 @@ Transliterator::createFromRules(const UnicodeString& ID,
}
// NOTE: The logic here matches that in TransliteratorRegistry.
- if (parser.idBlockVector->size() == 0 && parser.dataVector->size() == 0) {
+ if (parser.idBlockVector.size() == 0 && parser.dataVector.size() == 0) {
t = new NullTransliterator();
}
- else if (parser.idBlockVector->size() == 0 && parser.dataVector->size() == 1) {
- t = new RuleBasedTransliterator(ID, (TransliterationRuleData*)parser.dataVector->orphanElementAt(0), TRUE);
+ else if (parser.idBlockVector.size() == 0 && parser.dataVector.size() == 1) {
+ t = new RuleBasedTransliterator(ID, (TransliterationRuleData*)parser.dataVector.orphanElementAt(0), TRUE);
}
- else if (parser.idBlockVector->size() == 1 && parser.dataVector->size() == 0) {
+ else if (parser.idBlockVector.size() == 1 && parser.dataVector.size() == 0) {
// idBlock, no data -- this is an alias. The ID has
// been munged from reverse into forward mode, if
// necessary, so instantiate the ID in the forward
@@ -1064,10 +1072,10 @@ Transliterator::createFromRules(const UnicodeString& ID,
UnicodeString filterPattern;
parser.compoundFilter->toPattern(filterPattern, FALSE);
t = createInstance(filterPattern + UnicodeString(ID_DELIM)
- + *((UnicodeString*)parser.idBlockVector->elementAt(0)), UTRANS_FORWARD, parseError, status);
+ + *((UnicodeString*)parser.idBlockVector.elementAt(0)), UTRANS_FORWARD, parseError, status);
}
else
- t = createInstance(*((UnicodeString*)parser.idBlockVector->elementAt(0)), UTRANS_FORWARD, parseError, status);
+ t = createInstance(*((UnicodeString*)parser.idBlockVector.elementAt(0)), UTRANS_FORWARD, parseError, status);
if (t != NULL) {
@@ -1078,13 +1086,13 @@ Transliterator::createFromRules(const UnicodeString& ID,
UVector transliterators(status);
int32_t passNumber = 1;
- int32_t limit = parser.idBlockVector->size();
- if (parser.dataVector->size() > limit)
- limit = parser.dataVector->size();
+ int32_t limit = parser.idBlockVector.size();
+ if (parser.dataVector.size() > limit)
+ limit = parser.dataVector.size();
for (int32_t i = 0; i < limit; i++) {
- if (i < parser.idBlockVector->size()) {
- UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector->elementAt(i);
+ if (i < parser.idBlockVector.size()) {
+ UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector.elementAt(i);
if (!idBlock->isEmpty()) {
Transliterator* temp = createInstance(*idBlock, UTRANS_FORWARD, parseError, status);
if (temp != NULL && temp->getDynamicClassID() != NullTransliterator::getStaticClassID())
@@ -1093,8 +1101,8 @@ Transliterator::createFromRules(const UnicodeString& ID,
delete temp;
}
}
- if (!parser.dataVector->isEmpty()) {
- TransliterationRuleData* data = (TransliterationRuleData*)parser.dataVector->orphanElementAt(0);
+ if (!parser.dataVector.isEmpty()) {
+ TransliterationRuleData* data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
transliterators.addElement(
new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + (passNumber++),
data, TRUE), status);
@@ -1236,6 +1244,20 @@ void Transliterator::_registerInstance(Transliterator* adoptedPrototype) {
registry->put(adoptedPrototype, TRUE);
}
+void U_EXPORT2 Transliterator::registerAlias(const UnicodeString& aliasID,
+ const UnicodeString& realID) {
+ umtx_init(&registryMutex);
+ Mutex lock(&registryMutex);
+ if (HAVE_REGISTRY) {
+ _registerAlias(aliasID, realID);
+ }
+}
+
+void Transliterator::_registerAlias(const UnicodeString& aliasID,
+ const UnicodeString& realID) {
+ registry->put(aliasID, realID, FALSE, TRUE);
+}
+
/**
* Unregisters a transliterator or class. This may be either
* a system transliterator or a user transliterator or class.
@@ -1489,13 +1511,13 @@ UBool Transliterator::initializeRegistry() {
(ures_getUnicodeStringByKey(res, "direction", &status).charAt(0) ==
0x0046 /*F*/) ?
UTRANS_FORWARD : UTRANS_REVERSE;
- registry->put(id, UnicodeString(TRUE, resString, len), dir, visible);
+ registry->put(id, UnicodeString(TRUE, resString, len), dir, TRUE, visible);
}
break;
case 0x61: // 'a'
// 'alias'; row[2]=createInstance argument
resString = ures_getString(res, &len, &status);
- registry->put(id, UnicodeString(TRUE, resString, len), TRUE);
+ registry->put(id, UnicodeString(TRUE, resString, len), TRUE, TRUE);
break;
}
}
diff --git a/Build/source/libs/icu-xetex/i18n/transreg.cpp b/Build/source/libs/icu-xetex/i18n/transreg.cpp
index e340ca633c6..834e4ce8077 100644
--- a/Build/source/libs/icu-xetex/i18n/transreg.cpp
+++ b/Build/source/libs/icu-xetex/i18n/transreg.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2001-2005, International Business Machines
+* Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -40,8 +40,8 @@
// UChar constants
static const UChar LOCALE_SEP = 95; // '_'
-static const UChar ID_SEP = 0x002D; /*-*/
-static const UChar VARIANT_SEP = 0x002F; // '/'
+//static const UChar ID_SEP = 0x002D; /*-*/
+//static const UChar VARIANT_SEP = 0x002F; // '/'
// String constants
static const UChar NO_VARIANT[] = { 0 }; // empty string
@@ -50,7 +50,7 @@ static const UChar ANY[] = { 65, 110, 121, 0 }; // Any
/**
* Resource bundle key for the RuleBasedTransliterator rule.
*/
-static const char RB_RULE[] = "Rule";
+//static const char RB_RULE[] = "Rule";
U_NAMESPACE_BEGIN
@@ -105,6 +105,9 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
switch (type) {
case SIMPLE:
t = Transliterator::createInstance(aliasesOrRules, UTRANS_FORWARD, pe, ec);
+ if(U_FAILURE(ec)){
+ return 0;
+ }
if (compoundFilter != 0)
t->adoptFilter((UnicodeSet*)compoundFilter->clone());
break;
@@ -562,17 +565,17 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
entry->entryType == Entry::RULES_REVERSE ||
entry->entryType == Entry::LOCALE_RULES) {
- if (parser.idBlockVector->isEmpty() && parser.dataVector->isEmpty()) {
+ if (parser.idBlockVector.isEmpty() && parser.dataVector.isEmpty()) {
entry->u.data = 0;
entry->entryType = Entry::ALIAS;
entry->stringArg = UNICODE_STRING_SIMPLE("Any-NULL");
}
- else if (parser.idBlockVector->isEmpty() && parser.dataVector->size() == 1) {
- entry->u.data = (TransliterationRuleData*)parser.dataVector->orphanElementAt(0);
+ else if (parser.idBlockVector.isEmpty() && parser.dataVector.size() == 1) {
+ entry->u.data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
entry->entryType = Entry::RBT_DATA;
}
- else if (parser.idBlockVector->size() == 1 && parser.dataVector->isEmpty()) {
- entry->stringArg = *(UnicodeString*)(parser.idBlockVector->elementAt(0));
+ else if (parser.idBlockVector.size() == 1 && parser.dataVector.isEmpty()) {
+ entry->stringArg = *(UnicodeString*)(parser.idBlockVector.elementAt(0));
entry->compoundFilter = parser.orphanCompoundFilter();
entry->entryType = Entry::ALIAS;
}
@@ -582,18 +585,18 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
entry->u.dataVector = new UVector(status);
entry->stringArg.remove();
- int32_t limit = parser.idBlockVector->size();
- if (parser.dataVector->size() > limit)
- limit = parser.dataVector->size();
+ int32_t limit = parser.idBlockVector.size();
+ if (parser.dataVector.size() > limit)
+ limit = parser.dataVector.size();
for (int32_t i = 0; i < limit; i++) {
- if (i < parser.idBlockVector->size()) {
- UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector->elementAt(i);
+ if (i < parser.idBlockVector.size()) {
+ UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector.elementAt(i);
if (!idBlock->isEmpty())
entry->stringArg += *idBlock;
}
- if (!parser.dataVector->isEmpty()) {
- TransliterationRuleData* data = (TransliterationRuleData*)parser.dataVector->orphanElementAt(0);
+ if (!parser.dataVector.isEmpty()) {
+ TransliterationRuleData* data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
entry->u.dataVector->addElement(data, status);
entry->stringArg += (UChar)0xffff; // use U+FFFF to mark position of RBTs in ID block
}
@@ -625,20 +628,32 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
void TransliteratorRegistry::put(const UnicodeString& ID,
const UnicodeString& resourceName,
UTransDirection dir,
+ UBool readonlyResourceAlias,
UBool visible) {
Entry *entry = new Entry();
entry->entryType = (dir == UTRANS_FORWARD) ? Entry::RULES_FORWARD
: Entry::RULES_REVERSE;
- entry->stringArg = resourceName;
+ if (readonlyResourceAlias) {
+ entry->stringArg.setTo(TRUE, resourceName.getBuffer(), -1);
+ }
+ else {
+ entry->stringArg = resourceName;
+ }
registerEntry(ID, entry, visible);
}
void TransliteratorRegistry::put(const UnicodeString& ID,
const UnicodeString& alias,
+ UBool readonlyAliasAlias,
UBool visible) {
Entry *entry = new Entry();
entry->entryType = Entry::ALIAS;
- entry->stringArg = alias;
+ if (readonlyAliasAlias) {
+ entry->stringArg.setTo(TRUE, alias.getBuffer(), -1);
+ }
+ else {
+ entry->stringArg = alias;
+ }
registerEntry(ID, entry, visible);
}
@@ -1251,7 +1266,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
// and possibly also into an ::id header and/or footer. Then
// we modify the registry with the parsed data and retry.
{
- TransliteratorParser parser;
+ TransliteratorParser parser(status);
// We use the file name, taken from another resource bundle
// 2-d array at static init time, as a locale language. We're
diff --git a/Build/source/libs/icu-xetex/i18n/transreg.h b/Build/source/libs/icu-xetex/i18n/transreg.h
index bb88979959e..e74cfe43fed 100644
--- a/Build/source/libs/icu-xetex/i18n/transreg.h
+++ b/Build/source/libs/icu-xetex/i18n/transreg.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2001-2005, International Business Machines
+* Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -222,6 +222,7 @@ class TransliteratorRegistry : public UMemory {
void put(const UnicodeString& ID,
const UnicodeString& resourceName,
UTransDirection dir,
+ UBool readonlyResourceAlias,
UBool visible);
/**
@@ -231,6 +232,7 @@ class TransliteratorRegistry : public UMemory {
*/
void put(const UnicodeString& ID,
const UnicodeString& alias,
+ UBool readonlyAliasAlias,
UBool visible);
/**
diff --git a/Build/source/libs/icu-xetex/i18n/tridpars.cpp b/Build/source/libs/icu-xetex/i18n/tridpars.cpp
index 668005ca7e0..f0338de254f 100644
--- a/Build/source/libs/icu-xetex/i18n/tridpars.cpp
+++ b/Build/source/libs/icu-xetex/i18n/tridpars.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2002-2005, International Business Machines Corporation
+* Copyright (c) 2002-2006, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -33,7 +33,7 @@ static const UChar VARIANT_SEP = 0x002F; // /
static const UChar OPEN_REV = 0x0028; // (
static const UChar CLOSE_REV = 0x0029; // )
-static const UChar EMPTY[] = {0}; // ""
+//static const UChar EMPTY[] = {0}; // ""
static const UChar ANY[] = {65,110,121,0}; // "Any"
static const UChar ANY_NULL[] = {65,110,121,45,78,117,108,108,0}; // "Any-Null"
@@ -581,6 +581,10 @@ void TransliteratorIDParser::STVtoID(const UnicodeString& source,
if (variant.length() != 0) {
id.append(VARIANT_SEP).append(variant);
}
+ // NUL-terminate the ID string for getTerminatedBuffer.
+ // This prevents valgrind and Purify warnings.
+ id.append((UChar)0);
+ id.truncate(id.length()-1);
}
/**
@@ -878,7 +882,7 @@ void TransliteratorIDParser::init(UErrorCode &status) {
special_inverses = NULL;
}
umtx_unlock(&LOCK);
- delete special_inverses;
+ delete special_inverses; /*null instance*/
ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, transliterator_cleanup);
}
diff --git a/Build/source/libs/icu-xetex/i18n/ucal.cpp b/Build/source/libs/icu-xetex/i18n/ucal.cpp
index 5d8590f0fb3..636adf4cd74 100644
--- a/Build/source/libs/icu-xetex/i18n/ucal.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucal.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2004, International Business Machines
+* Copyright (C) 1996-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
@@ -13,6 +13,7 @@
#include "unicode/uloc.h"
#include "unicode/calendar.h"
#include "unicode/timezone.h"
+#include "unicode/gregocal.h"
#include "unicode/simpletz.h"
#include "unicode/ustring.h"
#include "unicode/strenum.h"
@@ -253,6 +254,32 @@ ucal_inDaylightTime( const UCalendar* cal,
return ((Calendar*)cal)->inDaylightTime(*status);
}
+U_DRAFT void U_EXPORT2
+ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ Calendar *cpp_cal = (Calendar *)cal;
+ if(cpp_cal->getDynamicClassID() != GregorianCalendar::getStaticClassID()) {
+ *pErrorCode = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ ((GregorianCalendar *)cpp_cal)->setGregorianChange(date, *pErrorCode);
+}
+
+U_DRAFT UDate U_EXPORT2
+ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return (UDate)0;
+ }
+ Calendar *cpp_cal = (Calendar *)cal;
+ if(cpp_cal->getDynamicClassID() != GregorianCalendar::getStaticClassID()) {
+ *pErrorCode = U_UNSUPPORTED_ERROR;
+ return (UDate)0;
+ }
+ return ((GregorianCalendar *)cpp_cal)->getGregorianChange();
+}
+
U_CAPI int32_t U_EXPORT2
ucal_getAttribute( const UCalendar* cal,
UCalendarAttribute attr)
diff --git a/Build/source/libs/icu-xetex/i18n/ucln_in.c b/Build/source/libs/icu-xetex/i18n/ucln_in.c
index 34653e079e6..afcf07112fb 100644
--- a/Build/source/libs/icu-xetex/i18n/ucln_in.c
+++ b/Build/source/libs/icu-xetex/i18n/ucln_in.c
@@ -1,7 +1,7 @@
/*
******************************************************************************
* *
-* Copyright (C) 2001-2004, International Business Machines *
+* Copyright (C) 2001-2006, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@@ -25,9 +25,9 @@ static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
static UBool i18n_cleanup(void)
{
- ECleanupI18NType libType;
+ ECleanupI18NType libType = UCLN_I18N_START;
- for (libType = UCLN_I18N_START+1; libType<UCLN_I18N_COUNT; libType++) {
+ while (++libType<UCLN_I18N_COUNT) {
if (gCleanupFunctions[libType])
{
gCleanupFunctions[libType]();
diff --git a/Build/source/libs/icu-xetex/i18n/ucln_in.h b/Build/source/libs/icu-xetex/i18n/ucln_in.h
index b04a25dccd8..6feae009edd 100644
--- a/Build/source/libs/icu-xetex/i18n/ucln_in.h
+++ b/Build/source/libs/icu-xetex/i18n/ucln_in.h
@@ -1,7 +1,7 @@
/*
******************************************************************************
* *
-* Copyright (C) 2001-2004, International Business Machines *
+* Copyright (C) 2001-2006, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@@ -38,6 +38,7 @@ typedef enum ECleanupI18NType {
UCLN_I18N_COLLATOR,
UCLN_I18N_UCOL,
UCLN_I18N_UCOL_BLD,
+ UCLN_I18N_CSDET,
UCLN_I18N_COUNT /* This must be last */
} ECleanupI18NType;
diff --git a/Build/source/libs/icu-xetex/i18n/ucol.cpp b/Build/source/libs/icu-xetex/i18n/ucol.cpp
index 98781fdbe98..5f756b04940 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines
+* Copyright (C) 1996-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol.cpp
@@ -145,7 +145,6 @@ inline void IInit_collIterate(const UCollator *collator, const UChar *sourceStr
}
(s)->iterator = NULL;
//(s)->iteratorIndex = 0;
- (s)->consumedChars = 0;
}
U_CAPI void U_EXPORT2
@@ -170,20 +169,20 @@ inline void backupState(const collIterate *data, collIterateState *backup)
backup->pos = data->pos;
backup->bufferaddress = data->writableBuffer;
backup->buffersize = data->writableBufSize;
+ backup->iteratorMove = 0;
+ backup->iteratorIndex = 0;
if(data->iterator != NULL) {
- //backup->iteratorIndex = data->iterator->getIndex(data->iterator, UITER_CURRENT);
- backup->iteratorIndex = data->iterator->getState(data->iterator);
- // no we try to fixup if we're using a normalizing iterator and we get UITER_NO_STATE
- backup->iteratorMove = 0;
- if(backup->iteratorIndex == UITER_NO_STATE) {
- while((backup->iteratorIndex = data->iterator->getState(data->iterator)) == UITER_NO_STATE) {
- backup->iteratorMove++;
- data->iterator->move(data->iterator, -1, UITER_CURRENT);
- }
- data->iterator->move(data->iterator, backup->iteratorMove, UITER_CURRENT);
- }
+ //backup->iteratorIndex = data->iterator->getIndex(data->iterator, UITER_CURRENT);
+ backup->iteratorIndex = data->iterator->getState(data->iterator);
+ // no we try to fixup if we're using a normalizing iterator and we get UITER_NO_STATE
+ if(backup->iteratorIndex == UITER_NO_STATE) {
+ while((backup->iteratorIndex = data->iterator->getState(data->iterator)) == UITER_NO_STATE) {
+ backup->iteratorMove++;
+ data->iterator->move(data->iterator, -1, UITER_CURRENT);
+ }
+ data->iterator->move(data->iterator, backup->iteratorMove, UITER_CURRENT);
+ }
}
- backup->consumedChars = data->consumedChars;
}
/**
@@ -197,15 +196,15 @@ static
inline void loadState(collIterate *data, const collIterateState *backup,
UBool forwards)
{
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
data->flags = backup->flags;
data->origFlags = backup->origFlags;
if(data->iterator != NULL) {
- //data->iterator->move(data->iterator, backup->iteratorIndex, UITER_ZERO);
- data->iterator->setState(data->iterator, backup->iteratorIndex, &status);
- if(backup->iteratorMove != 0) {
- data->iterator->move(data->iterator, backup->iteratorMove, UITER_CURRENT);
- }
+ //data->iterator->move(data->iterator, backup->iteratorIndex, UITER_ZERO);
+ data->iterator->setState(data->iterator, backup->iteratorIndex, &status);
+ if(backup->iteratorMove != 0) {
+ data->iterator->move(data->iterator, backup->iteratorMove, UITER_CURRENT);
+ }
}
data->pos = backup->pos;
if ((data->flags & UCOL_ITER_INNORMBUF) &&
@@ -241,7 +240,6 @@ inline void loadState(collIterate *data, const collIterateState *backup,
*/
data->fcdPosition = backup->fcdPosition;
}
- data->consumedChars = backup->consumedChars;
}
@@ -343,13 +341,14 @@ inline void freeHeapWritableBuffer(collIterate *data)
/* */
/****************************************************************************/
-U_CAPI UCollator* U_EXPORT2
-ucol_openBinary(const uint8_t *bin, int32_t length,
+static UCollator*
+ucol_initFromBinary(const uint8_t *bin, int32_t length,
const UCollator *base,
+ UCollator *fillIn,
UErrorCode *status)
{
- UCollator *result = NULL;
- if(U_FAILURE(*status)){
+ UCollator *result = fillIn;
+ if(U_FAILURE(*status)) {
return NULL;
}
/*
@@ -369,14 +368,16 @@ ucol_openBinary(const uint8_t *bin, int32_t length,
{
*status = U_COLLATOR_VERSION_MISMATCH;
return NULL;
- } else {
+ }
+ else {
if((uint32_t)length > (paddedsize(sizeof(UCATableHeader)) + paddedsize(sizeof(UColOptionSet)))) {
result = ucol_initCollator((const UCATableHeader *)bin, result, base, status);
if(U_FAILURE(*status)){
return NULL;
}
result->hasRealData = TRUE;
- } else {
+ }
+ else {
if(base) {
result = ucol_initCollator(base->image, result, base, status);
ucol_setOptionsFromHeader(result, (UColOptionSet *)(bin+((const UCATableHeader *)bin)->options), status);
@@ -384,7 +385,8 @@ ucol_openBinary(const uint8_t *bin, int32_t length,
return NULL;
}
result->hasRealData = FALSE;
- } else {
+ }
+ else {
*status = U_USELESS_COLLATOR_ERROR;
return NULL;
}
@@ -401,61 +403,155 @@ ucol_openBinary(const uint8_t *bin, int32_t length,
return result;
}
+U_CAPI UCollator* U_EXPORT2
+ucol_openBinary(const uint8_t *bin, int32_t length,
+ const UCollator *base,
+ UErrorCode *status)
+{
+ return ucol_initFromBinary(bin, length, base, NULL, status);
+}
+
+U_CAPI UCollator* U_EXPORT2
+ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t * pBufferSize, UErrorCode *status)
+{
+ UCollator * localCollator;
+ int32_t bufferSizeNeeded = (int32_t)sizeof(UCollator);
+ char *stackBufferChars = (char *)stackBuffer;
+ int32_t imageSize = 0;
+ int32_t rulesSize = 0;
+ int32_t rulesPadding = 0;
+ uint8_t *image;
+ UChar *rules;
+ UBool colAllocated = FALSE;
+ UBool imageAllocated = FALSE;
+
+ if (status == NULL || U_FAILURE(*status)){
+ return 0;
+ }
+ if ((stackBuffer && !pBufferSize) || !coll){
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ if (coll->rules && coll->freeRulesOnClose) {
+ rulesSize = (int32_t)(coll->rulesLength + 1)*sizeof(UChar);
+ rulesPadding = (int32_t)(bufferSizeNeeded % sizeof(UChar));
+ bufferSizeNeeded += rulesSize + rulesPadding;
+ }
+
+ if (stackBuffer && *pBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
+ *pBufferSize = bufferSizeNeeded;
+ return 0;
+ }
+
+ /* Pointers on 64-bit platforms need to be aligned
+ * on a 64-bit boundry in memory.
+ */
+ if (U_ALIGNMENT_OFFSET(stackBuffer) != 0) {
+ int32_t offsetUp = (int32_t)U_ALIGNMENT_OFFSET_UP(stackBufferChars);
+ if (*pBufferSize > offsetUp) {
+ *pBufferSize -= offsetUp;
+ stackBufferChars += offsetUp;
+ }
+ else {
+ /* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */
+ *pBufferSize = 1;
+ }
+ }
+ stackBuffer = (void *)stackBufferChars;
+
+ if (stackBuffer == NULL || *pBufferSize < bufferSizeNeeded) {
+ /* allocate one here...*/
+ stackBufferChars = (char *)uprv_malloc(bufferSizeNeeded);
+ colAllocated = TRUE;
+ if (U_SUCCESS(*status)) {
+ *status = U_SAFECLONE_ALLOCATED_WARNING;
+ }
+ }
+ localCollator = (UCollator *)stackBufferChars;
+ rules = (UChar *)(stackBufferChars + sizeof(UCollator) + rulesPadding);
+ {
+ UErrorCode tempStatus = U_ZERO_ERROR;
+ imageSize = ucol_cloneBinary(coll, NULL, 0, &tempStatus);
+ }
+ if (coll->freeImageOnClose) {
+ image = (uint8_t *)uprv_malloc(imageSize);
+ ucol_cloneBinary(coll, image, imageSize, status);
+ imageAllocated = TRUE;
+ }
+ else {
+ image = (uint8_t *)coll->image;
+ }
+ localCollator = ucol_initFromBinary(image, imageSize, coll->UCA, localCollator, status);
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (coll->rules) {
+ if (coll->freeRulesOnClose) {
+ localCollator->rules = u_strcpy(rules, coll->rules);
+ //bufferEnd += rulesSize;
+ }
+ else {
+ localCollator->rules = coll->rules;
+ }
+ localCollator->freeRulesOnClose = FALSE;
+ localCollator->rulesLength = coll->rulesLength;
+ }
+
+ int32_t i;
+ for(i = 0; i < UCOL_ATTRIBUTE_COUNT; i++) {
+ ucol_setAttribute(localCollator, (UColAttribute)i, ucol_getAttribute(coll, (UColAttribute)i, status), status);
+ }
+ localCollator->requestedLocale = NULL; // zero copies of pointers
+ localCollator->validLocale = NULL;
+ localCollator->rb = NULL;
+ localCollator->elements = NULL;
+ localCollator->freeOnClose = colAllocated;
+ localCollator->freeImageOnClose = imageAllocated;
+ return localCollator;
+}
+
U_CAPI void U_EXPORT2
ucol_close(UCollator *coll)
{
- UTRACE_ENTRY_OC(UTRACE_UCOL_CLOSE);
- UTRACE_DATA1(UTRACE_INFO, "coll = %p", coll);
- if(coll != NULL) {
- // these are always owned by each UCollator struct,
- // so we always free them
- if(coll->validLocale != NULL) {
- uprv_free(coll->validLocale);
- }
- if(coll->requestedLocale != NULL) {
- uprv_free(coll->requestedLocale);
- }
-
- /* Here, it would be advisable to close: */
- /* - UData for UCA (unless we stuff it in the root resb */
- /* Again, do we need additional housekeeping... HMMM! */
- UTRACE_DATA1(UTRACE_INFO, "coll->freeOnClose: %d", coll->freeOnClose);
- if(coll->freeOnClose){
- /* for safeClone, if freeOnClose is FALSE,
- don't free the other instance data */
- if(coll->freeOptionsOnClose != FALSE) {
- if(coll->options != NULL) {
- uprv_free(coll->options);
- }
- }
- if(coll->mapping != NULL) {
- /*ucmpe32_close(coll->mapping);*/
- uprv_free(coll->mapping);
- }
- if(coll->rules != NULL && coll->freeRulesOnClose) {
- uprv_free((UChar *)coll->rules);
- }
- if(coll->freeImageOnClose == TRUE) {
- uprv_free((UCATableHeader *)coll->image);
- }
- if(coll->resCleaner != NULL) {
+ UTRACE_ENTRY_OC(UTRACE_UCOL_CLOSE);
+ UTRACE_DATA1(UTRACE_INFO, "coll = %p", coll);
+ if(coll != NULL) {
+ // these are always owned by each UCollator struct,
+ // so we always free them
+ if(coll->validLocale != NULL) {
+ uprv_free(coll->validLocale);
+ }
+ if(coll->requestedLocale != NULL) {
+ uprv_free(coll->requestedLocale);
+ }
+ if(coll->resCleaner != NULL) {
coll->resCleaner(coll);
- }
-#if 0
- if(coll->rb != NULL) { /* pointing to read-only memory */
- ures_close(coll->rb);
- }
- if(coll->elements != NULL) {
- ures_close(coll->elements);
- }
-#endif
- if(coll->latinOneCEs != NULL) {
- uprv_free(coll->latinOneCEs);
- }
- uprv_free(coll);
- }
- }
- UTRACE_EXIT();
+ }
+ if(coll->latinOneCEs != NULL) {
+ uprv_free(coll->latinOneCEs);
+ }
+ if(coll->options != NULL && coll->freeOptionsOnClose) {
+ uprv_free(coll->options);
+ }
+ if(coll->rules != NULL && coll->freeRulesOnClose) {
+ uprv_free((UChar *)coll->rules);
+ }
+ if(coll->image != NULL && coll->freeImageOnClose) {
+ uprv_free((UCATableHeader *)coll->image);
+ }
+
+ /* Here, it would be advisable to close: */
+ /* - UData for UCA (unless we stuff it in the root resb */
+ /* Again, do we need additional housekeeping... HMMM! */
+ UTRACE_DATA1(UTRACE_INFO, "coll->freeOnClose: %d", coll->freeOnClose);
+ if(coll->freeOnClose){
+ /* for safeClone, if freeOnClose is FALSE,
+ don't free the other instance data */
+ uprv_free(coll);
+ }
+ }
+ UTRACE_EXIT();
}
/* This one is currently used by genrb & tests. After constructing from rules (tailoring),*/
@@ -592,7 +688,6 @@ inline uint8_t i_getCombiningClass(UChar32 c, const UCollator *coll) {
return sCC;
}
-
UCollator* ucol_initCollator(const UCATableHeader *image, UCollator *fillIn, const UCollator *UCA, UErrorCode *status) {
UChar c;
UCollator *result = fillIn;
@@ -612,32 +707,19 @@ UCollator* ucol_initCollator(const UCATableHeader *image, UCollator *fillIn, con
}
result->image = image;
+ result->mapping.getFoldingOffset = _getFoldingOffset;
const uint8_t *mapping = (uint8_t*)result->image+result->image->mappingPosition;
- /*CompactEIntArray *newUCAmapping = ucmpe32_openFromData(&mapping, status);*/
- UTrie *newUCAmapping = (UTrie *)uprv_malloc(sizeof(UTrie));
- if(newUCAmapping != NULL) {
- utrie_unserialize(newUCAmapping, mapping, result->image->endExpansionCE - result->image->mappingPosition, status);
- } else {
- *status = U_MEMORY_ALLOCATION_ERROR;
- if(result->freeOnClose == TRUE) {
- uprv_free(result);
- result = NULL;
- }
- return result;
- }
- if(U_SUCCESS(*status)) {
- result->mapping = newUCAmapping;
- } else {
+ utrie_unserialize(&result->mapping, mapping, result->image->endExpansionCE - result->image->mappingPosition, status);
+ if(U_FAILURE(*status)) {
if(result->freeOnClose == TRUE) {
uprv_free(result);
result = NULL;
}
- uprv_free(newUCAmapping);
return result;
}
/*result->latinOneMapping = (uint32_t*)((uint8_t*)result->image+result->image->latinOneMapping);*/
- result->latinOneMapping = UTRIE_GET32_LATIN1(result->mapping);
+ result->latinOneMapping = UTRIE_GET32_LATIN1(&result->mapping);
result->contractionCEs = (uint32_t*)((uint8_t*)result->image+result->image->contractionCEs);
result->contractionIndex = (UChar*)((uint8_t*)result->image+result->image->contractionIndex);
result->expansion = (uint32_t*)((uint8_t*)result->image+result->image->expansion);
@@ -666,14 +748,16 @@ UCollator* ucol_initCollator(const UCATableHeader *image, UCollator *fillIn, con
result->hiraganaQisDefault = TRUE;
result->numericCollationisDefault = TRUE;
- result->scriptOrder = NULL;
+ /*result->scriptOrder = NULL;*/
result->rules = NULL;
result->rulesLength = 0;
/* get the version info from UCATableHeader and populate the Collator struct*/
- result->dataInfo.dataVersion[0] = result->image->version[0]; /* UCA Builder version*/
- result->dataInfo.dataVersion[1] = result->image->version[1]; /* UCA Tailoring rules version*/
+ result->dataVersion[0] = result->image->version[0]; /* UCA Builder version*/
+ result->dataVersion[1] = result->image->version[1]; /* UCA Tailoring rules version*/
+ result->dataVersion[2] = 0;
+ result->dataVersion[3] = 0;
result->unsafeCP = (uint8_t *)result->image + result->image->unsafeCP;
result->minUnsafeCP = 0;
@@ -1124,7 +1208,7 @@ ucol_initUCA(UErrorCode *status) {
// Initalize variables for implicit generation
const UCAConstants *UCAconsts = (UCAConstants *)((uint8_t *)_staticUCA->image + _staticUCA->image->UCAConsts);
uprv_uca_initImplicitConstants(UCAconsts->UCA_PRIMARY_IMPLICIT_MIN, UCAconsts->UCA_PRIMARY_IMPLICIT_MAX, status);
- _staticUCA->mapping->getFoldingOffset = _getFoldingOffset;
+ //_staticUCA->mapping.getFoldingOffset = _getFoldingOffset;
}else{
udata_close(result);
uprv_free(newUCA);
@@ -1337,7 +1421,6 @@ inline uint32_t ucol_IGetNextCE(const UCollator *coll, collIterate *collationSou
}
UChar ch = 0;
- collationSource->consumedChars = 0;
for (;;) /* Loop handles case when incremental normalize switches */
{ /* to or from the side buffer / original string, and we */
@@ -1469,13 +1552,13 @@ inline uint32_t ucol_IGetNextCE(const UCollator *coll, collIterate *collationSou
}
else
{
- order = UTRIE_GET32_FROM_LEAD(coll->mapping, ch);
+ order = UTRIE_GET32_FROM_LEAD(&coll->mapping, ch);
if(order > UCOL_NOT_FOUND) { /* if a CE is special */
order = ucol_prv_getSpecialCE(coll, ch, order, collationSource, status); /* and try to get the special CE */
}
if(order == UCOL_NOT_FOUND && coll->UCA) { /* We couldn't find a good CE in the tailoring */
/* if we got here, the codepoint MUST be over 0xFF - so we look directly in the trie */
- order = UTRIE_GET32_FROM_LEAD(coll->UCA->mapping, ch);
+ order = UTRIE_GET32_FROM_LEAD(&coll->UCA->mapping, ch);
if(order > UCOL_NOT_FOUND) { /* UCA also gives us a special CE */
order = ucol_prv_getSpecialCE(coll->UCA, ch, order, collationSource, status);
@@ -1834,7 +1917,7 @@ inline uint32_t ucol_IGetPrevCE(const UCollator *coll, collIterate *data,
result = coll->latinOneMapping[ch];
}
else {
- result = UTRIE_GET32_FROM_LEAD(coll->mapping, ch);
+ result = UTRIE_GET32_FROM_LEAD(&coll->mapping, ch);
}
if (result > UCOL_NOT_FOUND) {
result = ucol_prv_getSpecialPrevCE(coll, ch, result, data, status);
@@ -1845,7 +1928,7 @@ inline uint32_t ucol_IGetPrevCE(const UCollator *coll, collIterate *data,
result = UCOL_CONTRACTION;
} else {
if(coll->UCA) {
- result = UTRIE_GET32_FROM_LEAD(coll->UCA->mapping, ch);
+ result = UTRIE_GET32_FROM_LEAD(&coll->UCA->mapping, ch);
}
}
@@ -2397,12 +2480,12 @@ inline UChar * insertBufferFront(collIterate *data, UChar *pNull, UChar ch)
* @param data collation iterator data
*/
static
-inline void normalizePrevContraction(collIterate *data)
+inline void normalizePrevContraction(collIterate *data, UErrorCode *status)
{
UChar *buffer = data->writableBuffer;
uint32_t buffersize = data->writableBufSize;
uint32_t nulltermsize;
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode localstatus = U_ZERO_ERROR;
UChar *pEnd = data->pos + 1; /* End normalize + 1 */
UChar *pStart;
uint32_t normLen;
@@ -2433,22 +2516,23 @@ inline void normalizePrevContraction(collIterate *data)
}
normLen = unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, buffer, 0,
- &status);
+ &localstatus);
if (nulltermsize <= normLen) {
uint32_t size = buffersize - nulltermsize + normLen + 1;
UChar *temp = (UChar *)uprv_malloc(size * sizeof(UChar));
- if(temp != NULL) {
- nulltermsize = normLen + 1;
- uprv_memcpy(temp + normLen, buffer,
- sizeof(UChar) * (buffersize - nulltermsize));
- freeHeapWritableBuffer(data);
- data->writableBuffer = temp;
- data->writableBufSize = size;
+ if (temp == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
+ nulltermsize = normLen + 1;
+ uprv_memcpy(temp + normLen, buffer,
+ sizeof(UChar) * (buffersize - nulltermsize));
+ freeHeapWritableBuffer(data);
+ data->writableBuffer = temp;
+ data->writableBufSize = size;
}
- status = U_ZERO_ERROR;
/*
this puts the null termination infront of the normalized string instead
of the end
@@ -2456,7 +2540,7 @@ inline void normalizePrevContraction(collIterate *data)
pStartNorm = buffer + (nulltermsize - normLen);
*(pStartNorm - 1) = 0;
unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, pStartNorm, normLen,
- &status);
+ status);
data->pos = data->writableBuffer + nulltermsize;
data->origFlags = data->flags;
@@ -2478,7 +2562,7 @@ inline void normalizePrevContraction(collIterate *data)
* @return previous character
*/
static
-inline UChar getPrevNormalizedChar(collIterate *data)
+inline UChar getPrevNormalizedChar(collIterate *data, UErrorCode *status)
{
UChar prevch;
UChar ch;
@@ -2540,7 +2624,7 @@ inline UChar getPrevNormalizedChar(collIterate *data)
UChar *backuppos = data->pos;
data->pos = start;
if (collPrevIterFCD(data)) {
- normalizePrevContraction(data);
+ normalizePrevContraction(data, status);
return *(data->pos - 1);
}
data->pos = backuppos;
@@ -2594,7 +2678,7 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
return 0;
} else {
/* TODO: CE contain the data from the previous CE + the mask. It should at least be unmasked */
- CE = UTRIE_GET32_FROM_OFFSET_TRAIL(coll->mapping, CE&0xFFFFFF, trail);
+ CE = UTRIE_GET32_FROM_OFFSET_TRAIL(&coll->mapping, CE&0xFFFFFF, trail);
if(CE == UCOL_NOT_FOUND) { // there are tailored surrogates in this block, but not this one.
// We need to backup
loadState(source, &state, TRUE);
@@ -2631,7 +2715,7 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
CE = *(coll->contractionCEs + (UCharOffset - coll->contractionIndex));
break;
}
- schar = getPrevNormalizedChar(source);
+ schar = getPrevNormalizedChar(source, status);
goBackOne(source);
while(schar > (tchar = *UCharOffset)) { /* since the contraction codepoints should be ordered, we skip all that are smaller */
@@ -2715,7 +2799,6 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
// Pick up the corresponding CE from the table.
CE = *(coll->contractionCEs +
(UCharOffset - coll->contractionIndex));
- source->consumedChars++;
}
else
{
@@ -2854,9 +2937,9 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
*/
uint32_t size;
uint32_t i; /* general counter */
- collIterateState digitState;
if (source->coll->numericCollation == UCOL_ON){
+ collIterateState digitState = {0,0,0,0,0,0,0,0};
UChar32 char32 = 0;
uint32_t digIndx = 0;
@@ -2909,22 +2992,23 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
*/
digIndx++;
for(;;){
- // Make sure we have enough space.
- if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
- {
- numTempBufSize *= 2;
- if (numTempBuf == stackNumTempBuf){
- numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
- uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
- }else
- uprv_realloc(numTempBuf, numTempBufSize);
- }
+ // Make sure we have enough space.
+ if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
+ {
+ numTempBufSize *= 2;
+ if (numTempBuf == stackNumTempBuf){
+ numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
+ uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
+ } else {
+ uprv_realloc(numTempBuf, numTempBufSize);
+ }
+ }
// Skipping over leading zeroes.
- if (digVal != 0 || nonZeroValReached){
- if (digVal != 0 && !nonZeroValReached)
- nonZeroValReached = TRUE;
-
+ if (digVal != 0) {
+ nonZeroValReached = TRUE;
+ }
+ if (nonZeroValReached) {
/*
We parse the digit string into base 100 numbers (this fits into a byte).
We only add to the buffer in twos, thus if we are parsing an odd character,
@@ -2991,7 +3075,7 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
loadState(source, &digitState, TRUE);
//goBackOne(source);
}
- goBackOne(source);
+ goBackOne(source);
break;
}
} else {
@@ -3112,18 +3196,12 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
// return the first CE, but first put the rest into the expansion buffer
if (!source->coll->image->jamoSpecial) { // FAST PATH
- /**(source->CEpos++) = ucmpe32_get(UCA->mapping, V);*/
- /**(source->CEpos++) = UTRIE_GET32_FROM_LEAD(UCA->mapping, V);*/
- *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(coll->mapping, V);
+ *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, V);
if (T != TBase) {
- /**(source->CEpos++) = ucmpe32_get(UCA->mapping, T);*/
- /**(source->CEpos++) = UTRIE_GET32_FROM_LEAD(UCA->mapping, T);*/
- *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(coll->mapping, T);
+ *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, T);
}
- /*return ucmpe32_get(UCA->mapping, L);*/ // return first one
- /*return UTRIE_GET32_FROM_LEAD(UCA->mapping, L);*/
- return UTRIE_GET32_FROM_LEAD(coll->mapping, L);
+ return UTRIE_GET32_FROM_LEAD(&coll->mapping, L);
} else { // Jamo is Special
// Since Hanguls pass the FCD check, it is
@@ -3240,7 +3318,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
CE = *(coll->contractionCEs + (UCharOffset - coll->contractionIndex));
break;
}
- schar = getPrevNormalizedChar(source);
+ schar = getPrevNormalizedChar(source, status);
goBackOne(source);
while(schar > (tchar = *UCharOffset)) { /* since the contraction codepoints should be ordered, we skip all that are smaller */
@@ -3259,7 +3337,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
// a prefix, we need to act as if it's not there
// assumption: 'real' noncharacters (*fffe, *ffff, fdd0-fdef are set to zero)
// lone surrogates cannot be set to zero as it would break other processing
- uint32_t isZeroCE = UTRIE_GET32_FROM_LEAD(coll->mapping, schar);
+ uint32_t isZeroCE = UTRIE_GET32_FROM_LEAD(&coll->mapping, schar);
// it's easy for BMP code points
if(isZeroCE == 0) {
continue;
@@ -3272,10 +3350,10 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
// that is explicitly set to zero.
if (!collIter_bos(source)) {
UChar lead;
- if(U16_IS_LEAD(lead = getPrevNormalizedChar(source))) {
- isZeroCE = UTRIE_GET32_FROM_LEAD(coll->mapping, lead);
+ if(U16_IS_LEAD(lead = getPrevNormalizedChar(source, status))) {
+ isZeroCE = UTRIE_GET32_FROM_LEAD(&coll->mapping, lead);
if(getCETag(isZeroCE) == SURROGATE_TAG) {
- uint32_t finalCE = UTRIE_GET32_FROM_OFFSET_TRAIL(coll->mapping, isZeroCE&0xFFFFFF, schar);
+ uint32_t finalCE = UTRIE_GET32_FROM_OFFSET_TRAIL(&coll->mapping, isZeroCE&0xFFFFFF, schar);
if(finalCE == 0) {
// this is a real, assigned completely ignorable code point
goBackOne(source);
@@ -3335,7 +3413,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
*(UCharOffset) = schar;
noChars++;
UCharOffset --;
- schar = getPrevNormalizedChar(source);
+ schar = getPrevNormalizedChar(source, status);
goBackOne(source);
// TODO: when we exhaust the contraction buffer,
// it needs to get reallocated. The problem is
@@ -3455,9 +3533,9 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
*/
//uint32_t size;
uint32_t i; /* general counter */
- collIterateState state;
if (source->coll->numericCollation == UCOL_ON){
+ collIterateState state = {0,0,0,0,0,0,0,0};
UChar32 char32 = 0;
uint32_t digIndx = 0;
@@ -3485,7 +3563,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
if (U16_IS_TRAIL (ch)){
if (!collIter_bos(source)){
- UChar lead = getPrevNormalizedChar(source);
+ UChar lead = getPrevNormalizedChar(source, status);
if(U16_IS_LEAD(lead)) {
char32 = U16_GET_SUPPLEMENTARY(lead,ch);
goBackOne(source);
@@ -3566,14 +3644,14 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
++trailingZeroCount;
if (!collIter_bos(source)){
- ch = getPrevNormalizedChar(source);
+ ch = getPrevNormalizedChar(source, status);
//goBackOne(source);
if (U16_IS_TRAIL(ch)){
backupState(source, &state);
if (!collIter_bos(source))
{
goBackOne(source);
- UChar lead = getPrevNormalizedChar(source);
+ UChar lead = getPrevNormalizedChar(source, status);
if(U16_IS_LEAD(lead)) {
char32 = U16_GET_SUPPLEMENTARY(lead,ch);
} else {
@@ -3692,16 +3770,10 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
*/
if (!source->coll->image->jamoSpecial)
{
- /**(source->CEpos ++) = ucmpe32_get(UCA->mapping, L);*/
- /**(source->CEpos++) = UTRIE_GET32_FROM_LEAD(UCA->mapping, L);*/
- *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(coll->mapping, L);
- /**(source->CEpos ++) = ucmpe32_get(UCA->mapping, V);*/
- /**(source->CEpos++) = UTRIE_GET32_FROM_LEAD(UCA->mapping, V);*/
- *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(coll->mapping, V);
+ *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, L);
+ *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, V);
if (T != TBase)
- /**(source->CEpos ++) = ucmpe32_get(UCA->mapping, T);*/
- /**(source->CEpos++) = UTRIE_GET32_FROM_LEAD(UCA->mapping, T);*/
- *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(coll->mapping, T);
+ *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, T);
source->toReturn = source->CEpos - 1;
return *(source->toReturn);
@@ -4172,7 +4244,10 @@ int32_t ucol_getSortKeySize(const UCollator *coll, collIterate *s, int32_t curre
}
}
- if(doCase) {
+ if(doCase && (primary1 > 0 || strength >= UCOL_SECONDARY)) {
+ // do the case level if we need to do it. We don't want to calculate
+ // case level for primary ignorables if we have only primary strength and case level
+ // otherwise we would break well formedness of CEs
if (caseShift == 0) {
currentSize++;
caseShift = UCOL_CASE_SHIFT_START;
@@ -4391,7 +4466,7 @@ ucol_calcSortKey(const UCollator *coll,
UBool shifted = (coll->alternateHandling == UCOL_SHIFTED);
//UBool qShifted = shifted && (compareQuad == 0);
UBool doHiragana = (coll->hiraganaQ == UCOL_ON) && (compareQuad == 0);
- const uint8_t *scriptOrder = coll->scriptOrder;
+ /*const uint8_t *scriptOrder = coll->scriptOrder;*/
uint32_t variableTopValue = coll->variableTopValue;
// TODO: UCOL_COMMON_BOT4 should be a function of qShifted. If we have no
@@ -4459,7 +4534,10 @@ ucol_calcSortKey(const UCollator *coll,
}
return keyLen;
}
- uint8_t *primarySafeEnd = primaries + resultLength - 2;
+ uint8_t *primarySafeEnd = primaries + resultLength - 1;
+ if(strength > UCOL_PRIMARY) {
+ primarySafeEnd--;
+ }
uint32_t minBufferSize = UCOL_MAX_BUFFER;
@@ -4517,11 +4595,9 @@ ucol_calcSortKey(const UCollator *coll,
primary2 = (uint8_t)((order >>= 8) & UCOL_BYTE_SIZE_MASK);
primary1 = (uint8_t)(order >> 8);
- if(notIsContinuation) {
- if(scriptOrder != NULL) {
- primary1 = scriptOrder[primary1];
- }
- }
+ /*if(notIsContinuation && scriptOrder != NULL) {
+ primary1 = scriptOrder[primary1];
+ }*/
if(shifted && ((notIsContinuation && order <= variableTopValue && primary1 > 0)
|| (!notIsContinuation && wasShifted))
@@ -4631,7 +4707,10 @@ ucol_calcSortKey(const UCollator *coll,
}
}
- if(doCase) {
+ if(doCase && (primary1 > 0 || strength >= UCOL_SECONDARY)) {
+ // do the case level if we need to do it. We don't want to calculate
+ // case level for primary ignorables if we have only primary strength and case level
+ // otherwise we would break well formedness of CEs
doCaseShift(&cases, caseShift);
if(notIsContinuation) {
caseBits = (uint8_t)(tertiary & 0xC0);
@@ -4672,9 +4751,10 @@ ucol_calcSortKey(const UCollator *coll,
if (tertiary == tertiaryCommon && notIsContinuation) {
++count3;
} else {
- if((tertiary > tertiaryCommon && tertiaryCommon == UCOL_COMMON3_NORMAL)
- || (tertiary <= tertiaryCommon && tertiaryCommon == UCOL_COMMON3_UPPERFIRST)) {
+ if(tertiary > tertiaryCommon && tertiaryCommon == UCOL_COMMON3_NORMAL) {
tertiary += tertiaryAddition;
+ } else if(tertiary <= tertiaryCommon && tertiaryCommon == UCOL_COMMON3_UPPERFIRST) {
+ tertiary -= tertiaryAddition;
}
if (count3 > 0) {
if ((tertiary > tertiaryCommon)) {
@@ -4728,7 +4808,10 @@ ucol_calcSortKey(const UCollator *coll,
primStart = reallocateBuffer(&primaries, *result, prim, &resultLength, 2*sks, status);
if(U_SUCCESS(*status)) {
*result = primStart;
- primarySafeEnd = primStart + resultLength - 2;
+ primarySafeEnd = primStart + resultLength - 1;
+ if(strength > UCOL_PRIMARY) {
+ primarySafeEnd--;
+ }
} else {
IInit_collIterate(coll, (UChar *)source, len, &s);
if(source == normSource) {
@@ -5375,12 +5458,15 @@ enum {
/** When we do French we need to reverse secondary values. However, continuations
* need to stay the same. So if you had abc1c2c3de, you need to have edc1c2c3ba
*/
- UCOL_PSK_USED_ELEMENTS_SHIFT = 7,
- UCOL_PSK_USED_ELEMENTS_MASK = 0x3FF,
- UCOL_PSK_ITER_SKIP_SHIFT = 17,
- UCOL_PSK_ITER_SKIP_MASK = 0x7FFF
+ UCOL_PSK_BOCSU_BYTES_SHIFT = 7,
+ UCOL_PSK_BOCSU_BYTES_MASK = 3,
+ UCOL_PSK_CONSUMED_CES_SHIFT = 9,
+ UCOL_PSK_CONSUMED_CES_MASK = 0x7FFFF
};
+// macro calculating the number of expansion CEs available
+#define uprv_numAvailableExpCEs(s) (s).CEpos - (s).toReturn
+
/** main sortkey part procedure. On the first call,
* you should pass in a collator, an iterator, empty state
@@ -5418,14 +5504,10 @@ enum {
* 4 - was shifted. Whether the previous iteration finished in the
* shifted state.
* 5, 6 - French continuation bytes written. See the comment in the enum
- * 7..16 - Used elements. Number of CEs that were already used from the
- * expansion buffer or number of bytes from a bocu sequence on
+ * 7,8 - Bocsu bytes used. Number of bytes from a bocu sequence on
* the identical level.
- * 17..31 - iterator skip. Number of move operations iterator needs to
- * skip from the current state in order to continue. This is used
- * only if normalization is turned on, since the normalizing iterator
- * can return undefined state, which means that it's in the middle
- * of normalizing sequence.
+ * 9..31 - CEs consumed. Number of getCE or next32 operations performed
+ * since thes last successful update of the iterator state.
*/
U_CAPI int32_t U_EXPORT2
ucol_nextSortKeyPart(const UCollator *coll,
@@ -5453,7 +5535,6 @@ ucol_nextSortKeyPart(const UCollator *coll,
UTRACE_EXIT_VALUE(0);
return 0;
}
-
/** Setting up situation according to the state we got from the previous iteration */
// The state of the iterator from the previous invocation
uint32_t iterState = state[0];
@@ -5466,13 +5547,13 @@ ucol_nextSortKeyPart(const UCollator *coll,
int32_t byteCountOrFrenchDone = (state[1] >> UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_SHIFT) & UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_MASK;
// number of bytes in the continuation buffer for French
int32_t usedFrench = (state[1] >> UCOL_PSK_USED_FRENCH_SHIFT) & UCOL_PSK_USED_FRENCH_MASK;
- // Skip the CEs that we got from an extraction
- // and delivered in the previous call
- int32_t usedElements = (state[1] >> UCOL_PSK_USED_ELEMENTS_SHIFT) & UCOL_PSK_USED_ELEMENTS_MASK;
- // Number of times to skip because the iterator returned
- // UITER_NO_STATE when it was stopped in the last iteration, so we had to save the
- // last valid state.
- int32_t iterSkips = (state[1] >> UCOL_PSK_ITER_SKIP_SHIFT) & UCOL_PSK_ITER_SKIP_MASK;
+ // Number of bytes already written from a bocsu sequence. Since
+ // the longes bocsu sequence is 4 long, this can be up to 3.
+ int32_t bocsuBytesUsed = (state[1] >> UCOL_PSK_BOCSU_BYTES_SHIFT) & UCOL_PSK_BOCSU_BYTES_MASK;
+ // Number of elements that need to be consumed in this iteration because
+ // the iterator returned UITER_NO_STATE at the end of the last iteration,
+ // so we had to save the last valid state.
+ int32_t cces = (state[1] >> UCOL_PSK_CONSUMED_CES_SHIFT) & UCOL_PSK_CONSUMED_CES_MASK;
/** values that depend on the collator attributes */
// strength of the collator.
@@ -5567,36 +5648,21 @@ ucol_nextSortKeyPart(const UCollator *coll,
}
}
- // Then, we may have to move more, if the normalizing iterator
- // was going through a normalizing sequence.
- if(iterSkips) {
- // if we are on secondary level AND we do French, we need to go backward instead of forward
- if(level == UCOL_PSK_SECONDARY && doingFrench) {
- s.iterator->move(s.iterator, -iterSkips, UITER_CURRENT);
- } else {
- s.iterator->move(s.iterator, iterSkips, UITER_CURRENT);
- }
- }
- // Number of expansion CEs that were already consumed in the
- // previous iteration for the last code point processed. We
- // want to clean out the expansion buffer, so that we can
- // get correct CEs. This value is persistent over iterations,
- // since we can have several iterations on the one expansion
- // buffer.
- int32_t consumedExpansionCEs = usedElements;
- // Number of bytes already writted from a bocsu sequence. Since
- // the longes bocsu sequence is 4 long, this can be up to 3. It
- // shares the state field with consumedExpansionCEs value, since
- // they cannot simultanously appear on the same level
- int32_t bocsuBytesUsed = 0;
- // Clean out the expansion buffer unless we are on
- // identical level. In that case we use this field
- // to store the number of bytes already written
- // from the previous bocsu sequence.
- if(level < UCOL_PSK_IDENTICAL && usedElements != 0) {
- while(usedElements-->0) {
+ // This variable tells us whether we can attempt to update the state
+ // of iterator. Situations where we don't want to update iterator state
+ // are the existence of expansion CEs that are not yet processed, and
+ // finishing the case level without enough space in the buffer to insert
+ // a level terminator.
+ UBool canUpdateState = TRUE;
+
+ // Consume all the CEs that were consumed at the end of the previous
+ // iteration without updating the iterator state. On identical level,
+ // consume the code points.
+ int32_t counter = cces;
+ if(level < UCOL_PSK_IDENTICAL) {
+ while(counter-->0) {
// If we're doing French and we are on the secondary level,
// we go backwards.
if(level == UCOL_PSK_SECONDARY && doingFrench) {
@@ -5610,22 +5676,19 @@ ucol_nextSortKeyPart(const UCollator *coll,
UTRACE_EXIT_STATUS(*status);
return 0;
}
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
+ }
}
} else {
- bocsuBytesUsed = usedElements;
+ while(counter-->0) {
+ uiter_next32(s.iterator);
+ }
}
- // This variable prevents the adjusting of iterator
- // skip variable when we are the first time on a
- // level. I hope there is a better way to do it, but
- // I could not think of it.
- UBool firstTimeOnLevel = TRUE;
// French secondary needs to know whether the iterator state of zero came from previous level OR
// from a new invocation...
UBool wasDoingPrimary = FALSE;
- // Case level is kind of goofy. This variable tells us that
- // we are still not done with the case level.
- UBool dontAdvanceIteratorBecauseWeNeedALevelTerminator = FALSE;
// destination buffer byte counter. When this guy
// gets to count, we're done with the iteration
int32_t i = 0;
@@ -5650,19 +5713,15 @@ ucol_nextSortKeyPart(const UCollator *coll,
// We should save the state only if we
// are sure that we are done with the
// previous iterator state
- if(consumedExpansionCEs == 0 && byteCountOrFrenchDone == 0) {
+ if(canUpdateState && byteCountOrFrenchDone == 0) {
newState = s.iterator->getState(s.iterator);
- if(newState != UITER_NO_STATE) {
+ if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel && !byteCountOrFrenchDone) {
- iterSkips++;
- }
+ cces = 0;
}
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetNextCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
@@ -5670,6 +5729,7 @@ ucol_nextSortKeyPart(const UCollator *coll,
// Restart the iteration an move to the
// second level
s.iterator->move(s.iterator, 0, UITER_START);
+ cces = 0;
level = UCOL_PSK_SECONDARY;
break;
}
@@ -5685,24 +5745,18 @@ ucol_nextSortKeyPart(const UCollator *coll,
if((CE &=0xff)!=0) {
if(i==count) {
/* overflow */
- byteCountOrFrenchDone=1;
+ byteCountOrFrenchDone = 1;
+ cces--;
goto saveState;
}
dest[i++]=(uint8_t)CE;
}
}
}
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- // s.pos != NULL means there is a normalization buffer in effect
- // in iterative case, this means that we are doing Thai (maybe discontiguos)
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- // maybe it is the end of Thai - we have to have
- // an extra skip
- iterSkips++;
+ canUpdateState = TRUE;
}
}
/* fall through to next level */
@@ -5716,26 +5770,23 @@ ucol_nextSortKeyPart(const UCollator *coll,
// We should save the state only if we
// are sure that we are done with the
// previous iterator state
- if(consumedExpansionCEs == 0) {
+ if(canUpdateState) {
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel) {
- iterSkips++;
- }
+ cces = 0;
}
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetNextCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
- byteCountOrFrenchDone=0;
+ byteCountOrFrenchDone = 0;
// Restart the iteration an move to the
// second level
s.iterator->move(s.iterator, 0, UITER_START);
+ cces = 0;
level = UCOL_PSK_CASE;
break;
}
@@ -5745,13 +5796,10 @@ ucol_nextSortKeyPart(const UCollator *coll,
dest[i++]=(uint8_t)CE;
}
}
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- iterSkips++;
+ canUpdateState = TRUE;
}
}
} else { // French secondary processing
@@ -5762,28 +5810,25 @@ ucol_nextSortKeyPart(const UCollator *coll,
// moved to end.
if(wasDoingPrimary) {
s.iterator->move(s.iterator, 0, UITER_LIMIT);
+ cces = 0;
}
for(;;) {
if(i == count) {
goto saveState;
}
- if(consumedExpansionCEs == 0) {
+ if(canUpdateState) {
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel) {
- iterSkips++;
- }
- }
+ cces = 0;
+ }
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetPrevCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
- byteCountOrFrenchDone=0;
+ byteCountOrFrenchDone = 0;
// Restart the iteration an move to the next level
s.iterator->move(s.iterator, 0, UITER_START);
level = UCOL_PSK_CASE;
@@ -5809,13 +5854,10 @@ ucol_nextSortKeyPart(const UCollator *coll,
}
}
}
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- iterSkips++;
+ canUpdateState = TRUE;
}
}
}
@@ -5836,29 +5878,25 @@ ucol_nextSortKeyPart(const UCollator *coll,
// We should save the state only if we
// are sure that we are done with the
// previous iterator state
- if(consumedExpansionCEs == 0) {
+ if(canUpdateState) {
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel) {
- iterSkips++;
- }
+ cces = 0;
}
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetNextCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// On the case level we might have an unfinished
// case byte. Add one if it's started.
if(caseShift != UCOL_CASE_SHIFT_START) {
dest[i++] = caseByte;
}
- // This is kind of tricky - situation where
- // we need to keep the iterator in the old
- // state, but don't need to bring anything
- // to the next invocation
+ cces = 0;
+ // We have finished processing CEs on this level.
+ // However, we don't know if we have enough space
+ // to add a case level terminator.
if(i < count) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
@@ -5867,13 +5905,16 @@ ucol_nextSortKeyPart(const UCollator *coll,
s.iterator->move(s.iterator, 0, UITER_START);
level = UCOL_PSK_TERTIARY;
} else {
- dontAdvanceIteratorBecauseWeNeedALevelTerminator = TRUE;
+ canUpdateState = FALSE;
}
break;
}
if(!isShiftedCE(CE, LVT, &wasShifted)) {
- if(!isContinuation(CE)) {
+ if(!isContinuation(CE) && ((CE & UCOL_PRIMARYMASK) != 0 || strength > UCOL_PRIMARY)) {
+ // do the case level if we need to do it. We don't want to calculate
+ // case level for primary ignorables if we have only primary strength and case level
+ // otherwise we would break well formedness of CEs
CE = (uint8_t)(CE & UCOL_BYTE_SIZE_MASK);
caseBits = (uint8_t)(CE & 0xC0);
// this copies the case level logic from the
@@ -5911,13 +5952,10 @@ ucol_nextSortKeyPart(const UCollator *coll,
}
}
// Not sure this is correct for the case level - revisit
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- iterSkips++;
+ canUpdateState = TRUE;
}
}
} else {
@@ -5933,26 +5971,23 @@ ucol_nextSortKeyPart(const UCollator *coll,
// We should save the state only if we
// are sure that we are done with the
// previous iterator state
- if(consumedExpansionCEs == 0) {
+ if(canUpdateState) {
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel) {
- iterSkips++;
- }
+ cces = 0;
}
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetNextCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
- byteCountOrFrenchDone=0;
+ byteCountOrFrenchDone = 0;
// Restart the iteration an move to the
// second level
s.iterator->move(s.iterator, 0, UITER_START);
+ cces = 0;
level = UCOL_PSK_QUATERNARY;
break;
}
@@ -5971,13 +6006,10 @@ ucol_nextSortKeyPart(const UCollator *coll,
dest[i++]=(uint8_t)CE;
}
}
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- iterSkips++;
+ canUpdateState = TRUE;
}
}
} else {
@@ -5995,27 +6027,24 @@ ucol_nextSortKeyPart(const UCollator *coll,
// We should save the state only if we
// are sure that we are done with the
// previous iterator state
- if(consumedExpansionCEs == 0) {
+ if(canUpdateState) {
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- if(!firstTimeOnLevel) {
- iterSkips++;
- }
+ cces = 0;
}
}
- firstTimeOnLevel = FALSE;
CE = ucol_IGetNextCE(coll, &s, status);
+ cces++;
if(CE==UCOL_NO_MORE_CES) {
// Add the level separator
terminatePSKLevel(level, maxLevel, i, dest);
//dest[i++] = UCOL_LEVELTERMINATOR;
- byteCountOrFrenchDone=0;
+ byteCountOrFrenchDone = 0;
// Restart the iteration an move to the
// second level
s.iterator->move(s.iterator, 0, UITER_START);
+ cces = 0;
level = UCOL_PSK_QUIN;
break;
}
@@ -6030,7 +6059,7 @@ ucol_nextSortKeyPart(const UCollator *coll,
if((CE &=0xff)!=0) {
if(i==count) {
/* overflow */
- byteCountOrFrenchDone=1;
+ byteCountOrFrenchDone = 1;
goto saveState;
}
dest[i++]=(uint8_t)CE;
@@ -6046,13 +6075,10 @@ ucol_nextSortKeyPart(const UCollator *coll,
}
}
}
- if(s.CEpos - s.toReturn || (s.pos && *s.pos != 0)) {
- consumedExpansionCEs++;
+ if(uprv_numAvailableExpCEs(s)) {
+ canUpdateState = FALSE;
} else {
- consumedExpansionCEs = 0;
- }
- if(s.pos && *s.pos == 0) {
- iterSkips++;
+ canUpdateState = TRUE;
}
}
} else {
@@ -6117,13 +6143,12 @@ ucol_nextSortKeyPart(const UCollator *coll,
newState = s.iterator->getState(s.iterator);
if(newState != UITER_NO_STATE) {
iterState = newState;
- iterSkips = 0;
- } else {
- iterSkips++;
- }
+ cces = 0;
+ }
uint8_t buff[4];
second = uiter_next32(s.iterator);
+ cces++;
// end condition for identical level
if(second == U_SENTINEL) {
@@ -6165,38 +6190,23 @@ ucol_nextSortKeyPart(const UCollator *coll,
saveState:
// Now we need to return stuff. First we want to see whether we have
// done everything for the current state of iterator.
- if(consumedExpansionCEs || byteCountOrFrenchDone
- || dontAdvanceIteratorBecauseWeNeedALevelTerminator) {
+ if(byteCountOrFrenchDone
+ || canUpdateState == FALSE
+ || (newState = s.iterator->getState(s.iterator)) == UITER_NO_STATE) {
// Any of above mean that the previous transaction
// wasn't finished and that we should store the
// previous iterator state.
state[0] = iterState;
} else {
- // The transaction is complete. We will continue in
- // next iteration.
- if((newState = s.iterator->getState(s.iterator))!= UITER_NO_STATE) {
+ // The transaction is complete. We will continue in the next iteration.
state[0] = s.iterator->getState(s.iterator);
- iterSkips = 0;
- } else {
- state[0] = iterState;
- iterSkips++;
- iterSkips += s.consumedChars;
- }
+ cces = 0;
}
- // Store the number of elements processed. On CE levels, this is
- // the number of expansion CEs processed. On identical level, this
- // is the number of bocsu bytes written.
- if(level < UCOL_PSK_IDENTICAL) {
- if((consumedExpansionCEs & UCOL_PSK_USED_ELEMENTS_MASK) != consumedExpansionCEs) {
- *status = U_INDEX_OUTOFBOUNDS_ERROR;
- }
- state[1] = (consumedExpansionCEs & UCOL_PSK_USED_ELEMENTS_MASK) << UCOL_PSK_USED_ELEMENTS_SHIFT;
- } else {
- if((bocsuBytesUsed & UCOL_PSK_USED_ELEMENTS_MASK) != bocsuBytesUsed) {
- *status = U_INDEX_OUTOFBOUNDS_ERROR;
- }
- state[1] = (bocsuBytesUsed & UCOL_PSK_USED_ELEMENTS_MASK) << UCOL_PSK_USED_ELEMENTS_SHIFT;
+ // Store the number of bocsu bytes written.
+ if((bocsuBytesUsed & UCOL_PSK_BOCSU_BYTES_MASK) != bocsuBytesUsed) {
+ *status = U_INDEX_OUTOFBOUNDS_ERROR;
}
+ state[1] = (bocsuBytesUsed & UCOL_PSK_BOCSU_BYTES_MASK) << UCOL_PSK_BOCSU_BYTES_SHIFT;
// Next we put in the level of comparison
state[1] |= ((level & UCOL_PSK_LEVEL_MASK) << UCOL_PSK_LEVEL_SHIFT);
@@ -6212,12 +6222,12 @@ saveState:
if(wasShifted) {
state[1] |= 1 << UCOL_PSK_WAS_SHIFTED_SHIFT;
}
- // Check for iterSkips overflow
- if((iterSkips & UCOL_PSK_ITER_SKIP_MASK) != iterSkips) {
+ // Check for cces overflow
+ if((cces & UCOL_PSK_CONSUMED_CES_MASK) != cces) {
*status = U_INDEX_OUTOFBOUNDS_ERROR;
}
- // Store iterSkips
- state[1] |= ((iterSkips & UCOL_PSK_ITER_SKIP_MASK) << UCOL_PSK_ITER_SKIP_SHIFT);
+ // Store cces
+ state[1] |= ((cces & UCOL_PSK_CONSUMED_CES_MASK) << UCOL_PSK_CONSUMED_CES_SHIFT);
// Check for French overflow
if((usedFrench & UCOL_PSK_USED_FRENCH_MASK) != usedFrench) {
@@ -6403,9 +6413,9 @@ ucol_setUpLatinOne(UCollator *coll, UErrorCode *status) {
if(ch < 0x100) {
CE = coll->latinOneMapping[ch];
} else {
- CE = UTRIE_GET32_FROM_LEAD(coll->mapping, ch);
+ CE = UTRIE_GET32_FROM_LEAD(&coll->mapping, ch);
if(CE == UCOL_NOT_FOUND && coll->UCA) {
- CE = UTRIE_GET32_FROM_LEAD(coll->UCA->mapping, ch);
+ CE = UTRIE_GET32_FROM_LEAD(&coll->UCA->mapping, ch);
}
}
if(CE < UCOL_NOT_FOUND) {
@@ -6434,8 +6444,7 @@ ucol_setUpLatinOne(UCollator *coll, UErrorCode *status) {
{
if((CE & 0x00FFF000) != 0) {
*status = U_UNSUPPORTED_ERROR;
- coll->latinOneFailed = TRUE;
- return FALSE;
+ goto cleanup_after_failure;
}
const UChar *UCharOffset = (UChar *)coll->image+getContractOffset(CE);
@@ -6491,90 +6500,91 @@ ucol_setUpLatinOne(UCollator *coll, UErrorCode *status) {
primShift = 24; secShift = 24; terShift = 24;
if(contractionOffset == coll->latinOneTableLen) { // we need to reallocate
if(!ucol_resizeLatinOneTable(coll, 2*coll->latinOneTableLen, status)) {
- coll->latinOneFailed = TRUE;
- return FALSE;
+ goto cleanup_after_failure;
}
}
} while(*UCharOffset != 0xFFFF);
}
break;
default:
- coll->latinOneFailed = TRUE;
- result = FALSE;
- break;
+ goto cleanup_after_failure;
}
}
}
- ucol_closeElements(it);
// compact table
if(contractionOffset < coll->latinOneTableLen) {
if(!ucol_resizeLatinOneTable(coll, contractionOffset, status)) {
- coll->latinOneFailed = TRUE;
- return FALSE;
+ goto cleanup_after_failure;
}
}
+ ucol_closeElements(it);
return result;
+
+cleanup_after_failure:
+ // status should already be set before arriving here.
+ coll->latinOneFailed = TRUE;
+ ucol_closeElements(it);
+ return FALSE;
}
void ucol_updateInternalState(UCollator *coll, UErrorCode *status) {
- if(U_SUCCESS(*status)) {
- if(coll->caseFirst == UCOL_UPPER_FIRST) {
- coll->caseSwitch = UCOL_CASE_SWITCH;
- } else {
- coll->caseSwitch = UCOL_NO_CASE_SWITCH;
- }
+ if(U_SUCCESS(*status)) {
+ if(coll->caseFirst == UCOL_UPPER_FIRST) {
+ coll->caseSwitch = UCOL_CASE_SWITCH;
+ } else {
+ coll->caseSwitch = UCOL_NO_CASE_SWITCH;
+ }
- if(coll->caseLevel == UCOL_ON || coll->caseFirst == UCOL_OFF) {
- coll->tertiaryMask = UCOL_REMOVE_CASE;
- coll->tertiaryCommon = UCOL_COMMON3_NORMAL;
- coll->tertiaryAddition = UCOL_FLAG_BIT_MASK_CASE_SW_OFF;
- coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_OFF;
- coll->tertiaryBottom = UCOL_COMMON_BOT3;
- } else {
- coll->tertiaryMask = UCOL_KEEP_CASE;
- coll->tertiaryAddition = UCOL_FLAG_BIT_MASK_CASE_SW_ON;
- if(coll->caseFirst == UCOL_UPPER_FIRST) {
- coll->tertiaryCommon = UCOL_COMMON3_UPPERFIRST;
- coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_UPPER;
- coll->tertiaryBottom = UCOL_COMMON_BOTTOM3_CASE_SW_UPPER;
- } else {
- coll->tertiaryCommon = UCOL_COMMON3_NORMAL;
- coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_LOWER;
- coll->tertiaryBottom = UCOL_COMMON_BOTTOM3_CASE_SW_LOWER;
- }
- }
+ if(coll->caseLevel == UCOL_ON || coll->caseFirst == UCOL_OFF) {
+ coll->tertiaryMask = UCOL_REMOVE_CASE;
+ coll->tertiaryCommon = UCOL_COMMON3_NORMAL;
+ coll->tertiaryAddition = UCOL_FLAG_BIT_MASK_CASE_SW_OFF;
+ coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_OFF;
+ coll->tertiaryBottom = UCOL_COMMON_BOT3;
+ } else {
+ coll->tertiaryMask = UCOL_KEEP_CASE;
+ coll->tertiaryAddition = UCOL_FLAG_BIT_MASK_CASE_SW_ON;
+ if(coll->caseFirst == UCOL_UPPER_FIRST) {
+ coll->tertiaryCommon = UCOL_COMMON3_UPPERFIRST;
+ coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_UPPER;
+ coll->tertiaryBottom = UCOL_COMMON_BOTTOM3_CASE_SW_UPPER;
+ } else {
+ coll->tertiaryCommon = UCOL_COMMON3_NORMAL;
+ coll->tertiaryTop = UCOL_COMMON_TOP3_CASE_SW_LOWER;
+ coll->tertiaryBottom = UCOL_COMMON_BOTTOM3_CASE_SW_LOWER;
+ }
+ }
- /* Set the compression values */
- uint8_t tertiaryTotal = (uint8_t)(coll->tertiaryTop - UCOL_COMMON_BOT3-1);
- coll->tertiaryTopCount = (uint8_t)(UCOL_PROPORTION3*tertiaryTotal); /* we multilply double with int, but need only int */
- coll->tertiaryBottomCount = (uint8_t)(tertiaryTotal - coll->tertiaryTopCount);
+ /* Set the compression values */
+ uint8_t tertiaryTotal = (uint8_t)(coll->tertiaryTop - UCOL_COMMON_BOT3-1);
+ coll->tertiaryTopCount = (uint8_t)(UCOL_PROPORTION3*tertiaryTotal); /* we multilply double with int, but need only int */
+ coll->tertiaryBottomCount = (uint8_t)(tertiaryTotal - coll->tertiaryTopCount);
- if(coll->caseLevel == UCOL_OFF && coll->strength == UCOL_TERTIARY
- && coll->frenchCollation == UCOL_OFF && coll->alternateHandling == UCOL_NON_IGNORABLE) {
- coll->sortKeyGen = ucol_calcSortKeySimpleTertiary;
- } else {
- coll->sortKeyGen = ucol_calcSortKey;
- }
- if(coll->caseLevel == UCOL_OFF && coll->strength <= UCOL_TERTIARY && coll->numericCollation == UCOL_OFF
- && coll->alternateHandling == UCOL_NON_IGNORABLE && !coll->latinOneFailed) {
- if(coll->latinOneCEs == NULL || coll->latinOneRegenTable) {
- if(ucol_setUpLatinOne(coll, status)) { // if we succeed in building latin1 table, we'll use it
- //fprintf(stderr, "F");
- coll->latinOneUse = TRUE;
- } else {
- coll->latinOneUse = FALSE;
- }
- if(*status == U_UNSUPPORTED_ERROR) {
- *status = U_ZERO_ERROR;
- }
- } else { // latin1Table exists and it doesn't need to be regenerated, just use it
- coll->latinOneUse = TRUE;
- }
+ if(coll->caseLevel == UCOL_OFF && coll->strength == UCOL_TERTIARY
+ && coll->frenchCollation == UCOL_OFF && coll->alternateHandling == UCOL_NON_IGNORABLE) {
+ coll->sortKeyGen = ucol_calcSortKeySimpleTertiary;
+ } else {
+ coll->sortKeyGen = ucol_calcSortKey;
+ }
+ if(coll->caseLevel == UCOL_OFF && coll->strength <= UCOL_TERTIARY && coll->numericCollation == UCOL_OFF
+ && coll->alternateHandling == UCOL_NON_IGNORABLE && !coll->latinOneFailed) {
+ if(coll->latinOneCEs == NULL || coll->latinOneRegenTable) {
+ if(ucol_setUpLatinOne(coll, status)) { // if we succeed in building latin1 table, we'll use it
+ //fprintf(stderr, "F");
+ coll->latinOneUse = TRUE;
} else {
coll->latinOneUse = FALSE;
}
+ if(*status == U_UNSUPPORTED_ERROR) {
+ *status = U_ZERO_ERROR;
+ }
+ } else { // latin1Table exists and it doesn't need to be regenerated, just use it
+ coll->latinOneUse = TRUE;
}
-
+ } else {
+ coll->latinOneUse = FALSE;
+ }
+ }
}
U_CAPI uint32_t U_EXPORT2
@@ -6863,9 +6873,7 @@ ucol_isTailored(const UCollator *coll, const UChar u, UErrorCode *status) {
return FALSE;
}
} else { /* regular */
- /*CE = ucmpe32_get(coll->mapping, u);*/
- CE = UTRIE_GET32_FROM_LEAD(coll->mapping, u);
-
+ CE = UTRIE_GET32_FROM_LEAD(&coll->mapping, u);
}
if(isContraction(CE)) {
@@ -7083,7 +7091,8 @@ inline void UCOL_CEBUF_PUT(ucol_CEBuf *b, uint32_t ce, collIterate *ci) {
/* This is a trick string compare function that goes in and uses sortkeys to compare */
/* It is used when compare gets in trouble and needs to bail out */
static UCollationResult ucol_compareUsingSortKeys(collIterate *sColl,
- collIterate *tColl)
+ collIterate *tColl,
+ UErrorCode *status)
{
uint8_t sourceKey[UCOL_MAX_BUFFER], targetKey[UCOL_MAX_BUFFER];
uint8_t *sourceKeyP = sourceKey;
@@ -7092,31 +7101,32 @@ static UCollationResult ucol_compareUsingSortKeys(collIterate *sColl,
const UCollator *coll = sColl->coll;
UChar *source = NULL;
UChar *target = NULL;
+ int32_t result = UCOL_EQUAL;
UChar sStackBuf[256], tStackBuf[256];
int32_t sourceLength = (sColl->flags&UCOL_ITER_HASLEN)?(sColl->endp-sColl->string):-1;
int32_t targetLength = (tColl->flags&UCOL_ITER_HASLEN)?(tColl->endp-tColl->string):-1;
// TODO: Handle long strings. Do the same in ucol_checkIdent.
if(sColl->flags & UCOL_USE_ITERATOR) {
- sColl->iterator->move(sColl->iterator, 0, UITER_START);
- tColl->iterator->move(tColl->iterator, 0, UITER_START);
- source = sStackBuf;
- UChar *sBufp = source;
- target = tStackBuf;
- UChar *tBufp = target;
- while(sColl->iterator->hasNext(sColl->iterator)) {
- *sBufp++ = (UChar)sColl->iterator->next(sColl->iterator);
- }
- while(tColl->iterator->hasNext(tColl->iterator)) {
- *tBufp++ = (UChar)tColl->iterator->next(tColl->iterator);
- }
- sourceLength = sBufp - source;
- targetLength = tBufp - target;
+ sColl->iterator->move(sColl->iterator, 0, UITER_START);
+ tColl->iterator->move(tColl->iterator, 0, UITER_START);
+ source = sStackBuf;
+ UChar *sBufp = source;
+ target = tStackBuf;
+ UChar *tBufp = target;
+ while(sColl->iterator->hasNext(sColl->iterator)) {
+ *sBufp++ = (UChar)sColl->iterator->next(sColl->iterator);
+ }
+ while(tColl->iterator->hasNext(tColl->iterator)) {
+ *tBufp++ = (UChar)tColl->iterator->next(tColl->iterator);
+ }
+ sourceLength = sBufp - source;
+ targetLength = tBufp - target;
} else { // no iterators
- sourceLength = (sColl->flags&UCOL_ITER_HASLEN)?(sColl->endp-sColl->string):-1;
- targetLength = (tColl->flags&UCOL_ITER_HASLEN)?(tColl->endp-tColl->string):-1;
- source = sColl->string;
- target = tColl->string;
+ sourceLength = (sColl->flags&UCOL_ITER_HASLEN)?(sColl->endp-sColl->string):-1;
+ targetLength = (tColl->flags&UCOL_ITER_HASLEN)?(tColl->endp-tColl->string):-1;
+ source = sColl->string;
+ target = tColl->string;
}
@@ -7124,26 +7134,31 @@ static UCollationResult ucol_compareUsingSortKeys(collIterate *sColl,
sourceKeyLen = ucol_getSortKey(coll, source, sourceLength, sourceKeyP, sourceKeyLen);
if(sourceKeyLen > UCOL_MAX_BUFFER) {
sourceKeyP = (uint8_t*)uprv_malloc(sourceKeyLen*sizeof(uint8_t));
- if(sourceKeyP != NULL) {
- sourceKeyLen = ucol_getSortKey(coll, source, sourceLength, sourceKeyP, sourceKeyLen);
+ if(sourceKeyP == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ goto cleanup_and_do_compare;
}
+ sourceKeyLen = ucol_getSortKey(coll, source, sourceLength, sourceKeyP, sourceKeyLen);
}
targetKeyLen = ucol_getSortKey(coll, target, targetLength, targetKeyP, targetKeyLen);
if(targetKeyLen > UCOL_MAX_BUFFER) {
targetKeyP = (uint8_t*)uprv_malloc(targetKeyLen*sizeof(uint8_t));
- if(targetKeyP != NULL) {
- targetKeyLen = ucol_getSortKey(coll, target, targetLength, targetKeyP, targetKeyLen);
+ if(targetKeyP == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ goto cleanup_and_do_compare;
}
+ targetKeyLen = ucol_getSortKey(coll, target, targetLength, targetKeyP, targetKeyLen);
}
- int32_t result = uprv_strcmp((const char*)sourceKeyP, (const char*)targetKeyP);
+ result = uprv_strcmp((const char*)sourceKeyP, (const char*)targetKeyP);
- if(sourceKeyP != sourceKey) {
+cleanup_and_do_compare:
+ if(sourceKeyP != NULL && sourceKeyP != sourceKey) {
uprv_free(sourceKeyP);
}
- if(targetKeyP != targetKey) {
+ if(targetKeyP != NULL && targetKeyP != targetKey) {
uprv_free(targetKeyP);
}
@@ -7186,7 +7201,7 @@ ucol_strcollRegular( collIterate *sColl, collIterate *tColl,
UBool doHiragana = (coll->hiraganaQ == UCOL_ON) && checkQuad;
if(doHiragana && shifted) {
- return (ucol_compareUsingSortKeys(sColl, tColl));
+ return (ucol_compareUsingSortKeys(sColl, tColl, status));
}
uint8_t caseSwitch = coll->caseSwitch;
uint8_t tertiaryMask = coll->tertiaryMask;
@@ -7469,8 +7484,15 @@ ucol_strcollRegular( collIterate *sColl, collIterate *tColl,
for(;;) {
while((secS & UCOL_REMOVE_CASE) == 0) {
if(!isContinuation(*sCE++)) {
- secS =*(sCE-1) & UCOL_TERT_CASE_MASK;
- secS ^= caseSwitch;
+ secS =*(sCE-1);
+ if(((secS & UCOL_PRIMARYMASK) != 0) || strength > UCOL_PRIMARY) {
+ // primary ignorables should not be considered on the case level when the strength is primary
+ // otherwise, the CEs stop being well-formed
+ secS &= UCOL_TERT_CASE_MASK;
+ secS ^= caseSwitch;
+ } else {
+ secS = 0;
+ }
} else {
secS = 0;
}
@@ -7478,8 +7500,15 @@ ucol_strcollRegular( collIterate *sColl, collIterate *tColl,
while((secT & UCOL_REMOVE_CASE) == 0) {
if(!isContinuation(*tCE++)) {
- secT = *(tCE-1) & UCOL_TERT_CASE_MASK;
- secT ^= caseSwitch;
+ secT = *(tCE-1);
+ if(((secT & UCOL_PRIMARYMASK) != 0) || strength > UCOL_PRIMARY) {
+ // primary ignorables should not be considered on the case level when the strength is primary
+ // otherwise, the CEs stop being well-formed
+ secT &= UCOL_TERT_CASE_MASK;
+ secT ^= caseSwitch;
+ } else {
+ secT = 0;
+ }
} else {
secT = 0;
}
@@ -7664,7 +7693,7 @@ ucol_getLatinOneContraction(const UCollator *coll, int32_t strength,
return UCOL_BAIL_OUT_CE;
}
// skip completely ignorables
- uint32_t isZeroCE = UTRIE_GET32_FROM_LEAD(coll->mapping, schar);
+ uint32_t isZeroCE = UTRIE_GET32_FROM_LEAD(&coll->mapping, schar);
if(isZeroCE == 0) { // we have to ignore completely ignorables
(*index)++;
continue;
@@ -7700,7 +7729,7 @@ ucol_strcollUseLatin1( const UCollator *coll,
UChar sChar = 0, tChar = 0;
uint32_t sOrder=0, tOrder=0;
- UBool endOfSource = FALSE, endOfTarget = FALSE;
+ UBool endOfSource = FALSE;
uint32_t *elements = coll->latinOneCEs;
@@ -7824,7 +7853,7 @@ endOfPrimLoop:
if(strength >= UCOL_SECONDARY) {
// adjust the table beggining
elements += coll->latinOneTableLen;
- endOfSource = FALSE; endOfTarget = FALSE;
+ endOfSource = FALSE;
if(coll->frenchCollation == UCOL_OFF) { // non French
// This loop is a simplified copy of primary loop
@@ -7938,7 +7967,7 @@ endOfSecLoop:
// tertiary loop is the same as secondary (except no French)
elements += coll->latinOneTableLen;
sIndex = 0; tIndex = 0;
- endOfSource = FALSE; endOfTarget = FALSE;
+ endOfSource = FALSE;
for(;;) {
while(sOrder==0) {
if(sIndex==sLen) {
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_bld.cpp b/Build/source/libs/icu-xetex/i18n/ucol_bld.cpp
index 1768d13c189..1191a86b825 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_bld.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_bld.cpp
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2005, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -333,7 +333,7 @@ U_CFUNC void ucol_inv_getGapPositions(UColTokenParser *src, UColTokListHeader *l
//if(lh->baseCE >= PRIMARY_IMPLICIT_MIN && lh->baseCE < PRIMARY_IMPLICIT_MAX ) { /* implicits - */
lh->pos[0] = 0;
t1 = lh->baseCE;
- t2 = lh->baseContCE;
+ t2 = lh->baseContCE & UCOL_REMOVE_CONTINUATION;
lh->gapsLo[0] = (t1 & UCOL_PRIMARYMASK) | (t2 & UCOL_PRIMARYMASK) >> 16;
lh->gapsLo[1] = (t1 & UCOL_SECONDARYMASK) << 16 | (t2 & UCOL_SECONDARYMASK) << 8;
lh->gapsLo[2] = (UCOL_TERTIARYORDER(t1)) << 24 | (UCOL_TERTIARYORDER(t2)) << 16;
@@ -341,7 +341,7 @@ U_CFUNC void ucol_inv_getGapPositions(UColTokenParser *src, UColTokListHeader *l
primaryCE = uprv_uca_getImplicitFromRaw(uprv_uca_getRawFromImplicit(primaryCE)+1);
t1 = primaryCE & UCOL_PRIMARYMASK | 0x0505;
- t2 = (primaryCE << 16) & UCOL_PRIMARYMASK | UCOL_CONTINUATION_MARKER;
+ t2 = (primaryCE << 16) & UCOL_PRIMARYMASK; // | UCOL_CONTINUATION_MARKER;
lh->gapsHi[0] = (t1 & UCOL_PRIMARYMASK) | (t2 & UCOL_PRIMARYMASK) >> 16;
lh->gapsHi[1] = (t1 & UCOL_SECONDARYMASK) << 16 | (t2 & UCOL_SECONDARYMASK) << 8;
@@ -350,12 +350,12 @@ U_CFUNC void ucol_inv_getGapPositions(UColTokenParser *src, UColTokListHeader *l
//} else if(lh->baseCE == UCOL_RESET_TOP_VALUE && lh->baseContCE == 0) {
lh->pos[0] = 0;
t1 = lh->baseCE;
- t2 = lh->baseContCE;
+ t2 = lh->baseContCE&UCOL_REMOVE_CONTINUATION;
lh->gapsLo[0] = (t1 & UCOL_PRIMARYMASK) | (t2 & UCOL_PRIMARYMASK) >> 16;
lh->gapsLo[1] = (t1 & UCOL_SECONDARYMASK) << 16 | (t2 & UCOL_SECONDARYMASK) << 8;
lh->gapsLo[2] = (UCOL_TERTIARYORDER(t1)) << 24 | (UCOL_TERTIARYORDER(t2)) << 16;
t1 = lh->nextCE;
- t2 = lh->nextContCE;
+ t2 = lh->nextContCE&UCOL_REMOVE_CONTINUATION;
lh->gapsHi[0] = (t1 & UCOL_PRIMARYMASK) | (t2 & UCOL_PRIMARYMASK) >> 16;
lh->gapsHi[1] = (t1 & UCOL_SECONDARYMASK) << 16 | (t2 & UCOL_SECONDARYMASK) << 8;
lh->gapsHi[2] = (UCOL_TERTIARYORDER(t1)) << 24 | (UCOL_TERTIARYORDER(t2)) << 16;
@@ -687,17 +687,19 @@ U_CFUNC void ucol_doCE(UColTokenParser *src, uint32_t *CEparts, UColToken *tok,
// we want to set case bits here and now, not later.
// Case bits handling
- tok->CEs[0] &= 0xFFFFFF3F; // Clean the case bits field
- int32_t cSize = (tok->source & 0xFF000000) >> 24;
- UChar *cPoints = (tok->source & 0x00FFFFFF) + src->source;
-
- if(cSize > 1) {
- // Do it manually
- tok->CEs[0] |= ucol_uprv_getCaseBits(src->UCA, cPoints, cSize, status);
- } else {
- // Copy it from the UCA
- uint32_t caseCE = ucol_getFirstCE(src->UCA, cPoints[0], status);
- tok->CEs[0] |= (caseCE & 0xC0);
+ if(tok->CEs[0] != 0) { // case bits should be set only for non-ignorables
+ tok->CEs[0] &= 0xFFFFFF3F; // Clean the case bits field
+ int32_t cSize = (tok->source & 0xFF000000) >> 24;
+ UChar *cPoints = (tok->source & 0x00FFFFFF) + src->source;
+
+ if(cSize > 1) {
+ // Do it manually
+ tok->CEs[0] |= ucol_uprv_getCaseBits(src->UCA, cPoints, cSize, status);
+ } else {
+ // Copy it from the UCA
+ uint32_t caseCE = ucol_getFirstCE(src->UCA, cPoints[0], status);
+ tok->CEs[0] |= (caseCE & 0xC0);
+ }
}
#if UCOL_DEBUG==2
@@ -1200,7 +1202,7 @@ UCATableHeader *ucol_assembleTailoringTable(UColTokenParser *src, UErrorCode *st
}
// Add completely ignorable elements
- utrie_enum(t->UCA->mapping, NULL, _processUCACompleteIgnorables, t);
+ utrie_enum(&t->UCA->mapping, NULL, _processUCACompleteIgnorables, t);
// canonical closure
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_cnt.cpp b/Build/source/libs/icu-xetex/i18n/ucol_cnt.cpp
index 0e57a3bb30a..68e9cfb4dac 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_cnt.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_cnt.cpp
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -26,8 +26,6 @@
#include "ucol_cnt.h"
#include "cmemory.h"
-U_NAMESPACE_BEGIN
-
static void uprv_growTable(ContractionTable *tbl, UErrorCode *status) {
if(tbl->position == tbl->size) {
uint32_t *newData = (uint32_t *)uprv_realloc(tbl->CEs, 2*tbl->size*sizeof(uint32_t));
@@ -55,15 +53,15 @@ uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status) {
}
CntTable *tbl = (CntTable *)uprv_malloc(sizeof(CntTable));
if(tbl == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
tbl->mapping = mapping;
tbl->elements = (ContractionTable **)uprv_malloc(INIT_EXP_TABLE_SIZE*sizeof(ContractionTable *));
if(tbl->elements == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(tbl);
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(tbl);
+ return NULL;
}
tbl->capacity = INIT_EXP_TABLE_SIZE;
uprv_memset(tbl->elements, 0, INIT_EXP_TABLE_SIZE*sizeof(ContractionTable *));
@@ -79,22 +77,22 @@ uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status) {
static ContractionTable *addATableElement(CntTable *table, uint32_t *key, UErrorCode *status) {
ContractionTable *el = (ContractionTable *)uprv_malloc(sizeof(ContractionTable));
if(el == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
el->CEs = (uint32_t *)uprv_malloc(INIT_EXP_TABLE_SIZE*sizeof(uint32_t));
if(el->CEs == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(el);
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(el);
+ return NULL;
}
el->codePoints = (UChar *)uprv_malloc(INIT_EXP_TABLE_SIZE*sizeof(UChar));
if(el->codePoints == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(el->CEs);
- uprv_free(el);
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(el->CEs);
+ uprv_free(el);
+ return NULL;
}
el->position = 0;
@@ -111,20 +109,20 @@ static ContractionTable *addATableElement(CntTable *table, uint32_t *key, UError
if(table->size == table->capacity) {
ContractionTable **newElements = (ContractionTable **)uprv_malloc(table->capacity*2*sizeof(ContractionTable *));
// do realloc
-/* table->elements = (ContractionTable **)realloc(table->elements, table->capacity*2*sizeof(ContractionTable *));*/
+ /* table->elements = (ContractionTable **)realloc(table->elements, table->capacity*2*sizeof(ContractionTable *));*/
if(newElements == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(el->codePoints);
- uprv_free(el->CEs);
- uprv_free(el);
- return NULL;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(el->codePoints);
+ uprv_free(el->CEs);
+ uprv_free(el);
+ return NULL;
} else {
- ContractionTable **oldElements = table->elements;
- uprv_memcpy(newElements, oldElements, table->capacity*sizeof(ContractionTable *));
- uprv_memset(newElements+table->capacity, 0, table->capacity*sizeof(ContractionTable *));
- table->capacity *= 2;
- table->elements = newElements;
- uprv_free(oldElements);
+ ContractionTable **oldElements = table->elements;
+ uprv_memcpy(newElements, oldElements, table->capacity*sizeof(ContractionTable *));
+ uprv_memset(newElements+table->capacity, 0, table->capacity*sizeof(ContractionTable *));
+ table->capacity *= 2;
+ table->elements = newElements;
+ uprv_free(oldElements);
}
}
@@ -145,8 +143,8 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
}
table->offsets = (int32_t *)uprv_malloc(table->size*sizeof(int32_t));
if(table->offsets == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return 0;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
}
@@ -162,10 +160,10 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
}
table->CEs = (uint32_t *)uprv_malloc(table->position*sizeof(uint32_t));
if(table->CEs == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(table->offsets);
- table->offsets = NULL;
- return 0;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(table->offsets);
+ table->offsets = NULL;
+ return 0;
}
uprv_memset(table->CEs, '?', table->position*sizeof(uint32_t));
@@ -174,12 +172,12 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
}
table->codePoints = (UChar *)uprv_malloc(table->position*sizeof(UChar));
if(table->codePoints == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(table->offsets);
- table->offsets = NULL;
- uprv_free(table->CEs);
- table->CEs = NULL;
- return 0;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(table->offsets);
+ table->offsets = NULL;
+ uprv_free(table->CEs);
+ table->CEs = NULL;
+ return 0;
}
uprv_memset(table->codePoints, '?', table->position*sizeof(UChar));
@@ -191,14 +189,14 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
int32_t size = table->elements[i]->position;
uint8_t ccMax = 0, ccMin = 255, cc = 0;
for(j = 1; j<size; j++) {
- cc = u_getCombiningClass(table->elements[i]->codePoints[j]);
- if(cc>ccMax) {
- ccMax = cc;
- }
- if(cc<ccMin) {
- ccMin = cc;
- }
- *(cpPointer+j) = table->elements[i]->codePoints[j];
+ cc = u_getCombiningClass(table->elements[i]->codePoints[j]);
+ if(cc>ccMax) {
+ ccMax = cc;
+ }
+ if(cc<ccMin) {
+ ccMin = cc;
+ }
+ *(cpPointer+j) = table->elements[i]->codePoints[j];
}
*cpPointer = ((ccMin==ccMax)?1:0 << 8) | ccMax;
@@ -233,97 +231,112 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
}
static ContractionTable *uprv_cnttab_cloneContraction(ContractionTable *t, UErrorCode *status) {
- ContractionTable *r = (ContractionTable *)uprv_malloc(sizeof(ContractionTable));
- if(r == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- r->position = t->position;
- r->size = t->size;
-
- r->codePoints = (UChar *)uprv_malloc(sizeof(UChar)*t->size);
- r->CEs = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->size);
-
- /* test for NULL */
- if((r->codePoints == NULL) || (r->CEs == NULL)) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- uprv_memcpy(r->codePoints, t->codePoints, sizeof(UChar)*t->size);
- uprv_memcpy(r->CEs, t->CEs, sizeof(uint32_t)*t->size);
-
- return r;
+ ContractionTable *r = (ContractionTable *)uprv_malloc(sizeof(ContractionTable));
+ if(r == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ r->position = t->position;
+ r->size = t->size;
+
+ r->codePoints = (UChar *)uprv_malloc(sizeof(UChar)*t->size);
+ if(r->codePoints == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r);
+ return NULL;
+ }
+ r->CEs = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->size);
+ if(r->CEs == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r->codePoints);
+ uprv_free(r);
+ return NULL;
+ }
+ uprv_memcpy(r->codePoints, t->codePoints, sizeof(UChar)*t->size);
+ uprv_memcpy(r->CEs, t->CEs, sizeof(uint32_t)*t->size);
+
+ return r;
}
U_CAPI CntTable* U_EXPORT2
uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
- if(U_FAILURE(*status)) {
- return NULL;
- }
- int32_t i = 0;
- CntTable *r = (CntTable *)uprv_malloc(sizeof(CntTable));
- /* test for NULL */
- if (r == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- r->position = t->position;
- r->size = t->size;
- r->capacity = t->capacity;
-
- r->mapping = t->mapping;
-
- r->elements = (ContractionTable **)uprv_malloc(t->capacity*sizeof(ContractionTable *));
- /* test for NULL */
- if (r->elements == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- //uprv_memcpy(r->elements, t->elements, t->capacity*sizeof(ContractionTable *));
-
- for(i = 0; i<t->size; i++) {
- r->elements[i] = uprv_cnttab_cloneContraction(t->elements[i], status);
- }
-
- if(t->CEs != NULL) {
- r->CEs = (uint32_t *)uprv_malloc(t->position*sizeof(uint32_t));
- /* test for NULL */
- if (r->CEs == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
+ if(U_FAILURE(*status)) {
return NULL;
}
- uprv_memcpy(r->CEs, t->CEs, t->position*sizeof(uint32_t));
- } else {
- r->CEs = NULL;
- }
-
- if(t->codePoints != NULL) {
- r->codePoints = (UChar *)uprv_malloc(t->position*sizeof(UChar));
+ int32_t i = 0;
+ CntTable *r = (CntTable *)uprv_malloc(sizeof(CntTable));
/* test for NULL */
- if (r->codePoints == NULL) {
+ if (r == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
- uprv_memcpy(r->codePoints, t->codePoints, t->position*sizeof(UChar));
- } else {
- r->codePoints = NULL;
- }
+ r->position = t->position;
+ r->size = t->size;
+ r->capacity = t->capacity;
+
+ r->mapping = t->mapping;
- if(t->offsets != NULL) {
- r->offsets = (int32_t *)uprv_malloc(t->size*sizeof(int32_t));
+ r->elements = (ContractionTable **)uprv_malloc(t->capacity*sizeof(ContractionTable *));
/* test for NULL */
- if (r->offsets == NULL) {
+ if (r->elements == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r);
return NULL;
}
- uprv_memcpy(r->offsets, t->offsets, t->size*sizeof(int32_t));
- } else {
- r->offsets = NULL;
- }
+ //uprv_memcpy(r->elements, t->elements, t->capacity*sizeof(ContractionTable *));
- return r;
+ for(i = 0; i<t->size; i++) {
+ r->elements[i] = uprv_cnttab_cloneContraction(t->elements[i], status);
+ }
+
+ if(t->CEs != NULL) {
+ r->CEs = (uint32_t *)uprv_malloc(t->position*sizeof(uint32_t));
+ /* test for NULL */
+ if (r->CEs == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r->elements);
+ uprv_free(r);
+ return NULL;
+ }
+ uprv_memcpy(r->CEs, t->CEs, t->position*sizeof(uint32_t));
+ } else {
+ r->CEs = NULL;
+ }
+
+ if(t->codePoints != NULL) {
+ r->codePoints = (UChar *)uprv_malloc(t->position*sizeof(UChar));
+ /* test for NULL */
+ if (r->codePoints == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r->CEs);
+ uprv_free(r->elements);
+ uprv_free(r);
+ return NULL;
+ }
+ uprv_memcpy(r->codePoints, t->codePoints, t->position*sizeof(UChar));
+ } else {
+ r->codePoints = NULL;
+ }
+
+ if(t->offsets != NULL) {
+ r->offsets = (int32_t *)uprv_malloc(t->size*sizeof(int32_t));
+ /* test for NULL */
+ if (r->offsets == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(r->codePoints);
+ uprv_free(r->CEs);
+ uprv_free(r->elements);
+ uprv_free(r);
+ return NULL;
+ }
+ uprv_memcpy(r->offsets, t->offsets, t->size*sizeof(int32_t));
+ } else {
+ r->offsets = NULL;
+ }
+
+ return r;
}
U_CAPI void U_EXPORT2
@@ -352,7 +365,7 @@ uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t value, UErr
}
if((element == 0xFFFFFF) || (tbl = table->elements[element]) == NULL) {
- return 0;
+ return 0;
}
tbl->CEs[tbl->position-1] = value;
@@ -365,12 +378,12 @@ uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t value, UErr
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status) {
- element &= 0xFFFFFF;
ContractionTable *tbl = NULL;
if(U_FAILURE(*status)) {
return 0;
}
+ element &= 0xFFFFFF;
if((element == 0xFFFFFF) || (tbl = table->elements[element]) == NULL) {
tbl = addATableElement(table, &element, status);
@@ -457,40 +470,40 @@ static ContractionTable *_cnttab_getContractionTable(CntTable *table, uint32_t e
ContractionTable *tbl = NULL;
if((element == 0xFFFFFF) || (tbl = table->elements[element]) == NULL) {
- return NULL;
+ return NULL;
} else {
- return tbl;
+ return tbl;
}
}
static int32_t _cnttab_findCP(ContractionTable *tbl, UChar codePoint) {
uint32_t position = 0;
if(tbl == NULL) {
- return -1;
+ return -1;
}
while(codePoint > tbl->codePoints[position]) {
- position++;
- if(position > tbl->position) {
- return -1;
- }
+ position++;
+ if(position > tbl->position) {
+ return -1;
+ }
}
if (codePoint == tbl->codePoints[position]) {
- return position;
+ return position;
} else {
- return -1;
+ return -1;
}
}
static uint32_t _cnttab_getCE(ContractionTable *tbl, int32_t position) {
- if(tbl == NULL) {
- return UCOL_NOT_FOUND;
- }
- if((uint32_t)position > tbl->position || position == -1) {
- return UCOL_NOT_FOUND;
- } else {
- return tbl->CEs[position];
- }
+ if(tbl == NULL) {
+ return UCOL_NOT_FOUND;
+ }
+ if((uint32_t)position > tbl->position || position == -1) {
+ return UCOL_NOT_FOUND;
+ } else {
+ return tbl->CEs[position];
+ }
}
U_CAPI int32_t U_EXPORT2
@@ -528,20 +541,16 @@ uprv_cnttab_isTailored(CntTable *table, uint32_t element, UChar *ztString, UErro
}
while(*(ztString)!=0) {
- element = uprv_cnttab_findCE(table, element, *(ztString), status);
- if(element == UCOL_NOT_FOUND) {
- return FALSE;
- }
- if(!isCntTableElement(element)) {
- return TRUE;
- }
- ztString++;
- }
- if(uprv_cnttab_getCE(table, element, 0, status) != UCOL_NOT_FOUND) {
- return TRUE;
- } else {
- return FALSE;
+ element = uprv_cnttab_findCE(table, element, *(ztString), status);
+ if(element == UCOL_NOT_FOUND) {
+ return FALSE;
+ }
+ if(!isCntTableElement(element)) {
+ return TRUE;
+ }
+ ztString++;
}
+ return (UBool)(uprv_cnttab_getCE(table, element, 0, status) != UCOL_NOT_FOUND);
}
U_CAPI uint32_t U_EXPORT2
@@ -555,25 +564,23 @@ uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar codePoint
}
if((element == 0xFFFFFF) || (tbl = table->elements[element]) == NULL) {
- return 0;
+ return 0;
}
uint32_t position = 0;
while(codePoint > tbl->codePoints[position]) {
- position++;
- if(position > tbl->position) {
- return UCOL_NOT_FOUND;
- }
+ position++;
+ if(position > tbl->position) {
+ return UCOL_NOT_FOUND;
+ }
}
if (codePoint == tbl->codePoints[position]) {
- tbl->CEs[position] = newCE;
- return element;
+ tbl->CEs[position] = newCE;
+ return element;
} else {
- return UCOL_NOT_FOUND;
+ return UCOL_NOT_FOUND;
}
}
-U_NAMESPACE_END
-
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_cnt.h b/Build/source/libs/icu-xetex/i18n/ucol_cnt.h
index 51cdf5250ee..c16211fc4d7 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_cnt.h
+++ b/Build/source/libs/icu-xetex/i18n/ucol_cnt.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001, International Business Machines
+* Copyright (C) 2001-2005, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -31,7 +31,7 @@
#include "ucol_elm.h"
#include "ucol_imp.h"
-U_NAMESPACE_BEGIN
+U_CDECL_BEGIN
#define UPRV_CNTTAB_NEWELEMENT 0xFFFFFF
@@ -98,7 +98,7 @@ uprv_cnttab_findCE(CntTable *table, uint32_t element, UChar codePoint, UErrorCod
U_CAPI UBool U_EXPORT2
uprv_cnttab_isTailored(CntTable *table, uint32_t element, UChar *ztString, UErrorCode *status);
-U_NAMESPACE_END
+U_CDECL_END
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_elm.cpp b/Build/source/libs/icu-xetex/i18n/ucol_elm.cpp
index 1258df43fe4..ab3bf408492 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_elm.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_elm.cpp
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2005, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -36,8 +36,6 @@
#include "unicode/caniter.h"
#include "cmemory.h"
-U_NAMESPACE_BEGIN
-
static uint32_t uprv_uca_processContraction(CntTable *contractions, UCAElements *element, uint32_t existingCE, UErrorCode *status);
U_CDECL_BEGIN
@@ -109,29 +107,30 @@ static int32_t uprv_uca_addExpansion(ExpansionTable *expansions, uint32_t value,
U_CAPI tempUCATable* U_EXPORT2
uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UColCETags supplementaryInitTag, UErrorCode *status) {
+ MaxJamoExpansionTable *maxjet;
+ MaxExpansionTable *maxet;
tempUCATable *t = (tempUCATable *)uprv_malloc(sizeof(tempUCATable));
/* test for NULL */
if (t == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
- MaxExpansionTable *maxet = (MaxExpansionTable *)uprv_malloc(
- sizeof(MaxExpansionTable));
- /* test for NULL */
+ uprv_memset(t, 0, sizeof(tempUCATable));
+
+ maxet = (MaxExpansionTable *)uprv_malloc(sizeof(MaxExpansionTable));
if (maxet == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(t);
- return NULL;
+ goto allocation_failure;
}
- MaxJamoExpansionTable *maxjet = (MaxJamoExpansionTable *)uprv_malloc(
- sizeof(MaxJamoExpansionTable));
- /* test for NULL */
+ uprv_memset(maxet, 0, sizeof(MaxExpansionTable));
+ t->maxExpansions = maxet;
+
+ maxjet = (MaxJamoExpansionTable *)uprv_malloc(sizeof(MaxJamoExpansionTable));
if (maxjet == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(t);
- uprv_free(maxet);
- return NULL;
+ goto allocation_failure;
}
+ uprv_memset(maxjet, 0, sizeof(MaxJamoExpansionTable));
+ t->maxJamoExpansions = maxjet;
+
t->image = image;
t->options = opts;
@@ -139,11 +138,7 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
t->expansions = (ExpansionTable *)uprv_malloc(sizeof(ExpansionTable));
/* test for NULL */
if (t->expansions == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(t);
- uprv_free(maxet);
- uprv_free(maxjet);
- return NULL;
+ goto allocation_failure;
}
uprv_memset(t->expansions, 0, sizeof(ExpansionTable));
/*t->mapping = ucmpe32_open(UCOL_SPECIAL_FLAG | (initTag<<24), UCOL_SPECIAL_FLAG | (SURROGATE_TAG<<24), UCOL_SPECIAL_FLAG | (LEAD_SURROGATE_TAG<<24), status);*/
@@ -153,13 +148,12 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
UCOL_SPECIAL_FLAG | (initTag<<24),
UCOL_SPECIAL_FLAG | (supplementaryInitTag << 24),
TRUE); // Do your own mallocs for the structure, array and have linear Latin 1
- t->prefixLookup = uhash_open(prefixLookupHash, prefixLookupComp, status);
+ t->prefixLookup = uhash_open(prefixLookupHash, prefixLookupComp, NULL, status);
uhash_setValueDeleter(t->prefixLookup, uhash_freeBlock);
t->contractions = uprv_cnttab_open(t->mapping, status);
/* copy UCA's maxexpansion and merge as we go along */
- t->maxExpansions = maxet;
if (UCA != NULL) {
/* adding an extra initial value for easier manipulation */
maxet->size = (UCA->lastEndExpansionCE - UCA->endExpansionCE)
@@ -169,16 +163,13 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
(uint32_t *)uprv_malloc(sizeof(uint32_t) * maxet->size);
/* test for NULL */
if (maxet->endExpansionCE == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ goto allocation_failure;
}
maxet->expansionCESize =
(uint8_t *)uprv_malloc(sizeof(uint8_t) * maxet->size);
/* test for NULL */
if (maxet->expansionCESize == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(maxet->endExpansionCE);
- return NULL;
+ goto allocation_failure;
}
/* initialized value */
*(maxet->endExpansionCE) = 0;
@@ -191,7 +182,6 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
else {
maxet->size = 0;
}
- t->maxJamoExpansions = maxjet;
maxjet->endExpansionCE = NULL;
maxjet->isV = NULL;
maxjet->size = 0;
@@ -203,19 +193,21 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
t->unsafeCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
/* test for NULL */
if (t->unsafeCP == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ goto allocation_failure;
}
t->contrEndCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
/* test for NULL */
if (t->contrEndCP == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(t->unsafeCP);
- return NULL;
+ goto allocation_failure;
}
uprv_memset(t->unsafeCP, 0, UCOL_UNSAFECP_TABLE_SIZE);
uprv_memset(t->contrEndCP, 0, UCOL_UNSAFECP_TABLE_SIZE);
-return t;
+ return t;
+
+allocation_failure:
+ uprv_uca_closeTempTable(t);
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
U_CAPI tempUCATable* U_EXPORT2
@@ -369,21 +361,26 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
U_CAPI void U_EXPORT2
uprv_uca_closeTempTable(tempUCATable *t) {
if(t != NULL) {
- uprv_free(t->expansions->CEs);
- uprv_free(t->expansions);
+ if (t->expansions != NULL) {
+ uprv_free(t->expansions->CEs);
+ uprv_free(t->expansions);
+ }
if(t->contractions != NULL) {
uprv_cnttab_close(t->contractions);
}
- /*ucmpe32_close(t->mapping);*/
- utrie_close(t->mapping);
+ if (t->mapping != NULL) {
+ utrie_close(t->mapping);
+ }
if(t->prefixLookup != NULL) {
uhash_close(t->prefixLookup);
}
- uprv_free(t->maxExpansions->endExpansionCE);
- uprv_free(t->maxExpansions->expansionCESize);
- uprv_free(t->maxExpansions);
+ if (t->maxExpansions != NULL) {
+ uprv_free(t->maxExpansions->endExpansionCE);
+ uprv_free(t->maxExpansions->expansionCESize);
+ uprv_free(t->maxExpansions);
+ }
if (t->maxJamoExpansions->size > 0) {
uprv_free(t->maxJamoExpansions->endExpansionCE);
@@ -596,6 +593,8 @@ static int uprv_uca_setMaxJamoExpansion(UChar ch,
/* test for NULL */;
if (maxexpansion->isV == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(maxexpansion->endExpansionCE);
+ maxexpansion->endExpansionCE = NULL;
return 0;
}
*(maxexpansion->isV) = 0;
@@ -604,20 +603,27 @@ static int uprv_uca_setMaxJamoExpansion(UChar ch,
}
if (maxexpansion->position + 1 == maxexpansion->size) {
- uint32_t *neweece = (uint32_t *)uprv_realloc(maxexpansion->endExpansionCE,
- 2 * maxexpansion->size * sizeof(uint32_t));
- UBool *newisV = (UBool *)uprv_realloc(maxexpansion->isV,
- 2 * maxexpansion->size * sizeof(UBool));
- if (neweece == NULL || newisV == NULL) {
+ maxexpansion->size *= 2;
+ maxexpansion->endExpansionCE = (uint32_t *)uprv_realloc(maxexpansion->endExpansionCE,
+ maxexpansion->size * sizeof(uint32_t));
+ if (maxexpansion->endExpansionCE == NULL) {
#ifdef UCOL_DEBUG
fprintf(stderr, "out of memory for maxExpansions\n");
#endif
*status = U_MEMORY_ALLOCATION_ERROR;
- return -1;
+ return 0;
+ }
+ maxexpansion->isV = (UBool *)uprv_realloc(maxexpansion->isV,
+ maxexpansion->size * sizeof(UBool));
+ if (maxexpansion->isV == NULL) {
+#ifdef UCOL_DEBUG
+ fprintf(stderr, "out of memory for maxExpansions\n");
+#endif
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(maxexpansion->endExpansionCE);
+ maxexpansion->endExpansionCE = NULL;
+ return 0;
}
- maxexpansion->endExpansionCE = neweece;
- maxexpansion->isV = newisV;
- maxexpansion->size *= 2;
}
uint32_t *pendexpansionce = maxexpansion->endExpansionCE;
@@ -1070,6 +1076,9 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
(uint8_t)element->noOfCEs,
t->maxJamoExpansions,
status);
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
}
}
}
@@ -1078,10 +1087,10 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
// processed differently if numeric collation is on.
UChar32 uniChar = 0;
//printElement(element);
- if ((element->cSize == 2) && U16_IS_LEAD(element->uchars[0])){
- uniChar = U16_GET_SUPPLEMENTARY(element->uchars[0], element->uchars[1]);
+ if ((element->cSize == 2) && U16_IS_LEAD(element->cPoints[0])){
+ uniChar = U16_GET_SUPPLEMENTARY(element->cPoints[0], element->cPoints[1]);
} else if (element->cSize == 1){
- uniChar = element->uchars[0];
+ uniChar = element->cPoints[0];
}
// Here, we either have one normal CE OR mapCE is set. Therefore, we stuff only
@@ -1480,19 +1489,19 @@ U_CDECL_BEGIN
static UBool U_CALLCONV
_enumCategoryRangeClosureCategory(const void *context, UChar32 start, UChar32 limit, UCharCategory type) {
- UErrorCode *status = ((enumStruct *)context)->status;
- tempUCATable *t = ((enumStruct *)context)->t;
- UCollator *tempColl = ((enumStruct *)context)->tempColl;
- UCollationElements* colEl = ((enumStruct *)context)->colEl;
- UCAElements el;
- UChar decomp[256] = { 0 };
- int32_t noOfDec = 0;
-
- UChar32 u32 = 0;
- UChar comp[2];
- uint32_t len = 0;
-
if (type != U_UNASSIGNED && type != U_PRIVATE_USE_CHAR) { // if the range is assigned - we might ommit more categories later
+ UErrorCode *status = ((enumStruct *)context)->status;
+ tempUCATable *t = ((enumStruct *)context)->t;
+ UCollator *tempColl = ((enumStruct *)context)->tempColl;
+ UCollationElements* colEl = ((enumStruct *)context)->colEl;
+ UCAElements el;
+ UChar decomp[256] = { 0 };
+ int32_t noOfDec = 0;
+
+ UChar32 u32 = 0;
+ UChar comp[2];
+ uint32_t len = 0;
+
for(u32 = start; u32 < limit; u32++) {
noOfDec = unorm_getDecomposition(u32, FALSE, decomp, 256);
//if((noOfDec = unorm_normalize(comp, len, UNORM_NFD, 0, decomp, 256, status)) > 1
@@ -1518,21 +1527,17 @@ _enumCategoryRangeClosureCategory(const void *context, UChar32 start, UChar32 li
el.prefixSize = 0;
UCAElements *prefix=(UCAElements *)uhash_get(t->prefixLookup, &el);
+ el.cPoints = comp;
+ el.cSize = len;
+ el.prefix = el.prefixChars;
+ el.prefixSize = 0;
if(prefix == NULL) {
- el.cPoints = comp;
- el.cSize = len;
- el.prefix = el.prefixChars;
- el.prefixSize = 0;
el.noOfCEs = 0;
ucol_setText(colEl, decomp, noOfDec, status);
while((el.CEs[el.noOfCEs] = ucol_next(colEl, status)) != (uint32_t)UCOL_NULLORDER) {
el.noOfCEs++;
}
} else {
- el.cPoints = comp;
- el.cSize = len;
- el.prefix = el.prefixChars;
- el.prefixSize = 0;
el.noOfCEs = 1;
el.CEs[0] = prefix->mapCE;
// This character uses a prefix. We have to add it
@@ -1589,8 +1594,6 @@ uprv_uca_canonicalClosure(tempUCATable *t, UErrorCode *status)
return context.noOfClosures;
}
-U_NAMESPACE_END
-
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_elm.h b/Build/source/libs/icu-xetex/i18n/ucol_elm.h
index 3ffd204a1c4..5e980e2645d 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_elm.h
+++ b/Build/source/libs/icu-xetex/i18n/ucol_elm.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2000-2003, International Business Machines
+* Copyright (C) 2000-2005, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -33,7 +33,7 @@
#include <stdio.h>
#endif
-U_NAMESPACE_BEGIN
+U_CDECL_BEGIN
typedef struct {
uint32_t *CEs;
@@ -62,8 +62,8 @@ typedef struct {
typedef struct {
uint32_t *endExpansionCE;
UBool *isV;
- int position;
- int size;
+ int32_t position;
+ int32_t size;
uint8_t maxLSize;
uint8_t maxVSize;
uint8_t maxTSize;
@@ -72,8 +72,8 @@ typedef struct {
typedef struct {
uint32_t *endExpansionCE;
uint8_t *expansionCESize;
- int position;
- int size;
+ int32_t position;
+ int32_t size;
} MaxExpansionTable;
typedef struct {
@@ -103,7 +103,7 @@ uprv_uca_canonicalClosure(tempUCATable *t, UErrorCode *status);
#define paddedsize(something) ((something)+((((something)%4)!=0)?(4-(something)%4):0))
#define headersize (paddedsize(sizeof(UCATableHeader))+paddedsize(sizeof(UColOptionSet)))
-U_NAMESPACE_END
+U_CDECL_END
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_imp.h b/Build/source/libs/icu-xetex/i18n/ucol_imp.h
index 6acee401630..db6e2dc4900 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_imp.h
+++ b/Build/source/libs/icu-xetex/i18n/ucol_imp.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2005, International Business Machines
+* Copyright (C) 1998-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -43,7 +43,7 @@
#include "unicode/ucol.h"
#include "utrie.h"
-#include "unicode/ures.h"
+#include "uresimp.h"
#include "unicode/udata.h"
#include "unicode/uiter.h"
@@ -279,9 +279,6 @@ typedef struct collIterate {
uint32_t CEs[UCOL_EXPAND_CE_BUFFER_SIZE]; /* This is where we store CEs */
UChar stackWritableBuffer[UCOL_WRITABLE_BUFFER_SIZE]; /* A writable buffer. */
UCharIterator *iterator;
- uint32_t consumedChars; /* number of extra consumed chars in a contraction */
- /* used in conjuction with iterator state for partial */
- /* sortkeys */
/*int32_t iteratorIndex;*/
} collIterate;
@@ -298,7 +295,6 @@ struct collIterateState {
uint8_t origFlags;
uint32_t iteratorIndex;
int32_t iteratorMove;
- uint32_t consumedChars;
};
U_CAPI void U_EXPORT2
@@ -562,7 +558,7 @@ enum {
UCOL_BYTE_FIRST_TAILORED = 0x04,
UCOL_BYTE_COMMON = 0x05,
UCOL_BYTE_FIRST_UCA = UCOL_BYTE_COMMON,
- UCOL_CODAN_PLACEHOLDER = 0x26,
+ UCOL_CODAN_PLACEHOLDER = 0x27,
UCOL_BYTE_LAST_LATIN_PRIMARY = 0x4C,
UCOL_BYTE_FIRST_NON_LATIN_PRIMARY = 0x4D,
UCOL_BYTE_UNSHIFTED_MAX = 0xFF
@@ -862,16 +858,18 @@ struct UCollator {
uint32_t *latinOneCEs;
char* validLocale;
char* requestedLocale;
+ const UChar *rules;
+ const UCollator *UCA;
+ ResourceCleaner *resCleaner;
UResourceBundle *rb;
UResourceBundle *elements;
const UCATableHeader *image;
- /*CompactEIntArray *mapping;*/
- UTrie *mapping;
+ UTrie mapping;
const uint32_t *latinOneMapping;
const uint32_t *expansion;
const UChar *contractionIndex;
const uint32_t *contractionCEs;
- const uint8_t *scriptOrder;
+ /*const uint8_t *scriptOrder;*/
const uint32_t *endExpansionCE; /* array of last ces in an expansion ce.
corresponds to expansionCESize */
@@ -885,12 +883,9 @@ struct UCollator {
UChar minUnsafeCP; /* Smallest unsafe Code Point. */
UChar minContrEndCP; /* Smallest code point at end of a contraction */
- const UChar *rules;
int32_t rulesLength;
int32_t latinOneTableLen;
- /*UErrorCode errorCode;*/ /* internal error code */
-
uint32_t variableTopValue;
UColAttributeValue frenchCollation;
UColAttributeValue alternateHandling; /* attribute for handling variable elements*/
@@ -931,10 +926,7 @@ struct UCollator {
uint8_t tertiaryTopCount;
uint8_t tertiaryBottomCount;
- UDataInfo dataInfo; /* Data info of UCA table */
- const UCollator *UCA;
- ResourceCleaner *resCleaner;
-
+ UVersionInfo dataVersion; /* Data info of UCA table */
};
U_CDECL_END
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_res.cpp b/Build/source/libs/icu-xetex/i18n/ucol_res.cpp
index 612baa3f0af..578fa8a36e0 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_res.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_res.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines
+* Copyright (C) 1996-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol_res.cpp
@@ -74,124 +74,129 @@ U_CFUNC UCollator*
ucol_open_internal(const char *loc,
UErrorCode *status)
{
- const UCollator* UCA = ucol_initUCA(status);
+ const UCollator* UCA = ucol_initUCA(status);
+
+ /* New version */
+ if(U_FAILURE(*status)) return 0;
+
+
+
+ UCollator *result = NULL;
+ UResourceBundle *b = ures_open(U_ICUDATA_COLL, loc, status);
+
+ /* we try to find stuff from keyword */
+ UResourceBundle *collations = ures_getByKey(b, "collations", NULL, status);
+ UResourceBundle *collElem = NULL;
+ char keyBuffer[256];
+ // if there is a keyword, we pick it up and try to get elements
+ if(!uloc_getKeywordValue(loc, "collation", keyBuffer, 256, status)) {
+ // no keyword. we try to find the default setting, which will give us the keyword value
+ UErrorCode intStatus = U_ZERO_ERROR;
+ // finding default value does not affect collation fallback status
+ UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, &intStatus);
+ if(U_SUCCESS(intStatus)) {
+ int32_t defaultKeyLen = 0;
+ const UChar *defaultKey = ures_getString(defaultColl, &defaultKeyLen, &intStatus);
+ u_UCharsToChars(defaultKey, keyBuffer, defaultKeyLen);
+ keyBuffer[defaultKeyLen] = 0;
+ } else {
+ *status = U_INTERNAL_PROGRAM_ERROR;
+ return NULL;
+ }
+ ures_close(defaultColl);
+ }
+ collElem = ures_getByKeyWithFallback(collations, keyBuffer, collElem, status);
- /* New version */
- if(U_FAILURE(*status)) return 0;
+ UResourceBundle *binary = NULL;
+ if(*status == U_MISSING_RESOURCE_ERROR) { /* We didn't find the tailoring data, we fallback to the UCA */
+ *status = U_USING_DEFAULT_WARNING;
+ result = ucol_initCollator(UCA->image, result, UCA, status);
+ // if we use UCA, real locale is root
+ result->rb = ures_open(U_ICUDATA_COLL, "", status);
+ result->elements = ures_open(U_ICUDATA_COLL, "", status);
+ if(U_FAILURE(*status)) {
+ goto clean;
+ }
+ ures_close(b);
+ result->hasRealData = FALSE;
+ } else if(U_SUCCESS(*status)) {
+ int32_t len = 0;
+ UErrorCode binaryStatus = U_ZERO_ERROR;
+
+ binary = ures_getByKey(collElem, "%%CollationBin", NULL, &binaryStatus);
+
+ if(binaryStatus == U_MISSING_RESOURCE_ERROR) { /* we didn't find the binary image, we should use the rules */
+ binary = NULL;
+ result = tryOpeningFromRules(collElem, status);
+ if(U_FAILURE(*status)) {
+ goto clean;
+ }
+ } else if(U_SUCCESS(*status)) { /* otherwise, we'll pick a collation data that exists */
+ const uint8_t *inData = ures_getBinary(binary, &len, status);
+ UCATableHeader *colData = (UCATableHeader *)inData;
+ if(uprv_memcmp(colData->UCAVersion, UCA->image->UCAVersion, sizeof(UVersionInfo)) != 0 ||
+ uprv_memcmp(colData->UCDVersion, UCA->image->UCDVersion, sizeof(UVersionInfo)) != 0 ||
+ colData->version[0] != UCOL_BUILDER_VERSION)
+ {
+ *status = U_DIFFERENT_UCA_VERSION;
+ result = tryOpeningFromRules(collElem, status);
+ } else {
+ if(U_FAILURE(*status)){
+ goto clean;
+ }
+ if((uint32_t)len > (paddedsize(sizeof(UCATableHeader)) + paddedsize(sizeof(UColOptionSet)))) {
+ result = ucol_initCollator((const UCATableHeader *)inData, result, UCA, status);
+ if(U_FAILURE(*status)){
+ goto clean;
+ }
+ result->hasRealData = TRUE;
+ } else {
+ result = ucol_initCollator(UCA->image, result, UCA, status);
+ ucol_setOptionsFromHeader(result, (UColOptionSet *)(inData+((const UCATableHeader *)inData)->options), status);
+ if(U_FAILURE(*status)){
+ goto clean;
+ }
+ result->hasRealData = FALSE;
+ }
+ result->freeImageOnClose = FALSE;
+ }
+ }
+ result->rb = b;
+ result->elements = collElem;
+ len = 0;
+ binaryStatus = U_ZERO_ERROR;
+ result->rules = ures_getStringByKey(result->elements, "Sequence", &len, &binaryStatus);
+ result->rulesLength = len;
+ result->freeRulesOnClose = FALSE;
+ } else { /* There is another error, and we're just gonna clean up */
+ goto clean;
+ }
+ result->validLocale = NULL; // default is to use rb info
- UCollator *result = NULL;
- UResourceBundle *b = ures_open(U_ICUDATA_COLL, loc, status);
-
- /* we try to find stuff from keyword */
- UResourceBundle *collations = ures_getByKey(b, "collations", NULL, status);
- UResourceBundle *collElem = NULL;
- char keyBuffer[256];
- // if there is a keyword, we pick it up and try to get elements
- if(!uloc_getKeywordValue(loc, "collation", keyBuffer, 256, status)) {
- // no keyword. we try to find the default setting, which will give us the keyword value
- UErrorCode intStatus = U_ZERO_ERROR;
- // finding default value does not affect collation fallback status
- UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, &intStatus);
- if(U_SUCCESS(intStatus)) {
- int32_t defaultKeyLen = 0;
- const UChar *defaultKey = ures_getString(defaultColl, &defaultKeyLen, &intStatus);
- u_UCharsToChars(defaultKey, keyBuffer, defaultKeyLen);
- keyBuffer[defaultKeyLen] = 0;
- } else {
- *status = U_INTERNAL_PROGRAM_ERROR;
- return NULL;
+ if(loc == NULL) {
+ loc = ures_getLocale(result->rb, status);
}
- ures_close(defaultColl);
- }
- collElem = ures_getByKeyWithFallback(collations, keyBuffer, collElem, status);
-
- UResourceBundle *binary = NULL;
- UErrorCode binaryStatus = U_ZERO_ERROR;
-
- if(*status == U_MISSING_RESOURCE_ERROR) { /* We didn't find the tailoring data, we fallback to the UCA */
- *status = U_USING_DEFAULT_WARNING;
- result = ucol_initCollator(UCA->image, result, UCA, status);
- // if we use UCA, real locale is root
- result->rb = ures_open(U_ICUDATA_COLL, "", status);
- result->elements = ures_open(U_ICUDATA_COLL, "", status);
- if(U_FAILURE(*status)) {
- goto clean;
- }
- ures_close(b);
- result->hasRealData = FALSE;
- } else if(U_SUCCESS(*status)) {
- binary = ures_getByKey(collElem, "%%CollationBin", NULL, &binaryStatus);
-
- if(binaryStatus == U_MISSING_RESOURCE_ERROR) { /* we didn't find the binary image, we should use the rules */
- binary = NULL;
- result = tryOpeningFromRules(collElem, status);
- if(U_FAILURE(*status)) {
+ result->requestedLocale = (char *)uprv_malloc((uprv_strlen(loc)+1)*sizeof(char));
+ /* test for NULL */
+ if (result->requestedLocale == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
goto clean;
- }
- } else if(U_SUCCESS(*status)) { /* otherwise, we'll pick a collation data that exists */
- int32_t len = 0;
- const uint8_t *inData = ures_getBinary(binary, &len, status);
- UCATableHeader *colData = (UCATableHeader *)inData;
- if(uprv_memcmp(colData->UCAVersion, UCA->image->UCAVersion, sizeof(UVersionInfo)) != 0 ||
- uprv_memcmp(colData->UCDVersion, UCA->image->UCDVersion, sizeof(UVersionInfo)) != 0 ||
- colData->version[0] != UCOL_BUILDER_VERSION) {
- *status = U_DIFFERENT_UCA_VERSION;
- result = tryOpeningFromRules(collElem, status);
- } else {
- if(U_FAILURE(*status)){
- goto clean;
- }
- if((uint32_t)len > (paddedsize(sizeof(UCATableHeader)) + paddedsize(sizeof(UColOptionSet)))) {
- result = ucol_initCollator((const UCATableHeader *)inData, result, UCA, status);
- if(U_FAILURE(*status)){
- goto clean;
- }
- result->hasRealData = TRUE;
- } else {
- result = ucol_initCollator(UCA->image, result, UCA, status);
- ucol_setOptionsFromHeader(result, (UColOptionSet *)(inData+((const UCATableHeader *)inData)->options), status);
- if(U_FAILURE(*status)){
- goto clean;
- }
- result->hasRealData = FALSE;
- }
- result->freeImageOnClose = FALSE;
- }
}
- result->rb = b;
- result->elements = collElem;
- } else { /* There is another error, and we're just gonna clean up */
+ uprv_strcpy(result->requestedLocale, loc);
+
+ ures_close(binary);
+ ures_close(collations); //??? we have to decide on that. Probably affects something :)
+ result->resCleaner = ucol_prv_closeResources;
+ return result;
+
clean:
ures_close(b);
ures_close(collElem);
ures_close(collations);
ures_close(binary);
return NULL;
- }
-
- result->validLocale = NULL; // default is to use rb info
-
- if(loc == NULL) {
- loc = ures_getLocale(result->rb, status);
- }
- result->requestedLocale = (char *)uprv_malloc((uprv_strlen(loc)+1)*sizeof(char));
- /* test for NULL */
- if (result->requestedLocale == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- ures_close(b); // ??? appears needed
- ures_close(collElem);
- ures_close(collations);
- ures_close(binary); // ??? appears needed
- return NULL;
- }
- uprv_strcpy(result->requestedLocale, loc);
-
- ures_close(binary);
- ures_close(collations); //??? we have to decide on that. Probably affects something :)
- result->resCleaner = ucol_prv_closeResources;
- return result;
}
U_CAPI UCollator*
@@ -236,7 +241,7 @@ ucol_openRules( const UChar *rules,
return NULL;
}
- if(rulesLength < -1 || (rules == NULL && rulesLength != 0)) {
+ if(rules == NULL || rulesLength < -1) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -322,7 +327,7 @@ ucol_openRules( const UChar *rules,
if(U_SUCCESS(*status)) {
UChar *newRules;
- result->dataInfo.dataVersion[0] = UCOL_BUILDER_VERSION;
+ result->dataVersion[0] = UCOL_BUILDER_VERSION;
if(rulesLength > 0) {
newRules = (UChar *)uprv_malloc((rulesLength+1)*U_SIZEOF_UCHAR);
/* test for NULL */
@@ -399,23 +404,14 @@ U_CAPI const UChar* U_EXPORT2
ucol_getRules( const UCollator *coll,
int32_t *length)
{
- if(coll->rules != NULL) {
- *length = coll->rulesLength;
- return coll->rules;
- } else {
- UErrorCode status = U_ZERO_ERROR;
- if(coll->elements != NULL) {
- if(U_SUCCESS(status)) {
- /*Semantic const */
- ((UCollator *)coll)->rules = ures_getStringByKey(coll->elements, "Sequence", length, &status);
- ((UCollator *)coll)->rulesLength = *length;
- ((UCollator *)coll)->freeRulesOnClose = FALSE;
+ if(coll->rules != NULL) {
+ *length = coll->rulesLength;
return coll->rules;
- }
}
- *length = 0;
- return &_NUL;
- }
+ else {
+ *length = 0;
+ return &_NUL;
+ }
}
U_CAPI UBool U_EXPORT2
@@ -681,6 +677,7 @@ ucol_getTailoredSet(const UCollator *coll, UErrorCode *status)
}
if(coll == NULL || coll->UCA == NULL) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
}
UParseError parseError;
UColTokenParser src;
@@ -719,57 +716,4 @@ ucol_getTailoredSet(const UCollator *coll, UErrorCode *status)
return (USet *)tailored;
}
-U_CAPI UCollator* U_EXPORT2
-ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t * pBufferSize, UErrorCode *status)
-{
- UCollator * localCollator;
- int32_t bufferSizeNeeded = (int32_t)sizeof(UCollator);
- char *stackBufferChars = (char *)stackBuffer;
-
- if (status == NULL || U_FAILURE(*status)){
- return 0;
- }
- if ((stackBuffer && !pBufferSize) || !coll){
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- /* Pointers on 64-bit platforms need to be aligned
- * on a 64-bit boundry in memory.
- */
- if (U_ALIGNMENT_OFFSET(stackBuffer) != 0) {
- int32_t offsetUp = (int32_t)U_ALIGNMENT_OFFSET_UP(stackBufferChars);
- *pBufferSize -= offsetUp;
- stackBufferChars += offsetUp;
- }
- stackBuffer = (void *)stackBufferChars;
-
- if (stackBuffer && *pBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
- *pBufferSize = bufferSizeNeeded;
- return 0;
- }
- if (!stackBuffer || *pBufferSize < bufferSizeNeeded) {
- /* allocate one here...*/
- int32_t length;
- const UChar * rules = ucol_getRules(coll, &length);
-
- localCollator = ucol_openRules(rules,
- length,
- ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, status),
- ucol_getStrength(coll),
- NULL,
- status);
- if (U_SUCCESS(*status))
- {
- *status = U_SAFECLONE_ALLOCATED_WARNING;
- }
- } else {
- localCollator = (UCollator *)stackBuffer;
- uprv_memcpy(localCollator, coll, sizeof(UCollator));
- localCollator->freeOnClose = FALSE;
- localCollator->requestedLocale = NULL; // zero copies of pointers
- localCollator->validLocale = NULL;
- }
- return localCollator;
-}
-
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_sit.cpp b/Build/source/libs/icu-xetex/i18n/ucol_sit.cpp
index 76a48bf3d03..7fa8fb54b83 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_sit.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_sit.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2004-2005, International Business Machines
+* Copyright (C) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol_sit.cpp
@@ -1062,11 +1062,6 @@ _processSpecials(const void *context, UChar32 start, UChar32 limit, uint32_t CE)
}
}
-static int32_t U_CALLCONV
-_getTrieFoldingOffset(uint32_t data)
-{
- return (int32_t)(data&0xFFFFFF);
-}
U_CDECL_END
@@ -1128,17 +1123,14 @@ ucol_getContractionsAndExpansions( const UCollator *coll,
contContext c = { NULL, contractions, expansions, src.removeSet, addPrefixes, status };
- coll->mapping->getFoldingOffset = _getTrieFoldingOffset;
-
-
// Add the UCA contractions
c.coll = coll->UCA;
- utrie_enum(coll->UCA->mapping, NULL, _processSpecials, &c);
+ utrie_enum(&coll->UCA->mapping, NULL, _processSpecials, &c);
// This is collator specific. Add contractions from a collator
c.coll = coll;
c.removedContractions = NULL;
- utrie_enum(coll->mapping, NULL, _processSpecials, &c);
+ utrie_enum(&coll->mapping, NULL, _processSpecials, &c);
ucol_tok_closeTokenList(&src);
}
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_tok.cpp b/Build/source/libs/icu-xetex/i18n/ucol_tok.cpp
index c848db5ac9c..9d43d88e819 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_tok.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucol_tok.cpp
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2005, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -1554,7 +1554,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
} else { /* there is both explicit and implicit expansion. We need to make a combination */
uprv_memcpy(src->extraCurrent, src->source + (expandNext & 0xFFFFFF), (expandNext >> 24)*sizeof(UChar));
uprv_memcpy(src->extraCurrent+(expandNext >> 24), src->source + src->parsedToken.extensionOffset, src->parsedToken.extensionLen*sizeof(UChar));
- sourceToken->expansion = (uint32_t)(((expandNext >> 24) + src->parsedToken.extensionLen)<<24 | (src->extraCurrent - src->source));
+ sourceToken->expansion = (uint32_t)(((expandNext >> 24) + src->parsedToken.extensionLen)<<24 | (uint32_t)(src->extraCurrent - src->source));
src->extraCurrent += (expandNext >> 24) + src->parsedToken.extensionLen;
}
}
@@ -1583,7 +1583,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
/* if the previous token was also a reset, */
/*this means that we have two consecutive resets */
/* and we want to remove the previous one if empty*/
- if(ListList[src->resultLen-1].first == NULL) {
+ if(src->resultLen > 0 && ListList[src->resultLen-1].first == NULL) {
src->resultLen--;
}
}
@@ -1820,7 +1820,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
if(U_FAILURE(*status)) {
return;
}
- src->tailored = uhash_open(uhash_hashTokens, uhash_compareTokens, status);
+ src->tailored = uhash_open(uhash_hashTokens, uhash_compareTokens, NULL, status);
if(U_FAILURE(*status)) {
return;
}
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_tok.h b/Build/source/libs/icu-xetex/i18n/ucol_tok.h
index 3a5984888a8..efd0a021f8e 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_tok.h
+++ b/Build/source/libs/icu-xetex/i18n/ucol_tok.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -43,7 +43,7 @@
/* this is space for the extra strings that need to be unquoted */
/* during the parsing of the rules */
-#define UCOL_TOK_EXTRA_RULE_SPACE_SIZE 2048
+#define UCOL_TOK_EXTRA_RULE_SPACE_SIZE 4096
typedef struct UColToken UColToken;
typedef struct {
diff --git a/Build/source/libs/icu-xetex/i18n/ucol_wgt.c b/Build/source/libs/icu-xetex/i18n/ucol_wgt.c
index f2ce4918b45..f531344944c 100644
--- a/Build/source/libs/icu-xetex/i18n/ucol_wgt.c
+++ b/Build/source/libs/icu-xetex/i18n/ucol_wgt.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -119,7 +119,7 @@ lengthenRange(WeightRange *range, uint32_t maxByte, uint32_t countBytes) {
}
/* for uprv_sortArray: sort ranges in weight order */
-static U_INLINE int32_t U_CALLCONV
+static int32_t U_CALLCONV
compareRanges(const void *context, const void *left, const void *right) {
uint32_t l, r;
diff --git a/Build/source/libs/icu-xetex/i18n/ucoleitr.cpp b/Build/source/libs/icu-xetex/i18n/ucoleitr.cpp
index f386fb4ef71..d31a90f837b 100644
--- a/Build/source/libs/icu-xetex/i18n/ucoleitr.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucoleitr.cpp
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 2001-2003, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
*
@@ -31,19 +31,6 @@ typedef struct collIterate collIterator;
/* public methods ---------------------------------------------------- */
-/**
-* Since this is going to be deprecated, I'll leave it as it is
-*/
-U_CAPI int32_t U_EXPORT2
-ucol_keyHashCode(const uint8_t *key,
- int32_t length)
-{
-
- CollationKey newKey(key, length);
- return newKey.hashCode();
-}
-
-
U_CAPI UCollationElements* U_EXPORT2
ucol_openElements(const UCollator *coll,
const UChar *text,
@@ -115,15 +102,16 @@ U_CAPI int32_t U_EXPORT2
ucol_next(UCollationElements *elems,
UErrorCode *status)
{
- uint32_t result;
+ int32_t result;
if (U_FAILURE(*status)) {
return UCOL_NULLORDER;
}
elems->reset_ = FALSE;
- result = ucol_getNextCE(elems->iteratordata_.coll, &elems->iteratordata_,
- status);
+ result = (int32_t)ucol_getNextCE(elems->iteratordata_.coll,
+ &elems->iteratordata_,
+ status);
if (result == UCOL_NO_MORE_CES) {
result = UCOL_NULLORDER;
@@ -140,7 +128,7 @@ ucol_previous(UCollationElements *elems,
}
else
{
- uint32_t result;
+ int32_t result;
if (elems->reset_ &&
(elems->iteratordata_.pos == elems->iteratordata_.string)) {
@@ -155,8 +143,9 @@ ucol_previous(UCollationElements *elems,
elems->reset_ = FALSE;
- result = ucol_getPrevCE(elems->iteratordata_.coll, &(elems->iteratordata_),
- status);
+ result = (int32_t)ucol_getPrevCE(elems->iteratordata_.coll,
+ &(elems->iteratordata_),
+ status);
if (result == UCOL_NO_MORE_CES) {
result = UCOL_NULLORDER;
diff --git a/Build/source/libs/icu-xetex/i18n/ucsdet.cpp b/Build/source/libs/icu-xetex/i18n/ucsdet.cpp
new file mode 100644
index 00000000000..114f896f415
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/ucsdet.cpp
@@ -0,0 +1,234 @@
+/*
+ ********************************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ ********************************************************************************
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+#include "unicode/ucsdet.h"
+#include "csdetect.h"
+#include "csmatch.h"
+
+#include "cmemory.h"
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
+#define DELETE_ARRAY(array) uprv_free((void *) (array))
+
+U_CDECL_BEGIN
+
+U_CAPI UCharsetDetector * U_EXPORT2
+ucsdet_open(UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return 0;
+ }
+
+ CharsetDetector* csd = new CharsetDetector(*status);
+
+ if (U_FAILURE(*status)) {
+ delete csd;
+ csd = NULL;
+ }
+
+ return (UCharsetDetector *) csd;
+}
+
+U_CAPI void U_EXPORT2
+ucsdet_close(UCharsetDetector *ucsd)
+{
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+ delete csd;
+}
+
+U_CAPI void U_EXPORT2
+ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return;
+ }
+
+ if (ucsd == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+
+ csd->setText(textIn, len);
+}
+
+U_CAPI const char * U_EXPORT2
+ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (ucsm == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ CharsetMatch *csm = (CharsetMatch *) ucsm;
+
+ return csm->getName();
+}
+
+U_CAPI int32_t U_EXPORT2
+ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if (ucsm == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ CharsetMatch *csm = (CharsetMatch *) ucsm;
+
+ return csm->getConfidence();
+}
+
+U_CAPI const char * U_EXPORT2
+ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (ucsm == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ CharsetMatch *csm = (CharsetMatch *) ucsm;
+
+ return csm->getLanguage();
+}
+
+U_CAPI const UCharsetMatch * U_EXPORT2
+ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (ucsd == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+
+ return (const UCharsetMatch *) csd->detect(*status);
+}
+
+U_CAPI void U_EXPORT2
+ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return;
+ }
+
+ if (ucsd == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+
+ csd->setDeclaredEncoding(encoding,length);
+}
+
+U_CAPI const UCharsetMatch**
+ucsdet_detectAll(UCharsetDetector *ucsd,
+ int32_t *maxMatchesFound, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (ucsd == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+
+ return (const UCharsetMatch**)csd->detectAll(*maxMatchesFound,*status);
+}
+
+// U_CAPI const char * U_EXPORT2
+// ucsdet_getDetectableCharsetName(const UCharsetDetector *csd, int32_t index, UErrorCode *status)
+// {
+// if(U_FAILURE(*status)) {
+// return 0;
+// }
+// return csd->getCharsetName(index,*status);
+// }
+
+// U_CAPI int32_t U_EXPORT2
+// ucsdet_getDetectableCharsetsCount(const UCharsetDetector *csd, UErrorCode *status)
+// {
+// if(U_FAILURE(*status)) {
+// return -1;
+// }
+// return UCharsetDetector::getDetectableCount();
+// }
+
+U_CAPI UBool U_EXPORT2
+ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd)
+{
+ // todo: could use an error return...
+ if (ucsd == NULL) {
+ return FALSE;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+
+ return csd->getStripTagsFlag();
+}
+
+U_CAPI UBool U_EXPORT2
+ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter)
+{
+ // todo: could use an error return...
+ if (ucsd == NULL) {
+ return FALSE;
+ }
+
+ CharsetDetector *csd = (CharsetDetector *) ucsd;
+ UBool prev = csd->getStripTagsFlag();
+
+ csd->setStripTagsFlag(filter);
+
+ return prev;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucsdet_getUChars(const UCharsetMatch *ucsm,
+ UChar *buf, int32_t cap, UErrorCode *status)
+{
+ if(U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if (ucsm == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ CharsetMatch *csm = (CharsetMatch *) ucsm;
+
+ return csm->getUChars(buf, cap, status);
+}
+U_CDECL_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/ucurr.cpp b/Build/source/libs/icu-xetex/i18n/ucurr.cpp
index d3ac644f45f..00d05245999 100644
--- a/Build/source/libs/icu-xetex/i18n/ucurr.cpp
+++ b/Build/source/libs/icu-xetex/i18n/ucurr.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2002-2005, International Business Machines
+* Copyright (c) 2002-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@@ -754,7 +754,8 @@ static const struct CurrencyList {
{"ATS", UCURR_COMMON|UCURR_DEPRECATED},
{"AUD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"AWG", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"AZM", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"AZM", UCURR_COMMON|UCURR_DEPRECATED},
+ {"AZN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"BAD", UCURR_COMMON|UCURR_DEPRECATED},
{"BAM", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"BBD", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -791,7 +792,7 @@ static const struct CurrencyList {
{"CHW", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"CLF", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"CLP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"CNX", UCURR_COMMON|UCURR_DEPRECATED},
+ {"CNX", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"CNY", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"COP", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"COU", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
@@ -899,7 +900,8 @@ static const struct CurrencyList {
{"MXV", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"MYR", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MZE", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"MZM", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"MZM", UCURR_COMMON|UCURR_DEPRECATED},
+ {"MZN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"NAD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"NGN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"NIC", UCURR_COMMON|UCURR_DEPRECATED},
@@ -922,7 +924,8 @@ static const struct CurrencyList {
{"PYG", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"QAR", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"RHD", UCURR_COMMON|UCURR_DEPRECATED},
- {"ROL", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"ROL", UCURR_COMMON|UCURR_DEPRECATED},
+ {"RON", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"RUB", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"RUR", UCURR_COMMON|UCURR_DEPRECATED},
{"RWF", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -934,7 +937,7 @@ static const struct CurrencyList {
{"SEK", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SGD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SHP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"SIT", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"SIT", UCURR_COMMON|UCURR_DEPRECATED},
{"SKK", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SLL", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SOS", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1025,7 +1028,7 @@ ucurr_countCurrencyList(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
static const char* U_CALLCONV
ucurr_nextCurrencyList(UEnumeration *enumerator,
int32_t* resultLength,
- UErrorCode *pErrorCode)
+ UErrorCode * /*pErrorCode*/)
{
UCurrencyContext *myContext = (UCurrencyContext *)(enumerator->context);
@@ -1041,7 +1044,9 @@ ucurr_nextCurrencyList(UEnumeration *enumerator,
}
}
/* We enumerated too far. */
- *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ if (resultLength) {
+ *resultLength = 0;
+ }
return NULL;
}
diff --git a/Build/source/libs/icu-xetex/i18n/udat.cpp b/Build/source/libs/icu-xetex/i18n/udat.cpp
index 140eb3d3ac5..7834b4cbba8 100644
--- a/Build/source/libs/icu-xetex/i18n/udat.cpp
+++ b/Build/source/libs/icu-xetex/i18n/udat.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines
+* Copyright (C) 1996-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
@@ -35,54 +35,48 @@ udat_open(UDateFormatStyle timeStyle,
int32_t patternLength,
UErrorCode *status)
{
- if(U_FAILURE(*status))
- {
+ DateFormat *fmt;
+ if(U_FAILURE(*status)) {
return 0;
}
- if(timeStyle != UDAT_IGNORE)
- {
- DateFormat *fmt;
- if(locale == 0)
+ if(timeStyle != UDAT_IGNORE) {
+ if(locale == 0) {
fmt = DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle,
(DateFormat::EStyle)timeStyle);
- else
+ }
+ else {
fmt = DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle,
(DateFormat::EStyle)timeStyle,
Locale(locale));
-
- if(fmt == 0) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return 0;
}
+ }
+ else {
+ UnicodeString pat((UBool)(patternLength == -1), pattern, patternLength);
- if(tzID != 0) {
- TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
- if(zone == 0) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- delete fmt;
- return 0;
- }
- fmt->adoptTimeZone(zone);
+ if(locale == 0) {
+ fmt = new SimpleDateFormat(pat, *status);
+ }
+ else {
+ fmt = new SimpleDateFormat(pat, Locale(locale), *status);
}
-
- return (UDateFormat*)fmt;
}
- else
- {
- const UnicodeString pat = UnicodeString((UBool)(patternLength == -1), pattern, patternLength);
- UDateFormat *retVal = 0;
- if(locale == 0)
- retVal = (UDateFormat*)new SimpleDateFormat(pat, *status);
- else
- retVal = (UDateFormat*)new SimpleDateFormat(pat, Locale(locale), *status);
+ if(fmt == 0) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
- if(retVal == 0) {
+ if(tzID != 0) {
+ TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
+ if(zone == 0) {
*status = U_MEMORY_ALLOCATION_ERROR;
+ delete fmt;
return 0;
}
- return retVal;
+ fmt->adoptTimeZone(zone);
}
+
+ return (UDateFormat*)fmt;
}
@@ -328,6 +322,10 @@ udat_getSymbols(const UDateFormat *fmt,
res = syms->getEras(count);
break;
+ case UDAT_ERA_NAMES:
+ res = syms->getEraNames(count);
+ break;
+
case UDAT_MONTHS:
res = syms->getMonths(count);
break;
@@ -360,10 +358,6 @@ udat_getSymbols(const UDateFormat *fmt,
return res1.extract(result, resultLength, *status);
}
- case UDAT_ERA_NAMES:
- res = syms->getEraNames(count);
- break;
-
case UDAT_NARROW_MONTHS:
res = syms->getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::NARROW);
break;
@@ -396,6 +390,22 @@ udat_getSymbols(const UDateFormat *fmt,
res = syms->getWeekdays(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::NARROW);
break;
+ case UDAT_QUARTERS:
+ res = syms->getQuarters(count, DateFormatSymbols::FORMAT, DateFormatSymbols::WIDE);
+ break;
+
+ case UDAT_SHORT_QUARTERS:
+ res = syms->getQuarters(count, DateFormatSymbols::FORMAT, DateFormatSymbols::ABBREVIATED);
+ break;
+
+ case UDAT_STANDALONE_QUARTERS:
+ res = syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::WIDE);
+ break;
+
+ case UDAT_STANDALONE_SHORT_QUARTERS:
+ res = syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
+ break;
+
}
if(index < count) {
@@ -440,6 +450,7 @@ udat_countSymbols( const UDateFormat *fmt,
case UDAT_LOCALIZED_CHARS:
count = 1;
break;
+
case UDAT_ERA_NAMES:
syms->getEraNames(count);
break;
@@ -476,6 +487,22 @@ udat_countSymbols( const UDateFormat *fmt,
syms->getWeekdays(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::NARROW);
break;
+ case UDAT_QUARTERS:
+ syms->getQuarters(count, DateFormatSymbols::FORMAT, DateFormatSymbols::WIDE);
+ break;
+
+ case UDAT_SHORT_QUARTERS:
+ syms->getQuarters(count, DateFormatSymbols::FORMAT, DateFormatSymbols::ABBREVIATED);
+ break;
+
+ case UDAT_STANDALONE_QUARTERS:
+ syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::WIDE);
+ break;
+
+ case UDAT_STANDALONE_SHORT_QUARTERS:
+ syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
+ break;
+
}
return count;
@@ -532,6 +559,13 @@ public:
}
static void
+ setEraName(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fEraNames, syms->fEraNamesCount, index, value, valueLength, errorCode);
+ }
+
+ static void
setMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
@@ -546,6 +580,34 @@ public:
}
static void
+ setNarrowMonth(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fNarrowMonths, syms->fNarrowMonthsCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneMonth(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneMonths, syms->fStandaloneMonthsCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneShortMonth(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneShortMonths, syms->fStandaloneShortMonthsCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneNarrowMonth(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneNarrowMonths, syms->fStandaloneNarrowMonthsCount, index, value, valueLength, errorCode);
+ }
+
+ static void
setWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
@@ -560,6 +622,62 @@ public:
}
static void
+ setNarrowWeekday(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fNarrowWeekdays, syms->fNarrowWeekdaysCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneWeekday(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneWeekdays, syms->fStandaloneWeekdaysCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneShortWeekday(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneShortWeekdays, syms->fStandaloneShortWeekdaysCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneNarrowWeekday(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneNarrowWeekdays, syms->fStandaloneNarrowWeekdaysCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setQuarter(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fQuarters, syms->fQuartersCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setShortQuarter(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fShortQuarters, syms->fShortQuartersCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneQuarter(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneQuarters, syms->fStandaloneQuartersCount, index, value, valueLength, errorCode);
+ }
+
+ static void
+ setStandaloneShortQuarter(DateFormatSymbols *syms, int32_t index,
+ const UChar *value, int32_t valueLength, UErrorCode &errorCode)
+ {
+ setSymbol(syms->fStandaloneShortQuarters, syms->fStandaloneShortQuartersCount, index, value, valueLength, errorCode);
+ }
+
+ static void
setAmPm(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
@@ -584,6 +702,7 @@ udat_setSymbols( UDateFormat *format,
int32_t valueLength,
UErrorCode *status)
{
+
if(U_FAILURE(*status)) return;
DateFormatSymbols *syms = (DateFormatSymbols *)((SimpleDateFormat *)format)->getDateFormatSymbols();
@@ -593,6 +712,10 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setEra(syms, index, value, valueLength, *status);
break;
+ case UDAT_ERA_NAMES:
+ DateFormatSymbolsSingleSetter::setEraName(syms, index, value, valueLength, *status);
+ break;
+
case UDAT_MONTHS:
DateFormatSymbolsSingleSetter::setMonth(syms, index, value, valueLength, *status);
break;
@@ -601,6 +724,22 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setShortMonth(syms, index, value, valueLength, *status);
break;
+ case UDAT_NARROW_MONTHS:
+ DateFormatSymbolsSingleSetter::setNarrowMonth(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_MONTHS:
+ DateFormatSymbolsSingleSetter::setStandaloneMonth(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_SHORT_MONTHS:
+ DateFormatSymbolsSingleSetter::setStandaloneShortMonth(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_NARROW_MONTHS:
+ DateFormatSymbolsSingleSetter::setStandaloneNarrowMonth(syms, index, value, valueLength, *status);
+ break;
+
case UDAT_WEEKDAYS:
DateFormatSymbolsSingleSetter::setWeekday(syms, index, value, valueLength, *status);
break;
@@ -609,6 +748,38 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setShortWeekday(syms, index, value, valueLength, *status);
break;
+ case UDAT_NARROW_WEEKDAYS:
+ DateFormatSymbolsSingleSetter::setNarrowWeekday(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_WEEKDAYS:
+ DateFormatSymbolsSingleSetter::setStandaloneWeekday(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_SHORT_WEEKDAYS:
+ DateFormatSymbolsSingleSetter::setStandaloneShortWeekday(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_NARROW_WEEKDAYS:
+ DateFormatSymbolsSingleSetter::setStandaloneNarrowWeekday(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_QUARTERS:
+ DateFormatSymbolsSingleSetter::setQuarter(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_SHORT_QUARTERS:
+ DateFormatSymbolsSingleSetter::setShortQuarter(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_QUARTERS:
+ DateFormatSymbolsSingleSetter::setStandaloneQuarter(syms, index, value, valueLength, *status);
+ break;
+
+ case UDAT_STANDALONE_SHORT_QUARTERS:
+ DateFormatSymbolsSingleSetter::setStandaloneShortQuarter(syms, index, value, valueLength, *status);
+ break;
+
case UDAT_AM_PMS:
DateFormatSymbolsSingleSetter::setAmPm(syms, index, value, valueLength, *status);
break;
@@ -616,6 +787,11 @@ udat_setSymbols( UDateFormat *format,
case UDAT_LOCALIZED_CHARS:
DateFormatSymbolsSingleSetter::setLocalPatternChars(syms, value, valueLength, *status);
break;
+
+ default:
+ *status = U_UNSUPPORTED_ERROR;
+ break;
+
}
}
diff --git a/Build/source/libs/icu-xetex/i18n/ulocdata.c b/Build/source/libs/icu-xetex/i18n/ulocdata.c
index a31000d564c..68c3d1d0345 100644
--- a/Build/source/libs/icu-xetex/i18n/ulocdata.c
+++ b/Build/source/libs/icu-xetex/i18n/ulocdata.c
@@ -21,6 +21,22 @@
#define MEASUREMENT_SYSTEM "MeasurementSystem"
#define PAPER_SIZE "PaperSize"
+/** A locale data object.
+ * For usage in C programs.
+ * @draft ICU 3.4
+ */
+struct ULocaleData {
+ /**
+ * Controls the "No Substitute" behavior of this locale data object
+ */
+ UBool noSubstitute;
+
+ /**
+ * Pointer to the resource bundle associated with this locale data object
+ */
+ UResourceBundle *bundle;
+};
+
U_CAPI ULocaleData* U_EXPORT2
ulocdata_open(const char *localeID, UErrorCode *status)
{
@@ -86,8 +102,7 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
localStatus = U_MISSING_RESOURCE_ERROR;
}
- if (U_FAILURE(localStatus) || (localStatus != U_USING_DEFAULT_WARNING &&
- localStatus != U_USING_FALLBACK_WARNING )) {
+ if (localStatus != U_ZERO_ERROR) {
*status = localStatus;
}
@@ -129,8 +144,7 @@ ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
localStatus = U_MISSING_RESOURCE_ERROR;
}
- if (U_FAILURE(localStatus) || (localStatus != U_USING_DEFAULT_WARNING &&
- localStatus != U_USING_FALLBACK_WARNING )) {
+ if (localStatus != U_ZERO_ERROR) {
*status = localStatus;
}
@@ -146,8 +160,7 @@ ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
localStatus = U_MISSING_RESOURCE_ERROR;
}
- if (U_FAILURE(localStatus) || (localStatus != U_USING_DEFAULT_WARNING &&
- localStatus != U_USING_FALLBACK_WARNING )) {
+ if (localStatus != U_ZERO_ERROR) {
*status = localStatus;
}
diff --git a/Build/source/libs/icu-xetex/i18n/umsg.cpp b/Build/source/libs/icu-xetex/i18n/umsg.cpp
index 696c6daae9a..8a58ee0442c 100644
--- a/Build/source/libs/icu-xetex/i18n/umsg.cpp
+++ b/Build/source/libs/icu-xetex/i18n/umsg.cpp
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -614,93 +614,93 @@ umsg_vparse(const UMessageFormat *fmt,
#define MAppend(c) if (len < destCapacity) dest[len++] = c; else len++
int32_t umsg_autoQuoteApostrophe(const UChar* pattern,
- int32_t patternLength,
- UChar* dest,
- int32_t destCapacity,
- UErrorCode* ec)
+ int32_t patternLength,
+ UChar* dest,
+ int32_t destCapacity,
+ UErrorCode* ec)
{
- int32_t state = STATE_INITIAL;
- int32_t braceCount = 0;
- int32_t len = 0;
-
- if (ec == NULL || U_FAILURE(*ec)) {
- return -1;
- }
-
- if (pattern == NULL || patternLength < -1 || (dest == NULL && destCapacity > 0)) {
- *ec = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
-
- if (patternLength == -1) {
- patternLength = u_strlen(pattern);
- }
-
- for (int i = 0; i < patternLength; ++i) {
- UChar c = pattern[i];
- switch (state) {
- case STATE_INITIAL:
- switch (c) {
- case SINGLE_QUOTE:
- state = STATE_SINGLE_QUOTE;
- break;
- case CURLY_BRACE_LEFT:
- state = STATE_MSG_ELEMENT;
- ++braceCount;
- break;
- }
- break;
-
- case STATE_SINGLE_QUOTE:
- switch (c) {
- case SINGLE_QUOTE:
- state = STATE_INITIAL;
- break;
- case CURLY_BRACE_LEFT:
- case CURLY_BRACE_RIGHT:
- state = STATE_IN_QUOTE;
- break;
- default:
- MAppend(SINGLE_QUOTE);
- state = STATE_INITIAL;
- break;
- }
- break;
-
- case STATE_IN_QUOTE:
- switch (c) {
- case SINGLE_QUOTE:
- state = STATE_INITIAL;
- break;
- }
- break;
-
- case STATE_MSG_ELEMENT:
- switch (c) {
- case CURLY_BRACE_LEFT:
- ++braceCount;
- break;
- case CURLY_BRACE_RIGHT:
- if (--braceCount == 0) {
- state = STATE_INITIAL;
- }
- break;
- }
- break;
-
- default: // Never happens.
- break;
+ int32_t state = STATE_INITIAL;
+ int32_t braceCount = 0;
+ int32_t len = 0;
+
+ if (ec == NULL || U_FAILURE(*ec)) {
+ return -1;
+ }
+
+ if (pattern == NULL || patternLength < -1 || (dest == NULL && destCapacity > 0)) {
+ *ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+
+ if (patternLength == -1) {
+ patternLength = u_strlen(pattern);
}
- MAppend(c);
- }
+ for (int i = 0; i < patternLength; ++i) {
+ UChar c = pattern[i];
+ switch (state) {
+ case STATE_INITIAL:
+ switch (c) {
+ case SINGLE_QUOTE:
+ state = STATE_SINGLE_QUOTE;
+ break;
+ case CURLY_BRACE_LEFT:
+ state = STATE_MSG_ELEMENT;
+ ++braceCount;
+ break;
+ }
+ break;
+
+ case STATE_SINGLE_QUOTE:
+ switch (c) {
+ case SINGLE_QUOTE:
+ state = STATE_INITIAL;
+ break;
+ case CURLY_BRACE_LEFT:
+ case CURLY_BRACE_RIGHT:
+ state = STATE_IN_QUOTE;
+ break;
+ default:
+ MAppend(SINGLE_QUOTE);
+ state = STATE_INITIAL;
+ break;
+ }
+ break;
- // End of scan
- if (state == STATE_SINGLE_QUOTE || state == STATE_IN_QUOTE) {
- MAppend(SINGLE_QUOTE);
- }
+ case STATE_IN_QUOTE:
+ switch (c) {
+ case SINGLE_QUOTE:
+ state = STATE_INITIAL;
+ break;
+ }
+ break;
+
+ case STATE_MSG_ELEMENT:
+ switch (c) {
+ case CURLY_BRACE_LEFT:
+ ++braceCount;
+ break;
+ case CURLY_BRACE_RIGHT:
+ if (--braceCount == 0) {
+ state = STATE_INITIAL;
+ }
+ break;
+ }
+ break;
+
+ default: // Never happens.
+ break;
+ }
+
+ MAppend(c);
+ }
+
+ // End of scan
+ if (state == STATE_SINGLE_QUOTE || state == STATE_IN_QUOTE) {
+ MAppend(SINGLE_QUOTE);
+ }
- return u_terminateUChars(dest, destCapacity, len, ec);
+ return u_terminateUChars(dest, destCapacity, len, ec);
}
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/unesctrn.h b/Build/source/libs/icu-xetex/i18n/unesctrn.h
index 1c181d14643..2418bce7a5a 100644
--- a/Build/source/libs/icu-xetex/i18n/unesctrn.h
+++ b/Build/source/libs/icu-xetex/i18n/unesctrn.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
- * Copyright (c) 2001-2004, International Business Machines
+ * Copyright (c) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -79,15 +79,11 @@ class U_I18N_API UnescapeTransliterator : public Transliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/uni2name.h b/Build/source/libs/icu-xetex/i18n/uni2name.h
index 84551151496..3e9412fe34d 100644
--- a/Build/source/libs/icu-xetex/i18n/uni2name.h
+++ b/Build/source/libs/icu-xetex/i18n/uni2name.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2004, International Business Machines
+* Copyright (C) 2001-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -55,15 +55,11 @@ class U_I18N_API UnicodeNameTransliterator : public Transliterator {
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @draft ICU 2.2
*/
static UClassID U_EXPORT2 getStaticClassID();
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/calendar.h b/Build/source/libs/icu-xetex/i18n/unicode/calendar.h
index 91dd1c44eb4..14fdd817d88 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/calendar.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/calendar.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -37,6 +37,7 @@
#include "unicode/locid.h"
#include "unicode/timezone.h"
#include "unicode/ucal.h"
+#include "unicode/umisc.h"
U_NAMESPACE_BEGIN
@@ -45,14 +46,9 @@ class ICUServiceFactory;
/**
* @internal
*/
-typedef const void* URegistryKey;
-
-/**
- * @internal
- */
typedef int32_t UFieldResolutionTable[12][8];
-/**.
+/**
* <code>Calendar</code> is an abstract base class for converting between
* a <code>UDate</code> object and a set of integer fields such as
* <code>YEAR</code>, <code>MONTH</code>, <code>DAY</code>, <code>HOUR</code>,
@@ -1591,7 +1587,7 @@ protected:
* computed. This occurs only in setTimeInMillis(). A calendar set
* to this state will compute all fields from the time if it becomes
* necessary, but otherwise will delay such computation.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UBool fAreFieldsVirtuallySet;
@@ -2091,7 +2087,7 @@ private:
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/coll.h b/Build/source/libs/icu-xetex/i18n/unicode/coll.h
index 638d8c54b7b..a01fabc074d 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/coll.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/coll.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines *
+* Copyright (C) 1996-2006, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
@@ -58,6 +58,7 @@
#include "unicode/normlzr.h"
#include "unicode/locid.h"
#include "unicode/uniset.h"
+#include "unicode/umisc.h"
U_NAMESPACE_BEGIN
@@ -67,11 +68,6 @@ class StringEnumeration;
/**
* @stable ICU 2.6
*/
-typedef const void* URegistryKey;
-
-/**
- * @stable ICU 2.6
- */
class CollatorFactory;
#endif
@@ -623,7 +619,7 @@ public:
* @param status input-output error code
* @return a string enumeration over locale strings. The caller is
* responsible for closing the result.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static StringEnumeration* U_EXPORT2 getKeywords(UErrorCode& status);
@@ -636,7 +632,7 @@ public:
* @param status input-output error code
* @return a string enumeration over collation keyword values, or NULL
* upon error. The caller is responsible for deleting the result.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static StringEnumeration* U_EXPORT2 getKeywordValues(const char *keyword, UErrorCode& status);
@@ -665,7 +661,7 @@ public:
* @param status reference to input-output error code
* @return the functionally equivalent collation locale, or the root
* locale upon error.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static Locale U_EXPORT2 getFunctionalEquivalent(const char* keyword, const Locale& locale,
UBool& isAvailable, UErrorCode& status);
@@ -983,7 +979,7 @@ public:
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~CollatorFactory();
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/curramt.h b/Build/source/libs/icu-xetex/i18n/unicode/curramt.h
index 94bf806c2b8..c33e6f1f833 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/curramt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/curramt.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2005, International Business Machines
+* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN
* A currency together with a numeric amount, such as 200 USD.
*
* @author Alan Liu
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
class U_I18N_API CurrencyAmount: public Measure {
public:
@@ -42,7 +42,7 @@ class U_I18N_API CurrencyAmount: public Measure {
* NULL and must have length 3
* @param ec input-output error code. If the amount or the isoCode
* is invalid, then this will be set to a failing value.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyAmount(const Formattable& amount, const UChar* isoCode,
UErrorCode &ec);
@@ -55,33 +55,33 @@ class U_I18N_API CurrencyAmount: public Measure {
* NULL and must have length 3
* @param ec input-output error code. If the isoCode is invalid,
* then this will be set to a failing value.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyAmount(double amount, const UChar* isoCode,
UErrorCode &ec);
/**
* Copy constructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyAmount(const CurrencyAmount& other);
/**
* Assignment operator
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyAmount& operator=(const CurrencyAmount& other);
/**
* Return a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UObject* clone() const;
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~CurrencyAmount();
@@ -91,7 +91,7 @@ class U_I18N_API CurrencyAmount: public Measure {
* @return The class ID for this object. All objects of a given
* class have the same class ID. Objects of other classes have
* different class IDs.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UClassID getDynamicClassID() const;
@@ -99,19 +99,19 @@ class U_I18N_API CurrencyAmount: public Measure {
* Returns the class ID for this class. This is used to compare to
* the return value of getDynamicClassID().
* @return The class ID for all objects of this class.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* Return the currency unit object of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
inline const CurrencyUnit& getCurrency() const;
/**
* Return the ISO currency code of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
inline const UChar* getISOCurrency() const;
};
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/currunit.h b/Build/source/libs/icu-xetex/i18n/unicode/currunit.h
index 4acff270bd5..ecd94110292 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/currunit.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/currunit.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2005, International Business Machines
+* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN
* subclasses MeasureUnit, for use with Measure and MeasureFormat.
*
* @author Alan Liu
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
class U_I18N_API CurrencyUnit: public MeasureUnit {
public:
@@ -40,39 +40,39 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* NULL and must have length 3
* @param ec input-output error code. If the isoCode is invalid,
* then this will be set to a failing value.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyUnit(const UChar* isoCode, UErrorCode &ec);
/**
* Copy constructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyUnit(const CurrencyUnit& other);
/**
* Assignment operator
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
CurrencyUnit& operator=(const CurrencyUnit& other);
/**
* Return a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UObject* clone() const;
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~CurrencyUnit();
/**
* Equality operator. Return true if this object is equal
* to the given object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UBool operator==(const UObject& other) const;
@@ -82,7 +82,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* @return The class ID for this object. All objects of a given
* class have the same class ID. Objects of other classes have
* different class IDs.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UClassID getDynamicClassID() const;
@@ -90,13 +90,13 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* Returns the class ID for this class. This is used to compare to
* the return value of getDynamicClassID().
* @return The class ID for all objects of this class.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* Return the ISO currency code of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
inline const UChar* getISOCurrency() const;
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h b/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h
index 3769ea0299a..ac040c06e0a 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -119,8 +119,12 @@ public:
/** Nan symbol */
kNaNSymbol,
/** Significant digit symbol
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
kSignificantDigitSymbol,
+ /** The monetary grouping separator
+ * @draft ICU 3.6
+ */
+ kMonetaryGroupingSeparatorSymbol,
/** count symbol constants */
kFormatSymbolCount
};
@@ -214,7 +218,7 @@ public:
/**
* Returns the locale for this object. Two flavors are available:
* valid and actual locale.
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
@@ -277,6 +281,12 @@ public:
*/
inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const;
+ /**
+ * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API.
+ * @internal
+ */
+ inline const UChar* getCurrencyPattern(void) const;
+
private:
/**
* Private symbol strings.
@@ -305,6 +315,7 @@ private:
char actualLocale[ULOC_FULLNAME_CAPACITY];
char validLocale[ULOC_FULLNAME_CAPACITY];
+ const UChar* currPattern;
};
// -------------------------------------
@@ -347,7 +358,10 @@ DecimalFormatSymbols::getLocale() const {
return locale;
}
-
+inline const UChar*
+DecimalFormatSymbols::getCurrencyPattern() const {
+ return currPattern;
+}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h
index c6922c0dd67..296906fb7d7 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -1119,7 +1119,7 @@ public:
* The width is counted in 16-bit code units.
* @return the format width, or zero if no padding is in effect
* @see #setFormatWidth
- * @see #getPadCharacter
+ * @see #getPadCharacterString
* @see #setPadCharacter
* @see #getPadPosition
* @see #setPadPosition
@@ -1135,7 +1135,7 @@ public:
* format(), or zero to disable padding. A negative
* width is equivalent to 0.
* @see #getFormatWidth
- * @see #getPadCharacter
+ * @see #getPadCharacterString
* @see #setPadCharacter
* @see #getPadPosition
* @see #setPadPosition
@@ -1166,7 +1166,7 @@ public:
* padChar.char32At(0) will be used as the pad character.
* @see #setFormatWidth
* @see #getFormatWidth
- * @see #getPadCharacter
+ * @see #getPadCharacterString
* @see #getPadPosition
* @see #setPadPosition
* @stable ICU 2.0
@@ -1183,7 +1183,7 @@ public:
* @see #setFormatWidth
* @see #getFormatWidth
* @see #setPadCharacter
- * @see #getPadCharacter
+ * @see #getPadCharacterString
* @see #setPadPosition
* @see #kPadBeforePrefix
* @see #kPadAfterPrefix
@@ -1204,7 +1204,7 @@ public:
* @see #setFormatWidth
* @see #getFormatWidth
* @see #setPadCharacter
- * @see #getPadCharacter
+ * @see #getPadCharacterString
* @see #getPadPosition
* @see #kPadBeforePrefix
* @see #kPadAfterPrefix
@@ -1540,7 +1540,7 @@ public:
* displayed. This value has no effect unless areSignificantDigitsUsed()
* returns true.
* @return the fewest significant digits that will be shown
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int32_t getMinimumSignificantDigits() const;
@@ -1549,7 +1549,7 @@ public:
* displayed. This value has no effect unless areSignificantDigitsUsed()
* returns true.
* @return the most significant digits that will be shown
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int32_t getMaximumSignificantDigits() const;
@@ -1560,7 +1560,7 @@ public:
* <code>min</code>, then it is set to <code>min</code>. This
* value has no effect unless areSignificantDigits() returns true.
* @param min the fewest significant digits to be shown
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
void setMinimumSignificantDigits(int32_t min);
@@ -1572,7 +1572,7 @@ public:
* This value has no effect unless areSignificantDigits() returns
* true.
* @param max the most significant digits to be shown
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
void setMaximumSignificantDigits(int32_t max);
@@ -1580,7 +1580,7 @@ public:
* Returns true if significant digits are in use, or false if
* integer and fraction digit counts are in use.
* @return true if significant digits are in use
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UBool areSignificantDigitsUsed() const;
@@ -1589,7 +1589,7 @@ public:
* fraction digit counts are in use.
* @param useSignificantDigits true to use significant digits, or
* false to use integer and fraction digit counts
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
void setSignificantDigitsUsed(UBool useSignificantDigits);
@@ -1604,7 +1604,7 @@ public:
* to use. It need not be null-terminated. May be the empty
* string or NULL to indicate no currency.
* @param ec input-output error code
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
@@ -1782,8 +1782,6 @@ private:
void setCurrencyForSymbols();
- void setCurrencyForLocale(const char* locale, UErrorCode& ec);
-
/**
* Constants.
*/
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h b/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h
index bf4913669b3..d758cf7728f 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -35,6 +35,7 @@ U_NAMESPACE_BEGIN
/* forward declaration */
class SimpleDateFormat;
+class Hashtable;
/**
* DateFormatSymbols is a public class for encapsulating localizable date-time
@@ -202,6 +203,14 @@ public:
const UnicodeString* getEraNames(int32_t& count) const;
/**
+ * Sets era name strings. For example: "Anno Domini" and "Before Christ".
+ * @param eraNames Array of era name strings (DateFormatSymbols retains ownership.)
+ * @param count Filled in with length of the array.
+ * @draft ICU 3.6
+ */
+ void setEraNames(const UnicodeString* eraNames, int32_t count);
+
+ /**
* Gets month strings. For example: "January", "February", etc.
* @param count Filled in with length of the array.
* @return the month strings. (DateFormatSymbols retains ownership.)
@@ -235,41 +244,31 @@ public:
*/
void setShortMonths(const UnicodeString* shortMonths, int32_t count);
+ /**
+ * Selector for date formatting context
+ * @draft ICU 3.6
+ */
enum DtContextType {
- /**
- * Selector for format date context
- * @draft ICU 3.4
- */
- FORMAT = 0,
- /**
- * Selector for standalone date context
- * @draft ICU 3.4
- */
- STANDALONE = 1
+ FORMAT,
+ STANDALONE,
+ DT_CONTEXT_COUNT
};
+ /**
+ * Selector for date formatting width
+ * @draft ICU 3.6
+ */
enum DtWidthType {
- /**
- * Selector for wide strings
- * @draft ICU 3.4
- */
- WIDE = 4,
- /**
- * Selector for abbreviated strings
- * @draft ICU 3.4
- */
- ABBREVIATED = 3,
- /**
- * Selector for narrow strings
- * @draft ICU 3.4
- */
- NARROW = 5
+ ABBREVIATED,
+ WIDE,
+ NARROW,
+ DT_WIDTH_COUNT
};
/**
* Gets month strings by width and context. For example: "January", "February", etc.
* @param count Filled in with length of the array.
- * @param context The day formatting context, either FORMAT or STANDALONE
+ * @param context The formatting context, either FORMAT or STANDALONE
* @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
* @return the month strings. (DateFormatSymbols retains ownership.)
* @draft ICU 3.4
@@ -277,6 +276,17 @@ public:
const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
/**
+ * Sets month strings by width and context. For example: "January", "February", etc.
+ *
+ * @param months The new month strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
+ * @draft ICU 3.6
+ */
+ void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
* Gets weekday strings. For example: "Sunday", "Monday", etc.
* @param count Filled in with length of the array.
* @return the weekday strings. (DateFormatSymbols retains ownership.)
@@ -312,14 +322,47 @@ public:
/**
* Gets weekday strings by width and context. For example: "Sunday", "Monday", etc.
* @param count Filled in with length of the array.
- * @param context The day formatting context, either FORMAT or STANDALONE
- * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
* @return the month strings. (DateFormatSymbols retains ownership.)
* @draft ICU 3.4
*/
const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
/**
+ * Sets weekday strings by width and context. For example: "Sunday", "Monday", etc.
+ * @param weekdays The new weekday strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
+ * @draft ICU 3.6
+ */
+ void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
+ * Gets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE or ABBREVIATED. There
+ * are no NARROW quarters.
+ * @return the quarter strings. (DateFormatSymbols retains ownership.)
+ * @draft ICU 3.6
+ */
+ const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
+
+ /**
+ * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
+ *
+ * @param quarters The new quarter strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE or ABBREVIATED. There
+ * are no NARROW quarters.
+ * @draft ICU 3.6
+ */
+ void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
* Gets AM/PM strings. For example: "AM" and "PM".
* @param count Filled in with length of the array.
* @return the weekday strings. (DateFormatSymbols retains ownership.)
@@ -340,7 +383,7 @@ public:
* @param rowCount Output param to receive number of rows.
* @param columnCount Output param to receive number of columns.
* @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)
- * @stable ICU 2.0
+ * @deprecated ICU 3.6
*/
const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
@@ -379,7 +422,7 @@ public:
/**
* Returns the locale for this object. Two flavors are available:
* valid and actual locale.
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
@@ -397,6 +440,55 @@ public:
*/
static UClassID U_EXPORT2 getStaticClassID();
+ /**
+ * The translation type of the translated zone strings
+ * @internal ICU 3.6
+ */
+ enum TimeZoneTranslationType {
+ TIMEZONE_SHORT_GENERIC,
+ TIMEZONE_SHORT_STANDARD,
+ TIMEZONE_SHORT_DAYLIGHT,
+ TIMEZONE_LONG_GENERIC,
+ TIMEZONE_LONG_STANDARD,
+ TIMEZONE_LONG_DAYLIGHT,
+ TIMEZONE_EXEMPLAR_CITY,
+ TIMEZONE_COUNT
+ };
+
+ /**
+ * Creates an enumeration of time zone IDs. The object is owned by the caller and should delete it after use.
+ * The time zone IDs are just for programmatic lookup. NOT LOCALIZED!!!
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @return A new StringEnumeration object
+ * @internal ICU 3.6
+ */
+ virtual StringEnumeration* createZoneStringIDs(UErrorCode &status);
+
+ /**
+ * Gets timezone string give the key and translation type
+ * @param ID The ID of zone strings, e.g: "America/Los_Angeles".
+ * The time zone ID is for programmatic lookup.
+ * @param type The translation type requested
+ * @param result Output parameter to recieve the translation string
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @return the input UnicodeString parameter for chaining
+ * @internal ICU 3.6
+ */
+ UnicodeString& getZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, UnicodeString &result, UErrorCode &status);
+
+ /**
+ * Sets timezone string for the given the ID and translation type
+ * @param ID The ID of zone strings, e.g: "America/Los_Angeles".
+ * The time zone ID is for programmatic lookup.
+ * @param type The translation type to set the value for
+ * @param value The string with which current translation needs to be replaced
+ * @param status Input/output parameter, set to success or
+ * @internal ICU 3.6
+ */
+ void setZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, const UnicodeString &value, UErrorCode &status);
+
private:
friend class SimpleDateFormat;
@@ -493,11 +585,38 @@ private:
int32_t fAmPmsCount;
/**
+ * Quarter strings. For example: "1st quarter", "2nd quarter", etc.
+ */
+ UnicodeString *fQuarters;
+ int32_t fQuartersCount;
+
+ /**
+ * Short quarters. For example: "Q1", "Q2", etc.
+ */
+ UnicodeString *fShortQuarters;
+ int32_t fShortQuartersCount;
+
+ /**
+ * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc.
+ */
+ UnicodeString *fStandaloneQuarters;
+ int32_t fStandaloneQuartersCount;
+
+ /**
+ * Standalone short quarter strings. For example: "Q1", "Q2", etc.
+ */
+ UnicodeString *fStandaloneShortQuarters;
+ int32_t fStandaloneShortQuartersCount;
+
+ /**
* The format data of all the timezones in this locale.
*/
UnicodeString** fZoneStrings;
int32_t fZoneStringsRowCount;
int32_t fZoneStringsColCount;
+ StringEnumeration* fZoneIDEnumeration;
+ Hashtable* fZoneStringsHash;
+ UResourceBundle* fResourceBundle;
/**
* Localized date-time pattern characters. For example: use 'u' as 'y'.
@@ -588,6 +707,61 @@ private:
* Delete just the zone strings.
*/
void disposeZoneStrings(void);
+ /**
+ * Initializes the zoneStrings hash and keys StringEnumeration after reading the zoneStrings resource
+ */
+ void initZoneStrings(UErrorCode &status);
+ /**
+ * initialzes the zoneStrings has and keys enumeration after reading the strings[][]. Required for backwards
+ * compatibility of setZoneStrings method
+ */
+ void initZoneStrings(const UnicodeString** strings, int32_t rowCount, int32_t collumnCount, UErrorCode& status);
+ /**
+ * initialization of the fZoneStrings data member
+ */
+ void initZoneStringsArray(UErrorCode& status);
+ /**
+ * Creates a deep clone of the Hashtable
+ */
+ Hashtable* createZoneStringsHash(const Hashtable* otherHash);
+
+ /**
+ * Fetches the key from the hashtable for a given ID.
+ * e.g: for a given ID such as PST returns "Americal/Los_Angeles"
+ * Used by SimpleDateFormat class.
+ * @param ID The id of the time zone for which the key needs to be fetched
+ * @param result Output parameter to recieve the key.
+ * @return the input UnicodeString object for chaining
+ */
+ UnicodeString& getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status);
+
+ /**
+ * Fetches the zone type and zone string from the hashtable for a given key.
+ * e.g: for key: "Americal/Los_Angeles", text: "2004/1/1 PT 1:00" and start:9
+ * returns TIMEZONE_SHORT_GENERIC and "PT".
+ * Used by SimpleDateFormat class.
+ * @param ID the name of the timezone
+ * @param text the string containing the time zone translation
+ * @param start The position in string where time zone string starts
+ * @param type output parameter to recieve the type of time zone string
+ * @param value output parameter to recieve the the acutal time zone string
+ */
+ void getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
+
+ /**
+ * Fetches the zone type and zone string from the hashtable by cycling through all elements in the hashtable.
+ * e.g: text: "2004/1/1 PT 1:00" and start:9
+ * returns "Americal/Los_Angeles", TIMEZONE_SHORT_GENERIC and "PT". Used by SimpleDateFormat class.
+ * Used by SimpleDateFormat class.
+ * @param ID output parameter to recieve the key name of the time zone
+ * @param text the string containing the time zone translation
+ * @param start The position in string where time zone string starts
+ * @param type output parameter to recieve the type of time zone string
+ * @param value output parameter to recieve the the acutal time zone string
+ * @param status output parameter to recive the error information
+ */
+ void findZoneIDTypeValue(UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
+
};
U_NAMESPACE_END
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h b/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h
index b0b4786df1d..94ee32843f5 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2005, International Business Machines
+* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -127,7 +127,7 @@ public:
/**
* Creates a Formattable object that adopts the given UObject.
* @param objectToAdopt the UObject to set this object to
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
Formattable(UObject* objectToAdopt);
@@ -232,7 +232,7 @@ public:
/**
* Selector indicating a UObject value. Use getObject to
* retrieve the value.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
kObject
};
@@ -248,7 +248,7 @@ public:
* Returns TRUE if the data type of this Formattable object
* is kDouble, kLong, or kInt64.
* @return TRUE if this is a pure numeric object
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UBool isNumeric() const;
@@ -270,7 +270,7 @@ public:
* the status is set to U_INVALID_FORMAT_ERROR.
* @param status the error code
* @return the double value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
double getDouble(UErrorCode& status) const;
@@ -296,7 +296,7 @@ public:
* the status is set to U_INVALID_FORMAT_ERROR.
* @param status the error code
* @return the long value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int32_t getLong(UErrorCode& status) const;
@@ -321,7 +321,7 @@ public:
* the status is set to U_INVALID_FORMAT_ERROR.
* @param status the error code
* @return the int64 value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int64_t getInt64(UErrorCode& status) const;
@@ -339,7 +339,7 @@ public:
* undefined.
* @param status the error code.
* @return the Date value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDate getDate(UErrorCode& status) const;
@@ -360,7 +360,7 @@ public:
* @param result Output param to receive the Date value of this object.
* @param status the error code.
* @return A reference to 'result'.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UnicodeString& getString(UnicodeString& result, UErrorCode& status) const;
@@ -379,7 +379,7 @@ public:
* U_INVALID_FORMAT_ERROR and the result is a bogus string.
* @param status the error code.
* @return a const reference to the string value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
const UnicodeString& getString(UErrorCode& status) const;
@@ -397,7 +397,7 @@ public:
* and the result is a bogus string.
* @param status the error code.
* @return a reference to the string value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UnicodeString& getString(UErrorCode& status);
@@ -418,7 +418,7 @@ public:
* @param count fill-in with the count of this object.
* @param status the error code.
* @return the array value of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
const Formattable* getArray(int32_t& count, UErrorCode& status) const;
@@ -436,7 +436,7 @@ public:
* Returns a pointer to the UObject contained within this
* formattable, or NULL if this object does not contain a UObject.
* @return a UObject pointer, or NULL
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
const UObject* getObject() const;
@@ -509,7 +509,7 @@ public:
* the type to kObject. After this call, the caller must not
* delete the given object.
* @param objectToAdopt the UObject value to be adopted
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
void adoptObject(UObject* objectToAdopt);
@@ -542,15 +542,6 @@ private:
*/
void dispose(void);
- /**
- * Creates a new Formattable array and copies the values from the specified
- * original.
- * @param array the original array
- * @param count the original array count
- * @return the new Formattable array.
- */
- static Formattable* createArrayCopy(const Formattable* array, int32_t count);
-
UnicodeString* getBogus() const;
union {
@@ -569,14 +560,6 @@ private:
UnicodeString fBogus; // Bogus string when it's needed.
};
-inline Formattable*
-Formattable::createArrayCopy(const Formattable* array, int32_t count)
-{
- Formattable *result = new Formattable[count];
- for (int32_t i=0; i<count; ++i) result[i] = array[i]; // Don't memcpy!
- return result;
-}
-
inline UDate Formattable::getDate(UErrorCode& status) const {
if (fType != kDate) {
if (U_SUCCESS(status)) {
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/format.h b/Build/source/libs/icu-xetex/i18n/unicode/format.h
index 75e53f839b3..7f17b52f00a 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/format.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/format.h
@@ -1,6 +1,7 @@
/*
********************************************************************************
-* Copyright (C) {1997-2005}, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
********************************************************************************
*
* File FORMAT.H
@@ -236,7 +237,7 @@ public:
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h b/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h
index 7430b82f96d..f2d1b0b17d5 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h
@@ -1,5 +1,6 @@
/*
-* Copyright (C) {1997-2005}, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
********************************************************************************
*
* File GREGOCAL.H
@@ -398,7 +399,7 @@ public:
* @param field the time field.
* @param status error result.
* @return the minimum value that this field could have, given the current date.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const;
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h
index 76c752cb856..a5af55e9d53 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2005, International Business Machines
+* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -36,7 +36,7 @@ U_NAMESPACE_BEGIN
*
* @see Format
* @author Alan Liu
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
class U_I18N_API MeasureFormat : public Format {
@@ -48,7 +48,7 @@ class U_I18N_API MeasureFormat : public Format {
* @param locale desired locale
* @param ec input-output error code
* @return a formatter object, or NULL upon error
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale,
UErrorCode& ec);
@@ -58,7 +58,7 @@ class U_I18N_API MeasureFormat : public Format {
* locale.
* @param ec input-output error code
* @return a formatter object, or NULL upon error
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec);
@@ -66,7 +66,7 @@ class U_I18N_API MeasureFormat : public Format {
/**
* Default constructor.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
MeasureFormat();
};
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measunit.h b/Build/source/libs/icu-xetex/i18n/unicode/measunit.h
index eae8dec978f..9a210e65957 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/measunit.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measunit.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2005, International Business Machines
+* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -31,34 +31,34 @@ U_NAMESPACE_BEGIN
* <p>This is an abstract class.
*
* @author Alan Liu
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
class U_I18N_API MeasureUnit: public UObject {
public:
/**
* Return a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UObject* clone() const = 0;
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~MeasureUnit();
/**
* Equality operator. Return true if this object is equal
* to the given object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UBool operator==(const UObject& other) const = 0;
protected:
/**
* Default constructor.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
MeasureUnit();
};
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measure.h b/Build/source/libs/icu-xetex/i18n/unicode/measure.h
index 84f29fe5119..6b7a0497b47 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/measure.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measure.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2005, International Business Machines
+* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -40,7 +40,7 @@ class MeasureUnit;
* <p>This is an abstract class.
*
* @author Alan Liu
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
class U_I18N_API Measure: public UObject {
public:
@@ -52,40 +52,40 @@ class U_I18N_API Measure: public UObject {
* @param adoptedUnit the unit object, which must not be NULL
* @param ec input-output error code. If the amount or the unit
* is invalid, then this will be set to a failing value.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
Measure(const Formattable& number, MeasureUnit* adoptedUnit,
UErrorCode& ec);
/**
* Copy constructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
Measure(const Measure& other);
/**
* Assignment operator
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
Measure& operator=(const Measure& other);
/**
* Return a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UObject* clone() const = 0;
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~Measure();
/**
* Equality operator. Return true if this object is equal
* to the given object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UBool operator==(const UObject& other) const;
@@ -93,20 +93,20 @@ class U_I18N_API Measure: public UObject {
* Return a reference to the numeric value of this object. The
* numeric value may be of any numeric type supported by
* Formattable.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
inline const Formattable& getNumber() const;
/**
* Return a reference to the unit of this object.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
inline const MeasureUnit& getUnit() const;
protected:
/**
* Default constructor.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
Measure();
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h
index e9713ec4433..815cabbb944 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others. All Rights Reserved.
********************************************************************************
*
* File MSGFMT.H
@@ -611,7 +611,7 @@ public:
* @param status Input/output error code. If the pattern
* cannot be parsed, the failure code is set.
* @return the standard equivalent of the original pattern
- * @since ICU 3.4
+ * @stable ICU 3.4
*/
static UnicodeString autoQuoteApostrophe(const UnicodeString& pattern,
UErrorCode& status);
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h
index 764ff36af8d..b27ed470819 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h
@@ -1,5 +1,7 @@
/*
-* Copyright (C) {1997-2005}, International Business Machines Corporation and others. All Rights Reserved.
+********************************************************************************
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
********************************************************************************
*
* File NUMFMT.H
@@ -39,11 +41,6 @@ U_NAMESPACE_BEGIN
#if !UCONFIG_NO_SERVICE
class NumberFormatFactory;
class StringEnumeration;
-
-/**
- * @internal
- */
-typedef const void* URegistryKey;
#endif
/**
@@ -645,7 +642,7 @@ public:
* to use. It need not be null-terminated. May be the empty
* string or NULL to indicate no currency.
* @param ec input-output error code
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
@@ -771,7 +768,7 @@ public:
/**
* Destructor
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~NumberFormatFactory();
@@ -802,7 +799,7 @@ public:
/**
* A NumberFormatFactory that supports a single locale. It can be visible or invisible.
- * @draft ICU 3.0
+ * @stable ICU 2.6
*/
class U_I18N_API SimpleNumberFormatFactory : public NumberFormatFactory {
protected:
@@ -825,7 +822,7 @@ public:
SimpleNumberFormatFactory(const Locale& locale, UBool visible = TRUE);
/**
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual ~SimpleNumberFormatFactory();
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h b/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h
index 59cdf10616c..030565eb284 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and others.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
@@ -22,7 +22,7 @@
*
* @stable ICU 2.4
*/
-#if defined(U_INT64_T_UNAVAILABLE) || UCONFIG_NO_FORMATTING
+#if UCONFIG_NO_FORMATTING
#define U_HAVE_RBNF 0
#else
#define U_HAVE_RBNF 1
@@ -57,16 +57,13 @@ class Collator;
#endif
/**
- *
- * <h2> Rule Based Number Format C++ API </h2>
- *
- * <p>A class that formats numbers according to a set of rules. This number formatter is
+ * The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is
* typically used for spelling out numeric values in words (e.g., 25,3476 as
* &quot;twenty-five thousand three hundred seventy-six&quot; or &quot;vingt-cinq mille trois
* cents soixante-seize&quot; or
* &quot;f&uuml;nfundzwanzigtausenddreihundertsechsundsiebzig&quot;), but can also be used for
* other complicated formatting tasks, such as formatting a number of seconds as hours,
- * minutes and seconds (e.g., 3,730 as &quot;1:02:10&quot;).</p>
+ * minutes and seconds (e.g., 3,730 as &quot;1:02:10&quot;).
*
* <p>The resources contain three predefined formatters for each locale: spellout, which
* spells out a value in words (123 is &quot;one hundred twenty-three&quot;); ordinal, which
@@ -517,7 +514,7 @@ public:
* syntax.
* @param perror The parse error if an error was encountered.
* @param status The status indicating whether the constructor succeeded.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
RuleBasedNumberFormat(const UnicodeString& rules, UParseError& perror, UErrorCode& status);
@@ -542,7 +539,7 @@ public:
* names in the description. These will be copied by the constructor.
* @param perror The parse error if an error was encountered.
* @param status The status indicating whether the constructor succeeded.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
UParseError& perror, UErrorCode& status);
@@ -589,7 +586,7 @@ public:
* lenient parsing.
* @param perror The parse error if an error was encountered.
* @param status The status indicating whether the constructor succeeded.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
const Locale& locale, UParseError& perror, UErrorCode& status);
@@ -680,7 +677,7 @@ public:
/**
* Return the number of locales for which we have localized rule set display names.
* @return the number of locales for which we have localized rule set display names.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
virtual int32_t getNumberOfRuleSetDisplayNameLocales(void) const;
@@ -690,7 +687,7 @@ public:
* @param status set to a failure code when this function fails
* @return the locale
* @see #getNumberOfRuleSetDisplayNameLocales
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
virtual Locale getRuleSetDisplayNameLocale(int32_t index, UErrorCode& status) const;
@@ -705,7 +702,7 @@ public:
* display name is desired
* @return the display name for the given index, which might be bogus if there is an error
* @see #getRuleSetName
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
virtual UnicodeString getRuleSetDisplayName(int32_t index,
const Locale& locale = Locale::getDefault());
@@ -715,8 +712,8 @@ public:
* The locale is matched against the locales for which there is display name data, using
* normal fallback rules. If no locale matches, the default display name is returned.
* @return the display name for the rule set
- * @draft ICU 3.2
- * @see #getRuleSetDisplayNames
+ * @stable ICU 3.2
+ * @see #getRuleSetDisplayName
*/
virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
const Locale& locale = Locale::getDefault());
@@ -861,7 +858,7 @@ public:
* @param parsePosition On entry, contains the position of the first character
* in "text" to examine. On exit, has been updated to contain the position
* of the first character in "text" that wasn't consumed by the parse.
- * @see #setLenientParseMode
+ * @see #setLenient
* @stable ICU 2.0
*/
virtual void parse(const UnicodeString& text,
@@ -921,7 +918,7 @@ public:
* Returns true if lenient-parse mode is turned on. Lenient parsing is off
* by default.
* @return true if lenient-parse mode is turned on.
- * @see #setLenientParseMode
+ * @see #setLenient
* @stable ICU 2.0
*/
virtual inline UBool isLenient(void) const;
@@ -942,7 +939,7 @@ public:
* Return the name of the current default rule set. If the current rule set is
* not public, returns a bogus (and empty) UnicodeString.
* @return the name of the current default rule set
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
virtual UnicodeString getDefaultRuleSetName() const;
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/regex.h b/Build/source/libs/icu-xetex/i18n/unicode/regex.h
index 2c6e95a5e8d..979082a394f 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/regex.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/regex.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2002-2005, International Business Machines
+* Copyright (C) 2002-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
@@ -282,7 +282,7 @@ private:
*
* @internal
*/
- virtual RegexMatcher *matcher(const UChar *input,
+ RegexMatcher *matcher(const UChar *input,
UErrorCode &status) const;
public:
@@ -652,7 +652,7 @@ public:
* @return the start position of substring matched by the specified group.
* @stable ICU 2.4
*/
- virtual int32_t start(int group, UErrorCode &status) const;
+ virtual int32_t start(int32_t group, UErrorCode &status) const;
/**
@@ -680,7 +680,7 @@ public:
* Return -1 if the capture group exists in the pattern but was not part of the match.
* @stable ICU 2.4
*/
- virtual int32_t end(int group, UErrorCode &status) const;
+ virtual int32_t end(int32_t group, UErrorCode &status) const;
/**
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h b/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h
index db180109191..bb7c9d14445 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h
@@ -645,7 +645,7 @@ public:
* are in effect. A positive number, typically one hour (3600000).
* @stable ICU 2.0
*/
- int32_t getDSTSavings(void) const;
+ virtual int32_t getDSTSavings(void) const;
/**
* Queries if this TimeZone uses Daylight Savings Time.
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h
index af79af240b6..4c2195943af 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others. All Rights Reserved.
*******************************************************************************
*
* File SMPDTFMT.H
@@ -724,6 +724,21 @@ private:
const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
/**
+ * Private code-size reduction function used by subParse.
+ * @param text the time text being parsed.
+ * @param start where to start parsing.
+ * @param field the date field being parsed.
+ * @param stringArray the string array to parsed.
+ * @param stringArrayCount the size of the array.
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @return the new start position if matching succeeded; a negative number
+ * indicating matching failure, otherwise.
+ */
+ int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
+ const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
+
+ /**
* Private member function that converts the parsed date strings into
* timeFields. Returns -start (for ParsePosition) if failed.
* @param text the time text to be parsed.
@@ -773,23 +788,23 @@ private:
void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status);
/**
- * Given a canonical time zone id, return the row index in our symbols for that id,
- * or -1 if none found.
- */
- int32_t getTimeZoneIndex(const UnicodeString& id) const;
-
- /**
* Given text, a start in the text, and a row index, return the column index that
* of the zone name that matches (case insensitive) at start, or 0 if none matches.
- */
+ *
int32_t matchZoneString(const UnicodeString& text, int32_t start, int32_t zi) const;
+ */
/**
* Given text, a start in the text, and a calendar, return the next offset in the text
* after matching the zone string. If we fail to match, return 0. Update the calendar
* as appropriate.
*/
- int32_t subParseZoneString(const UnicodeString& text, int32_t start, Calendar& cal) const;
+ int32_t subParseZoneString(const UnicodeString& text, int32_t start, Calendar& cal, UErrorCode& status) const;
+
+ /**
+ * append the gmt string
+ */
+ inline void appendGMT(UnicodeString &appendTo, Calendar& cal, UErrorCode& status) const;
/**
* Used to map pattern characters to Calendar field identifiers.
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h b/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h
index ed633cbce25..ef202dd9ba4 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h
@@ -1,7 +1,8 @@
/*
- * Copyright (C) 1996-2005, International Business Machines Corporation and others.
+ *****************************************************************************
+ * Copyright (C) 1996-2006, International Business Machines Corporation and others.
* All Rights Reserved.
- *****************************************************************************************
+ *****************************************************************************
*
* File sortkey.h
*
@@ -14,7 +15,7 @@
* 6/20/97 helena Java class name change.
* 8/18/97 helena Added internal API documentation.
* 6/26/98 erm Changed to use byte arrays and memcmp.
- *****************************************************************************************
+ *****************************************************************************
*/
#ifndef SORTKEY_H
@@ -108,7 +109,6 @@ public:
* Creates a collation key based on the collation key values.
* @param values the collation key values
* @param count number of collation key values, including trailing nulls.
- * @see #createBits
* @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
*/
CollationKey(const uint8_t* values,
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h b/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h
index c50306881cc..3844315abf6 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2005 IBM and others. All rights reserved.
+* Copyright (C) 2001-2006 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 03/22/2000 helena Creation.
@@ -501,11 +501,6 @@ private :
*/
UnicodeString m_pattern_;
/**
- * Corresponding collation rules
- * @stable ICU 2.0
- */
- UnicodeString m_collation_rules_;
- /**
* String search struct data
* @stable ICU 2.0
*/
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h b/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h
index 39801bc547a..c83a6ac222d 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines Corporation and
+* Copyright (C) 1996-2006, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
@@ -693,7 +693,7 @@ private:
/**
* Rule UnicodeString
*/
- UnicodeString *urulestring;
+ UnicodeString urulestring;
// friend classes --------------------------------------------------------
@@ -721,13 +721,6 @@ private:
RuleBasedCollator();
/**
- * Constructor that takes in a UCollator struct
- * @param collator UCollator struct
- * @param rule the rule for the collator.
- */
- RuleBasedCollator(UCollator *collator, UnicodeString *rule);
-
- /**
* RuleBasedCollator constructor. This constructor takes a locale. The
* only caller of this class should be Collator::createInstance(). If
* createInstance() happens to know that the requested locale's collation is
@@ -776,7 +769,7 @@ private:
* @param collator new ucollator data
* @param rules corresponding collation rules
*/
- void setUCollator(UCollator *collator, UnicodeString *rules);
+ void setUCollator(UCollator *collator);
public:
/**
@@ -801,7 +794,7 @@ private:
void checkOwned(void);
// utility to init rule string used by checkOwned and construct
- void setRuleStringFromCollator(UErrorCode& status);
+ void setRuleStringFromCollator();
/**
* Converts C's UCollationResult to EComparisonResult
@@ -838,17 +831,16 @@ inline void RuleBasedCollator::setUCollator(const Locale &locale,
}
-inline void RuleBasedCollator::setUCollator(UCollator *collator,
- UnicodeString *rules)
+inline void RuleBasedCollator::setUCollator(UCollator *collator)
{
+
if (ucollator && dataIsOwned) {
ucol_close(ucollator);
- delete urulestring;
}
ucollator = collator;
- urulestring = rules;
dataIsOwned = FALSE;
isWriteThroughAlias = TRUE;
+ setRuleStringFromCollator();
}
inline const UCollator * RuleBasedCollator::getUCollator()
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/timezone.h b/Build/source/libs/icu-xetex/i18n/unicode/timezone.h
index 1d4e4bbe1b2..ef90ee13996 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/timezone.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/timezone.h
@@ -602,7 +602,23 @@ public:
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
-
+
+ /**
+ * Returns the amount of time to be added to local standard time
+ * to get local wall clock time.
+ * <p>
+ * The default implementation always returns 3600000 milliseconds
+ * (i.e., one hour) if this time zone observes Daylight Saving
+ * Time. Otherwise, 0 (zero) is returned.
+ * <p>
+ * If an underlying TimeZone implementation subclass supports
+ * historical Daylight Saving Time changes, this method returns
+ * the known latest daylight saving value.
+ *
+ * @return the amount of saving time in milliseconds
+ * @draft ICU 3.6
+ */
+ virtual int32_t getDSTSavings() const;
protected:
/**
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/translit.h b/Build/source/libs/icu-xetex/i18n/unicode/translit.h
index dfa36ccaad7..117325ff178 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/translit.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/translit.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2005, International Business Machines
+* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -373,7 +373,7 @@ public:
* @see #registerInstance
* @stable ICU 2.0
*/
- virtual Transliterator* clone() const { return 0; }
+ virtual Transliterator* clone() const;
/**
* Transliterates a segment of a string, with optional filtering.
@@ -606,8 +606,8 @@ protected:
* [<code>pos.start</code>, <code>pos.limit</code>) without
* applying the filter. End user code should call <code>
* transliterate()</code> instead of this method. Subclass code
- * should call <code>filteredTransliterate()</code> instead of
- * this method.<p>
+ * and wrapping transliterators should call
+ * <code>filteredTransliterate()</code> instead of this method.<p>
*
* @param text the buffer holding transliterated and
* untransliterated text
@@ -628,7 +628,8 @@ protected:
UTransPosition& pos,
UBool incremental) const = 0;
- /**
+public:
+ /**
* Transliterate a substring of text, as specified by index, taking filters
* into account. This method is for subclasses that need to delegate to
* another transliterator, such as CompoundTransliterator.
@@ -643,9 +644,6 @@ protected:
UTransPosition& index,
UBool incremental) const;
- friend class CompoundTransliterator; // for filteredTransliterate()
- friend class AnyTransliterator; // for filteredTransliterate()
-
private:
/**
@@ -891,7 +889,7 @@ public:
* @return the number of transliterators that compose this
* transliterator, or 1 if this transliterator is not composed of
* multiple transliterators
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
int32_t countElements() const;
@@ -912,7 +910,7 @@ public:
* transliterator, if this transliterator is made up of multiple
* transliterators, otherwise a reference to this object if given
* an index of 0
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
const Transliterator& getElement(int32_t index, UErrorCode& ec) const;
@@ -982,7 +980,7 @@ public:
Token context);
/**
- * Registers a instance <tt>obj</tt> of a subclass of
+ * Registers an instance <tt>obj</tt> of a subclass of
* <code>Transliterator</code> with the system. When
* <tt>createInstance()</tt> is called with an ID string that is
* equal to <tt>obj->getID()</tt>, then <tt>obj->clone()</tt> is
@@ -1000,6 +998,23 @@ public:
*/
static void U_EXPORT2 registerInstance(Transliterator* adoptedObj);
+ /**
+ * Registers an ID string as an alias of another ID string.
+ * That is, after calling this function, <tt>createInstance(aliasID)</tt>
+ * will return the same thing as <tt>createInstance(realID)</tt>.
+ * This is generally used to create shorter, more mnemonic aliases
+ * for long compound IDs.
+ *
+ * @param aliasID The new ID being registered.
+ * @param realID The ID that the new ID is to be an alias for.
+ * This can be a compound ID and can include filters and should
+ * refer to transliterators that have already been registered with
+ * the framework, although this isn't checked.
+ * @draft ICU 3.6
+ */
+ static void U_EXPORT2 registerAlias(const UnicodeString& aliasID,
+ const UnicodeString& realID);
+
protected:
/**
@@ -1020,6 +1035,11 @@ protected:
*/
static void _registerInstance(Transliterator* adoptedObj);
+ /**
+ * @internal
+ */
+ static void _registerAlias(const UnicodeString& aliasID, const UnicodeString& realID);
+
/**
* Register two targets as being inverses of one another. For
* example, calling registerSpecialInverse("NFC", "NFD", true) causes
@@ -1083,7 +1103,7 @@ public:
* @return a newly-created StringEnumeration over the transliterators
* available at the time of the call. The caller should delete this object
* when done using it.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
static StringEnumeration* U_EXPORT2 getAvailableIDs(UErrorCode& ec);
@@ -1279,8 +1299,9 @@ inline int32_t Transliterator::getMaximumContextLength(void) const {
inline void Transliterator::setID(const UnicodeString& id) {
ID = id;
- // NUL-terminate the ID string
- ID.getTerminatedBuffer();
+ // NUL-terminate the ID string, which is a non-aliased copy.
+ ID.append((UChar)0);
+ ID.truncate(ID.length()-1);
}
inline Transliterator::Token Transliterator::integerToken(int32_t i) {
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucal.h b/Build/source/libs/icu-xetex/i18n/unicode/ucal.h
index d6ab3d023b7..30e4bfa871e 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/ucal.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucal.h
@@ -1,5 +1,7 @@
/*
-* Copyright (C) 1996-2005, International Business Machines Corporation and others. All Rights Reserved.
+*******************************************************************************
+* Copyright (C) 1996-2006, International Business Machines Corporation and
+* others. All Rights Reserved.
*******************************************************************************
*/
@@ -161,119 +163,238 @@ typedef enum UCalendarType UCalendarType;
*/
enum UCalendarDateFields {
/**
- * Era field
+ * Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar.
+ * This is a calendar-specific value.
* @stable ICU 2.6
*/
UCAL_ERA,
+
/**
- * Year field
+ * Field number indicating the year. This is a calendar-specific value.
* @stable ICU 2.6
*/
UCAL_YEAR,
+
/**
- * Month field
+ * Field number indicating the month. This is a calendar-specific value.
+ * The first month of the year is
+ * <code>JANUARY</code>; the last depends on the number of months in a year.
+ * @see #UCAL_JANUARY
+ * @see #UCAL_FEBRUARY
+ * @see #UCAL_MARCH
+ * @see #UCAL_APRIL
+ * @see #UCAL_MAY
+ * @see #UCAL_JUNE
+ * @see #UCAL_JULY
+ * @see #UCAL_AUGUST
+ * @see #UCAL_SEPTEMBER
+ * @see #UCAL_OCTOBER
+ * @see #UCAL_NOVEMBER
+ * @see #UCAL_DECEMBER
+ * @see #UCAL_UNDECIMBER
* @stable ICU 2.6
*/
UCAL_MONTH,
+
/**
- * Week of year field
+ * Field number indicating the
+ * week number within the current year. The first week of the year, as
+ * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
+ * attributes, has value 1. Subclasses define
+ * the value of <code>UCAL_WEEK_OF_YEAR</code> for days before the first week of
+ * the year.
+ * @see ucal_setAttribute
* @stable ICU 2.6
*/
UCAL_WEEK_OF_YEAR,
- /**
- * Week of month field
+
+ /**
+ * Field number indicating the
+ * week number within the current month. The first week of the month, as
+ * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
+ * attributes, has value 1. Subclasses define
+ * the value of <code>WEEK_OF_MONTH</code> for days before the first week of
+ * the month.
+ * @see #getFirstDayOfWeek
+ * @see #getMinimalDaysInFirstWeek
* @stable ICU 2.6
*/
UCAL_WEEK_OF_MONTH,
- /**
- * Date field
+
+ /**
+ * Field number indicating the
+ * day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
+ * The first day of the month has value 1.
+ * @see #DAY_OF_MONTH
* @stable ICU 2.6
*/
UCAL_DATE,
- /**
- * Day of year field
+
+ /**
+ * Field number indicating the day
+ * number within the current year. The first day of the year has value 1.
* @stable ICU 2.6
*/
UCAL_DAY_OF_YEAR,
- /**
- * Day of week field
+
+ /**
+ * Field number indicating the day
+ * of the week. This field takes values <code>SUNDAY</code>,
+ * <code>MONDAY</code>, <code>TUESDAY</code>, <code>WEDNESDAY</code>,
+ * <code>THURSDAY</code>, <code>FRIDAY</code>, and <code>SATURDAY</code>.
+ * @see #SUNDAY
+ * @see #MONDAY
+ * @see #TUESDAY
+ * @see #WEDNESDAY
+ * @see #THURSDAY
+ * @see #FRIDAY
+ * @see #SATURDAY
+ * @stable ICU 2.0
* @stable ICU 2.6
*/
UCAL_DAY_OF_WEEK,
- /**
- * Day of week in month field
+
+ /**
+ * Field number indicating the
+ * ordinal number of the day of the week within the current month. Together
+ * with the <code>DAY_OF_WEEK</code> field, this uniquely specifies a day
+ * within a month. Unlike <code>WEEK_OF_MONTH</code> and
+ * <code>WEEK_OF_YEAR</code>, this field's value does <em>not</em> depend on
+ * <code>getFirstDayOfWeek()</code> or
+ * <code>getMinimalDaysInFirstWeek()</code>. <code>DAY_OF_MONTH 1</code>
+ * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH
+ * 1</code>; <code>8</code> through <code>15</code> correspond to
+ * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on.
+ * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before
+ * <code>DAY_OF_WEEK_IN_MONTH 1</code>. Negative values count back from the
+ * end of the month, so the last Sunday of a month is specified as
+ * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>. Because
+ * negative values count backward they will usually be aligned differently
+ * within the month than positive values. For example, if a month has 31
+ * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap
+ * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>.
+ * @see #DAY_OF_WEEK
+ * @see #WEEK_OF_MONTH
* @stable ICU 2.6
*/
UCAL_DAY_OF_WEEK_IN_MONTH,
- /**
- * AM/PM field
+
+ /**
+ * Field number indicating
+ * whether the <code>HOUR</code> is before or after noon.
+ * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>.
+ * @see #UCAL_AM
+ * @see #UCAL_PM
+ * @see #UCAL_HOUR
* @stable ICU 2.6
*/
UCAL_AM_PM,
- /**
- * Hour field
+
+ /**
+ * Field number indicating the
+ * hour of the morning or afternoon. <code>HOUR</code> is used for the 12-hour
+ * clock.
+ * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.
+ * @see #UCAL_AM_PM
+ * @see #UCAL_HOUR_OF_DAY
* @stable ICU 2.6
*/
UCAL_HOUR,
- /**
- * Hour of day field
+
+ /**
+ * Field number indicating the
+ * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.
+ * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.
+ * @see #UCAL_HOUR
* @stable ICU 2.6
*/
UCAL_HOUR_OF_DAY,
- /**
- * Minute field
+
+ /**
+ * Field number indicating the
+ * minute within the hour.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_MINUTE</code> is 4.
* @stable ICU 2.6
*/
UCAL_MINUTE,
- /**
- * Second field
+
+ /**
+ * Field number indicating the
+ * second within the minute.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_SECOND</code> is 15.
* @stable ICU 2.6
*/
UCAL_SECOND,
- /**
- * Millisecond field
+
+ /**
+ * Field number indicating the
+ * millisecond within the second.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_MILLISECOND</code> is 250.
* @stable ICU 2.6
*/
UCAL_MILLISECOND,
- /**
- * Zone offset field
+
+ /**
+ * Field number indicating the
+ * raw offset from GMT in milliseconds.
* @stable ICU 2.6
*/
UCAL_ZONE_OFFSET,
- /**
- * DST offset field
+
+ /**
+ * Field number indicating the
+ * daylight savings offset in milliseconds.
* @stable ICU 2.6
*/
UCAL_DST_OFFSET,
- /**
- * Year / week of year
+
+ /**
+ * Field number
+ * indicating the extended year corresponding to the
+ * <code>UCAL_WEEK_OF_YEAR</code> field. This may be one greater or less
+ * than the value of <code>UCAL_EXTENDED_YEAR</code>.
* @stable ICU 2.6
*/
UCAL_YEAR_WOY,
- /**
- * Day of week, localized (1..7)
+
+ /**
+ * Field number
+ * indicating the localized day of week. This will be a value from 1
+ * to 7 inclusive, with 1 being the localized first day of the week.
* @stable ICU 2.6
*/
-#ifndef U_HIDE_DRAFT_API
-
UCAL_DOW_LOCAL,
+
/**
- * Year of this calendar system, encompassing all supra-year fields. For example, in Gregorian/Julian calendars, positive Extended Year values indicate years AD, 1 BC = 0 extended, 2 BC = -1 extended, and so on.
+ * Year of this calendar system, encompassing all supra-year fields. For example,
+ * in Gregorian/Julian calendars, positive Extended Year values indicate years AD,
+ * 1 BC = 0 extended, 2 BC = -1 extended, and so on.
* @stable ICU 2.8
*/
UCAL_EXTENDED_YEAR,
- /**
- * Modified Julian day number, encompassing all date-related fields. Demarcates at local midnight.
+
+ /**
+ * Field number
+ * indicating the modified Julian day number. This is different from
+ * the conventional Julian day number in two regards. First, it
+ * demarcates days at local zone midnight, rather than noon GMT.
+ * Second, it is a local number; that is, it depends on the local time
+ * zone. It can be thought of as a single number that encompasses all
+ * the date-related fields.
* @stable ICU 2.8
*/
UCAL_JULIAN_DAY,
+
/**
- * Ranges from 0 to 23:59:59.999 (regardless of DST). This field behaves <em>exactly</em> like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the DST_OFFSET field to obtain a unique local time value.
+ * Ranges from 0 to 23:59:59.999 (regardless of DST). This field behaves <em>exactly</em>
+ * like a composite of all time-related fields, not including the zone fields. As such,
+ * it also reflects discontinuities of those fields on DST transition days. On a day
+ * of DST onset, it will jump forward. On a day of DST cessation, it will jump
+ * backward. This reflects the fact that it must be combined with the DST_OFFSET field
+ * to obtain a unique local time value.
* @stable ICU 2.8
*/
UCAL_MILLISECONDS_IN_DAY,
-
-#endif /* U_HIDE_DRAFT_API */
/**
* Field count
@@ -281,15 +402,15 @@ enum UCalendarDateFields {
*/
UCAL_FIELD_COUNT,
-#ifndef U_HIDE_DRAFT_API
-
- /**
+ /**
+ * Field number indicating the
+ * day of the month. This is a synonym for <code>UCAL_DATE</code>.
+ * The first day of the month has value 1.
+ * @see #UCAL_DATE
* Synonym for UCAL_DATE
* @stable ICU 2.8
**/
UCAL_DAY_OF_MONTH=UCAL_DATE
-
-#endif /*U_HIDE_DRAFT_API*/
};
/** @stable ICU 2.0 */
@@ -350,7 +471,10 @@ enum UCalendarMonths {
UCAL_NOVEMBER,
/** December */
UCAL_DECEMBER,
- /** Undecimber */
+ /** Value of the <code>UCAL_MONTH</code> field indicating the
+ * thirteenth month of the year. Although the Gregorian calendar
+ * does not use this value, lunar calendars do.
+ */
UCAL_UNDECIMBER
};
@@ -381,7 +505,7 @@ typedef enum UCalendarAMPMs UCalendarAMPMs;
*
* @stable ICU 2.6
*/
-U_DRAFT UEnumeration* U_EXPORT2
+U_STABLE UEnumeration* U_EXPORT2
ucal_openTimeZones(UErrorCode* ec);
/**
@@ -400,7 +524,7 @@ ucal_openTimeZones(UErrorCode* ec);
*
* @stable ICU 2.6
*/
-U_DRAFT UEnumeration* U_EXPORT2
+U_STABLE UEnumeration* U_EXPORT2
ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
/**
@@ -419,7 +543,7 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
*
* @stable ICU 2.6
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
/**
@@ -431,7 +555,7 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
*
* @stable ICU 2.6
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
/**
@@ -450,7 +574,7 @@ ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
*
* @stable ICU 2.6
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
/**
@@ -557,6 +681,52 @@ ucal_inDaylightTime(const UCalendar* cal,
UErrorCode* status );
/**
+ * Sets the GregorianCalendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * This function works only for Gregorian calendars. If the UCalendar is not
+ * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
+ * error code is set.
+ *
+ * @param cal The calendar object.
+ * @param date The given Gregorian cutover date.
+ * @param pErrorCode Pointer to a standard ICU error code. Its input value must
+ * pass the U_SUCCESS() test, or else the function returns
+ * immediately. Check for U_FAILURE() on output or use with
+ * function chaining. (See User Guide for details.)
+ *
+ * @see GregorianCalendar::setGregorianChange
+ * @see ucal_getGregorianChange
+ * @draft ICU 3.6
+ */
+U_DRAFT void U_EXPORT2
+ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
+
+/**
+ * Gets the Gregorian Calendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * This function works only for Gregorian calendars. If the UCalendar is not
+ * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
+ * error code is set.
+ *
+ * @param cal The calendar object.
+ * @param pErrorCode Pointer to a standard ICU error code. Its input value must
+ * pass the U_SUCCESS() test, or else the function returns
+ * immediately. Check for U_FAILURE() on output or use with
+ * function chaining. (See User Guide for details.)
+ * @return The Gregorian cutover time for this calendar.
+ *
+ * @see GregorianCalendar::getGregorianChange
+ * @see ucal_setGregorianChange
+ * @draft ICU 3.6
+ */
+U_DRAFT UDate U_EXPORT2
+ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
+
+/**
* Types of UCalendar attributes
* @stable ICU 2.0
*/
@@ -927,9 +1097,9 @@ ucal_countAvailableTZIDs(int32_t rawOffset);
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale name
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
-U_DRAFT const char * U_EXPORT2
+U_STABLE const char * U_EXPORT2
ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucol.h b/Build/source/libs/icu-xetex/i18n/unicode/ucol.h
index 70b4d1c9930..ed4c13c19cd 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/ucol.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucol.h
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (c) 1996-2005, International Business Machines Corporation and others.
+* Copyright (c) 1996-2006, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
@@ -164,12 +164,12 @@ typedef UColAttributeValue UCollationStrength;
* @stable ICU 2.0
*/
typedef enum {
- /** Attribute for direction of secondary weights - used in French.\
+ /** Attribute for direction of secondary weights - used in French.
* Acceptable values are UCOL_ON, which results in secondary weights
* being considered backwards and UCOL_OFF which treats secondary
* weights in the order they appear.*/
UCOL_FRENCH_COLLATION,
- /** Attribute for handling variable elements.\
+ /** Attribute for handling variable elements.
* Acceptable values are UCOL_NON_IGNORABLE (default)
* which treats all the codepoints with non-ignorable
* primary weights in the same way,
@@ -178,7 +178,7 @@ typedef enum {
* to be ignored on primary level and moved to the quaternary
* level.*/
UCOL_ALTERNATE_HANDLING,
- /** Controls the ordering of upper and lower case letters.\
+ /** Controls the ordering of upper and lower case letters.
* Acceptable values are UCOL_OFF (default), which orders
* upper and lower case letters in accordance to their tertiary
* weights, UCOL_UPPER_FIRST which forces upper case letters to
@@ -186,45 +186,41 @@ typedef enum {
* the opposite. */
UCOL_CASE_FIRST,
/** Controls whether an extra case level (positioned before the third
- * level) is generated or not.\ Acceptable values are UCOL_OFF (default),
+ * level) is generated or not. Acceptable values are UCOL_OFF (default),
* when case level is not generated, and UCOL_ON which causes the case
- * level to be generated.\ Contents of the case level are affected by
- * the value of UCOL_CASE_FIRST attribute.\ A simple way to ignore
+ * level to be generated. Contents of the case level are affected by
+ * the value of UCOL_CASE_FIRST attribute. A simple way to ignore
* accent differences in a string is to set the strength to UCOL_PRIMARY
* and enable case level. */
UCOL_CASE_LEVEL,
/** Controls whether the normalization check and necessary normalizations
- * are performed.\ When set to UCOL_OFF (default) no normalization check
- * is performed.\ The correctness of the result is guaranteed only if the
- * input data is in so-called FCD form (see users manual for more info).\
- * When set to UCOL_ON, an incremental check is performed to see whether the input data
- * is in the FCD form.\ If the data is not in the FCD form, incremental
- * NFD normalization is performed. */
+ * are performed. When set to UCOL_OFF (default) no normalization check
+ * is performed. The correctness of the result is guaranteed only if the
+ * input data is in so-called FCD form (see users manual for more info).
+ * When set to UCOL_ON, an incremental check is performed to see whether
+ * the input data is in the FCD form. If the data is not in the FCD form,
+ * incremental NFD normalization is performed. */
UCOL_NORMALIZATION_MODE,
/** An alias for UCOL_NORMALIZATION_MODE attribute */
UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
- /** The strength attribute.\ Can be either UCOL_PRIMARY, UCOL_SECONDARY,
- * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL.\ The usual strength
- * for most locales (except Japanese) is tertiary.\ Quaternary strength
+ /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
+ * for most locales (except Japanese) is tertiary. Quaternary strength
* is useful when combined with shifted setting for alternate handling
* attribute and for JIS x 4061 collation, when it is used to distinguish
* between Katakana and Hiragana (this is achieved by setting the
- * UCOL_HIRAGANA_QUATERNARY mode to on.\ Otherwise, quaternary level
+ * UCOL_HIRAGANA_QUATERNARY mode to on. Otherwise, quaternary level
* is affected only by the number of non ignorable code points in
- * the string.\ Identical strength is rarely useful, as it amounts
+ * the string. Identical strength is rarely useful, as it amounts
* to codepoints of the NFD form of the string. */
UCOL_STRENGTH,
- /** when turned on, this attribute
- * positions Hiragana before all
- * non-ignorables on quaternary level
- * This is a sneaky way to produce JIS
- * sort order */
+ /** When turned on, this attribute positions Hiragana before all
+ * non-ignorables on quaternary level This is a sneaky way to produce JIS
+ * sort order */
UCOL_HIRAGANA_QUATERNARY_MODE,
- /** when turned on, this attribute
- * generates a collation key
- * for the numeric value of substrings
- * of digits. This is a way to get '100'
- * to sort AFTER '2'.*/
+ /** When turned on, this attribute generates a collation key
+ * for the numeric value of substrings of digits.
+ * This is a way to get '100' to sort AFTER '2'. */
UCOL_NUMERIC_COLLATION,
UCOL_ATTRIBUTE_COUNT
} UColAttribute;
@@ -277,7 +273,7 @@ ucol_open(const char *loc, UErrorCode *status);
* occurred during parsing. This argument can currently be set
* to NULL, but at users own risk. Please provide a real structure.
* @param status A pointer to an UErrorCode to receive any errors
- * @return A pointer to a UCollator.\ It is not guaranteed that NULL be returned in case
+ * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
* of error - please use status argument to check for errors.
* @see ucol_open
* @see ucol_safeClone
@@ -323,10 +319,10 @@ ucol_openRules( const UChar *rules,
* @see ucol_setVariableTop
* @see ucol_getShortDefinitionString
* @see ucol_normalizeShortDefinitionString
- * @draft ICU 3.0
+ * @stable ICU 3.0
*
*/
-U_CAPI UCollator* U_EXPORT2
+U_STABLE UCollator* U_EXPORT2
ucol_openFromShortString( const char *definition,
UBool forceDefaults,
UParseError *parseError,
@@ -345,7 +341,7 @@ ucol_openFromShortString( const char *definition,
*
* @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
*/
-U_CAPI int32_t U_EXPORT2
+U_DEPRECATED int32_t U_EXPORT2
ucol_getContractions( const UCollator *coll,
USet *conts,
UErrorCode *status);
@@ -361,15 +357,15 @@ ucol_getContractions( const UCollator *coll,
*
* @draft ICU 3.4
*/
-U_CAPI void U_EXPORT2
+U_DRAFT void U_EXPORT2
ucol_getContractionsAndExpansions( const UCollator *coll,
USet *contractions, USet *expansions,
UBool addPrefixes, UErrorCode *status);
/**
* Close a UCollator.
- * Once closed, a UCollator should not be used.\ Every open collator should
- * be closed.\ Otherwise, a memory leak will result.
+ * Once closed, a UCollator should not be used. Every open collator should
+ * be closed. Otherwise, a memory leak will result.
* @param coll The UCollator to close.
* @see ucol_open
* @see ucol_openRules
@@ -550,9 +546,9 @@ ucol_countAvailable(void);
* @param status input-output error code
* @return a string enumeration over locale strings. The caller is
* responsible for closing the result.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UEnumeration* U_EXPORT2
+U_STABLE UEnumeration* U_EXPORT2
ucol_openAvailableLocales(UErrorCode *status);
#endif
@@ -563,9 +559,9 @@ ucol_openAvailableLocales(UErrorCode *status);
* @param status input-output error code
* @return a string enumeration over locale strings. The caller is
* responsible for closing the result.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UEnumeration* U_EXPORT2
+U_STABLE UEnumeration* U_EXPORT2
ucol_getKeywords(UErrorCode *status);
/**
@@ -577,9 +573,9 @@ ucol_getKeywords(UErrorCode *status);
* @param status input-output error code
* @return a string enumeration over collation keyword values, or NULL
* upon error. The caller is responsible for closing the result.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UEnumeration* U_EXPORT2
+U_STABLE UEnumeration* U_EXPORT2
ucol_getKeywordValues(const char *keyword, UErrorCode *status);
/**
@@ -610,9 +606,9 @@ ucol_getKeywordValues(const char *keyword, UErrorCode *status);
* @return the actual buffer size needed for the locale. If greater
* than resultCapacity, the returned full name will be truncated and
* an error code will be returned.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
const char* keyword, const char* locale,
UBool* isAvailable, UErrorCode* status);
@@ -647,9 +643,9 @@ ucol_getRules( const UCollator *coll,
* @return length of the resulting string
* @see ucol_openFromShortString
* @see ucol_normalizeShortDefinitionString
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucol_getShortDefinitionString(const UCollator *coll,
const char *locale,
char *buffer,
@@ -673,10 +669,10 @@ ucol_getShortDefinitionString(const UCollator *coll,
* @see ucol_openFromShortString
* @see ucol_getShortDefinitionString
*
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucol_normalizeShortDefinitionString(const char *source,
char *destination,
int32_t capacity,
@@ -812,7 +808,7 @@ ucol_getVersion(const UCollator* coll, UVersionInfo info);
* @param info the version # information, the result will be filled in
* @stable ICU 2.8
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
/**
@@ -998,9 +994,9 @@ ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *statu
* @return real locale name from which the collation data comes.
* If the collator was instantiated from rules, returns
* NULL.
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
-U_DRAFT const char * U_EXPORT2
+U_STABLE const char * U_EXPORT2
ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
/**
@@ -1016,12 +1012,14 @@ ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode
U_STABLE USet * U_EXPORT2
ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
+#ifndef U_HIDE_INTERNAL_API
/**
* Returned by ucol_collatorToIdentifier to signify that collator is
* not encodable as an identifier.
* @internal ICU 3.0
*/
#define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000
+#endif /* U_HIDE_INTERNAL_API */
/**
* Get a 31-bit identifier given a collator.
@@ -1189,9 +1187,9 @@ ucol_prepareShortStringOpen( const char *definition,
* @param status for catching errors
* @return size of the image
* @see ucol_openBinary
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucol_cloneBinary(const UCollator *coll,
uint8_t *buffer, int32_t capacity,
UErrorCode *status);
@@ -1211,9 +1209,9 @@ ucol_cloneBinary(const UCollator *coll,
* @param status for catching errors
* @return newly created collator
* @see ucol_cloneBinary
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT UCollator* U_EXPORT2
+U_STABLE UCollator* U_EXPORT2
ucol_openBinary(const uint8_t *bin, int32_t length,
const UCollator *base,
UErrorCode *status);
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h b/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h
new file mode 100644
index 00000000000..27e2e34e6aa
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h
@@ -0,0 +1,350 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ * file name: ucsdet.h
+ * encoding: US-ASCII
+ * indentation:4
+ *
+ * created on: 2005Aug04
+ * created by: Andy Heninger
+ *
+ * ICU Character Set Detection, API for C
+ *
+ * Draft version 18 Oct 2005
+ *
+ */
+
+#ifndef __UCSDET_H
+#define __UCSDET_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+#include "unicode/uenum.h"
+
+/**
+ * \file
+ * \brief C API: Charset Detection API
+ *
+ * This API provides a facility for detecting the
+ * charset or encoding of character data in an unknown text format.
+ * The input data can be from an array of bytes.
+ * <p>
+ * Character set detection is at best an imprecise operation. The detection
+ * process will attempt to identify the charset that best matches the characteristics
+ * of the byte data, but the process is partly statistical in nature, and
+ * the results can not be guaranteed to always be correct.
+ * <p>
+ * For best accuracy in charset detection, the input data should be primarily
+ * in a single language, and a minimum of a few hundred bytes worth of plain text
+ * in the language are needed. The detection process will attempt to
+ * ignore html or xml style markup that could otherwise obscure the content.
+ */
+
+
+struct UCharsetDetector;
+/**
+ * Structure representing a charset detector
+ * @draft ICU 3.6
+ */
+typedef struct UCharsetDetector UCharsetDetector;
+
+struct UCharsetMatch;
+/**
+ * Opaque structure representing a match that was identified
+ * from a charset detection operation.
+ * @draft ICU 3.6
+ */
+typedef struct UCharsetMatch UCharsetMatch;
+
+/**
+ * Open a charset detector.
+ *
+ * @param status Any error conditions occurring during the open
+ * operation are reported back in this variable.
+ * @return the newly opened charset detector.
+ * @draft ICU 3.6
+ */
+U_DRAFT UCharsetDetector * U_EXPORT2
+ucsdet_open(UErrorCode *status);
+
+/**
+ * Close a charset detector. All storage and any other resources
+ * owned by this charset detector will be released. Failure to
+ * close a charset detector when finished with it can result in
+ * memory leaks in the application.
+ *
+ * @param ucsd The charset detector to be closed.
+ * @draft ICU 3.6
+ */
+U_DRAFT void U_EXPORT2
+ucsdet_close(UCharsetDetector *ucsd);
+
+/**
+ * Set the input byte data whose charset is to detected.
+ *
+ * Ownership of the input text byte array remains with the caller.
+ * The input string must not be altered or deleted until the charset
+ * detector is either closed or reset to refer to different input text.
+ *
+ * @param ucsd the charset detector to be used.
+ * @param textIn the input text of unknown encoding. .
+ * @param len the length of the input text, or -1 if the text
+ * is NUL terminated.
+ * @param status any error conditions are reported back in this variable.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT void U_EXPORT2
+ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status);
+
+
+/** Set the declared encoding for charset detection.
+ * The declared encoding of an input text is an encoding obtained
+ * by the user from an http header or xml declaration or similar source that
+ * can be provided as an additional hint to the charset detector.
+ *
+ * How and whether the declared encoding will be used during the
+ * detection process is TBD.
+ *
+ * @param ucsd the charset detector to be used.
+ * @param encoding an encoding for the current data obtained from
+ * a header or declaration or other source outside
+ * of the byte data itself.
+ * @param length the length of the encoding name, or -1 if the name string
+ * is NUL terminated.
+ * @param status any error conditions are reported back in this variable.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT void U_EXPORT2
+ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status);
+
+
+/**
+ * Return the charset that best matches the supplied input data.
+ *
+ * Note though, that because the detection
+ * only looks at the start of the input data,
+ * there is a possibility that the returned charset will fail to handle
+ * the full set of input data.
+ * <p>
+ * The returned UCharsetMatch object is owned by the UCharsetDetector.
+ * It will remain valid until the detector input is reset, or until
+ * the detector is closed.
+ * <p>
+ * The function will fail if
+ * <ul>
+ * <li>no charset appears to match the data.</li>
+ * <li>no input text has been provided</li>
+ * </ul>
+ *
+ * @param ucsd the charset detector to be used.
+ * @param status any error conditions are reported back in this variable.
+ * @return a UCharsetMatch representing the best matching charset,
+ * or NULL if no charset matches the byte data.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT const UCharsetMatch * U_EXPORT2
+ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status);
+
+
+/**
+ * Find all charset matches that appear to be consistent with the input,
+ * returning an array of results. The results are ordered with the
+ * best quality match first.
+ *
+ * Because the detection only looks at a limited amount of the
+ * input byte data, some of the returned charsets may fail to handle
+ * the all of input data.
+ * <p>
+ * The returned UCharsetMatch objects are owned by the UCharsetDetector.
+ * They will remain valid until the detector is closed or modified
+ *
+ * <p>
+ * Return an error if
+ * <ul>
+ * <li>no charsets appear to match the input data.</li>
+ * <li>no input text has been provided</li>
+ * </ul>
+ *
+ * @param ucsd the charset detector to be used.
+ * @param matchesFound pointer to a variable that will be set to the
+ * number of charsets identified that are consistent with
+ * the input data. Output only.
+ * @param status any error conditions are reported back in this variable.
+ * @return A pointer to an array of pointers to UCharSetMatch objects.
+ * This array, and the UCharSetMatch instances to which it refers,
+ * are owned by the UCharsetDetector, and will remain valid until
+ * the detector is closed or modified.
+ * @draft ICU 3.4
+ */
+U_DRAFT const UCharsetMatch ** U_EXPORT2
+ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status);
+
+
+
+/**
+ * Get the name of the charset represented by a UCharsetMatch.
+ *
+ * The storage for the returned name string is owned by the
+ * UCharsetMatch, and will remain valid while the UCharsetMatch
+ * is valid.
+ *
+ * The name returned is suitable for use with the ICU conversion APIs.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The name of the matching charset.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT const char * U_EXPORT2
+ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status);
+
+/**
+ * Get a confidence number for the quality of the match of the byte
+ * data with the charset. Confidence numbers range from zero to 100,
+ * with 100 representing complete confidence and zero representing
+ * no confidence.
+ *
+ * The confidence values are somewhat arbitrary. They define an
+ * an ordering within the results for any single detection operation
+ * but are not generally comparable between the results for different input.
+ *
+ * A confidence value of ten does have a general meaning - it is used
+ * for charsets that can represent the input data, but for which there
+ * is no other indication that suggests that the charset is the correct one.
+ * Pure 7 bit ASCII data, for example, is compatible with a
+ * great many charsets, most of which will appear as possible matches
+ * with a confidence of 10.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return A confidence number for the charset match.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT int32_t U_EXPORT2
+ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status);
+
+/**
+ * Get the RFC 3066 code for the language of the input data.
+ *
+ * The Charset Detection service is intended primarily for detecting
+ * charsets, not language. For some, but not all, charsets, a language is
+ * identified as a byproduct of the detection process, and that is what
+ * is returned by this function.
+ *
+ * CAUTION:
+ * 1. Language information is not available for input data encoded in
+ * all charsets. In particular, no language is identified
+ * for UTF-8 input data.
+ *
+ * 2. Closely related languages may sometimes be confused.
+ *
+ * If more accurate language detection is required, a linguistic
+ * analysis package should be used.
+ *
+ * The storage for the returned name string is owned by the
+ * UCharsetMatch, and will remain valid while the UCharsetMatch
+ * is valid.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The RFC 3066 code for the language of the input data, or
+ * an empty string if the language could not be determined.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT const char * U_EXPORT2
+ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status);
+
+
+/**
+ * Get the entire input text as a UChar string, placing it into
+ * a caller-supplied buffer. A terminating
+ * NUL character will be appended to the buffer if space is available.
+ *
+ * The number of UChars in the output string, not including the terminating
+ * NUL, is returned.
+ *
+ * If the supplied buffer is smaller than required to hold the output,
+ * the contents of the buffer are undefined. The full output string length
+ * (in UChars) is returned as always, and can be used to allocate a buffer
+ * of the correct size.
+ *
+ *
+ * @param ucsm The charset match object.
+ * @param buf A UChar buffer to be filled with the converted text data.
+ * @param cap The capacity of the buffer in UChars.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The number of UChars in the output string.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT int32_t U_EXPORT2
+ucsdet_getUChars(const UCharsetMatch *ucsm,
+ UChar *buf, int32_t cap, UErrorCode *status);
+
+
+
+/**
+ * Get an iterator over the set of all detectable charsets -
+ * over the charsets that are known to the charset detection
+ * service.
+ *
+ * The returned UEnumeration provides access to the names of
+ * the charsets.
+ *
+ * The state of the Charset detector that is passed in does not
+ * affect the result of this function, but requiring a valid, open
+ * charset detector as a parameter insures that the charset detection
+ * service has been safely initialized and that the required detection
+ * data is available.
+ *
+ * @param ucsd a Charset detector.
+ * @param status Any error conditions are reported back in this variable.
+ * @return an iterator providing access to the detectable charset names.
+ * @draft ICU 3.6
+ */
+
+U_DRAFT UEnumeration * U_EXPORT2
+ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status);
+
+
+/**
+ * Test whether input filtering is enabled for this charset detector.
+ * Input filtering removes text that appears to be HTML or xml
+ * markup from the input before applying the code page detection
+ * heuristics.
+ *
+ * @param ucsd The charset detector to check.
+ * @return TRUE if filtering is enabled.
+ * @draft ICU 3.4
+ */
+U_DRAFT UBool U_EXPORT2
+ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd);
+
+
+/**
+ * Enable filtering of input text. If filtering is enabled,
+ * text within angle brackets ("<" and ">") will be removed
+ * before detection, which will remove most HTML or xml markup.
+ *
+ * @param ucsd the charset detector to be modified.
+ * @param filter <code>true</code> to enable input text filtering.
+ * @return The previous setting.
+ *
+ * @draft ICU 3.6
+ */
+U_DRAFT UBool U_EXPORT2
+ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter);
+
+#endif
+#endif /* __UCSDET_H */
+
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h b/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h
index ac0d81ea46f..0aa8dba4f3e 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2002-2005, International Business Machines
+* Copyright (c) 2002-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@@ -79,7 +79,7 @@ typedef enum UCurrNameStyle {
#if !UCONFIG_NO_SERVICE
/**
- * @internal
+ * @stable ICU 2.6
*/
typedef const void* UCurrRegistryKey;
@@ -145,9 +145,9 @@ ucurr_getName(const UChar* currency,
* @param ec input-output error code
* @return a non-negative number of fraction digits to be
* displayed, or 0 if there is an error
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ucurr_getDefaultFractionDigits(const UChar* currency,
UErrorCode* ec);
@@ -158,9 +158,9 @@ ucurr_getDefaultFractionDigits(const UChar* currency,
* @param ec input-output error code
* @return the non-negative rounding increment, or 0.0 if none,
* or 0.0 if there is an error
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT double U_EXPORT2
+U_STABLE double U_EXPORT2
ucurr_getRoundingIncrement(const UChar* currency,
UErrorCode* ec);
@@ -168,12 +168,12 @@ ucurr_getRoundingIncrement(const UChar* currency,
* Selector constants for ucurr_openCurrencies().
*
* @see ucurr_openCurrencies
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
typedef enum UCurrCurrencyType {
/**
* Select all ISO-4217 currency codes.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UCURR_ALL = INT32_MAX,
/**
@@ -182,7 +182,7 @@ typedef enum UCurrCurrencyType {
* bank notes or coins associated with the currency code.
* This does not include fund codes, precious metals and other
* various ISO-4217 codes limited to special financial products.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UCURR_COMMON = 1,
/**
@@ -190,19 +190,19 @@ typedef enum UCurrCurrencyType {
* These codes respresent fund codes, precious metals and other
* various ISO-4217 codes limited to special financial products.
* A fund code is a monetary resource associated with a currency.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UCURR_UNCOMMON = 2,
/**
* Select only deprecated ISO-4217 codes.
* These codes are no longer in general public use.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UCURR_DEPRECATED = 4,
/**
* Select only non-deprecated ISO-4217 codes.
* These codes are in general public use.
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UCURR_NON_DEPRECATED = 8
} UCurrCurrencyType;
@@ -214,9 +214,9 @@ typedef enum UCurrCurrencyType {
* currencies. Most people will want to use the (UCURR_CURRENCY|UCURR_NON_DEPRECATED) value to
* get a list of current currencies.
* @param pErrorCode Error code
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT UEnumeration * U_EXPORT2
+U_STABLE UEnumeration * U_EXPORT2
ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
@@ -244,7 +244,7 @@ U_NAMESPACE_BEGIN
*
* @internal
*/
-void
+U_INTERNAL void
uprv_parseCurrency(const char* locale,
const UnicodeString& text,
ParsePosition& pos,
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/udat.h b/Build/source/libs/icu-xetex/i18n/unicode/udat.h
index ee1f0d50fed..03376ed9167 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/udat.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/udat.h
@@ -1,6 +1,7 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1996-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
*******************************************************************************
*/
@@ -160,34 +161,34 @@ typedef enum UDateFormatStyle {
/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by DateFormat and UDateFormat.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
typedef enum UDateFormatField {
/**
* FieldPosition and UFieldPosition selector for 'G' field alignment,
* corresponding to the UCAL_ERA field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_ERA_FIELD = 0,
/**
* FieldPosition and UFieldPosition selector for 'y' field alignment,
* corresponding to the UCAL_YEAR field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_YEAR_FIELD = 1,
/**
* FieldPosition and UFieldPosition selector for 'M' field alignment,
* corresponding to the UCAL_MONTH field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_MONTH_FIELD = 2,
/**
* FieldPosition and UFieldPosition selector for 'd' field alignment,
* corresponding to the UCAL_DATE field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_DATE_FIELD = 3,
@@ -196,7 +197,7 @@ typedef enum UDateFormatField {
* corresponding to the UCAL_HOUR_OF_DAY field.
* UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
* For example, 23:59 + 01:00 results in 24:59.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_HOUR_OF_DAY1_FIELD = 4,
@@ -205,70 +206,70 @@ typedef enum UDateFormatField {
* corresponding to the UCAL_HOUR_OF_DAY field.
* UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
* For example, 23:59 + 01:00 results in 00:59.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_HOUR_OF_DAY0_FIELD = 5,
/**
* FieldPosition and UFieldPosition selector for 'm' field alignment,
* corresponding to the UCAL_MINUTE field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_MINUTE_FIELD = 6,
/**
* FieldPosition and UFieldPosition selector for 's' field alignment,
* corresponding to the UCAL_SECOND field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_SECOND_FIELD = 7,
/**
* FieldPosition and UFieldPosition selector for 'S' field alignment,
* corresponding to the UCAL_MILLISECOND field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_FRACTIONAL_SECOND_FIELD = 8,
/**
* FieldPosition and UFieldPosition selector for 'E' field alignment,
* corresponding to the UCAL_DAY_OF_WEEK field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_DAY_OF_WEEK_FIELD = 9,
/**
* FieldPosition and UFieldPosition selector for 'D' field alignment,
* corresponding to the UCAL_DAY_OF_YEAR field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_DAY_OF_YEAR_FIELD = 10,
/**
* FieldPosition and UFieldPosition selector for 'F' field alignment,
* corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
/**
* FieldPosition and UFieldPosition selector for 'w' field alignment,
* corresponding to the UCAL_WEEK_OF_YEAR field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_WEEK_OF_YEAR_FIELD = 12,
/**
* FieldPosition and UFieldPosition selector for 'W' field alignment,
* corresponding to the UCAL_WEEK_OF_MONTH field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_WEEK_OF_MONTH_FIELD = 13,
/**
* FieldPosition and UFieldPosition selector for 'a' field alignment,
* corresponding to the UCAL_AM_PM field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_AM_PM_FIELD = 14,
@@ -277,7 +278,7 @@ typedef enum UDateFormatField {
* corresponding to the UCAL_HOUR field.
* UDAT_HOUR1_FIELD is used for the one-based 12-hour clock.
* For example, 11:30 PM + 1 hour results in 12:30 AM.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_HOUR1_FIELD = 15,
@@ -286,7 +287,7 @@ typedef enum UDateFormatField {
* corresponding to the UCAL_HOUR field.
* UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock.
* For example, 11:30 PM + 1 hour results in 00:30 AM.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_HOUR0_FIELD = 16,
@@ -294,42 +295,42 @@ typedef enum UDateFormatField {
* FieldPosition and UFieldPosition selector for 'z' field alignment,
* corresponding to the UCAL_ZONE_OFFSET and
* UCAL_DST_OFFSET fields.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_TIMEZONE_FIELD = 17,
/**
* FieldPosition and UFieldPosition selector for 'Y' field alignment,
* corresponding to the UCAL_YEAR_WOY field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_YEAR_WOY_FIELD = 18,
/**
* FieldPosition and UFieldPosition selector for 'e' field alignment,
* corresponding to the UCAL_DOW_LOCAL field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_DOW_LOCAL_FIELD = 19,
/**
* FieldPosition and UFieldPosition selector for 'u' field alignment,
* corresponding to the UCAL_EXTENDED_YEAR field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_EXTENDED_YEAR_FIELD = 20,
/**
* FieldPosition and UFieldPosition selector for 'g' field alignment,
* corresponding to the UCAL_JULIAN_DAY field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_JULIAN_DAY_FIELD = 21,
/**
* FieldPosition and UFieldPosition selector for 'A' field alignment,
* corresponding to the UCAL_MILLISECONDS_IN_DAY field.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
@@ -337,11 +338,13 @@ typedef enum UDateFormatField {
* FieldPosition and UFieldPosition selector for 'Z' field alignment,
* corresponding to the UCAL_ZONE_OFFSET and
* UCAL_DST_OFFSET fields.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UDAT_TIMEZONE_RFC_FIELD = 23,
- /**
+#ifndef U_HIDE_DRAFT_API
+
+ /**
* FieldPosition and UFieldPosition selector for 'v' field alignment,
* corresponding to the UCAL_ZONE_OFFSET field.
* @draft ICU 3.4
@@ -363,15 +366,35 @@ typedef enum UDateFormatField {
*/
UDAT_STANDALONE_MONTH_FIELD = 26,
+ /**
+ * FieldPosition selector for "Q" field alignment,
+ * corresponding to quarters. This is implemented
+ * using the {@link Calendar#MONTH} field. This
+ * displays the quarter.
+ * @draft ICU 3.6
+ */
+ UDAT_QUARTER_FIELD = 27,
+
+ /**
+ * FieldPosition selector for the "q" field alignment,
+ * corresponding to stand-alone quarters. This is
+ * implemented using the {@link Calendar#MONTH} field.
+ * This displays the stand-alone quarter.
+ * @draft ICU 3.6
+ */
+ UDAT_STANDALONE_QUARTER_FIELD = 28,
+
+#endif /*U_HIDE_DRAFT_API*/
+
/**
* Number of FieldPosition and UFieldPosition selectors for
* DateFormat and UDateFormat.
* Valid selectors range from 0 to UDAT_FIELD_COUNT-1.
* This value is subject to change if new fields are defined
* in the future.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
- UDAT_FIELD_COUNT = 27
+ UDAT_FIELD_COUNT = 29
} UDateFormatField;
@@ -687,7 +710,15 @@ typedef enum UDateFormatSymbolType {
/** Standalone context versions of weekdays */
UDAT_STANDALONE_WEEKDAYS,
UDAT_STANDALONE_SHORT_WEEKDAYS,
- UDAT_STANDALONE_NARROW_WEEKDAYS
+ UDAT_STANDALONE_NARROW_WEEKDAYS,
+ /** The quarters, for example 1st Quarter */
+ UDAT_QUARTERS,
+ /** The short quarter names, for example Q1 */
+ UDAT_SHORT_QUARTERS,
+ /** Standalone context versions of quarters */
+ UDAT_STANDALONE_QUARTERS,
+ UDAT_STANDALONE_SHORT_QUARTERS
+
} UDateFormatSymbolType;
struct UDateFormatSymbols;
@@ -767,9 +798,9 @@ udat_setSymbols( UDateFormat *format,
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale name
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
-U_DRAFT const char* U_EXPORT2
+U_STABLE const char* U_EXPORT2
udat_getLocaleByType(const UDateFormat *fmt,
ULocDataLocaleType type,
UErrorCode* status);
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h b/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h
index 84ba9ee13dd..667fc155af9 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h
@@ -1,7 +1,7 @@
/*
******************************************************************************
* *
-* Copyright (C) 2003-2005, International Business Machines *
+* Copyright (C) 2003-2006, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@@ -26,40 +26,36 @@
* \brief C API: Provides access to locale data.
*/
-/** A locale data object.
- * For usage in C programs.
- * @draft ICU 3.4
- */
-typedef struct ULocaleData {
- /**
- * Controls the "No Substitute" behavior of this locale data object
- */
- UBool noSubstitute;
-
- /**
- * Pointer to the resource bundle associated with this locale data object
- */
- UResourceBundle *bundle;
-} ULocaleData;
+/** Forward declaration of the ULocaleData structure. @draft ICU 3.6 */
+struct ULocaleData;
+
+/** A locale data object. @draft ICU 3.6 */
+typedef struct ULocaleData ULocaleData;
+
+
/** The possible types of exemplar character sets.
* @draft ICU 3.4
*/
-typedef enum ULocaleDataExemplarSetType {
- ULOCDATA_ES_STANDARD, /* Basic set */
- ULOCDATA_ES_AUXILIARY, /* Auxiliary set */
- ULOCDATA_ES_COUNT
+typedef enum ULocaleDataExemplarSetType {
+#ifndef U_HIDE_DRAFT_API
+ ULOCDATA_ES_STANDARD=0, /* Basic set */
+ ULOCDATA_ES_AUXILIARY=1, /* Auxiliary set */
+#endif
+ ULOCDATA_ES_COUNT=3
} ULocaleDataExemplarSetType;
/** The possible types of delimiters.
* @draft ICU 3.4
*/
typedef enum ULocaleDataDelimiterType {
- ULOCDATA_QUOTATION_START, /* Quotation start */
- ULOCDATA_QUOTATION_END, /* Quotation end */
- ULOCDATA_ALT_QUOTATION_START, /* Alternate quotation start */
- ULOCDATA_ALT_QUOTATION_END, /* Alternate quotation end */
- ULOCDATA_DELIMITER_COUNT
+#ifndef U_HIDE_DRAFT_API
+ ULOCDATA_QUOTATION_START = 0, /* Quotation start */
+ ULOCDATA_QUOTATION_END = 1, /* Quotation end */
+ ULOCDATA_ALT_QUOTATION_START = 2, /* Alternate quotation start */
+ ULOCDATA_ALT_QUOTATION_END = 3, /* Alternate quotation end */
+#endif
+ ULOCDATA_DELIMITER_COUNT = 4
} ULocaleDataDelimiterType;
/**
@@ -155,17 +151,15 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
U_DRAFT int32_t U_EXPORT2
ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status);
-#ifndef U_HIDE_DRAFT_API
/**
* Enumeration for representing the measurement systems.
- * @draft ICU 2.8
+ * @stable ICU 2.8
*/
typedef enum UMeasurementSystem {
UMS_SI, /** Measurement system specified by SI otherwise known as Metric system. */
UMS_US, /** Measurement system followed in the United States of America. */
UMS_LIMIT
} UMeasurementSystem;
-#endif /*U_HIDE_DRAFT_API */
/**
* Returns the measurement system used in the locale specified by the localeID.
@@ -175,9 +169,9 @@ typedef enum UMeasurementSystem {
* @param status Must be a valid pointer to an error code value,
* which must not indicate a failure before the function call.
* @return UMeasurementSystem the measurement system used in the locale.
- * @draft ICU 2.8
+ * @stable ICU 2.8
*/
-U_DRAFT UMeasurementSystem U_EXPORT2
+U_STABLE UMeasurementSystem U_EXPORT2
ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status);
/**
@@ -194,9 +188,9 @@ ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status);
* @param width A pointer to int to recieve the width information.
* @param status Must be a valid pointer to an error code value,
* which must not indicate a failure before the function call.
- * @draft ICU 2.8
+ * @stable ICU 2.8
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status);
#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/umsg.h b/Build/source/libs/icu-xetex/i18n/unicode/umsg.h
index a55c272bc2e..32ed063c274 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/umsg.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/umsg.h
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1996-2005, International Business Machines Corporation
+* Copyright (C) 1996-2006, International Business Machines Corporation
* and others. All Rights Reserved.
*******************************************************************************
*
@@ -612,35 +612,35 @@ umsg_vparse(const UMessageFormat *fmt,
UErrorCode *status);
- /**
- * Convert an 'apostrophe-friendly' pattern into a standard
- * pattern. Standard patterns treat all apostrophes as
- * quotes, which is problematic in some languages, e.g.
- * French, where apostrophe is commonly used. This utility
- * assumes that only an unpaired apostrophe immediately before
- * a brace is a true quote. Other unpaired apostrophes are paired,
- * and the resulting standard pattern string is returned.
- *
- * <p><b>Note</b> it is not guaranteed that the returned pattern
- * is indeed a valid pattern. The only effect is to convert
- * between patterns having different quoting semantics.
- *
- * @param pattern the 'apostrophe-friendly' patttern to convert
- * @param patternLength the length of pattern, or -1 if unknown and pattern is null-terminated
- * @param dest the buffer for the result, or NULL if preflight only
- * @param destCapacity the length of the buffer, or 0 if preflighting
- * @param ec the error code
- * @return the length of the resulting text, not including trailing null
- * if buffer has room for the trailing null, it is provided, otherwise
- * not
- * @draft ICU 3.4
- */
+/**
+ * Convert an 'apostrophe-friendly' pattern into a standard
+ * pattern. Standard patterns treat all apostrophes as
+ * quotes, which is problematic in some languages, e.g.
+ * French, where apostrophe is commonly used. This utility
+ * assumes that only an unpaired apostrophe immediately before
+ * a brace is a true quote. Other unpaired apostrophes are paired,
+ * and the resulting standard pattern string is returned.
+ *
+ * <p><b>Note</b> it is not guaranteed that the returned pattern
+ * is indeed a valid pattern. The only effect is to convert
+ * between patterns having different quoting semantics.
+ *
+ * @param pattern the 'apostrophe-friendly' patttern to convert
+ * @param patternLength the length of pattern, or -1 if unknown and pattern is null-terminated
+ * @param dest the buffer for the result, or NULL if preflight only
+ * @param destCapacity the length of the buffer, or 0 if preflighting
+ * @param ec the error code
+ * @return the length of the resulting text, not including trailing null
+ * if buffer has room for the trailing null, it is provided, otherwise
+ * not
+ * @stable ICU 3.4
+ */
U_STABLE int32_t U_EXPORT2
umsg_autoQuoteApostrophe(const UChar* pattern,
- int32_t patternLength,
- UChar* dest,
- int32_t destCapacity,
- UErrorCode* ec);
+ int32_t patternLength,
+ UChar* dest,
+ int32_t destCapacity,
+ UErrorCode* ec);
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/unum.h b/Build/source/libs/icu-xetex/i18n/unicode/unum.h
index e699adb3d41..c3bbc1e7705 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/unum.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/unum.h
@@ -1,6 +1,7 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
* Modification History:
*
* Date Name Description
@@ -133,7 +134,7 @@ typedef void* UNumberFormat;
typedef enum UNumberFormatStyle {
/**
* Decimal format defined by pattern
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PATTERN_DECIMAL=0,
/** Decimal format */
@@ -148,17 +149,17 @@ typedef enum UNumberFormatStyle {
UNUM_SPELLOUT,
/**
* Ordinal rule-based format
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_ORDINAL,
/**
* Duration rule-based format
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_DURATION,
/**
* Rule-based format defined by pattern
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PATTERN_RULEBASED,
/** Default format */
@@ -221,7 +222,7 @@ typedef enum UNumberFormatPadPosition {
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI UNumberFormat* U_EXPORT2
+U_STABLE UNumberFormat* U_EXPORT2
unum_open( UNumberFormatStyle style,
const UChar* pattern,
int32_t patternLength,
@@ -236,7 +237,7 @@ unum_open( UNumberFormatStyle style,
* @param fmt The formatter to close.
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_close(UNumberFormat* fmt);
/**
@@ -247,7 +248,7 @@ unum_close(UNumberFormat* fmt);
* @return A pointer to a UNumberFormat identical to fmt.
* @stable ICU 2.0
*/
-U_CAPI UNumberFormat* U_EXPORT2
+U_STABLE UNumberFormat* U_EXPORT2
unum_clone(const UNumberFormat *fmt,
UErrorCode *status);
@@ -272,7 +273,7 @@ unum_clone(const UNumberFormat *fmt,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_format( const UNumberFormat* fmt,
int32_t number,
UChar* result,
@@ -301,7 +302,7 @@ unum_format( const UNumberFormat* fmt,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatInt64(const UNumberFormat *fmt,
int64_t number,
UChar* result,
@@ -330,7 +331,7 @@ unum_formatInt64(const UNumberFormat *fmt,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatDouble( const UNumberFormat* fmt,
double number,
UChar* result,
@@ -357,9 +358,9 @@ unum_formatDouble( const UNumberFormat* fmt,
* @see unum_formatDouble
* @see unum_parseDoubleCurrency
* @see UFieldPosition
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatDoubleCurrency(const UNumberFormat* fmt,
double number,
UChar* currency,
@@ -385,7 +386,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt,
* @see unum_formatDouble
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_parse( const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
@@ -433,7 +434,7 @@ unum_parseInt64(const UNumberFormat* fmt,
* @see unum_formatDouble
* @stable ICU 2.0
*/
-U_CAPI double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_parseDouble( const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
@@ -457,9 +458,9 @@ unum_parseDouble( const UNumberFormat* fmt,
* @return the parsed double
* @see unum_parseDouble
* @see unum_formatDoubleCurrency
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_parseDoubleCurrency(const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
@@ -483,7 +484,7 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt,
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_applyPattern( UNumberFormat *format,
UBool localized,
const UChar *pattern,
@@ -502,7 +503,7 @@ unum_applyPattern( UNumberFormat *format,
* @see unum_countAvailable
* @stable ICU 2.0
*/
-U_CAPI const char* U_EXPORT2
+U_STABLE const char* U_EXPORT2
unum_getAvailable(int32_t index);
/**
@@ -514,7 +515,7 @@ unum_getAvailable(int32_t index);
* @see unum_getAvailable
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_countAvailable(void);
/** The possible UNumberFormat numeric attributes @stable ICU 2.0 */
@@ -552,16 +553,16 @@ typedef enum UNumberFormatAttribute {
/** Secondary grouping size */
UNUM_SECONDARY_GROUPING_SIZE,
/** Use significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_SIGNIFICANT_DIGITS_USED,
/** Minimum significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_MIN_SIGNIFICANT_DIGITS,
/** Maximum significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_MAX_SIGNIFICANT_DIGITS,
/** Lenient parse mode used by rule-based formats.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_LENIENT_PARSE
} UNumberFormatAttribute;
@@ -582,7 +583,7 @@ typedef enum UNumberFormatAttribute {
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr);
@@ -605,7 +606,7 @@ unum_getAttribute(const UNumberFormat* fmt,
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
int32_t newValue);
@@ -625,7 +626,7 @@ unum_setAttribute( UNumberFormat* fmt,
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_getDoubleAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr);
@@ -643,7 +644,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt,
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setDoubleAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
double newValue);
@@ -664,14 +665,14 @@ typedef enum UNumberFormatTextAttribute {
UNUM_CURRENCY_CODE,
/**
* The default rule set. This is only available with rule-based formatters.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_DEFAULT_RULESET,
/**
* The public rule sets. This is only available with rule-based formatters.
* This is a read-only attribute. The public rulesets are returned as a
* single string, with each ruleset name delimited by ';' (semicolon).
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PUBLIC_RULESETS
} UNumberFormatTextAttribute;
@@ -694,7 +695,7 @@ typedef enum UNumberFormatTextAttribute {
* @see unum_setAttribute
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getTextAttribute( const UNumberFormat* fmt,
UNumberFormatTextAttribute tag,
UChar* result,
@@ -717,7 +718,7 @@ unum_getTextAttribute( const UNumberFormat* fmt,
* @see unum_setAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setTextAttribute( UNumberFormat* fmt,
UNumberFormatTextAttribute tag,
const UChar* newValue,
@@ -740,15 +741,13 @@ unum_setTextAttribute( UNumberFormat* fmt,
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_toPattern( const UNumberFormat* fmt,
UBool isPatternLocalized,
UChar* result,
int32_t resultLength,
UErrorCode* status);
-/** The maximum size for a textual number format symbol. @internal*/
-#define UNFSYMBOLSMAXSIZE 10
/**
* Constants for specifying a number format symbol.
@@ -756,42 +755,50 @@ unum_toPattern( const UNumberFormat* fmt,
*/
typedef enum UNumberFormatSymbol {
/** The decimal separator */
- UNUM_DECIMAL_SEPARATOR_SYMBOL,
+ UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
/** The grouping separator */
- UNUM_GROUPING_SEPARATOR_SYMBOL,
+ UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
/** The pattern separator */
- UNUM_PATTERN_SEPARATOR_SYMBOL,
+ UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
/** The percent sign */
- UNUM_PERCENT_SYMBOL,
+ UNUM_PERCENT_SYMBOL = 3,
/** Zero*/
- UNUM_ZERO_DIGIT_SYMBOL,
+ UNUM_ZERO_DIGIT_SYMBOL = 4,
/** Character representing a digit in the pattern */
- UNUM_DIGIT_SYMBOL,
+ UNUM_DIGIT_SYMBOL = 5,
/** The minus sign */
- UNUM_MINUS_SIGN_SYMBOL,
+ UNUM_MINUS_SIGN_SYMBOL = 6,
/** The plus sign */
- UNUM_PLUS_SIGN_SYMBOL,
+ UNUM_PLUS_SIGN_SYMBOL = 7,
/** The currency symbol */
- UNUM_CURRENCY_SYMBOL,
+ UNUM_CURRENCY_SYMBOL = 8,
/** The international currency symbol */
- UNUM_INTL_CURRENCY_SYMBOL,
+ UNUM_INTL_CURRENCY_SYMBOL = 9,
/** The monetary separator */
- UNUM_MONETARY_SEPARATOR_SYMBOL,
+ UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
/** The exponential symbol */
- UNUM_EXPONENTIAL_SYMBOL,
+ UNUM_EXPONENTIAL_SYMBOL = 11,
/** Per mill symbol */
- UNUM_PERMILL_SYMBOL,
+ UNUM_PERMILL_SYMBOL = 12,
/** Escape padding character */
- UNUM_PAD_ESCAPE_SYMBOL,
+ UNUM_PAD_ESCAPE_SYMBOL = 13,
/** Infinity symbol */
- UNUM_INFINITY_SYMBOL,
+ UNUM_INFINITY_SYMBOL = 14,
/** Nan symbol */
- UNUM_NAN_SYMBOL,
+ UNUM_NAN_SYMBOL = 15,
/** Significant digit symbol
- * @draft ICU 3.0 */
- UNUM_SIGNIFICANT_DIGIT_SYMBOL,
+ * @stable ICU 3.0 */
+ UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
+
+#ifndef U_HIDE_DRAFT_API
+ /** The monetary grouping separator
+ * @draft ICU 3.6
+ */
+ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
+#endif /*U_HIDE_DRAFT_API*/
+
/** count symbol constants */
- UNUM_FORMAT_SYMBOL_COUNT
+ UNUM_FORMAT_SYMBOL_COUNT = 18
} UNumberFormatSymbol;
/**
@@ -810,7 +817,7 @@ typedef enum UNumberFormatSymbol {
* @see unum_setSymbol
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getSymbol(const UNumberFormat *fmt,
UNumberFormatSymbol symbol,
UChar *buffer,
@@ -830,7 +837,7 @@ unum_getSymbol(const UNumberFormat *fmt,
* @see unum_getSymbol
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setSymbol(UNumberFormat *fmt,
UNumberFormatSymbol symbol,
const UChar *value,
@@ -845,9 +852,9 @@ unum_setSymbol(UNumberFormat *fmt,
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale name
- * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
-U_CAPI const char* U_EXPORT2
+U_STABLE const char* U_EXPORT2
unum_getLocaleByType(const UNumberFormat *fmt,
ULocDataLocaleType type,
UErrorCode* status);
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/uregex.h b/Build/source/libs/icu-xetex/i18n/unicode/uregex.h
index 6a44080c6ca..862cf344641 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/uregex.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/uregex.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2004-2005, International Business Machines
+* Copyright (C) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
@@ -29,29 +29,27 @@
#include "unicode/parseerr.h"
-#ifndef U_HIDE_DRAFT_API
-
struct URegularExpression;
/**
* Structure represeting a compiled regular rexpression, plus the results
* of a match operation.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
typedef struct URegularExpression URegularExpression;
-#endif /* U_HIDE_DRAFT_API */
-
/**
* Constants for Regular Expression Match Modes.
* @stable ICU 2.4
*/
typedef enum URegexpFlag{
+
+#ifndef U_HIDE_DRAFT_API
/** Forces normalization of pattern and strings.
Not implemented yet, just a placeholder, hence draft.
@draft ICU 2.4 */
UREGEX_CANON_EQ = 128,
-
+#endif
/** Enable case insensitive matching. @stable ICU 2.4 */
UREGEX_CASE_INSENSITIVE = 2,
@@ -96,10 +94,10 @@ typedef enum URegexpFlag{
* error within the source regular expression string. If this
* information is not wanted, pass NULL for this parameter.
* @param status Receives error detected by this function.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*
*/
-U_DRAFT URegularExpression * U_EXPORT2
+U_STABLE URegularExpression * U_EXPORT2
uregex_open( const UChar *pattern,
int32_t patternLength,
uint32_t flags,
@@ -127,10 +125,10 @@ uregex_open( const UChar *pattern,
* @return The URegularExpression object representing the compiled
* pattern.
*
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
#if !UCONFIG_NO_CONVERSION
-U_DRAFT URegularExpression * U_EXPORT2
+U_STABLE URegularExpression * U_EXPORT2
uregex_openC( const char *pattern,
uint32_t flags,
UParseError *pe,
@@ -144,9 +142,9 @@ uregex_openC( const char *pattern,
* was holding.
*
* @param regexp The regular expression to be closed.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
uregex_close(URegularExpression *regexp);
/**
@@ -165,9 +163,9 @@ uregex_close(URegularExpression *regexp);
* @param regexp The compiled regular expression to be cloned.
* @param status Receives indication of any errors encountered
* @return the cloned copy of the compiled regular expression.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT URegularExpression * U_EXPORT2
+U_STABLE URegularExpression * U_EXPORT2
uregex_clone(const URegularExpression *regexp, UErrorCode *status);
/**
@@ -184,9 +182,9 @@ uregex_clone(const URegularExpression *regexp, UErrorCode *status);
* owned by the regular expression object, and must not be
* altered or deleted by the application. The returned string
* will remain valid until the regular expression is closed.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT const UChar * U_EXPORT2
+U_STABLE const UChar * U_EXPORT2
uregex_pattern(const URegularExpression *regexp,
int32_t *patLength,
UErrorCode *status);
@@ -198,9 +196,9 @@ uregex_pattern(const URegularExpression *regexp,
* @param regexp The compiled regular expression.
* @return The match mode flags
* @see URegexpFlag
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_flags(const URegularExpression *regexp,
UErrorCode *status);
@@ -223,9 +221,9 @@ uregex_flags(const URegularExpression *regexp,
* @param textLength The length of the subject text, or -1 if the string
* is NUL terminated.
* @param status Receives errors detected by this function.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
uregex_setText(URegularExpression *regexp,
const UChar *text,
int32_t textLength,
@@ -245,9 +243,9 @@ uregex_setText(URegularExpression *regexp,
* @param status Receives errors detected by this function.
* @return Poiner to the subject text string currently associated with
* this regular expression.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT const UChar * U_EXPORT2
+U_STABLE const UChar * U_EXPORT2
uregex_getText(URegularExpression *regexp,
int32_t *textLength,
UErrorCode *status);
@@ -260,9 +258,9 @@ uregex_getText(URegularExpression *regexp,
* @param startIndex The input string index at which to begin matching.
* @param status Receives errors detected by this function.
* @return TRUE if there is a match
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UBool U_EXPORT2
+U_STABLE UBool U_EXPORT2
uregex_matches(URegularExpression *regexp,
int32_t startIndex,
UErrorCode *status);
@@ -280,9 +278,9 @@ uregex_matches(URegularExpression *regexp,
* @param startIndex The input string index at which to begin matching.
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if there is a match.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UBool U_EXPORT2
+U_STABLE UBool U_EXPORT2
uregex_lookingAt(URegularExpression *regexp,
int32_t startIndex,
UErrorCode *status);
@@ -297,9 +295,9 @@ uregex_lookingAt(URegularExpression *regexp,
* @param startIndex The position in the input string to begin the search
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if a match is found.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UBool U_EXPORT2
+U_STABLE UBool U_EXPORT2
uregex_find(URegularExpression *regexp,
int32_t startIndex,
UErrorCode *status);
@@ -315,9 +313,9 @@ uregex_find(URegularExpression *regexp,
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if a match is found.
* @see uregex_reset
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT UBool U_EXPORT2
+U_STABLE UBool U_EXPORT2
uregex_findNext(URegularExpression *regexp,
UErrorCode *status);
@@ -326,9 +324,9 @@ uregex_findNext(URegularExpression *regexp,
* @param regexp The compiled regular expression.
* @param status A reference to a UErrorCode to receive any errors.
* @return the number of capture groups
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_groupCount(URegularExpression *regexp,
UErrorCode *status);
@@ -346,9 +344,9 @@ uregex_groupCount(URegularExpression *regexp,
* @param status A reference to a UErrorCode to receive any errors.
* @return Length of matching data,
* or -1 if no applicable match.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_group(URegularExpression *regexp,
int32_t groupNum,
UChar *dest,
@@ -368,9 +366,9 @@ uregex_group(URegularExpression *regexp,
* @param status A reference to a UErrorCode to receive any errors.
* @return the starting position in the input of the text matched
* by the specified group.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_start(URegularExpression *regexp,
int32_t groupNum,
UErrorCode *status);
@@ -386,9 +384,9 @@ uregex_start(URegularExpression *regexp,
* @param groupNum The capture group number
* @param status A reference to a UErrorCode to receive any errors.
* @return the index of the position following the last matched character.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_end(URegularExpression *regexp,
int32_t groupNum,
UErrorCode *status);
@@ -403,9 +401,9 @@ uregex_end(URegularExpression *regexp,
* @param index The position in the text at which a
* uregex_findNext() should begin searching.
* @param status A reference to a UErrorCode to receive any errors.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
uregex_reset(URegularExpression *regexp,
int32_t index,
UErrorCode *status);
@@ -432,9 +430,9 @@ uregex_reset(URegularExpression *regexp,
* and replace operation. In the event that the
* destination capacity is inadequate, the return value
* is still the full length of the untruncated string.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_replaceAll(URegularExpression *regexp,
const UChar *replacementText,
int32_t replacementLength,
@@ -465,9 +463,9 @@ uregex_replaceAll(URegularExpression *regexp,
* and replace operation. In the event that the
* destination capacity is inadequate, the return value
* is still the full length of the untruncated string.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_replaceFirst(URegularExpression *regexp,
const UChar *replacementText,
int32_t replacementLength,
@@ -519,10 +517,10 @@ uregex_replaceFirst(URegularExpression *regexp,
* destCapacity is inadequate, the full length of the
* untruncated output string is returned.
*
- * @draft ICU 3.0
+ * @stable ICU 3.0
*
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_appendReplacement(URegularExpression *regexp,
const UChar *replacementText,
int32_t replacementLength,
@@ -553,9 +551,9 @@ uregex_appendReplacement(URegularExpression *regexp,
* destCapacity is inadequate, the full length of the
* untruncated output string is returned.
*
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_appendTail(URegularExpression *regexp,
UChar **destBuf,
int32_t *destCapacity,
@@ -573,6 +571,22 @@ uregex_appendTail(URegularExpression *regexp,
* Each of the fields is copied from the input string to the destination
* buffer, and the NUL terminated. The position of each field within
* the destination buffer is returned in the destFields array.
+ *
+ * Note: another choice for the design of this function would be to not
+ * copy the resulting fields at all, but to return indexes and
+ * lengths within the source text.
+ * Advantages would be
+ * o Faster. No Copying.
+ * o Nothing extra needed when field data may contain embedded NUL chars.
+ * o Less memory needed if working on large data.
+ * Disadvantages
+ * o Less consistent with C++ split, which copies into an
+ * array of UnicodeStrings.
+ * o No NUL termination, extracted fields would be less convenient
+ * to use in most cases.
+ * o Possible problems in the future, when support Unicode Normalization
+ * could cause the fields to not correspond exactly to
+ * a range of the source text.
*
* @param regexp The compiled regular expression.
* @param destBuf A (UChar *) buffer to receive the fields that
@@ -600,25 +614,9 @@ uregex_appendTail(URegularExpression *regexp,
* positions are used.
* @param status A reference to a UErrorCode to receive any errors.
* @return The number of fields into which the input string was split.
- * @draft ICU 3.0
- *
- * Note: another choice for the design of this function would be to not
- * copy the resulting fields at all, but to return indexes and
- * lengths within the source text.
- * Advantages would be
- * o Faster. No Copying.
- * o Nothing extra needed when field data may contain embedded NUL chars.
- * o Less memory needed if working on large data.
- * Disadvantages
- * o Less consistent with C++ split, which copies into an
- * array of UnicodeStrings.
- * o No NUL termination, extracted fields would be less convenient
- * to use in most cases.
- * o Possible problems in the future, when support Unicode Normalization
- * could cause the fields to not correspond exactly to
- * a range of the source text.
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uregex_split( URegularExpression *regexp,
UChar *destBuf,
int32_t destCapacity,
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h b/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h
index 36d4ea493d6..1ab9c215d48 100644
--- a/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h
+++ b/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2004 - 2005, International Business Machines Corporation and
+* Copyright (C) 2004 - 2006, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@@ -74,7 +74,7 @@
* </tr>
* <tr>
* <td>UDTS_MAC_OLD_TIME</td>
- * <td>int32_t</td>
+ * <td>int32_t or int64_t</td>
* <td>seconds</td>
* <td>Jan 1, 1904</td>
*
@@ -190,14 +190,14 @@
* <code>UDateTimeScale</code> values are used to specify the time scale used for
* conversion into or out if the universal time scale.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
typedef enum UDateTimeScale {
/**
* Used in the JDK. Data is a Java <code>long</code> (<code>int64_t</code>). Value
* is milliseconds since January 1, 1970.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_JAVA_TIME = 0,
@@ -205,7 +205,7 @@ typedef enum UDateTimeScale {
* Used on Unix systems. Data is <code>int32_t</code> or <code>int64_t</code>. Value
* is seconds since January 1, 1970.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_UNIX_TIME,
@@ -213,7 +213,7 @@ typedef enum UDateTimeScale {
* Used in IUC4C. Data is a <code>double</code>. Value
* is milliseconds since January 1, 1970.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_ICU4C_TIME,
@@ -221,7 +221,7 @@ typedef enum UDateTimeScale {
* Used in Windows for file times. Data is an <code>int64_t</code>. Value
* is ticks (1 tick == 100 nanoseconds) since January 1, 1601.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_WINDOWS_FILE_TIME,
@@ -229,15 +229,15 @@ typedef enum UDateTimeScale {
* Used in the .NET framework's <code>System.DateTime</code> structure. Data is an <code>int64_t</code>. Value
* is ticks (1 tick == 100 nanoseconds) since January 1, 0001.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_DOTNET_DATE_TIME,
/**
- * Used in older Macintosh systems. Data is an <code>int32_t</code>. Value
+ * Used in older Macintosh systems. Data is <code>int32_t</code> or <code>int64_t</code>. Value
* is seconds since January 1, 1904.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_MAC_OLD_TIME,
@@ -245,7 +245,7 @@ typedef enum UDateTimeScale {
* Used in newer Macintosh systems. Data is a <code>double</code>. Value
* is seconds since January 1, 2001.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_MAC_TIME,
@@ -253,7 +253,7 @@ typedef enum UDateTimeScale {
* Used in Excel. Data is an <code>?unknown?</code>. Value
* is days since December 31, 1899.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_EXCEL_TIME,
@@ -261,14 +261,12 @@ typedef enum UDateTimeScale {
* Used in DB2. Data is an <code>?unknown?</code>. Value
* is days since December 31, 1899.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UDTS_DB2_TIME,
/**
- * The first unused time scale value.
- *
- * @draft ICU 3.2
+ * The first unused time scale value. The limit of this enum
*/
UDTS_MAX_SCALE
} UDateTimeScale;
@@ -279,7 +277,7 @@ typedef enum UDateTimeScale {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
typedef enum UTimeScaleValue {
/**
@@ -288,7 +286,7 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
UTSV_UNITS_VALUE = 0,
@@ -298,9 +296,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
- UTSV_EPOCH_OFFSET_VALUE,
+ UTSV_EPOCH_OFFSET_VALUE=1,
/**
* The constant used to select the minimum from value
@@ -308,9 +306,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
- UTSV_FROM_MIN_VALUE,
+ UTSV_FROM_MIN_VALUE=2,
/**
* The constant used to select the maximum from value
@@ -318,9 +316,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
- UTSV_FROM_MAX_VALUE,
+ UTSV_FROM_MAX_VALUE=3,
/**
* The constant used to select the minimum to value
@@ -328,9 +326,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
- UTSV_TO_MIN_VALUE,
+ UTSV_TO_MIN_VALUE=4,
/**
* The constant used to select the maximum to value
@@ -338,10 +336,11 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
- UTSV_TO_MAX_VALUE,
+ UTSV_TO_MAX_VALUE=5,
+#ifndef U_HIDE_INTERNAL_API
/**
* The constant used to select the epoch plus one value
* for a time scale.
@@ -351,9 +350,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @internal ICU 3.2
*/
- UTSV_EPOCH_OFFSET_PLUS_1_VALUE,
+ UTSV_EPOCH_OFFSET_PLUS_1_VALUE=6,
/**
* The constant used to select the epoch plus one value
@@ -364,9 +363,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @draft ICU 3.2
+ * @internal ICU 3.2
*/
- UTSV_EPOCH_OFFSET_MINUS_1_VALUE,
+ UTSV_EPOCH_OFFSET_MINUS_1_VALUE=7,
/**
* The constant used to select the units round value
@@ -376,9 +375,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @internal
+ * @internal ICU 3.2
*/
- UTSV_UNITS_ROUND_VALUE,
+ UTSV_UNITS_ROUND_VALUE=8,
/**
* The constant used to select the minimum safe rounding value
@@ -388,9 +387,9 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @internal
+ * @internal ICU 3.2
*/
- UTSV_MIN_ROUND_VALUE,
+ UTSV_MIN_ROUND_VALUE=9,
/**
* The constant used to select the maximum safe rounding value
@@ -400,20 +399,19 @@ typedef enum UTimeScaleValue {
*
* @see utmscale_getTimeScaleValue
*
- * @internal
+ * @internal ICU 3.2
*/
- UTSV_MAX_ROUND_VALUE,
+ UTSV_MAX_ROUND_VALUE=10,
+
+#endif /* U_HIDE_INTERNAL_API */
/**
- * The number of time scale values.
- *
- * NOTE: This is an internal value. DO NOT USE IT.
+ * The number of time scale values, in other words limit of this enum.
*
* @see utmscale_getTimeScaleValue
- *
- * @internal
*/
- UTSV_MAX_SCALE_VALUE
+ UTSV_MAX_SCALE_VALUE=11
+
} UTimeScaleValue;
/**
@@ -424,9 +422,9 @@ typedef enum UTimeScaleValue {
* @param status The status code. Set to <code>U_ILLEGAL_ARGUMENT_ERROR</code> if arguments are invalid.
* @return - the value.
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT int64_t U_EXPORT2
+U_STABLE int64_t U_EXPORT2
utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status);
/* Conversion to 'universal time scale' */
@@ -440,9 +438,9 @@ U_DRAFT int64_t U_EXPORT2
*
* @return The datetime converted to the universal time scale
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT int64_t U_EXPORT2
+U_STABLE int64_t U_EXPORT2
utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status);
/* Conversion from 'universal time scale' */
@@ -456,9 +454,9 @@ U_DRAFT int64_t U_EXPORT2
*
* @return The datetime converted to the given time scale
*
- * @draft ICU 3.2
+ * @stable ICU 3.2
*/
-U_DRAFT int64_t U_EXPORT2
+U_STABLE int64_t U_EXPORT2
utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status);
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/uregex.cpp b/Build/source/libs/icu-xetex/i18n/uregex.cpp
index efcc1d5e147..9aab85e5df7 100644
--- a/Build/source/libs/icu-xetex/i18n/uregex.cpp
+++ b/Build/source/libs/icu-xetex/i18n/uregex.cpp
@@ -963,7 +963,10 @@ static void copyString(UChar *destBuffer, // Destination buffer.
break;
}
}
- destBuffer[di++] = 0;
+ if (di<destCapacity) {
+ destBuffer[di] = 0;
+ }
+ di++;
*destIndex = di;
}
@@ -1091,7 +1094,7 @@ uregex_split( URegularExpression *regexp,
if (requiredCapacity != NULL) {
*requiredCapacity = destIdx;
}
- if (*requiredCapacity > destCapacity) {
+ if (destIdx > destCapacity) {
*status = U_BUFFER_OVERFLOW_ERROR;
}
return i+1;
diff --git a/Build/source/libs/icu-xetex/i18n/usearch.cpp b/Build/source/libs/icu-xetex/i18n/usearch.cpp
index 5572992436e..74798e88aef 100644
--- a/Build/source/libs/icu-xetex/i18n/usearch.cpp
+++ b/Build/source/libs/icu-xetex/i18n/usearch.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2001-2005 IBM and others. All rights reserved.
+* Copyright (C) 2001-2006 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 07/02/2001 synwee Creation.
@@ -2490,11 +2490,13 @@ U_CAPI UStringSearch * U_EXPORT2 usearch_openFromCollator(
#endif
if (pattern == NULL || text == NULL || collator == NULL) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
}
// string search does not really work when numeric collation is turned on
if(ucol_getAttribute(collator, UCOL_NUMERIC_COLLATION, status) == UCOL_ON) {
*status = U_UNSUPPORTED_ERROR;
+ return NULL;
}
if (U_SUCCESS(*status)) {
diff --git a/Build/source/libs/icu-xetex/i18n/utmscale.c b/Build/source/libs/icu-xetex/i18n/utmscale.c
index 12ff579491d..dd35007b3bb 100644
--- a/Build/source/libs/icu-xetex/i18n/utmscale.c
+++ b/Build/source/libs/icu-xetex/i18n/utmscale.c
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2004, International Business Machines Corporation and
+* Copyright (C) 2004-2006, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@@ -19,103 +19,41 @@
#define hours (minutes * 60)
#define days (hours * 24)
-#define TIME_SCALE_CHECK(scale,status) \
- if(scale < 0 || scale >= UDTS_MAX_SCALE) { \
- *status = U_ILLEGAL_ARGUMENT_ERROR; \
- return 0; \
- }
-
-typedef struct
-{
- int64_t units;
- int64_t epochOffset;
-
- int64_t fromMin;
- int64_t fromMax;
- int64_t toMin;
- int64_t toMax;
-
- int64_t epochOffsetP1;
- int64_t epochOffsetM1;
- int64_t unitsRound;
- int64_t minRound;
- int64_t maxRound;
-} InternalTimeScaleData;
-
-static const InternalTimeScaleData timeScaleTable[] = {
+/* Constants generated by ICU4J com.ibm.icu.dev.tool.timescale.GenerateCTimeScaleData. */
+static const int64_t timeScaleTable[UDTS_MAX_SCALE][UTSV_MAX_SCALE_VALUE] = {
/* units epochOffset fromMin fromMax toMin toMax epochOffsetP1 epochOffsetM1 unitsRound minRound maxRound */
- {milliseconds, INT64_C(62135769600000), INT64_C(-984472973285477), INT64_C(860201434085477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135769600001), INT64_C(62135769599999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
- {seconds, INT64_C(62135769600), INT64_C(-984472973285), INT64_C(860201434085), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(62135769601), INT64_C(62135769599), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {milliseconds, INT64_C(62135769600000), INT64_C(-984472973285477), INT64_C(860201434085477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135769600001), INT64_C(62135769599999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
- {ticks, INT64_C(504912960000000000), U_INT64_MIN, INT64_C(8718459076854775807), INT64_C(-8718459076854775808), INT64_C(9223372036854775807), INT64_C(504912960000000000), INT64_C(504912960000000000), INT64_C(0), U_INT64_MIN, INT64_C(9223372036854775807)},
- {ticks, INT64_C(0), U_INT64_MIN, INT64_C(9223372036854775807), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(0), INT64_C(0), INT64_C(0), U_INT64_MIN, INT64_C(9223372036854775807)},
- {seconds, INT64_C(60052924800), INT64_C(-982390128485), INT64_C(862284278885), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(60052924801), INT64_C(60052924799), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {seconds, INT64_C(63114076800), INT64_C(-985451280485), INT64_C(859223126885), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(63114076801), INT64_C(63114076799), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {days, INT64_C(693596), INT64_C(-11368795), INT64_C(9981603), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(693597), INT64_C(693595), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
- {days, INT64_C(693596), INT64_C(-11368795), INT64_C(9981603), U_INT64_MIN, INT64_C(9223372036854775807), INT64_C(693597), INT64_C(693595), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
+ {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
+ {seconds, INT64_C(62135596800), INT64_C(-984472800485), INT64_C(860201606885), U_INT64_MIN, U_INT64_MAX, INT64_C(62135596801), INT64_C(62135596799), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
+ {ticks, INT64_C(504911232000000000), U_INT64_MIN, INT64_C(8718460804854775807), INT64_C(-8718460804854775808), U_INT64_MAX, INT64_C(504911232000000000), INT64_C(504911232000000000), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
+ {ticks, INT64_C(0), U_INT64_MIN, U_INT64_MAX, U_INT64_MIN, U_INT64_MAX, INT64_C(0), INT64_C(0), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
+ {seconds, INT64_C(60052752000), INT64_C(-982389955685), INT64_C(862284451685), U_INT64_MIN, U_INT64_MAX, INT64_C(60052752001), INT64_C(60052751999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {seconds, INT64_C(63113904000), INT64_C(-985451107685), INT64_C(859223299685), U_INT64_MIN, U_INT64_MAX, INT64_C(63113904001), INT64_C(63113903999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
+ {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
};
U_CAPI int64_t U_EXPORT2
utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status)
{
- const InternalTimeScaleData *internalData;
-
if (status == NULL || U_FAILURE(*status)) {
return 0;
}
- if (timeScale < 0 || timeScale >= UDTS_MAX_SCALE) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- internalData = &timeScaleTable[timeScale];
-
- switch (value)
+ if (timeScale < UDTS_JAVA_TIME || UDTS_MAX_SCALE <= timeScale
+ || value < UTSV_UNITS_VALUE || UTSV_MAX_SCALE_VALUE <= value)
{
- case UTSV_UNITS_VALUE:
- return internalData->units;
-
- case UTSV_EPOCH_OFFSET_VALUE:
- return internalData->epochOffset;
-
- case UTSV_FROM_MIN_VALUE:
- return internalData->fromMin;
-
- case UTSV_FROM_MAX_VALUE:
- return internalData->fromMax;
-
- case UTSV_TO_MIN_VALUE:
- return internalData->toMin;
-
- case UTSV_TO_MAX_VALUE:
- return internalData->toMax;
-
- case UTSV_EPOCH_OFFSET_PLUS_1_VALUE:
- return internalData->epochOffsetP1;
-
- case UTSV_EPOCH_OFFSET_MINUS_1_VALUE:
- return internalData->epochOffsetM1;
-
- case UTSV_UNITS_ROUND_VALUE:
- return internalData->unitsRound;
-
- case UTSV_MIN_ROUND_VALUE:
- return internalData->minRound;
-
- case UTSV_MAX_ROUND_VALUE:
- return internalData->maxRound;
-
- default:
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
+
+ return timeScaleTable[timeScale][value];
}
U_CAPI int64_t U_EXPORT2
utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status)
{
- const InternalTimeScaleData *data;
+ const int64_t *data;
if (status == NULL || U_FAILURE(*status)) {
return 0;
@@ -126,20 +64,20 @@ utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *stat
return 0;
}
- data = &timeScaleTable[timeScale];
+ data = (const int64_t *)(&timeScaleTable[timeScale]);
- if (otherTime < data->fromMin || otherTime > data->fromMax) {
+ if (otherTime < data[UTSV_FROM_MIN_VALUE] || otherTime > data[UTSV_FROM_MAX_VALUE]) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- return (otherTime + data->epochOffset) * data->units;
+ return (otherTime + data[UTSV_EPOCH_OFFSET_VALUE]) * data[UTSV_UNITS_VALUE];
}
U_CAPI int64_t U_EXPORT2
utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status)
{
- const InternalTimeScaleData *data;
+ const int64_t *data;
if (status == NULL || U_FAILURE(*status)) {
return 0;
@@ -150,26 +88,26 @@ utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *st
return 0;
}
- data = &timeScaleTable[timeScale];
+ data = (const int64_t *)(&timeScaleTable[timeScale]);
- if (universalTime < data->toMin || universalTime > data->toMax) {
+ if (universalTime < data[UTSV_TO_MIN_VALUE] || universalTime > data[UTSV_TO_MAX_VALUE]) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
if (universalTime < 0) {
- if (universalTime < data->minRound) {
- return (universalTime + data->unitsRound) / data->units - data->epochOffsetP1;
+ if (universalTime < data[UTSV_MIN_ROUND_VALUE]) {
+ return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_PLUS_1_VALUE];
}
- return (universalTime - data->unitsRound) / data->units - data->epochOffset;
+ return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
}
- if (universalTime > data->maxRound) {
- return (universalTime - data->unitsRound) / data->units - data->epochOffsetM1;
+ if (universalTime > data[UTSV_MAX_ROUND_VALUE]) {
+ return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_MINUS_1_VALUE];
}
- return (universalTime + data->unitsRound) / data->units - data->epochOffset;
+ return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
}
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/Build/source/libs/icu-xetex/i18n/windtfmt.cpp b/Build/source/libs/icu-xetex/i18n/windtfmt.cpp
new file mode 100644
index 00000000000..19766b1f637
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/windtfmt.cpp
@@ -0,0 +1,315 @@
+/*
+********************************************************************************
+* Copyright (C) 2005-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File WINDTFMT.CPP
+*
+********************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#ifdef U_WINDOWS
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/ures.h"
+#include "unicode/format.h"
+#include "unicode/fmtable.h"
+#include "unicode/datefmt.h"
+#include "unicode/msgfmt.h"
+#include "unicode/calendar.h"
+#include "unicode/gregocal.h"
+#include "unicode/locid.h"
+#include "unicode/unistr.h"
+#include "unicode/ustring.h"
+#include "unicode/timezone.h"
+#include "unicode/utmscale.h"
+
+#include "cmemory.h"
+#include "uresimp.h"
+#include "windtfmt.h"
+#include "wintz.h"
+
+# define WIN32_LEAN_AND_MEAN
+# define VC_EXTRALEAN
+# define NOUSER
+# define NOSERVICE
+# define NOIME
+# define NOMCX
+#include <windows.h>
+
+U_NAMESPACE_BEGIN
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Win32DateFormat)
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
+#define DELETE_ARRAY(array) uprv_free((void *) (array))
+
+#define STACK_BUFFER_SIZE 64
+
+UnicodeString *getTimeDateFormat(const Calendar *cal, const Locale *locale, UErrorCode &status)
+{
+ UnicodeString *result = NULL;
+ const char *type = cal->getType();
+ const char *base = locale->getBaseName();
+ UResourceBundle *topBundle = ures_open((char *) 0, base, &status);
+ UResourceBundle *calBundle = ures_getByKey(topBundle, "calendar", NULL, &status);
+ UResourceBundle *typBundle = ures_getByKeyWithFallback(calBundle, type, NULL, &status);
+ UResourceBundle *patBundle = ures_getByKeyWithFallback(typBundle, "DateTimePatterns", NULL, &status);
+
+ if (status == U_MISSING_RESOURCE_ERROR) {
+ status = U_ZERO_ERROR;
+ typBundle = ures_getByKeyWithFallback(calBundle, "gregorian", typBundle, &status);
+ patBundle = ures_getByKeyWithFallback(typBundle, "DateTimePatterns", patBundle, &status);
+ }
+
+ if (U_FAILURE(status)) {
+ UChar defaultPattern[] = {0x007B, 0x0031, 0x007D, 0x0020, 0x007B, 0x0030, 0x007D, 0x0000}; // "{1} {0}"
+ return new UnicodeString(defaultPattern, ARRAY_SIZE(defaultPattern));
+ }
+
+ int32_t resStrLen = 0;
+ const UChar *resStr = ures_getStringByIndex(patBundle, (int32_t)DateFormat::kDateTime, &resStrLen, &status);
+
+ result = new UnicodeString(TRUE, resStr, resStrLen);
+
+ ures_close(patBundle);
+ ures_close(typBundle);
+ ures_close(calBundle);
+ ures_close(topBundle);
+
+ return result;
+}
+
+// TODO: Range-check timeStyle, dateStyle
+Win32DateFormat::Win32DateFormat(DateFormat::EStyle timeStyle, DateFormat::EStyle dateStyle, const Locale &locale, UErrorCode &status)
+ : DateFormat(), fDateTimeMsg(NULL), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(&locale), fZoneID()
+{
+ if (U_SUCCESS(status)) {
+ fLCID = locale.getLCID();
+ fTZI = NEW_ARRAY(TIME_ZONE_INFORMATION, 1);
+ uprv_memset(fTZI, 0, sizeof(TIME_ZONE_INFORMATION));
+ adoptCalendar(Calendar::createInstance(locale, status));
+ }
+}
+
+Win32DateFormat::Win32DateFormat(const Win32DateFormat &other)
+ : DateFormat(other)
+{
+ *this = other;
+}
+
+Win32DateFormat::~Win32DateFormat()
+{
+// delete fCalendar;
+ uprv_free(fTZI);
+ delete fDateTimeMsg;
+}
+
+Win32DateFormat &Win32DateFormat::operator=(const Win32DateFormat &other)
+{
+ // The following handles fCalendar
+ DateFormat::operator=(other);
+
+// delete fCalendar;
+
+ this->fDateTimeMsg = other.fDateTimeMsg;
+ this->fTimeStyle = other.fTimeStyle;
+ this->fDateStyle = other.fDateStyle;
+ this->fLCID = other.fLCID;
+// this->fCalendar = other.fCalendar->clone();
+ this->fZoneID = other.fZoneID;
+
+ this->fTZI = NEW_ARRAY(TIME_ZONE_INFORMATION, 1);
+ *this->fTZI = *other.fTZI;
+
+ return *this;
+}
+
+Format *Win32DateFormat::clone(void) const
+{
+ return new Win32DateFormat(*this);
+}
+
+// TODO: Is just ignoring pos the right thing?
+UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, FieldPosition &pos) const
+{
+ FILETIME ft;
+ SYSTEMTIME st_gmt;
+ SYSTEMTIME st_local;
+ TIME_ZONE_INFORMATION tzi = *fTZI;
+ UErrorCode status = U_ZERO_ERROR;
+ const TimeZone &tz = cal.getTimeZone();
+ int64_t uct, uft;
+
+ setTimeZoneInfo(&tzi, tz);
+
+ uct = utmscale_fromInt64((int64_t) cal.getTime(status), UDTS_ICU4C_TIME, &status);
+ uft = utmscale_toInt64(uct, UDTS_WINDOWS_FILE_TIME, &status);
+
+ ft.dwLowDateTime = (DWORD) (uft & 0xFFFFFFFF);
+ ft.dwHighDateTime = (DWORD) ((uft >> 32) & 0xFFFFFFFF);
+
+ FileTimeToSystemTime(&ft, &st_gmt);
+ SystemTimeToTzSpecificLocalTime(&tzi, &st_gmt, &st_local);
+
+
+ if (fDateStyle != DateFormat::kNone && fTimeStyle != DateFormat::kNone) {
+ UnicodeString *date = new UnicodeString();
+ UnicodeString *time = new UnicodeString();
+ UnicodeString *pattern = fDateTimeMsg;
+ Formattable timeDateArray[2];
+
+ formatDate(&st_local, *date);
+ formatTime(&st_local, *time);
+
+ timeDateArray[0].adoptString(time);
+ timeDateArray[1].adoptString(date);
+
+ if (strcmp(fCalendar->getType(), cal.getType()) != 0) {
+ pattern = getTimeDateFormat(&cal, fLocale, status);
+ }
+
+ MessageFormat::format(*pattern, timeDateArray, 2, appendTo, status);
+ } else if (fDateStyle != DateFormat::kNone) {
+ formatDate(&st_local, appendTo);
+ } else if (fTimeStyle != DateFormat::kNone) {
+ formatTime(&st_local, appendTo);
+ }
+
+ return appendTo;
+}
+
+void Win32DateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition& pos) const
+{
+ pos.setErrorIndex(pos.getIndex());
+}
+
+void Win32DateFormat::adoptCalendar(Calendar *newCalendar)
+{
+ if (fCalendar == NULL || strcmp(fCalendar->getType(), newCalendar->getType()) != 0) {
+ UErrorCode status = U_ZERO_ERROR;
+
+ if (fDateStyle != DateFormat::kNone && fTimeStyle != DateFormat::kNone) {
+ delete fDateTimeMsg;
+ fDateTimeMsg = getTimeDateFormat(newCalendar, fLocale, status);
+ }
+ }
+
+ delete fCalendar;
+ fCalendar = newCalendar;
+
+ fZoneID = setTimeZoneInfo(fTZI, fCalendar->getTimeZone());
+}
+
+void Win32DateFormat::setCalendar(const Calendar &newCalendar)
+{
+ adoptCalendar(newCalendar.clone());
+}
+
+void Win32DateFormat::adoptTimeZone(TimeZone *zoneToAdopt)
+{
+ fZoneID = setTimeZoneInfo(fTZI, *zoneToAdopt);
+ fCalendar->adoptTimeZone(zoneToAdopt);
+}
+
+void Win32DateFormat::setTimeZone(const TimeZone& zone)
+{
+ fZoneID = setTimeZoneInfo(fTZI, zone);
+ fCalendar->setTimeZone(zone);
+}
+
+static const DWORD dfFlags[] = {DATE_LONGDATE, DATE_LONGDATE, DATE_SHORTDATE, DATE_SHORTDATE};
+
+void Win32DateFormat::formatDate(const SYSTEMTIME *st, UnicodeString &appendTo) const
+{
+ int result;
+ UChar stackBuffer[STACK_BUFFER_SIZE];
+ UChar *buffer = stackBuffer;
+
+ result = GetDateFormatW(fLCID, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, STACK_BUFFER_SIZE);
+
+ if (result == 0) {
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+ int newLength = GetDateFormatW(fLCID, dfFlags[fDateStyle - kDateOffset], st, NULL, NULL, 0);
+
+ buffer = NEW_ARRAY(UChar, newLength);
+ GetDateFormatW(fLCID, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, newLength);
+ }
+ }
+
+ appendTo.append(buffer, (int32_t) wcslen(buffer));
+
+ if (buffer != stackBuffer) {
+ DELETE_ARRAY(buffer);
+ }
+}
+
+static const DWORD tfFlags[] = {0, 0, 0, TIME_NOSECONDS};
+
+void Win32DateFormat::formatTime(const SYSTEMTIME *st, UnicodeString &appendTo) const
+{
+ int result;
+ UChar stackBuffer[STACK_BUFFER_SIZE];
+ UChar *buffer = stackBuffer;
+
+ result = GetTimeFormatW(fLCID, tfFlags[fTimeStyle], st, NULL, buffer, STACK_BUFFER_SIZE);
+
+ if (result == 0) {
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+ int newLength = GetTimeFormatW(fLCID, tfFlags[fTimeStyle], st, NULL, NULL, 0);
+
+ buffer = NEW_ARRAY(UChar, newLength);
+ GetDateFormatW(fLCID, tfFlags[fTimeStyle], st, NULL, buffer, newLength);
+ }
+ }
+
+ appendTo.append(buffer, (int32_t) wcslen(buffer));
+
+ if (buffer != stackBuffer) {
+ DELETE_ARRAY(buffer);
+ }
+}
+
+UnicodeString Win32DateFormat::setTimeZoneInfo(TIME_ZONE_INFORMATION *tzi, const TimeZone &zone) const
+{
+ UnicodeString zoneID;
+
+ zone.getID(zoneID);
+
+ if (zoneID.compare(fZoneID) != 0) {
+ UnicodeString icuid;
+
+ zone.getID(icuid);
+ if (! uprv_getWindowsTimeZoneInfo(tzi, icuid.getBuffer(), icuid.length())) {
+ UBool found = FALSE;
+ int32_t ec = TimeZone::countEquivalentIDs(icuid);
+
+ for (int z = 0; z < ec; z += 1) {
+ UnicodeString equiv = TimeZone::getEquivalentID(icuid, z);
+
+ if (found = uprv_getWindowsTimeZoneInfo(tzi, equiv.getBuffer(), equiv.length())) {
+ break;
+ }
+ }
+
+ if (! found) {
+ GetTimeZoneInformation(tzi);
+ }
+ }
+ }
+
+ return zoneID;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // #ifdef U_WINDOWS
+
diff --git a/Build/source/libs/icu-xetex/i18n/windtfmt.h b/Build/source/libs/icu-xetex/i18n/windtfmt.h
new file mode 100644
index 00000000000..364822d56b1
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/windtfmt.h
@@ -0,0 +1,148 @@
+/*
+********************************************************************************
+* Copyright (C) 2005-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File WINDTFMT.H
+*
+********************************************************************************
+*/
+
+#ifndef __WINDTFMT
+#define __WINDTFMT
+
+#include "unicode/utypes.h"
+
+#ifdef U_WINDOWS
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/format.h"
+#include "unicode/datefmt.h"
+#include "unicode/calendar.h"
+#include "unicode/ustring.h"
+#include "unicode/locid.h"
+
+/**
+ * \file
+ * \brief C++ API: Format dates using Windows API.
+ */
+
+U_CDECL_BEGIN
+// Forward declarations for Windows types...
+typedef struct _SYSTEMTIME SYSTEMTIME;
+typedef struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION;
+U_CDECL_END
+
+U_NAMESPACE_BEGIN
+
+class Win32DateFormat : public DateFormat
+{
+public:
+ Win32DateFormat(DateFormat::EStyle timeStyle, DateFormat::EStyle dateStyle, const Locale &locale, UErrorCode &status);
+
+ Win32DateFormat(const Win32DateFormat &other);
+
+ virtual ~Win32DateFormat();
+
+ virtual Format *clone(void) const;
+
+ Win32DateFormat &operator=(const Win32DateFormat &other);
+
+ UnicodeString &format(Calendar &cal, UnicodeString &appendTo, FieldPosition &pos) const;
+
+ UnicodeString& format(UDate date, UnicodeString& appendTo) const;
+
+ void parse(const UnicodeString& text, Calendar& cal, ParsePosition& pos) const;
+
+ /**
+ * Set the calendar to be used by this date format. Initially, the default
+ * calendar for the specified or default locale is used. The caller should
+ * not delete the Calendar object after it is adopted by this call.
+ *
+ * @param calendarToAdopt Calendar object to be adopted.
+ * @draft ICU 3.6
+ */
+ virtual void adoptCalendar(Calendar* calendarToAdopt);
+
+ /**
+ * Set the calendar to be used by this date format. Initially, the default
+ * calendar for the specified or default locale is used.
+ *
+ * @param newCalendar Calendar object to be set.
+ *
+ * @draft ICU 3.6
+ */
+ virtual void setCalendar(const Calendar& newCalendar);
+
+ /**
+ * Sets the time zone for the calendar of this DateFormat object. The caller
+ * no longer owns the TimeZone object and should not delete it after this call.
+ *
+ * @param zoneToAdopt the TimeZone to be adopted.
+ *
+ * @draft ICU 3.6
+ */
+ virtual void adoptTimeZone(TimeZone* zoneToAdopt);
+
+ /**
+ * Sets the time zone for the calendar of this DateFormat object.
+ * @param zone the new time zone.
+ *
+ * @draft ICU 3.6
+ */
+ virtual void setTimeZone(const TimeZone& zone);
+
+ /**
+ * Return the class ID for this class. This is useful only for comparing to
+ * a return value from getDynamicClassID(). For example:
+ * <pre>
+ * . Base* polymorphic_pointer = createPolymorphicObject();
+ * . if (polymorphic_pointer->getDynamicClassID() ==
+ * . erived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @draft ICU 3.6
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
+ * method is to implement a simple version of RTTI, since not all C++
+ * compilers support genuine RTTI. Polymorphic operator==() and clone()
+ * methods call this method.
+ *
+ * @return The class ID for this object. All objects of a
+ * given class have the same class ID. Objects of
+ * other classes have different class IDs.
+ * @draft ICU 3.6
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+private:
+ void formatDate(const SYSTEMTIME *st, UnicodeString &appendTo) const;
+ void formatTime(const SYSTEMTIME *st, UnicodeString &appendTo) const;
+
+ UnicodeString setTimeZoneInfo(TIME_ZONE_INFORMATION *tzi, const TimeZone &zone) const;
+
+ UnicodeString *fDateTimeMsg;
+ DateFormat::EStyle fTimeStyle;
+ DateFormat::EStyle fDateStyle;
+ const Locale *fLocale;
+ int32_t fLCID;
+ UnicodeString fZoneID;
+ TIME_ZONE_INFORMATION *fTZI;
+};
+
+inline UnicodeString &Win32DateFormat::format(UDate date, UnicodeString& appendTo) const {
+ return DateFormat::format(date, appendTo);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // #ifdef U_WINDOWS
+
+#endif // __WINDTFMT
diff --git a/Build/source/libs/icu-xetex/i18n/winnmfmt.cpp b/Build/source/libs/icu-xetex/i18n/winnmfmt.cpp
new file mode 100644
index 00000000000..32b1cd7c137
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/winnmfmt.cpp
@@ -0,0 +1,345 @@
+/*
+********************************************************************************
+* Copyright (C) 2005-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File WINNMFMT.CPP
+*
+********************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#ifdef U_WINDOWS
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "winnmfmt.h"
+
+#include "unicode/format.h"
+#include "unicode/numfmt.h"
+#include "unicode/locid.h"
+#include "unicode/ustring.h"
+
+#include "cmemory.h"
+#include "uassert.h"
+#include "locmap.h"
+
+# define WIN32_LEAN_AND_MEAN
+# define VC_EXTRALEAN
+# define NOUSER
+# define NOSERVICE
+# define NOIME
+# define NOMCX
+#include <windows.h>
+#include <stdio.h>
+
+U_NAMESPACE_BEGIN
+
+union FormatInfo
+{
+ NUMBERFMTW number;
+ CURRENCYFMTW currency;
+};
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Win32NumberFormat)
+
+#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
+#define DELETE_ARRAY(array) uprv_free((void *) (array))
+
+#define STACK_BUFFER_SIZE 32
+
+/*
+ * Turns a string of the form "3;2;0" into the grouping UINT
+ * needed for NUMBERFMT and CURRENCYFMT. If the string does not
+ * end in ";0" then the return value should be multiplied by 10.
+ * (e.g. "3" => 30, "3;2" => 320)
+ */
+static UINT getGrouping(const char *grouping)
+{
+ UINT g = 0;
+ const char *s;
+
+ for (s = grouping; *s != '\0'; s += 1) {
+ if (*s > '0' && *s < '9') {
+ g = g * 10 + (*s - '0');
+ } else if (*s != ';') {
+ break;
+ }
+ }
+
+ if (*s != '0') {
+ g *= 10;
+ }
+
+ return g;
+}
+
+static void getNumberFormat(NUMBERFMTW *fmt, int32_t lcid)
+{
+ char buf[10];
+
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_IDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
+
+ GetLocaleInfoA(lcid, LOCALE_SGROUPING, buf, 10);
+ fmt->Grouping = getGrouping(buf);
+
+ fmt->lpDecimalSep = NEW_ARRAY(UChar, 6);
+ GetLocaleInfoW(lcid, LOCALE_SDECIMAL, fmt->lpDecimalSep, 6);
+
+ fmt->lpThousandSep = NEW_ARRAY(UChar, 6);
+ GetLocaleInfoW(lcid, LOCALE_STHOUSAND, fmt->lpThousandSep, 6);
+
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_INEGNUMBER, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
+}
+
+static void freeNumberFormat(NUMBERFMTW *fmt)
+{
+ DELETE_ARRAY(fmt->lpThousandSep);
+ DELETE_ARRAY(fmt->lpDecimalSep);
+}
+
+static void getCurrencyFormat(CURRENCYFMTW *fmt, int32_t lcid)
+{
+ char buf[10];
+
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_ICURRDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
+
+ GetLocaleInfoA(lcid, LOCALE_SMONGROUPING, buf, sizeof(buf));
+ fmt->Grouping = getGrouping(buf);
+
+ fmt->lpDecimalSep = NEW_ARRAY(UChar, 6);
+ GetLocaleInfoW(lcid, LOCALE_SMONDECIMALSEP, fmt->lpDecimalSep, 6);
+
+ fmt->lpThousandSep = NEW_ARRAY(UChar, 6);
+ GetLocaleInfoW(lcid, LOCALE_SMONTHOUSANDSEP, fmt->lpThousandSep, 6);
+
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_INEGCURR, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
+ GetLocaleInfoW(lcid, LOCALE_RETURN_NUMBER|LOCALE_ICURRENCY, (LPWSTR) &fmt->PositiveOrder, sizeof(UINT));
+
+ fmt->lpCurrencySymbol = NEW_ARRAY(UChar, 8);
+ GetLocaleInfoW(lcid, LOCALE_SCURRENCY, (LPWSTR) fmt->lpCurrencySymbol, 8);
+}
+
+static void freeCurrencyFormat(CURRENCYFMTW *fmt)
+{
+ DELETE_ARRAY(fmt->lpCurrencySymbol);
+ DELETE_ARRAY(fmt->lpThousandSep);
+ DELETE_ARRAY(fmt->lpDecimalSep);
+}
+
+// TODO: keep locale too?
+Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErrorCode &status)
+ : NumberFormat(), fCurrency(currency), fFractionDigitsSet(FALSE)
+{
+ if (!U_FAILURE(status)) {
+ fLCID = locale.getLCID();
+
+ fFormatInfo = (FormatInfo*)uprv_malloc(sizeof(FormatInfo));
+
+ if (fCurrency) {
+ getCurrencyFormat(&fFormatInfo->currency, fLCID);
+ } else {
+ getNumberFormat(&fFormatInfo->number, fLCID);
+ }
+ }
+}
+
+Win32NumberFormat::Win32NumberFormat(const Win32NumberFormat &other)
+ : NumberFormat(other)
+{
+ *this = other;
+}
+
+Win32NumberFormat::~Win32NumberFormat()
+{
+ if (fCurrency) {
+ freeCurrencyFormat(&fFormatInfo->currency);
+ } else {
+ freeNumberFormat(&fFormatInfo->number);
+ }
+
+ uprv_free(fFormatInfo);
+}
+
+Win32NumberFormat &Win32NumberFormat::operator=(const Win32NumberFormat &other)
+{
+ NumberFormat::operator=(other);
+
+ this->fCurrency = other.fCurrency;
+ this->fLCID = other.fLCID;
+ this->fFractionDigitsSet = other.fFractionDigitsSet;
+
+ if (fCurrency) {
+ freeCurrencyFormat(&fFormatInfo->currency);
+ getCurrencyFormat(&fFormatInfo->currency, fLCID);
+ } else {
+ freeNumberFormat(&fFormatInfo->number);
+ getNumberFormat(&fFormatInfo->number, fLCID);
+ }
+
+ return *this;
+}
+
+Format *Win32NumberFormat::clone(void) const
+{
+ return new Win32NumberFormat(*this);
+}
+
+UnicodeString& Win32NumberFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos) const
+{
+ return format(getMaximumFractionDigits(), appendTo, L"%.16f", number);
+}
+
+UnicodeString& Win32NumberFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const
+{
+ return format(getMinimumFractionDigits(), appendTo, L"%I32d", number);
+}
+
+UnicodeString& Win32NumberFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const
+{
+ return format(getMinimumFractionDigits(), appendTo, L"%I64d", number);
+}
+
+// TODO: cache Locale and NumberFormat? Could keep locale passed to constructor...
+void Win32NumberFormat::parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const
+{
+ UErrorCode status = U_ZERO_ERROR;
+ Locale loc(uprv_convertToPosix(fLCID, &status));
+ NumberFormat *nf = fCurrency? NumberFormat::createCurrencyInstance(loc, status) : NumberFormat::createInstance(loc, status);
+
+ nf->parse(text, result, parsePosition);
+ delete nf;
+}
+void Win32NumberFormat::setMaximumFractionDigits(int32_t newValue)
+{
+ fFractionDigitsSet = TRUE;
+ NumberFormat::setMaximumFractionDigits(newValue);
+}
+
+void Win32NumberFormat::setMinimumFractionDigits(int32_t newValue)
+{
+ fFractionDigitsSet = TRUE;
+ NumberFormat::setMinimumFractionDigits(newValue);
+}
+
+UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appendTo, wchar_t *fmt, ...) const
+{
+ wchar_t nStackBuffer[STACK_BUFFER_SIZE];
+ wchar_t *nBuffer = nStackBuffer;
+ va_list args;
+ int result;
+
+ nBuffer[0] = 0x0000;
+
+ /* Due to the arguments causing a result to be <= 23 characters (+2 for NULL and minus),
+ we don't need to reallocate the buffer. */
+ va_start(args, fmt);
+ result = _vsnwprintf(nBuffer, STACK_BUFFER_SIZE, fmt, args);
+ va_end(args);
+
+ /* Just to make sure of the above statement, we add this assert */
+ U_ASSERT(result >=0);
+ // The following code is not used because _vscwprintf isn't available on MinGW at the moment.
+ /*if (result < 0) {
+ int newLength;
+
+ va_start(args, fmt);
+ newLength = _vscwprintf(fmt, args);
+ va_end(args);
+
+ nBuffer = NEW_ARRAY(UChar, newLength + 1);
+
+ va_start(args, fmt);
+ result = _vsnwprintf(nBuffer, newLength + 1, fmt, args);
+ va_end(args);
+ }*/
+
+ // vswprintf is sensitive to the locale set by setlocale. For some locales
+ // it doesn't use "." as the decimal separator, which is what GetNumberFormatW
+ // and GetCurrencyFormatW both expect to see.
+ //
+ // To fix this, we scan over the string and replace the first non-digits, except
+ // for a leading "-", with a "."
+ //
+ // Note: (nBuffer[0] == L'-') will evaluate to 1 if there is a leading '-' in the
+ // number, and 0 otherwise.
+ for (wchar_t *p = &nBuffer[nBuffer[0] == L'-']; *p != L'\0'; p += 1) {
+ if (*p < L'0' || *p > L'9') {
+ *p = L'.';
+ break;
+ }
+ }
+
+ UChar stackBuffer[STACK_BUFFER_SIZE];
+ UChar *buffer = stackBuffer;
+ FormatInfo formatInfo;
+
+ formatInfo = *fFormatInfo;
+ buffer[0] = 0x0000;
+
+ if (fCurrency) {
+ if (fFractionDigitsSet) {
+ formatInfo.currency.NumDigits = (UINT) numDigits;
+ }
+
+ if (!isGroupingUsed()) {
+ formatInfo.currency.Grouping = 0;
+ }
+
+ result = GetCurrencyFormatW(fLCID, 0, nBuffer, &formatInfo.currency, buffer, STACK_BUFFER_SIZE);
+
+ if (result == 0) {
+ DWORD lastError = GetLastError();
+
+ if (lastError == ERROR_INSUFFICIENT_BUFFER) {
+ int newLength = GetCurrencyFormatW(fLCID, 0, nBuffer, &formatInfo.currency, NULL, 0);
+
+ buffer = NEW_ARRAY(UChar, newLength);
+ buffer[0] = 0x0000;
+ GetCurrencyFormatW(fLCID, 0, nBuffer, &formatInfo.currency, buffer, newLength);
+ }
+ }
+ } else {
+ if (fFractionDigitsSet) {
+ formatInfo.number.NumDigits = (UINT) numDigits;
+ }
+
+ if (!isGroupingUsed()) {
+ formatInfo.number.Grouping = 0;
+ }
+
+ result = GetNumberFormatW(fLCID, 0, nBuffer, &formatInfo.number, buffer, STACK_BUFFER_SIZE);
+
+ if (result == 0) {
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+ int newLength = GetNumberFormatW(fLCID, 0, nBuffer, &formatInfo.number, NULL, 0);
+
+ buffer = NEW_ARRAY(UChar, newLength);
+ buffer[0] = 0x0000;
+ GetNumberFormatW(fLCID, 0, nBuffer, &formatInfo.number, buffer, newLength);
+ }
+ }
+ }
+
+ appendTo.append(buffer, (int32_t) wcslen(buffer));
+
+ if (buffer != stackBuffer) {
+ DELETE_ARRAY(buffer);
+ }
+
+ /*if (nBuffer != nStackBuffer) {
+ DELETE_ARRAY(nBuffer);
+ }*/
+
+ return appendTo;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // #ifdef U_WINDOWS
diff --git a/Build/source/libs/icu-xetex/i18n/winnmfmt.h b/Build/source/libs/icu-xetex/i18n/winnmfmt.h
new file mode 100644
index 00000000000..b67c0669939
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/winnmfmt.h
@@ -0,0 +1,168 @@
+/*
+********************************************************************************
+* Copyright (C) 2005-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File WINNMFMT.H
+*
+********************************************************************************
+*/
+
+#ifndef __WINNMFMT
+#define __WINNMFMT
+
+#include "unicode/utypes.h"
+
+#ifdef U_WINDOWS
+
+#include "unicode/format.h"
+#include "unicode/datefmt.h"
+#include "unicode/calendar.h"
+#include "unicode/ustring.h"
+#include "unicode/locid.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+/**
+ * \file
+ * \brief C++ API: Format numbers using Windows API.
+ */
+
+U_NAMESPACE_BEGIN
+
+union FormatInfo;
+
+class Win32NumberFormat : public NumberFormat
+{
+public:
+ Win32NumberFormat(const Locale &locale, UBool currency, UErrorCode &status);
+
+ Win32NumberFormat(const Win32NumberFormat &other);
+
+ virtual ~Win32NumberFormat();
+
+ virtual Format *clone(void) const;
+
+ Win32NumberFormat &operator=(const Win32NumberFormat &other);
+
+ /**
+ * Format a double number. Concrete subclasses must implement
+ * these pure virtual methods.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos On input: an alignment field, if desired.
+ * On output: the offsets of the alignment field.
+ * @return Reference to 'appendTo' parameter.
+ * @draft ICU 3.6
+ */
+ virtual UnicodeString& format(double number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+ /**
+ * Format a long number. Concrete subclasses must implement
+ * these pure virtual methods.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos On input: an alignment field, if desired.
+ * On output: the offsets of the alignment field.
+ * @return Reference to 'appendTo' parameter.
+ * @draft ICU 3.6
+ */
+ virtual UnicodeString& format(int32_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Format an int64 number.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos On input: an alignment field, if desired.
+ * On output: the offsets of the alignment field.
+ * @return Reference to 'appendTo' parameter.
+ * @draft ICU 3.6
+ */
+ virtual UnicodeString& format(int64_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+// Use the default behavior for the following.
+// virtual UnicodeString &format(double number, UnicodeString &appendTo) const;
+// virtual UnicodeString &format(int32_t number, UnicodeString &appendTo) const;
+// virtual UnicodeString &format(int64_t number, UnicodeString &appendTo) const;
+
+ virtual void parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const;
+
+ /**
+ * Sets the maximum number of digits allowed in the fraction portion of a
+ * number. maximumFractionDigits must be >= minimumFractionDigits. If the
+ * new value for maximumFractionDigits is less than the current value
+ * of minimumFractionDigits, then minimumFractionDigits will also be set to
+ * the new value.
+ * @param newValue the new value to be set.
+ * @see getMaximumFractionDigits
+ * @draft ICU 3.6
+ */
+ virtual void setMaximumFractionDigits(int32_t newValue);
+
+ /**
+ * Sets the minimum number of digits allowed in the fraction portion of a
+ * number. minimumFractionDigits must be &lt;= maximumFractionDigits. If the
+ * new value for minimumFractionDigits exceeds the current value
+ * of maximumFractionDigits, then maximumIntegerDigits will also be set to
+ * the new value
+ * @param newValue the new value to be set.
+ * @see getMinimumFractionDigits
+ * @draft ICU 3.6
+ */
+ virtual void setMinimumFractionDigits(int32_t newValue);
+
+ /**
+ * Return the class ID for this class. This is useful only for comparing to
+ * a return value from getDynamicClassID(). For example:
+ * <pre>
+ * . Base* polymorphic_pointer = createPolymorphicObject();
+ * . if (polymorphic_pointer->getDynamicClassID() ==
+ * . erived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
+ * method is to implement a simple version of RTTI, since not all C++
+ * compilers support genuine RTTI. Polymorphic operator==() and clone()
+ * methods call this method.
+ *
+ * @return The class ID for this object. All objects of a
+ * given class have the same class ID. Objects of
+ * other classes have different class IDs.
+ * @stable ICU 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+private:
+ UnicodeString &format(int32_t numDigits, UnicodeString &appendTo, wchar_t *format, ...) const;
+
+ UBool fCurrency;
+ int32_t fLCID;
+ FormatInfo *fFormatInfo;
+ UBool fFractionDigitsSet;
+
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // #ifdef U_WINDOWS
+
+#endif // __WINNMFMT