Annotation of embedaddon/php/ext/intl/php_intl.c, revision 1.1
1.1 ! misho 1: /*
! 2: +----------------------------------------------------------------------+
! 3: | PHP Version 5 |
! 4: +----------------------------------------------------------------------+
! 5: | This source file is subject to version 3.01 of the PHP license, |
! 6: | that is bundled with this package in the file LICENSE, and is |
! 7: | available through the world-wide-web at the following url: |
! 8: | http://www.php.net/license/3_01.txt |
! 9: | If you did not receive a copy of the PHP license and are unable to |
! 10: | obtain it through the world-wide-web, please send a note to |
! 11: | license@php.net so we can mail you a copy immediately. |
! 12: +----------------------------------------------------------------------+
! 13: | Authors: Vadim Savchuk <vsavchuk@productengine.com> |
! 14: | Dmitry Lakhtyuk <dlakhtyuk@productengine.com> |
! 15: | Stanislav Malyshev <stas@zend.com> |
! 16: | Kirti Velankar <kirtig@yahoo-inc.com> |
! 17: +----------------------------------------------------------------------+
! 18: */
! 19:
! 20: #ifdef HAVE_CONFIG_H
! 21: #include "config.h"
! 22: #endif
! 23:
! 24:
! 25: #include "php_intl.h"
! 26: #include "intl_error.h"
! 27: #include "collator/collator_class.h"
! 28: #include "collator/collator.h"
! 29: #include "collator/collator_attr.h"
! 30: #include "collator/collator_compare.h"
! 31: #include "collator/collator_sort.h"
! 32: #include "collator/collator_convert.h"
! 33: #include "collator/collator_locale.h"
! 34: #include "collator/collator_create.h"
! 35: #include "collator/collator_error.h"
! 36:
! 37: #include "formatter/formatter.h"
! 38: #include "formatter/formatter_class.h"
! 39: #include "formatter/formatter_attr.h"
! 40: #include "formatter/formatter_format.h"
! 41: #include "formatter/formatter_main.h"
! 42: #include "formatter/formatter_parse.h"
! 43:
! 44: #include "msgformat/msgformat.h"
! 45: #include "msgformat/msgformat_class.h"
! 46: #include "msgformat/msgformat_attr.h"
! 47: #include "msgformat/msgformat_format.h"
! 48: #include "msgformat/msgformat_parse.h"
! 49:
! 50: #include "normalizer/normalizer.h"
! 51: #include "normalizer/normalizer_class.h"
! 52: #include "normalizer/normalizer_normalize.h"
! 53:
! 54: #include "locale/locale.h"
! 55: #include "locale/locale_class.h"
! 56: #include "locale/locale_methods.h"
! 57:
! 58: #include "dateformat/dateformat.h"
! 59: #include "dateformat/dateformat_class.h"
! 60: #include "dateformat/dateformat_attr.h"
! 61: #include "dateformat/dateformat_format.h"
! 62: #include "dateformat/dateformat_parse.h"
! 63: #include "dateformat/dateformat_data.h"
! 64:
! 65: #include "resourcebundle/resourcebundle_class.h"
! 66:
! 67: #include "idn/idn.h"
! 68:
! 69: #include "msgformat/msgformat.h"
! 70: #include "common/common_error.h"
! 71:
! 72: #include <unicode/uloc.h>
! 73: #include <ext/standard/info.h>
! 74:
! 75: #include "php_ini.h"
! 76: #define INTL_MODULE_VERSION PHP_INTL_VERSION
! 77:
! 78: /*
! 79: * locale_get_default has a conflict since ICU also has
! 80: * a function with the same name
! 81: * in fact ICU appends the version no. to it also
! 82: * Hence the following undef for ICU version
! 83: * Same true for the locale_set_default function
! 84: */
! 85: #undef locale_get_default
! 86: #undef locale_set_default
! 87:
! 88: ZEND_DECLARE_MODULE_GLOBALS( intl )
! 89:
! 90: /* {{{ Arguments info */
! 91: ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
! 92: ZEND_END_ARG_INFO()
! 93:
! 94: ZEND_BEGIN_ARG_INFO_EX(collator_static_1_arg, 0, 0, 1)
! 95: ZEND_ARG_INFO(0, arg1)
! 96: ZEND_END_ARG_INFO()
! 97:
! 98: ZEND_BEGIN_ARG_INFO_EX(collator_static_2_args, 0, 0, 2)
! 99: ZEND_ARG_INFO(0, arg1)
! 100: ZEND_ARG_INFO(0, arg2)
! 101: ZEND_END_ARG_INFO()
! 102:
! 103: ZEND_BEGIN_ARG_INFO_EX(collator_0_args, 0, 0, 1)
! 104: ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
! 105: ZEND_END_ARG_INFO()
! 106:
! 107: ZEND_BEGIN_ARG_INFO_EX(collator_1_arg, 0, 0, 2)
! 108: ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
! 109: ZEND_ARG_INFO(0, arg1)
! 110: ZEND_END_ARG_INFO()
! 111:
! 112: ZEND_BEGIN_ARG_INFO_EX(collator_2_args, 0, 0, 3)
! 113: ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
! 114: ZEND_ARG_INFO(0, arg1)
! 115: ZEND_ARG_INFO(0, arg2)
! 116: ZEND_END_ARG_INFO()
! 117:
! 118: ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
! 119: ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
! 120: ZEND_ARG_ARRAY_INFO(1, arr, 0)
! 121: ZEND_ARG_INFO(0, sort_flags)
! 122: ZEND_END_ARG_INFO()
! 123:
! 124: ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
! 125: ZEND_ARG_INFO(0, formatter)
! 126: ZEND_ARG_INFO(0, string)
! 127: ZEND_ARG_INFO(0, type)
! 128: ZEND_ARG_INFO(1, position)
! 129: ZEND_END_ARG_INFO()
! 130:
! 131: ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
! 132: ZEND_ARG_INFO(0, formatter)
! 133: ZEND_ARG_INFO(0, string)
! 134: ZEND_ARG_INFO(1, currency)
! 135: ZEND_ARG_INFO(1, position)
! 136: ZEND_END_ARG_INFO()
! 137:
! 138: ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
! 139: ZEND_END_ARG_INFO()
! 140:
! 141: ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
! 142: ZEND_ARG_INFO(0, arg1)
! 143: ZEND_END_ARG_INFO()
! 144:
! 145: ZEND_BEGIN_ARG_INFO_EX(locale_2_args, 0, 0, 2)
! 146: ZEND_ARG_INFO(0, arg1)
! 147: ZEND_ARG_INFO(0, arg2)
! 148: ZEND_END_ARG_INFO()
! 149:
! 150: ZEND_BEGIN_ARG_INFO_EX(locale_3_args, 0, 0, 3)
! 151: ZEND_ARG_INFO(0, arg1)
! 152: ZEND_ARG_INFO(0, arg2)
! 153: ZEND_ARG_INFO(0, arg3)
! 154: ZEND_END_ARG_INFO()
! 155:
! 156: ZEND_BEGIN_ARG_INFO_EX(locale_4_args, 0, 0, 4)
! 157: ZEND_ARG_INFO(0, arg1)
! 158: ZEND_ARG_INFO(0, arg2)
! 159: ZEND_ARG_INFO(0, arg3)
! 160: ZEND_ARG_INFO(0, arg4)
! 161: ZEND_END_ARG_INFO()
! 162:
! 163: #define intl_0_args collator_static_0_args
! 164: #define intl_1_arg collator_static_1_arg
! 165:
! 166: ZEND_BEGIN_ARG_INFO_EX(normalizer_args, 0, 0, 1)
! 167: ZEND_ARG_INFO(0, input)
! 168: ZEND_ARG_INFO(0, form)
! 169: ZEND_END_ARG_INFO()
! 170:
! 171: ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
! 172: ZEND_ARG_INFO(0, string)
! 173: ZEND_END_ARG_INFO()
! 174:
! 175: ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
! 176: ZEND_ARG_INFO(0, haystack)
! 177: ZEND_ARG_INFO(0, needle)
! 178: ZEND_ARG_INFO(0, offset)
! 179: ZEND_END_ARG_INFO()
! 180:
! 181: ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
! 182: ZEND_ARG_INFO(0, string)
! 183: ZEND_ARG_INFO(0, start)
! 184: ZEND_ARG_INFO(0, length)
! 185: ZEND_END_ARG_INFO()
! 186:
! 187: ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
! 188: ZEND_ARG_INFO(0, haystack)
! 189: ZEND_ARG_INFO(0, needle)
! 190: ZEND_ARG_INFO(0, before_needle)
! 191: ZEND_END_ARG_INFO()
! 192:
! 193: ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
! 194: ZEND_ARG_INFO(0, arg1)
! 195: ZEND_ARG_INFO(0, arg2)
! 196: ZEND_ARG_INFO(0, arg3)
! 197: ZEND_ARG_INFO(0, arg4)
! 198: ZEND_ARG_INFO(1, arg5) /* 1 = pass by reference */
! 199: ZEND_END_ARG_INFO()
! 200:
! 201: ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
! 202: ZEND_ARG_INFO(0, formatter)
! 203: ZEND_ARG_INFO(0, string)
! 204: ZEND_ARG_INFO(1, position)
! 205: ZEND_END_ARG_INFO()
! 206:
! 207: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_create, 0, 0, 2)
! 208: ZEND_ARG_INFO(0, locale)
! 209: ZEND_ARG_INFO(0, style)
! 210: ZEND_ARG_INFO(0, pattern)
! 211: ZEND_END_ARG_INFO()
! 212:
! 213: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_error_code, 0, 0, 1)
! 214: ZEND_ARG_INFO(0, nf)
! 215: ZEND_END_ARG_INFO()
! 216:
! 217: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format, 0, 0, 2)
! 218: ZEND_ARG_INFO(0, nf)
! 219: ZEND_ARG_INFO(0, num)
! 220: ZEND_ARG_INFO(0, type)
! 221: ZEND_END_ARG_INFO()
! 222:
! 223: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format_currency, 0, 0, 3)
! 224: ZEND_ARG_INFO(0, nf)
! 225: ZEND_ARG_INFO(0, num)
! 226: ZEND_ARG_INFO(0, currency)
! 227: ZEND_END_ARG_INFO()
! 228:
! 229: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_attribute, 0, 0, 2)
! 230: ZEND_ARG_INFO(0, nf)
! 231: ZEND_ARG_INFO(0, attr)
! 232: ZEND_END_ARG_INFO()
! 233:
! 234: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_attribute, 0, 0, 3)
! 235: ZEND_ARG_INFO(0, nf)
! 236: ZEND_ARG_INFO(0, attr)
! 237: ZEND_ARG_INFO(0, value)
! 238: ZEND_END_ARG_INFO()
! 239:
! 240: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_symbol, 0, 0, 3)
! 241: ZEND_ARG_INFO(0, nf)
! 242: ZEND_ARG_INFO(0, attr)
! 243: ZEND_ARG_INFO(0, symbol)
! 244: ZEND_END_ARG_INFO()
! 245:
! 246: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_pattern, 0, 0, 2)
! 247: ZEND_ARG_INFO(0, nf)
! 248: ZEND_ARG_INFO(0, pattern)
! 249: ZEND_END_ARG_INFO()
! 250:
! 251: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_locale, 0, 0, 1)
! 252: ZEND_ARG_INFO(0, nf)
! 253: ZEND_ARG_INFO(0, type)
! 254: ZEND_END_ARG_INFO()
! 255:
! 256: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_create, 0, 0, 2)
! 257: ZEND_ARG_INFO(0, locale)
! 258: ZEND_ARG_INFO(0, pattern)
! 259: ZEND_END_ARG_INFO()
! 260:
! 261: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_code, 0, 0, 1)
! 262: ZEND_ARG_INFO(0, nf)
! 263: ZEND_END_ARG_INFO()
! 264:
! 265: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_message, 0, 0, 1)
! 266: ZEND_ARG_INFO(0, coll)
! 267: ZEND_END_ARG_INFO()
! 268:
! 269: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format, 0, 0, 2)
! 270: ZEND_ARG_INFO(0, nf)
! 271: ZEND_ARG_INFO(0, args)
! 272: ZEND_END_ARG_INFO()
! 273:
! 274: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format_message, 0, 0, 3)
! 275: ZEND_ARG_INFO(0, locale)
! 276: ZEND_ARG_INFO(0, pattern)
! 277: ZEND_ARG_INFO(0, args)
! 278: ZEND_END_ARG_INFO()
! 279:
! 280: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
! 281: ZEND_ARG_INFO(0, nf)
! 282: ZEND_ARG_INFO(0, source)
! 283: ZEND_END_ARG_INFO()
! 284:
! 285: ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_parse_message, 0, 0, 3)
! 286: ZEND_ARG_INFO(0, locale)
! 287: ZEND_ARG_INFO(0, pattern)
! 288: ZEND_ARG_INFO(0, source)
! 289: ZEND_END_ARG_INFO()
! 290:
! 291: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_set_pattern, 0, 0, 2)
! 292: ZEND_ARG_INFO(0, mf)
! 293: ZEND_ARG_INFO(0, pattern)
! 294: ZEND_END_ARG_INFO()
! 295:
! 296: ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_locale, 0, 0, 1)
! 297: ZEND_ARG_INFO(0, mf)
! 298: ZEND_END_ARG_INFO()
! 299:
! 300: ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
! 301: ZEND_ARG_INFO(0, mf)
! 302: ZEND_ARG_INFO(0, pattern)
! 303: ZEND_END_ARG_INFO()
! 304:
! 305: ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
! 306: ZEND_ARG_INFO(0, mf)
! 307: ZEND_ARG_INFO(0, calendar)
! 308: ZEND_END_ARG_INFO()
! 309:
! 310: ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0)
! 311: ZEND_ARG_INFO(0, args)
! 312: ZEND_ARG_INFO(0, array)
! 313: ZEND_END_ARG_INFO()
! 314:
! 315: ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3)
! 316: ZEND_ARG_INFO(0, locale)
! 317: ZEND_ARG_INFO(0, date_type)
! 318: ZEND_ARG_INFO(0, time_type)
! 319: ZEND_ARG_INFO(0, timezone_str)
! 320: ZEND_ARG_INFO(0, calendar)
! 321: ZEND_ARG_INFO(0, pattern)
! 322: ZEND_END_ARG_INFO()
! 323:
! 324: ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
! 325: ZEND_ARG_INFO(0, domain)
! 326: ZEND_ARG_INFO(0, option)
! 327: ZEND_ARG_INFO(0, status)
! 328: ZEND_END_ARG_INFO()
! 329:
! 330: ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_utf8, 0, 0, 1)
! 331: ZEND_ARG_INFO(0, domain)
! 332: ZEND_ARG_INFO(0, option)
! 333: ZEND_ARG_INFO(0, status)
! 334: ZEND_END_ARG_INFO()
! 335:
! 336: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_create_proc, 0, 0, 2 )
! 337: ZEND_ARG_INFO( 0, locale )
! 338: ZEND_ARG_INFO( 0, bundlename )
! 339: ZEND_ARG_INFO( 0, fallback )
! 340: ZEND_END_ARG_INFO()
! 341:
! 342: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_proc, 0, 0, 2 )
! 343: ZEND_ARG_INFO( 0, bundle )
! 344: ZEND_ARG_INFO( 0, index )
! 345: ZEND_ARG_INFO( 0, fallback )
! 346: ZEND_END_ARG_INFO()
! 347:
! 348: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count_proc, 0, 0, 1 )
! 349: ZEND_ARG_INFO( 0, bundle )
! 350: ZEND_END_ARG_INFO()
! 351:
! 352: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_locales_proc, 0, 0, 1 )
! 353: ZEND_ARG_INFO( 0, bundlename )
! 354: ZEND_END_ARG_INFO()
! 355:
! 356: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code_proc, 0, 0, 1 )
! 357: ZEND_ARG_INFO( 0, bundle )
! 358: ZEND_END_ARG_INFO()
! 359:
! 360: ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message_proc, 0, 0, 1 )
! 361: ZEND_ARG_INFO( 0, bundle )
! 362: ZEND_END_ARG_INFO()
! 363:
! 364:
! 365: /* }}} */
! 366:
! 367: /* {{{ intl_functions
! 368: *
! 369: * Every user visible function must have an entry in intl_functions[].
! 370: */
! 371: zend_function_entry intl_functions[] = {
! 372:
! 373: /* collator functions */
! 374: PHP_FE( collator_create, collator_static_1_arg )
! 375: PHP_FE( collator_compare, collator_2_args )
! 376: PHP_FE( collator_get_attribute, collator_1_arg )
! 377: PHP_FE( collator_set_attribute, collator_2_args )
! 378: PHP_FE( collator_get_strength, collator_0_args )
! 379: PHP_FE( collator_set_strength, collator_1_arg )
! 380: PHP_FE( collator_sort, collator_sort_args )
! 381: PHP_FE( collator_sort_with_sort_keys, collator_sort_args )
! 382: PHP_FE( collator_asort, collator_sort_args )
! 383: PHP_FE( collator_get_locale, collator_1_arg )
! 384: PHP_FE( collator_get_error_code, collator_0_args )
! 385: PHP_FE( collator_get_error_message, collator_0_args )
! 386: PHP_FE( collator_get_sort_key, collator_2_args )
! 387:
! 388: /* formatter functions */
! 389: PHP_FE( numfmt_create, arginfo_numfmt_create )
! 390: PHP_FE( numfmt_format, arginfo_numfmt_format )
! 391: PHP_FE( numfmt_parse, numfmt_parse_arginfo )
! 392: PHP_FE( numfmt_format_currency, arginfo_numfmt_format_currency )
! 393: PHP_FE( numfmt_parse_currency, numfmt_parse_currency_arginfo )
! 394: PHP_FE( numfmt_set_attribute, arginfo_numfmt_set_attribute )
! 395: PHP_FE( numfmt_get_attribute, arginfo_numfmt_get_attribute )
! 396: PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_attribute )
! 397: PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_attribute )
! 398: PHP_FE( numfmt_set_symbol, arginfo_numfmt_set_symbol )
! 399: PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_attribute )
! 400: PHP_FE( numfmt_set_pattern, arginfo_numfmt_set_pattern )
! 401: PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_error_code )
! 402: PHP_FE( numfmt_get_locale, arginfo_numfmt_get_locale )
! 403: PHP_FE( numfmt_get_error_code, arginfo_numfmt_get_error_code )
! 404: PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_code )
! 405:
! 406: /* normalizer functions */
! 407: PHP_FE( normalizer_normalize, normalizer_args )
! 408: PHP_FE( normalizer_is_normalized, normalizer_args )
! 409:
! 410: /* Locale functions */
! 411: PHP_NAMED_FE( locale_get_default, zif_locale_get_default, locale_0_args )
! 412: PHP_NAMED_FE( locale_set_default, zif_locale_set_default, locale_1_arg )
! 413: PHP_FE( locale_get_primary_language, locale_1_arg )
! 414: PHP_FE( locale_get_script, locale_1_arg )
! 415: PHP_FE( locale_get_region, locale_1_arg )
! 416: PHP_FE( locale_get_keywords, locale_1_arg )
! 417: PHP_FE( locale_get_display_script, locale_2_args )
! 418: PHP_FE( locale_get_display_region, locale_2_args )
! 419: PHP_FE( locale_get_display_name, locale_2_args )
! 420: PHP_FE( locale_get_display_language, locale_2_args)
! 421: PHP_FE( locale_get_display_variant, locale_2_args )
! 422: PHP_FE( locale_compose, locale_1_arg )
! 423: PHP_FE( locale_parse, locale_1_arg )
! 424: PHP_FE( locale_get_all_variants, locale_1_arg )
! 425: PHP_FE( locale_filter_matches, locale_3_args )
! 426: PHP_FE( locale_canonicalize, locale_1_arg )
! 427: PHP_FE( locale_lookup, locale_4_args )
! 428: PHP_FE( locale_accept_from_http, locale_1_arg )
! 429:
! 430: /* MessageFormatter functions */
! 431: PHP_FE( msgfmt_create, arginfo_msgfmt_create )
! 432: PHP_FE( msgfmt_format, arginfo_msgfmt_format )
! 433: PHP_FE( msgfmt_format_message, arginfo_msgfmt_format_message )
! 434: PHP_FE( msgfmt_parse, arginfo_msgfmt_parse )
! 435: PHP_FE( msgfmt_parse_message, arginfo_numfmt_parse_message )
! 436: PHP_FE( msgfmt_set_pattern, arginfo_msgfmt_set_pattern )
! 437: PHP_FE( msgfmt_get_pattern, arginfo_msgfmt_get_locale )
! 438: PHP_FE( msgfmt_get_locale, arginfo_msgfmt_get_locale )
! 439: PHP_FE( msgfmt_get_error_code, arginfo_msgfmt_get_error_code )
! 440: PHP_FE( msgfmt_get_error_message, arginfo_msgfmt_get_error_message )
! 441:
! 442: /* IntlDateFormatter functions */
! 443: PHP_FE( datefmt_create, arginfo_datefmt_create )
! 444: PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale )
! 445: PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale )
! 446: PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale )
! 447: PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar )
! 448: PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale )
! 449: PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale )
! 450: PHP_FE( datefmt_set_timezone_id, arginfo_msgfmt_get_locale )
! 451: PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale )
! 452: PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern )
! 453: PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale )
! 454: PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale )
! 455: PHP_FE( datefmt_format, arginfo_datefmt_format )
! 456: PHP_FE( datefmt_parse, datefmt_parse_args )
! 457: PHP_FE( datefmt_localtime , datefmt_parse_args )
! 458: PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code )
! 459: PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
! 460:
! 461: /* grapheme functions */
! 462: PHP_FE( grapheme_strlen, grapheme_1_arg )
! 463: PHP_FE( grapheme_strpos, grapheme_search_args )
! 464: PHP_FE( grapheme_stripos, grapheme_search_args )
! 465: PHP_FE( grapheme_strrpos, grapheme_search_args )
! 466: PHP_FE( grapheme_strripos, grapheme_search_args )
! 467: PHP_FE( grapheme_substr, grapheme_substr_args )
! 468: PHP_FE( grapheme_strstr, grapheme_strstr_args )
! 469: PHP_FE( grapheme_stristr, grapheme_strstr_args )
! 470: PHP_FE( grapheme_extract, grapheme_extract_args )
! 471:
! 472: /* IDN functions */
! 473: PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)
! 474: PHP_FE( idn_to_utf8, arginfo_idn_to_ascii)
! 475:
! 476: /* ResourceBundle functions */
! 477: PHP_FE( resourcebundle_create, arginfo_resourcebundle_create_proc )
! 478: PHP_FE( resourcebundle_get, arginfo_resourcebundle_get_proc )
! 479: PHP_FE( resourcebundle_count, arginfo_resourcebundle_count_proc )
! 480: PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc )
! 481: PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc )
! 482: PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc )
! 483:
! 484: /* common functions */
! 485: PHP_FE( intl_get_error_code, intl_0_args )
! 486: PHP_FE( intl_get_error_message, intl_0_args )
! 487: PHP_FE( intl_is_failure, intl_1_arg )
! 488: PHP_FE( intl_error_name, intl_1_arg )
! 489:
! 490: PHP_FE_END
! 491: };
! 492: /* }}} */
! 493:
! 494:
! 495: /* {{{ INI Settings */
! 496: PHP_INI_BEGIN()
! 497: STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
! 498: STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
! 499:
! 500: PHP_INI_END()
! 501: /* }}} */
! 502:
! 503:
! 504: static PHP_GINIT_FUNCTION(intl);
! 505:
! 506: /* {{{ intl_module_entry */
! 507: zend_module_entry intl_module_entry = {
! 508: #if ZEND_MODULE_API_NO >= 20010901
! 509: STANDARD_MODULE_HEADER,
! 510: #endif
! 511: "intl",
! 512: intl_functions,
! 513: PHP_MINIT( intl ),
! 514: PHP_MSHUTDOWN( intl ),
! 515: PHP_RINIT( intl ),
! 516: PHP_RSHUTDOWN( intl ),
! 517: PHP_MINFO( intl ),
! 518: INTL_MODULE_VERSION,
! 519: PHP_MODULE_GLOBALS(intl), /* globals descriptor */
! 520: PHP_GINIT(intl), /* globals ctor */
! 521: NULL, /* globals dtor */
! 522: NULL, /* post deactivate */
! 523: STANDARD_MODULE_PROPERTIES_EX
! 524: };
! 525: /* }}} */
! 526:
! 527: #ifdef COMPILE_DL_INTL
! 528: ZEND_GET_MODULE( intl )
! 529: #endif
! 530:
! 531: /* {{{ intl_init_globals */
! 532: static PHP_GINIT_FUNCTION(intl)
! 533: {
! 534: memset( intl_globals, 0, sizeof(zend_intl_globals) );
! 535: }
! 536: /* }}} */
! 537:
! 538: /* {{{ PHP_MINIT_FUNCTION
! 539: */
! 540: PHP_MINIT_FUNCTION( intl )
! 541: {
! 542: /* For the default locale php.ini setting */
! 543: REGISTER_INI_ENTRIES();
! 544:
! 545: REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_CS);
! 546: REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
! 547: #ifdef U_ICU_DATA_VERSION
! 548: REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
! 549: #endif
! 550:
! 551: /* Register 'Collator' PHP class */
! 552: collator_register_Collator_class( TSRMLS_C );
! 553:
! 554: /* Expose Collator constants to PHP scripts */
! 555: collator_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 556:
! 557: /* Register 'NumberFormatter' PHP class */
! 558: formatter_register_class( TSRMLS_C );
! 559:
! 560: /* Expose NumberFormatter constants to PHP scripts */
! 561: formatter_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 562:
! 563: /* Register 'Normalizer' PHP class */
! 564: normalizer_register_Normalizer_class( TSRMLS_C );
! 565:
! 566: /* Expose Normalizer constants to PHP scripts */
! 567: normalizer_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 568:
! 569: /* Register 'Locale' PHP class */
! 570: locale_register_Locale_class( TSRMLS_C );
! 571:
! 572: /* Expose Locale constants to PHP scripts */
! 573: locale_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 574:
! 575: msgformat_register_class(TSRMLS_C);
! 576:
! 577: grapheme_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 578:
! 579: /* Register 'DateFormat' PHP class */
! 580: dateformat_register_IntlDateFormatter_class( TSRMLS_C );
! 581:
! 582: /* Expose DateFormat constants to PHP scripts */
! 583: dateformat_register_constants( INIT_FUNC_ARGS_PASSTHRU );
! 584:
! 585: /* Register 'ResourceBundle' PHP class */
! 586: resourcebundle_register_class( TSRMLS_C);
! 587:
! 588: /* Expose ICU error codes to PHP scripts. */
! 589: intl_expose_icu_error_codes( INIT_FUNC_ARGS_PASSTHRU );
! 590:
! 591: /* Expose IDN constants to PHP scripts. */
! 592: idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
! 593:
! 594: /* Global error handling. */
! 595: intl_error_init( NULL TSRMLS_CC );
! 596:
! 597: /* Set the default_locale value */
! 598: if( INTL_G(default_locale) == NULL ) {
! 599: INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
! 600: }
! 601:
! 602: return SUCCESS;
! 603: }
! 604: /* }}} */
! 605:
! 606: /* {{{ PHP_MSHUTDOWN_FUNCTION
! 607: */
! 608: PHP_MSHUTDOWN_FUNCTION( intl )
! 609: {
! 610: /* For the default locale php.ini setting */
! 611: UNREGISTER_INI_ENTRIES();
! 612:
! 613: return SUCCESS;
! 614: }
! 615: /* }}} */
! 616:
! 617: /* {{{ PHP_RINIT_FUNCTION
! 618: */
! 619: PHP_RINIT_FUNCTION( intl )
! 620: {
! 621: /* Set the default_locale value */
! 622: if( INTL_G(default_locale) == NULL ) {
! 623: INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
! 624: }
! 625: return SUCCESS;
! 626: }
! 627: /* }}} */
! 628:
! 629: /* {{{ PHP_RSHUTDOWN_FUNCTION
! 630: */
! 631: PHP_RSHUTDOWN_FUNCTION( intl )
! 632: {
! 633: if(INTL_G(current_collator)) {
! 634: INTL_G(current_collator) = NULL;
! 635: }
! 636: if (INTL_G(grapheme_iterator)) {
! 637: grapheme_close_global_iterator( TSRMLS_C );
! 638: INTL_G(grapheme_iterator) = NULL;
! 639: }
! 640:
! 641: intl_error_reset( NULL TSRMLS_CC);
! 642: return SUCCESS;
! 643: }
! 644: /* }}} */
! 645:
! 646: /* {{{ PHP_MINFO_FUNCTION
! 647: */
! 648: PHP_MINFO_FUNCTION( intl )
! 649: {
! 650: php_info_print_table_start();
! 651: php_info_print_table_header( 2, "Internationalization support", "enabled" );
! 652: php_info_print_table_row( 2, "version", INTL_MODULE_VERSION );
! 653: php_info_print_table_row( 2, "ICU version", U_ICU_VERSION );
! 654: #ifdef U_ICU_DATA_VERSION
! 655: php_info_print_table_row( 2, "ICU Data version", U_ICU_DATA_VERSION );
! 656: #endif
! 657: php_info_print_table_end();
! 658:
! 659: /* For the default locale php.ini setting */
! 660: DISPLAY_INI_ENTRIES() ;
! 661: }
! 662: /* }}} */
! 663:
! 664: /*
! 665: * Local variables:
! 666: * tab-width: 4
! 667: * c-basic-offset: 4
! 668: * End:
! 669: * vim600: noet sw=4 ts=4 fdm=marker
! 670: * vim<600: noet sw=4 ts=4
! 671: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>