diff options
author | Stanislav Malyshev <stas@php.net> | 2010-01-04 21:44:45 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2010-01-04 21:44:45 +0000 |
commit | 8f4337f2551e28d98290752e9ca99fc7f87d93b5 (patch) | |
tree | 65f4e75f335d8736f9df347484bfe14b9a0b0a8e /ext/intl/php_intl.c | |
parent | 795f716832379f43aa7daba605b0c6e136dab24e (diff) | |
download | php-git-8f4337f2551e28d98290752e9ca99fc7f87d93b5.tar.gz |
add ICU resource bundle support, contributed by Hans-Peter Oeri
Diffstat (limited to 'ext/intl/php_intl.c')
-rwxr-xr-x | ext/intl/php_intl.c | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index f4d1dcc525..a9bfefd14c 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -62,6 +62,8 @@ #include "dateformat/dateformat_parse.h" #include "dateformat/dateformat_data.h" +#include "resourcebundle/resourcebundle_class.h" + #include "idn/idn.h" #include "msgformat/msgformat.h" @@ -74,11 +76,11 @@ #define INTL_MODULE_VERSION PHP_INTL_VERSION /* - * locale_get_default has a conflict since ICU also has + * locale_get_default has a conflict since ICU also has * a function with the same name * in fact ICU appends the version no. to it also * Hence the following undef for ICU version - * Same true for the locale_set_default function + * Same true for the locale_set_default function */ #undef locale_get_default #undef locale_set_default @@ -330,6 +332,36 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_utf8, 0, 0, 1) ZEND_ARG_INFO(0, option) ZEND_ARG_INFO(0, status) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_create_proc, 0, 0, 2 ) + ZEND_ARG_INFO( 0, locale ) + ZEND_ARG_INFO( 0, bundlename ) + ZEND_ARG_INFO( 0, fallback ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_proc, 0, 0, 2 ) + ZEND_ARG_INFO( 0, bundle ) + ZEND_ARG_INFO( 0, index ) + ZEND_ARG_INFO( 0, fallback ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count_proc, 0, 0, 1 ) + ZEND_ARG_INFO( 0, bundle ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_locales_proc, 0, 0, 1 ) + ZEND_ARG_INFO( 0, bundlename ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code_proc, 0, 0, 1 ) + ZEND_ARG_INFO( 0, bundle ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message_proc, 0, 0, 1 ) + ZEND_ARG_INFO( 0, bundle ) +ZEND_END_ARG_INFO() + + /* }}} */ /* {{{ intl_functions @@ -422,7 +454,7 @@ zend_function_entry intl_functions[] = { PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_format, arginfo_datefmt_format ) PHP_FE( datefmt_parse, datefmt_parse_args ) - PHP_FE( datefmt_localtime , datefmt_parse_args ) + PHP_FE( datefmt_localtime , datefmt_parse_args ) PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code ) PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message ) @@ -438,8 +470,16 @@ zend_function_entry intl_functions[] = { PHP_FE( grapheme_extract, grapheme_extract_args ) /* IDN functions */ - PHP_FE(idn_to_ascii, arginfo_idn_to_ascii) - PHP_FE(idn_to_utf8, arginfo_idn_to_ascii) + PHP_FE( idn_to_ascii, arginfo_idn_to_ascii) + PHP_FE( idn_to_utf8, arginfo_idn_to_ascii) + + /* ResourceBundle functions */ + PHP_FE( resourcebundle_create, arginfo_resourcebundle_create_proc ) + PHP_FE( resourcebundle_get, arginfo_resourcebundle_get_proc ) + PHP_FE( resourcebundle_count, arginfo_resourcebundle_count_proc ) + PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc ) + PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc ) + PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc ) /* common functions */ PHP_FE( intl_get_error_code, intl_0_args ) @@ -521,7 +561,7 @@ PHP_MINIT_FUNCTION( intl ) /* Expose Normalizer constants to PHP scripts */ normalizer_register_constants( INIT_FUNC_ARGS_PASSTHRU ); - + /* Register 'Locale' PHP class */ locale_register_Locale_class( TSRMLS_C ); @@ -538,6 +578,9 @@ PHP_MINIT_FUNCTION( intl ) /* Expose DateFormat constants to PHP scripts */ dateformat_register_constants( INIT_FUNC_ARGS_PASSTHRU ); + /* Register 'ResourceBundle' PHP class */ + resourcebundle_register_class( TSRMLS_C); + /* Expose ICU error codes to PHP scripts. */ intl_expose_icu_error_codes( INIT_FUNC_ARGS_PASSTHRU ); |