Back to index

php5  5.3.10
php_intl.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | This source file is subject to version 3.01 of the PHP license,      |
00006    | that is bundled with this package in the file LICENSE, and is        |
00007    | available through the world-wide-web at the following url:           |
00008    | http://www.php.net/license/3_01.txt                                  |
00009    | If you did not receive a copy of the PHP license and are unable to   |
00010    | obtain it through the world-wide-web, please send a note to          |
00011    | license@php.net so we can mail you a copy immediately.               |
00012    +----------------------------------------------------------------------+
00013    | Authors: Vadim Savchuk <vsavchuk@productengine.com>                  |
00014    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
00015    |          Stanislav Malyshev <stas@zend.com>                          |
00016    |          Kirti Velankar <kirtig@yahoo-inc.com>                     |
00017    +----------------------------------------------------------------------+
00018  */
00019 
00020 #ifdef HAVE_CONFIG_H
00021 #include "config.h"
00022 #endif
00023 
00024 
00025 #include "php_intl.h"
00026 #include "intl_error.h"
00027 #include "collator/collator_class.h"
00028 #include "collator/collator.h"
00029 #include "collator/collator_attr.h"
00030 #include "collator/collator_compare.h"
00031 #include "collator/collator_sort.h"
00032 #include "collator/collator_convert.h"
00033 #include "collator/collator_locale.h"
00034 #include "collator/collator_create.h"
00035 #include "collator/collator_error.h"
00036 
00037 #include "formatter/formatter.h"
00038 #include "formatter/formatter_class.h"
00039 #include "formatter/formatter_attr.h"
00040 #include "formatter/formatter_format.h"
00041 #include "formatter/formatter_main.h"
00042 #include "formatter/formatter_parse.h"
00043 
00044 #include "msgformat/msgformat.h"
00045 #include "msgformat/msgformat_class.h"
00046 #include "msgformat/msgformat_attr.h"
00047 #include "msgformat/msgformat_format.h"
00048 #include "msgformat/msgformat_parse.h"
00049 
00050 #include "normalizer/normalizer.h"
00051 #include "normalizer/normalizer_class.h"
00052 #include "normalizer/normalizer_normalize.h"
00053 
00054 #include "locale/locale.h"
00055 #include "locale/locale_class.h"
00056 #include "locale/locale_methods.h"
00057 
00058 #include "dateformat/dateformat.h"
00059 #include "dateformat/dateformat_class.h"
00060 #include "dateformat/dateformat_attr.h"
00061 #include "dateformat/dateformat_format.h"
00062 #include "dateformat/dateformat_parse.h"
00063 #include "dateformat/dateformat_data.h"
00064 
00065 #include "resourcebundle/resourcebundle_class.h"
00066 
00067 #include "idn/idn.h"
00068 
00069 #include "msgformat/msgformat.h"
00070 #include "common/common_error.h"
00071 
00072 #include <unicode/uloc.h>
00073 #include <ext/standard/info.h>
00074 
00075 #include "php_ini.h"
00076 #define INTL_MODULE_VERSION PHP_INTL_VERSION
00077 
00078 /*
00079  * locale_get_default has a conflict since ICU also has
00080  * a function with the same  name
00081  * in fact ICU appends the version no. to it also
00082  * Hence the following undef for ICU version
00083  * Same true for the locale_set_default function
00084 */
00085 #undef locale_get_default
00086 #undef locale_set_default
00087 
00088 ZEND_DECLARE_MODULE_GLOBALS( intl )
00089 
00090 /* {{{ Arguments info */
00091 ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
00092 ZEND_END_ARG_INFO()
00093 
00094 ZEND_BEGIN_ARG_INFO_EX(collator_static_1_arg, 0, 0, 1)
00095        ZEND_ARG_INFO(0, arg1)
00096 ZEND_END_ARG_INFO()
00097 
00098 ZEND_BEGIN_ARG_INFO_EX(collator_static_2_args, 0, 0, 2)
00099        ZEND_ARG_INFO(0, arg1)
00100        ZEND_ARG_INFO(0, arg2)
00101 ZEND_END_ARG_INFO()
00102 
00103 ZEND_BEGIN_ARG_INFO_EX(collator_0_args, 0, 0, 1)
00104        ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
00105 ZEND_END_ARG_INFO()
00106 
00107 ZEND_BEGIN_ARG_INFO_EX(collator_1_arg, 0, 0, 2)
00108        ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
00109        ZEND_ARG_INFO(0, arg1)
00110 ZEND_END_ARG_INFO()
00111 
00112 ZEND_BEGIN_ARG_INFO_EX(collator_2_args, 0, 0, 3)
00113        ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
00114        ZEND_ARG_INFO(0, arg1)
00115        ZEND_ARG_INFO(0, arg2)
00116 ZEND_END_ARG_INFO()
00117 
00118 ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
00119        ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
00120        ZEND_ARG_ARRAY_INFO(1, arr, 0)
00121        ZEND_ARG_INFO(0, sort_flags)
00122 ZEND_END_ARG_INFO()
00123 
00124 ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
00125        ZEND_ARG_INFO(0, formatter)
00126        ZEND_ARG_INFO(0, string)
00127        ZEND_ARG_INFO(0, type)
00128        ZEND_ARG_INFO(1, position)
00129 ZEND_END_ARG_INFO()
00130 
00131 ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
00132        ZEND_ARG_INFO(0, formatter)
00133        ZEND_ARG_INFO(0, string)
00134        ZEND_ARG_INFO(1, currency)
00135        ZEND_ARG_INFO(1, position)
00136 ZEND_END_ARG_INFO()
00137 
00138 ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
00139 ZEND_END_ARG_INFO()
00140 
00141 ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
00142        ZEND_ARG_INFO(0, arg1)
00143 ZEND_END_ARG_INFO()
00144 
00145 ZEND_BEGIN_ARG_INFO_EX(locale_2_args, 0, 0, 2)
00146        ZEND_ARG_INFO(0, arg1)
00147        ZEND_ARG_INFO(0, arg2)
00148 ZEND_END_ARG_INFO()
00149 
00150 ZEND_BEGIN_ARG_INFO_EX(locale_3_args, 0, 0, 3)
00151        ZEND_ARG_INFO(0, arg1)
00152        ZEND_ARG_INFO(0, arg2)
00153        ZEND_ARG_INFO(0, arg3)
00154 ZEND_END_ARG_INFO()
00155 
00156 ZEND_BEGIN_ARG_INFO_EX(locale_4_args, 0, 0, 4)
00157        ZEND_ARG_INFO(0, arg1)
00158        ZEND_ARG_INFO(0, arg2)
00159        ZEND_ARG_INFO(0, arg3)
00160        ZEND_ARG_INFO(0, arg4)
00161 ZEND_END_ARG_INFO()
00162 
00163 #define intl_0_args collator_static_0_args
00164 #define intl_1_arg collator_static_1_arg
00165 
00166 ZEND_BEGIN_ARG_INFO_EX(normalizer_args, 0, 0, 1)
00167        ZEND_ARG_INFO(0, input)
00168        ZEND_ARG_INFO(0, form)
00169 ZEND_END_ARG_INFO()
00170 
00171 ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
00172        ZEND_ARG_INFO(0, string)
00173 ZEND_END_ARG_INFO()
00174 
00175 ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
00176        ZEND_ARG_INFO(0, haystack)
00177        ZEND_ARG_INFO(0, needle)
00178        ZEND_ARG_INFO(0, offset)
00179 ZEND_END_ARG_INFO()
00180 
00181 ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
00182        ZEND_ARG_INFO(0, string)
00183        ZEND_ARG_INFO(0, start)
00184        ZEND_ARG_INFO(0, length)
00185 ZEND_END_ARG_INFO()
00186 
00187 ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
00188        ZEND_ARG_INFO(0, haystack)
00189        ZEND_ARG_INFO(0, needle)
00190        ZEND_ARG_INFO(0, before_needle)
00191 ZEND_END_ARG_INFO()
00192 
00193 ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
00194        ZEND_ARG_INFO(0, arg1)
00195        ZEND_ARG_INFO(0, arg2)
00196        ZEND_ARG_INFO(0, arg3)
00197        ZEND_ARG_INFO(0, arg4)
00198        ZEND_ARG_INFO(1, arg5)  /* 1 = pass by reference */
00199 ZEND_END_ARG_INFO()
00200 
00201 ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
00202        ZEND_ARG_INFO(0, formatter)
00203        ZEND_ARG_INFO(0, string)
00204        ZEND_ARG_INFO(1, position)
00205 ZEND_END_ARG_INFO()
00206 
00207 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_create, 0, 0, 2)
00208        ZEND_ARG_INFO(0, locale)
00209        ZEND_ARG_INFO(0, style)
00210        ZEND_ARG_INFO(0, pattern)
00211 ZEND_END_ARG_INFO()
00212 
00213 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_error_code, 0, 0, 1)
00214        ZEND_ARG_INFO(0, nf)
00215 ZEND_END_ARG_INFO()
00216 
00217 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format, 0, 0, 2)
00218        ZEND_ARG_INFO(0, nf)
00219        ZEND_ARG_INFO(0, num)
00220        ZEND_ARG_INFO(0, type)
00221 ZEND_END_ARG_INFO()
00222 
00223 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format_currency, 0, 0, 3)
00224        ZEND_ARG_INFO(0, nf)
00225        ZEND_ARG_INFO(0, num)
00226        ZEND_ARG_INFO(0, currency)
00227 ZEND_END_ARG_INFO()
00228 
00229 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_attribute, 0, 0, 2)
00230        ZEND_ARG_INFO(0, nf)
00231        ZEND_ARG_INFO(0, attr)
00232 ZEND_END_ARG_INFO()
00233 
00234 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_attribute, 0, 0, 3)
00235        ZEND_ARG_INFO(0, nf)
00236        ZEND_ARG_INFO(0, attr)
00237        ZEND_ARG_INFO(0, value)
00238 ZEND_END_ARG_INFO()
00239 
00240 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_symbol, 0, 0, 3)
00241        ZEND_ARG_INFO(0, nf)
00242        ZEND_ARG_INFO(0, attr)
00243        ZEND_ARG_INFO(0, symbol)
00244 ZEND_END_ARG_INFO()
00245 
00246 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_pattern, 0, 0, 2)
00247        ZEND_ARG_INFO(0, nf)
00248        ZEND_ARG_INFO(0, pattern)
00249 ZEND_END_ARG_INFO()
00250 
00251 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_locale, 0, 0, 1)
00252        ZEND_ARG_INFO(0, nf)
00253        ZEND_ARG_INFO(0, type)
00254 ZEND_END_ARG_INFO()
00255 
00256 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_create, 0, 0, 2)
00257        ZEND_ARG_INFO(0, locale)
00258        ZEND_ARG_INFO(0, pattern)
00259 ZEND_END_ARG_INFO()
00260 
00261 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_code, 0, 0, 1)
00262        ZEND_ARG_INFO(0, nf)
00263 ZEND_END_ARG_INFO()
00264 
00265 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_message, 0, 0, 1)
00266        ZEND_ARG_INFO(0, coll)
00267 ZEND_END_ARG_INFO()
00268 
00269 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format, 0, 0, 2)
00270        ZEND_ARG_INFO(0, nf)
00271        ZEND_ARG_INFO(0, args)
00272 ZEND_END_ARG_INFO()
00273 
00274 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format_message, 0, 0, 3)
00275        ZEND_ARG_INFO(0, locale)
00276        ZEND_ARG_INFO(0, pattern)
00277        ZEND_ARG_INFO(0, args)
00278 ZEND_END_ARG_INFO()
00279 
00280 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
00281        ZEND_ARG_INFO(0, nf)
00282        ZEND_ARG_INFO(0, source)
00283 ZEND_END_ARG_INFO()
00284 
00285 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_parse_message, 0, 0, 3)
00286        ZEND_ARG_INFO(0, locale)
00287        ZEND_ARG_INFO(0, pattern)
00288        ZEND_ARG_INFO(0, source)
00289 ZEND_END_ARG_INFO()
00290 
00291 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_set_pattern, 0, 0, 2)
00292        ZEND_ARG_INFO(0, mf)
00293        ZEND_ARG_INFO(0, pattern)
00294 ZEND_END_ARG_INFO()
00295 
00296 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_locale, 0, 0, 1)
00297        ZEND_ARG_INFO(0, mf)
00298 ZEND_END_ARG_INFO()
00299 
00300 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
00301        ZEND_ARG_INFO(0, mf)
00302        ZEND_ARG_INFO(0, pattern)
00303 ZEND_END_ARG_INFO()
00304 
00305 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
00306        ZEND_ARG_INFO(0, mf)
00307        ZEND_ARG_INFO(0, calendar)
00308 ZEND_END_ARG_INFO()
00309 
00310 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0)
00311        ZEND_ARG_INFO(0, args)
00312        ZEND_ARG_INFO(0, array)
00313 ZEND_END_ARG_INFO()
00314 
00315 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3)
00316        ZEND_ARG_INFO(0, locale)
00317        ZEND_ARG_INFO(0, date_type)
00318        ZEND_ARG_INFO(0, time_type)
00319        ZEND_ARG_INFO(0, timezone_str)
00320        ZEND_ARG_INFO(0, calendar)
00321        ZEND_ARG_INFO(0, pattern)
00322 ZEND_END_ARG_INFO()
00323 
00324 ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
00325        ZEND_ARG_INFO(0, domain)
00326        ZEND_ARG_INFO(0, option)
00327        ZEND_ARG_INFO(0, status)
00328 ZEND_END_ARG_INFO()
00329 
00330 ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_utf8, 0, 0, 1)
00331        ZEND_ARG_INFO(0, domain)
00332        ZEND_ARG_INFO(0, option)
00333        ZEND_ARG_INFO(0, status)
00334 ZEND_END_ARG_INFO()
00335 
00336 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_create_proc, 0, 0, 2 )
00337        ZEND_ARG_INFO( 0, locale )
00338        ZEND_ARG_INFO( 0, bundlename )
00339        ZEND_ARG_INFO( 0, fallback )
00340 ZEND_END_ARG_INFO()
00341 
00342 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_proc, 0, 0, 2 )
00343     ZEND_ARG_INFO( 0, bundle )
00344        ZEND_ARG_INFO( 0, index )
00345        ZEND_ARG_INFO( 0, fallback )
00346 ZEND_END_ARG_INFO()
00347 
00348 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count_proc, 0, 0, 1 )
00349   ZEND_ARG_INFO( 0, bundle )
00350 ZEND_END_ARG_INFO()
00351 
00352 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_locales_proc, 0, 0, 1 )
00353        ZEND_ARG_INFO( 0, bundlename )
00354 ZEND_END_ARG_INFO()
00355 
00356 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code_proc, 0, 0, 1 )
00357   ZEND_ARG_INFO( 0, bundle )
00358 ZEND_END_ARG_INFO()
00359 
00360 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message_proc, 0, 0, 1 )
00361   ZEND_ARG_INFO( 0, bundle )
00362 ZEND_END_ARG_INFO()
00363 
00364 
00365 /* }}} */
00366 
00367 /* {{{ intl_functions
00368  *
00369  * Every user visible function must have an entry in intl_functions[].
00370  */
00371 zend_function_entry intl_functions[] = {
00372 
00373        /* collator functions */
00374        PHP_FE( collator_create, collator_static_1_arg )
00375        PHP_FE( collator_compare, collator_2_args )
00376        PHP_FE( collator_get_attribute, collator_1_arg )
00377        PHP_FE( collator_set_attribute, collator_2_args )
00378        PHP_FE( collator_get_strength, collator_0_args )
00379        PHP_FE( collator_set_strength, collator_1_arg )
00380        PHP_FE( collator_sort, collator_sort_args )
00381        PHP_FE( collator_sort_with_sort_keys, collator_sort_args )
00382        PHP_FE( collator_asort, collator_sort_args )
00383        PHP_FE( collator_get_locale, collator_1_arg )
00384        PHP_FE( collator_get_error_code, collator_0_args )
00385        PHP_FE( collator_get_error_message, collator_0_args )
00386        PHP_FE( collator_get_sort_key, collator_2_args )
00387 
00388        /* formatter functions */
00389        PHP_FE( numfmt_create, arginfo_numfmt_create )
00390        PHP_FE( numfmt_format, arginfo_numfmt_format )
00391        PHP_FE( numfmt_parse, numfmt_parse_arginfo )
00392        PHP_FE( numfmt_format_currency, arginfo_numfmt_format_currency )
00393        PHP_FE( numfmt_parse_currency, numfmt_parse_currency_arginfo )
00394        PHP_FE( numfmt_set_attribute, arginfo_numfmt_set_attribute )
00395        PHP_FE( numfmt_get_attribute, arginfo_numfmt_get_attribute )
00396        PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_attribute )
00397        PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_attribute )
00398        PHP_FE( numfmt_set_symbol, arginfo_numfmt_set_symbol )
00399        PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_attribute )
00400        PHP_FE( numfmt_set_pattern, arginfo_numfmt_set_pattern )
00401        PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_error_code )
00402        PHP_FE( numfmt_get_locale, arginfo_numfmt_get_locale )
00403        PHP_FE( numfmt_get_error_code, arginfo_numfmt_get_error_code )
00404        PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_code )
00405 
00406        /* normalizer functions */
00407        PHP_FE( normalizer_normalize, normalizer_args )
00408        PHP_FE( normalizer_is_normalized, normalizer_args )
00409 
00410        /* Locale functions */
00411        PHP_NAMED_FE( locale_get_default, zif_locale_get_default, locale_0_args )
00412        PHP_NAMED_FE( locale_set_default, zif_locale_set_default, locale_1_arg )
00413        PHP_FE( locale_get_primary_language, locale_1_arg )
00414        PHP_FE( locale_get_script, locale_1_arg )
00415        PHP_FE( locale_get_region, locale_1_arg )
00416        PHP_FE( locale_get_keywords, locale_1_arg )
00417        PHP_FE( locale_get_display_script, locale_2_args )
00418        PHP_FE( locale_get_display_region, locale_2_args )
00419        PHP_FE( locale_get_display_name, locale_2_args )
00420        PHP_FE( locale_get_display_language, locale_2_args)
00421        PHP_FE( locale_get_display_variant, locale_2_args )
00422        PHP_FE( locale_compose, locale_1_arg )
00423        PHP_FE( locale_parse, locale_1_arg )
00424        PHP_FE( locale_get_all_variants, locale_1_arg )
00425        PHP_FE( locale_filter_matches, locale_3_args )
00426        PHP_FE( locale_canonicalize, locale_1_arg )
00427        PHP_FE( locale_lookup, locale_4_args )
00428        PHP_FE( locale_accept_from_http, locale_1_arg )
00429 
00430        /* MessageFormatter functions */
00431        PHP_FE( msgfmt_create, arginfo_msgfmt_create )
00432        PHP_FE( msgfmt_format, arginfo_msgfmt_format )
00433        PHP_FE( msgfmt_format_message, arginfo_msgfmt_format_message )
00434        PHP_FE( msgfmt_parse, arginfo_msgfmt_parse )
00435        PHP_FE( msgfmt_parse_message, arginfo_numfmt_parse_message )
00436        PHP_FE( msgfmt_set_pattern, arginfo_msgfmt_set_pattern )
00437        PHP_FE( msgfmt_get_pattern, arginfo_msgfmt_get_locale )
00438        PHP_FE( msgfmt_get_locale, arginfo_msgfmt_get_locale )
00439        PHP_FE( msgfmt_get_error_code, arginfo_msgfmt_get_error_code )
00440        PHP_FE( msgfmt_get_error_message, arginfo_msgfmt_get_error_message )
00441 
00442        /* IntlDateFormatter functions */
00443        PHP_FE( datefmt_create, arginfo_datefmt_create )
00444        PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale )
00445        PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale )
00446        PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale )
00447        PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar )
00448        PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale )
00449        PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale )
00450        PHP_FE( datefmt_set_timezone_id, arginfo_msgfmt_get_locale )
00451        PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale )
00452        PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern )
00453        PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale )
00454        PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale )
00455        PHP_FE( datefmt_format, arginfo_datefmt_format )
00456        PHP_FE( datefmt_parse, datefmt_parse_args )
00457        PHP_FE( datefmt_localtime , datefmt_parse_args )
00458        PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code )
00459        PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
00460 
00461        /* grapheme functions */
00462        PHP_FE( grapheme_strlen, grapheme_1_arg )
00463        PHP_FE( grapheme_strpos, grapheme_search_args )
00464        PHP_FE( grapheme_stripos, grapheme_search_args )
00465        PHP_FE( grapheme_strrpos, grapheme_search_args )
00466        PHP_FE( grapheme_strripos, grapheme_search_args )
00467        PHP_FE( grapheme_substr, grapheme_substr_args )
00468        PHP_FE( grapheme_strstr, grapheme_strstr_args )
00469        PHP_FE( grapheme_stristr, grapheme_strstr_args )
00470        PHP_FE( grapheme_extract, grapheme_extract_args )
00471 
00472        /* IDN functions */
00473        PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)
00474        PHP_FE( idn_to_utf8, arginfo_idn_to_ascii)
00475 
00476        /* ResourceBundle functions */
00477        PHP_FE( resourcebundle_create, arginfo_resourcebundle_create_proc )
00478        PHP_FE( resourcebundle_get, arginfo_resourcebundle_get_proc )
00479        PHP_FE( resourcebundle_count, arginfo_resourcebundle_count_proc )
00480        PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc )
00481        PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc )
00482        PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc )
00483 
00484        /* common functions */
00485        PHP_FE( intl_get_error_code, intl_0_args )
00486        PHP_FE( intl_get_error_message, intl_0_args )
00487        PHP_FE( intl_is_failure, intl_1_arg )
00488        PHP_FE( intl_error_name, intl_1_arg )
00489 
00490        PHP_FE_END
00491 };
00492 /* }}} */
00493 
00494 
00495 /* {{{ INI Settings */
00496 PHP_INI_BEGIN()
00497     STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
00498     STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
00499 
00500 PHP_INI_END()
00501 /* }}} */
00502 
00503 
00504 static PHP_GINIT_FUNCTION(intl);
00505 
00506 /* {{{ intl_module_entry */
00507 zend_module_entry intl_module_entry = {
00508 #if ZEND_MODULE_API_NO >= 20010901
00509        STANDARD_MODULE_HEADER,
00510 #endif
00511        "intl",
00512        intl_functions,
00513        PHP_MINIT( intl ),
00514        PHP_MSHUTDOWN( intl ),
00515        PHP_RINIT( intl ),
00516        PHP_RSHUTDOWN( intl ),
00517        PHP_MINFO( intl ),
00518        INTL_MODULE_VERSION,
00519        PHP_MODULE_GLOBALS(intl),   /* globals descriptor */
00520        PHP_GINIT(intl),            /* globals ctor */
00521        NULL,                       /* globals dtor */
00522        NULL,                       /* post deactivate */
00523        STANDARD_MODULE_PROPERTIES_EX
00524 };
00525 /* }}} */
00526 
00527 #ifdef COMPILE_DL_INTL
00528 ZEND_GET_MODULE( intl )
00529 #endif
00530 
00531 /* {{{ intl_init_globals */
00532 static PHP_GINIT_FUNCTION(intl)
00533 {
00534        memset( intl_globals, 0, sizeof(zend_intl_globals) );
00535 }
00536 /* }}} */
00537 
00538 /* {{{ PHP_MINIT_FUNCTION
00539  */
00540 PHP_MINIT_FUNCTION( intl )
00541 {
00542        /* For the default locale php.ini setting */
00543        REGISTER_INI_ENTRIES();
00544 
00545        REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_CS);
00546        REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
00547 #ifdef U_ICU_DATA_VERSION
00548        REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
00549 #endif 
00550 
00551        /* Register 'Collator' PHP class */
00552        collator_register_Collator_class( TSRMLS_C );
00553 
00554        /* Expose Collator constants to PHP scripts */
00555        collator_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00556 
00557        /* Register 'NumberFormatter' PHP class */
00558        formatter_register_class( TSRMLS_C );
00559 
00560        /* Expose NumberFormatter constants to PHP scripts */
00561        formatter_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00562 
00563        /* Register 'Normalizer' PHP class */
00564        normalizer_register_Normalizer_class( TSRMLS_C );
00565 
00566        /* Expose Normalizer constants to PHP scripts */
00567        normalizer_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00568 
00569        /* Register 'Locale' PHP class */
00570        locale_register_Locale_class( TSRMLS_C );
00571 
00572        /* Expose Locale constants to PHP scripts */
00573        locale_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00574 
00575        msgformat_register_class(TSRMLS_C);
00576 
00577        grapheme_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00578 
00579        /* Register 'DateFormat' PHP class */
00580        dateformat_register_IntlDateFormatter_class( TSRMLS_C );
00581 
00582        /* Expose DateFormat constants to PHP scripts */
00583        dateformat_register_constants( INIT_FUNC_ARGS_PASSTHRU );
00584 
00585        /* Register 'ResourceBundle' PHP class */
00586        resourcebundle_register_class( TSRMLS_C);
00587 
00588        /* Expose ICU error codes to PHP scripts. */
00589        intl_expose_icu_error_codes( INIT_FUNC_ARGS_PASSTHRU );
00590 
00591        /* Expose IDN constants to PHP scripts. */
00592        idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
00593 
00594        /* Global error handling. */
00595        intl_error_init( NULL TSRMLS_CC );
00596 
00597        /* Set the default_locale value */
00598        if( INTL_G(default_locale) == NULL ) {
00599               INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
00600        }
00601 
00602        return SUCCESS;
00603 }
00604 /* }}} */
00605 
00606 /* {{{ PHP_MSHUTDOWN_FUNCTION
00607  */
00608 PHP_MSHUTDOWN_FUNCTION( intl )
00609 {
00610     /* For the default locale php.ini setting */
00611     UNREGISTER_INI_ENTRIES();
00612 
00613     return SUCCESS;
00614 }
00615 /* }}} */
00616 
00617 /* {{{ PHP_RINIT_FUNCTION
00618  */
00619 PHP_RINIT_FUNCTION( intl )
00620 {
00621        /* Set the default_locale value */
00622     if( INTL_G(default_locale) == NULL ) {
00623         INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
00624     }
00625        return SUCCESS;
00626 }
00627 /* }}} */
00628 
00629 /* {{{ PHP_RSHUTDOWN_FUNCTION
00630  */
00631 PHP_RSHUTDOWN_FUNCTION( intl )
00632 {
00633        if(INTL_G(current_collator)) {
00634               INTL_G(current_collator) = NULL;
00635        }
00636        if (INTL_G(grapheme_iterator)) {
00637               grapheme_close_global_iterator( TSRMLS_C );
00638               INTL_G(grapheme_iterator) = NULL;
00639        }
00640 
00641        intl_error_reset( NULL TSRMLS_CC);
00642        return SUCCESS;
00643 }
00644 /* }}} */
00645 
00646 /* {{{ PHP_MINFO_FUNCTION
00647  */
00648 PHP_MINFO_FUNCTION( intl )
00649 {
00650        php_info_print_table_start();
00651        php_info_print_table_header( 2, "Internationalization support", "enabled" );
00652        php_info_print_table_row( 2, "version", INTL_MODULE_VERSION );
00653        php_info_print_table_row( 2, "ICU version", U_ICU_VERSION );
00654 #ifdef U_ICU_DATA_VERSION
00655        php_info_print_table_row( 2, "ICU Data version", U_ICU_DATA_VERSION );
00656 #endif
00657        php_info_print_table_end();
00658 
00659     /* For the default locale php.ini setting */
00660     DISPLAY_INI_ENTRIES() ;
00661 }
00662 /* }}} */
00663 
00664 /*
00665  * Local variables:
00666  * tab-width: 4
00667  * c-basic-offset: 4
00668  * End:
00669  * vim600: noet sw=4 ts=4 fdm=marker
00670  * vim<600: noet sw=4 ts=4
00671  */