2008-07-08 06:51:04 +08:00
|
|
|
dnl config.m4 for extension intl
|
|
|
|
|
|
|
|
dnl ##########################################################################
|
|
|
|
dnl Initialize the extension
|
|
|
|
PHP_ARG_ENABLE(intl, whether to enable internationalization support,
|
|
|
|
[ --enable-intl Enable internationalization support])
|
|
|
|
|
|
|
|
if test "$PHP_INTL" != "no"; then
|
|
|
|
PHP_SETUP_ICU(INTL_SHARED_LIBADD)
|
|
|
|
PHP_SUBST(INTL_SHARED_LIBADD)
|
|
|
|
PHP_REQUIRE_CXX()
|
2011-02-15 16:28:03 +08:00
|
|
|
if test "$icu_version" -ge "4002"; then
|
|
|
|
icu_spoof_src=" spoofchecker/spoofchecker_class.c \
|
|
|
|
spoofchecker/spoofchecker.c\
|
|
|
|
spoofchecker/spoofchecker_create.c\
|
|
|
|
spoofchecker/spoofchecker_main.c"
|
|
|
|
else
|
|
|
|
icu_spoof_src=""
|
|
|
|
fi
|
2008-07-14 17:02:26 +08:00
|
|
|
PHP_NEW_EXTENSION(intl, php_intl.c \
|
|
|
|
intl_error.c \
|
|
|
|
intl_convert.c \
|
2012-04-01 17:11:40 +08:00
|
|
|
intl_convertcpp.cpp \
|
2008-07-14 17:02:26 +08:00
|
|
|
collator/collator.c \
|
|
|
|
collator/collator_class.c \
|
|
|
|
collator/collator_sort.c \
|
|
|
|
collator/collator_convert.c \
|
|
|
|
collator/collator_locale.c \
|
|
|
|
collator/collator_compare.c \
|
|
|
|
collator/collator_attr.c \
|
|
|
|
collator/collator_create.c \
|
|
|
|
collator/collator_is_numeric.c \
|
|
|
|
collator/collator_error.c \
|
|
|
|
common/common_error.c \
|
2012-04-01 17:11:40 +08:00
|
|
|
common/common_enum.cpp \
|
2012-07-02 06:24:54 +08:00
|
|
|
common/common_date.cpp \
|
2012-12-06 07:07:36 +08:00
|
|
|
converter/converter.c \
|
2008-07-14 17:02:26 +08:00
|
|
|
formatter/formatter.c \
|
|
|
|
formatter/formatter_main.c \
|
|
|
|
formatter/formatter_class.c \
|
|
|
|
formatter/formatter_attr.c \
|
|
|
|
formatter/formatter_data.c \
|
|
|
|
formatter/formatter_format.c \
|
|
|
|
formatter/formatter_parse.c \
|
|
|
|
normalizer/normalizer.c \
|
|
|
|
normalizer/normalizer_class.c \
|
|
|
|
normalizer/normalizer_normalize.c \
|
|
|
|
locale/locale.c \
|
|
|
|
locale/locale_class.c \
|
|
|
|
locale/locale_methods.c \
|
|
|
|
dateformat/dateformat.c \
|
|
|
|
dateformat/dateformat_class.c \
|
|
|
|
dateformat/dateformat_attr.c \
|
|
|
|
dateformat/dateformat_data.c \
|
|
|
|
dateformat/dateformat_format.c \
|
2012-07-22 09:54:03 +08:00
|
|
|
dateformat/dateformat_format_object.cpp \
|
2008-07-14 17:02:26 +08:00
|
|
|
dateformat/dateformat_parse.c \
|
DateFormat plays nice with Calendar, TimeZone
The following changes were made:
* The IntlDateFormatter constructor now accepts the usual values
for its $timezone argument. This includes timezone identifiers,
IntlTimeZone objects, DateTimeZone objects and NULL. An empty
string is not accepted. An invalid time zone is no longer accepted
(it used to use UTC in this case).
* When NULL is passed to IntlDateFormatter, the time zone specified in
date.timezone is used instead of the ICU default.
* The IntlDateFormatter $calendar argument now accepts also an
IntlCalendar. In this case, IntlDateFormatter::getCalendar() will
return false.
* The time zone passed to the IntlDateFormatter is ignored if it is
NULL and if the calendar passed is an IntlCalendar object -- in this
case, the IntlCalendar time zone will be used instead. Otherwise,
the time zone specified in the $timezone argument is used instead.
* Added IntlDateFormatter::getCalendarObject(), which always returns
the IntlCalendar object that backs the DateFormat, even if a
constant was passed to the constructor, i.e., if an IntlCalendar
was not passed to the constructor.
* Added IntlDateFormatter::setTimeZone(). It accepts the usual values
for time zone arguments. If NULL is passed, the time zone of the
IntlDateFormatter WILL be overridden with the default time zone,
even if an IntlCalendar object was passed to the constructor.
* Added IntlDateFormatter::getTimeZone(), which returns the time zone
that's associated with the DateFormat.
* Depreacated IntlDateFormatter::setTimeZoneId() and made it an alias
for IntlDateFormatter::setTimeZone(), as the new ::setTimeZone()
also accepts plain identifiers, besides other types.
IntlDateFormatter::getTimeZoneId() is not deprecated however.
* IntlDateFormatter::setCalendar() with a constant passed should now
work correctly. This requires saving the requested locale to the
constructor.
* Centralized the hacks required to avoid compilation disasters on
Windows due to some headers being included inside and outside of
extern "C" blocks.
2012-06-04 06:01:48 +08:00
|
|
|
dateformat/dateformat_create.cpp \
|
|
|
|
dateformat/dateformat_attrcpp.cpp \
|
|
|
|
dateformat/dateformat_helpers.cpp \
|
2008-07-14 17:02:26 +08:00
|
|
|
msgformat/msgformat.c \
|
|
|
|
msgformat/msgformat_attr.c \
|
|
|
|
msgformat/msgformat_class.c \
|
|
|
|
msgformat/msgformat_data.c \
|
|
|
|
msgformat/msgformat_format.c \
|
|
|
|
msgformat/msgformat_helpers.cpp \
|
|
|
|
msgformat/msgformat_parse.c \
|
|
|
|
grapheme/grapheme_string.c \
|
2009-01-27 06:30:57 +08:00
|
|
|
grapheme/grapheme_util.c \
|
2010-01-05 05:44:45 +08:00
|
|
|
resourcebundle/resourcebundle.c \
|
|
|
|
resourcebundle/resourcebundle_class.c \
|
|
|
|
resourcebundle/resourcebundle_iterator.c \
|
2010-10-07 02:53:27 +08:00
|
|
|
transliterator/transliterator.c \
|
|
|
|
transliterator/transliterator_class.c \
|
|
|
|
transliterator/transliterator_methods.c \
|
DateFormat plays nice with Calendar, TimeZone
The following changes were made:
* The IntlDateFormatter constructor now accepts the usual values
for its $timezone argument. This includes timezone identifiers,
IntlTimeZone objects, DateTimeZone objects and NULL. An empty
string is not accepted. An invalid time zone is no longer accepted
(it used to use UTC in this case).
* When NULL is passed to IntlDateFormatter, the time zone specified in
date.timezone is used instead of the ICU default.
* The IntlDateFormatter $calendar argument now accepts also an
IntlCalendar. In this case, IntlDateFormatter::getCalendar() will
return false.
* The time zone passed to the IntlDateFormatter is ignored if it is
NULL and if the calendar passed is an IntlCalendar object -- in this
case, the IntlCalendar time zone will be used instead. Otherwise,
the time zone specified in the $timezone argument is used instead.
* Added IntlDateFormatter::getCalendarObject(), which always returns
the IntlCalendar object that backs the DateFormat, even if a
constant was passed to the constructor, i.e., if an IntlCalendar
was not passed to the constructor.
* Added IntlDateFormatter::setTimeZone(). It accepts the usual values
for time zone arguments. If NULL is passed, the time zone of the
IntlDateFormatter WILL be overridden with the default time zone,
even if an IntlCalendar object was passed to the constructor.
* Added IntlDateFormatter::getTimeZone(), which returns the time zone
that's associated with the DateFormat.
* Depreacated IntlDateFormatter::setTimeZoneId() and made it an alias
for IntlDateFormatter::setTimeZone(), as the new ::setTimeZone()
also accepts plain identifiers, besides other types.
IntlDateFormatter::getTimeZoneId() is not deprecated however.
* IntlDateFormatter::setCalendar() with a constant passed should now
work correctly. This requires saving the requested locale to the
constructor.
* Centralized the hacks required to avoid compilation disasters on
Windows due to some headers being included inside and outside of
extern "C" blocks.
2012-06-04 06:01:48 +08:00
|
|
|
timezone/timezone_class.cpp \
|
|
|
|
timezone/timezone_methods.cpp \
|
|
|
|
calendar/calendar_class.cpp \
|
|
|
|
calendar/calendar_methods.cpp \
|
|
|
|
calendar/gregoriancalendar_methods.cpp \
|
BreakIterator and RuleBasedBreakiterator added
This commit adds wrappers for the classes BreakIterator and
RuleBasedbreakIterator. The C++ ICU classes are described here:
<http://icu-project.org/apiref/icu4c/classBreakIterator.html>
<http://icu-project.org/apiref/icu4c/classRuleBasedBreakIterator.html>
Additionally, a tutorial is available at:
<http://userguide.icu-project.org/boundaryanalysis>
This implementation wraps UTF-8 text in a UText. The text is
iterated without any copying or conversion to UTF-16. There is
also no validation that the input is actually UTF-8; where there
are malformed sequences, the UText will simply U+FFFD.
The class BreakIterator cannot be instantiated directly (has a
private constructor). It provides the interface exposed by the ICU
abstract class with the same name. The PHP class is not abstract
because we may use it to wrap native subclasses of BreakIterator
that we don't know how to wrap. This class includes methods to
move the iterator position to the beginning (first()), to the
end (last()), forward (next()), backwards (previous()), to the
boundary preceding a certain position (preceding()) and following
a certain position (following()) and to obtain the current position
(current()). next() can also be used to advance or recede an
arbitrary number of positions.
BreakIterator also exposes other native methods:
getAvailableLocales(), getLocale() and factory methods to build
several predefined types of BreakIterators: createWordInstance()
for word boundaries, createCharacterInstance() for locale
dependent notions of "characters", createSentenceInstance() for
sentences, createLineInstance() and createTitleInstance() -- for
title casing breaks. These factories currently return
RuleBasedbreakIterators where the names of the rule sets are found
in the ICU data, observing the passed locale (although the locale
is taken into considering there are very few exceptions to the
root rules).
The clone and compare_object PHP object handlers are also
implemented, though the comparison does not yield meaningful results
when used with >, <, >= and <=.
Note that BreakIterator is an iterator only in the sense of the
first 'Iterator' in 'IteratorIterator', i.e., it does not
implement the Iterator interface. The reason is that there is
no sensible implementation for Iterator::key(). Using it for
an ordinal of the current boundary is not feasible because
we are allowed to move to any boundary at any time. It we were
to determine the current ordinal when last() is called we'd
have to traverse the whole input text to find out how many
breaks there were before. Therefore, BreakIterator implements
only Traversable. It can be wrapped in an IteratorIterator,
but the usual warnings apply.
Finally, I added a convenience method to BreakIterator:
getPartsIterator(). This provides an IntlIterator, backed
by the BreakIterator PHP object (i.e. moving the pointer or
changing the text in BreakIterator affects the iterator
and also moving the iterator affects the backing BreakIterator),
which allows traversing the text between each boundary.
This iterator uses the original text to retrieve the text
between two positions, not the code points returned by the
wrapping UText. Therefore, if the text includes invalid code
unit sequences, these invalid sequences will be in the output
of this iterator, not U+FFFD code points.
The class RuleBasedIterator exposes a constructor that allows
building an iterator from arbitrary compiled or non-compiled
rules. The form of these rules in described in the tutorial linked
above. The rest of the methods allow retrieving the rules --
getRules() and getCompiledRules() --, a hash code of the rule set
(hashCode()) and the rules statuses (getRuleStatus() and
getRuleStatusVec()).
Because the RuleBasedBreakIterator constructor may return parse
errors, I reuse the UParseError to text function that was in the
transliterator files. Therefore, I move that function to
intl_error.c.
common_enum.cpp was also changed, mainly to expose previously
static functions. This avoided code duplication when implementing
the BreakIterator iterator and the IntlIterator returned by
BreakIterator::getPartsIterator().
2012-05-31 18:11:44 +08:00
|
|
|
breakiterator/breakiterator_class.cpp \
|
|
|
|
breakiterator/breakiterator_iterators.cpp \
|
|
|
|
breakiterator/breakiterator_methods.cpp \
|
|
|
|
breakiterator/rulebasedbreakiterator_methods.cpp \
|
2012-06-23 00:19:54 +08:00
|
|
|
breakiterator/codepointiterator_internal.cpp \
|
|
|
|
breakiterator/codepointiterator_methods.cpp \
|
2014-12-16 06:29:52 +08:00
|
|
|
uchar/uchar.c \
|
2011-01-13 14:53:09 +08:00
|
|
|
idn/idn.c \
|
2017-01-18 20:00:49 +08:00
|
|
|
$icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,cxx)
|
2008-07-14 17:02:26 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/collator)
|
2012-12-06 07:07:36 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/converter)
|
2008-07-14 17:02:26 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/common)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/formatter)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/normalizer)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/dateformat)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/locale)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/msgformat)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/grapheme)
|
2010-01-05 05:44:45 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/resourcebundle)
|
2010-10-07 02:53:27 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/transliterator)
|
2012-04-01 17:11:40 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/timezone)
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/calendar)
|
2009-01-27 06:30:57 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/idn)
|
2011-01-13 14:53:09 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/spoofchecker)
|
2012-06-23 00:19:54 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/breakiterator)
|
2014-12-16 06:29:52 +08:00
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir/uchar)
|
2008-07-08 06:51:04 +08:00
|
|
|
fi
|