PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - intl - php_intl.c
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 47
Code covered: 95.7 % Executed lines: 45
Legend: not executed executed

       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 "idn/idn.h"
      66                 : 
      67                 : #include "msgformat/msgformat.h"
      68                 : #include "common/common_error.h"
      69                 : 
      70                 : #include <unicode/uloc.h>
      71                 : #include <ext/standard/info.h>
      72                 : 
      73                 : #include "php_ini.h"
      74                 : #define INTL_MODULE_VERSION PHP_INTL_VERSION
      75                 : 
      76                 : /*
      77                 :  * locale_get_default has a conflict since ICU also has 
      78                 :  * a function with the same  name
      79                 :  * in fact ICU appends the version no. to it also
      80                 :  * Hence the following undef for ICU version
      81                 :  * Same true for the locale_set_default function 
      82                 : */
      83                 : #undef locale_get_default
      84                 : #undef locale_set_default
      85                 : 
      86                 : ZEND_DECLARE_MODULE_GLOBALS( intl )
      87                 : 
      88                 : /* {{{ Arguments info */
      89                 : ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
      90                 : ZEND_END_ARG_INFO()
      91                 : 
      92                 : ZEND_BEGIN_ARG_INFO_EX(collator_static_1_arg, 0, 0, 1)
      93                 :         ZEND_ARG_INFO(0, arg1)
      94                 : ZEND_END_ARG_INFO()
      95                 : 
      96                 : ZEND_BEGIN_ARG_INFO_EX(collator_static_2_args, 0, 0, 2)
      97                 :         ZEND_ARG_INFO(0, arg1)
      98                 :         ZEND_ARG_INFO(0, arg2)
      99                 : ZEND_END_ARG_INFO()
     100                 : 
     101                 : ZEND_BEGIN_ARG_INFO_EX(collator_0_args, 0, 0, 1)
     102                 :         ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
     103                 : ZEND_END_ARG_INFO()
     104                 : 
     105                 : ZEND_BEGIN_ARG_INFO_EX(collator_1_arg, 0, 0, 2)
     106                 :         ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
     107                 :         ZEND_ARG_INFO(0, arg1)
     108                 : ZEND_END_ARG_INFO()
     109                 : 
     110                 : ZEND_BEGIN_ARG_INFO_EX(collator_2_args, 0, 0, 3)
     111                 :         ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
     112                 :         ZEND_ARG_INFO(0, arg1)
     113                 :         ZEND_ARG_INFO(0, arg2)
     114                 : ZEND_END_ARG_INFO()
     115                 : 
     116                 : ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
     117                 :         ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
     118                 :         ZEND_ARG_ARRAY_INFO(1, arr, 0)
     119                 :         ZEND_ARG_INFO(0, sort_flags)
     120                 : ZEND_END_ARG_INFO()
     121                 : 
     122                 : ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
     123                 :         ZEND_ARG_INFO(0, formatter)
     124                 :         ZEND_ARG_INFO(0, string)
     125                 :         ZEND_ARG_INFO(0, type)
     126                 :         ZEND_ARG_INFO(1, position)
     127                 : ZEND_END_ARG_INFO()
     128                 : 
     129                 : ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
     130                 :         ZEND_ARG_INFO(0, formatter)
     131                 :         ZEND_ARG_INFO(0, string)
     132                 :         ZEND_ARG_INFO(1, currency)
     133                 :         ZEND_ARG_INFO(1, position)
     134                 : ZEND_END_ARG_INFO()
     135                 : 
     136                 : ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
     137                 : ZEND_END_ARG_INFO()
     138                 : 
     139                 : ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
     140                 :         ZEND_ARG_INFO(0, arg1)
     141                 : ZEND_END_ARG_INFO()
     142                 : 
     143                 : ZEND_BEGIN_ARG_INFO_EX(locale_2_args, 0, 0, 2)
     144                 :         ZEND_ARG_INFO(0, arg1)
     145                 :         ZEND_ARG_INFO(0, arg2)
     146                 : ZEND_END_ARG_INFO()
     147                 : 
     148                 : ZEND_BEGIN_ARG_INFO_EX(locale_3_args, 0, 0, 3)
     149                 :         ZEND_ARG_INFO(0, arg1)
     150                 :         ZEND_ARG_INFO(0, arg2)
     151                 :         ZEND_ARG_INFO(0, arg3)
     152                 : ZEND_END_ARG_INFO()
     153                 : 
     154                 : ZEND_BEGIN_ARG_INFO_EX(locale_4_args, 0, 0, 4)
     155                 :         ZEND_ARG_INFO(0, arg1)
     156                 :         ZEND_ARG_INFO(0, arg2)
     157                 :         ZEND_ARG_INFO(0, arg3)
     158                 :         ZEND_ARG_INFO(0, arg4)
     159                 : ZEND_END_ARG_INFO()
     160                 : 
     161                 : #define intl_0_args collator_static_0_args
     162                 : #define intl_1_arg collator_static_1_arg
     163                 : 
     164                 : ZEND_BEGIN_ARG_INFO_EX(normalizer_args, 0, 0, 1)
     165                 :         ZEND_ARG_INFO(0, input)
     166                 :         ZEND_ARG_INFO(0, form)
     167                 : ZEND_END_ARG_INFO()
     168                 : 
     169                 : ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
     170                 :         ZEND_ARG_INFO(0, string)
     171                 : ZEND_END_ARG_INFO()
     172                 : 
     173                 : ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
     174                 :         ZEND_ARG_INFO(0, haystack)
     175                 :         ZEND_ARG_INFO(0, needle)
     176                 :         ZEND_ARG_INFO(0, offset)
     177                 : ZEND_END_ARG_INFO()
     178                 : 
     179                 : ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
     180                 :         ZEND_ARG_INFO(0, string)
     181                 :         ZEND_ARG_INFO(0, start)
     182                 :         ZEND_ARG_INFO(0, length)
     183                 : ZEND_END_ARG_INFO()
     184                 : 
     185                 : ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
     186                 :         ZEND_ARG_INFO(0, haystack)
     187                 :         ZEND_ARG_INFO(0, needle)
     188                 :         ZEND_ARG_INFO(0, before_needle)
     189                 : ZEND_END_ARG_INFO()
     190                 : 
     191                 : ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
     192                 :         ZEND_ARG_INFO(0, arg1)
     193                 :         ZEND_ARG_INFO(0, arg2)
     194                 :         ZEND_ARG_INFO(0, arg3)
     195                 :         ZEND_ARG_INFO(0, arg4)
     196                 :         ZEND_ARG_INFO(1, arg5)  /* 1 = pass by reference */
     197                 : ZEND_END_ARG_INFO()
     198                 : 
     199                 : ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
     200                 :         ZEND_ARG_INFO(0, formatter)
     201                 :         ZEND_ARG_INFO(0, string)
     202                 :         ZEND_ARG_INFO(1, position)
     203                 : ZEND_END_ARG_INFO()
     204                 : 
     205                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_create, 0, 0, 2)
     206                 :         ZEND_ARG_INFO(0, locale)
     207                 :         ZEND_ARG_INFO(0, style)
     208                 :         ZEND_ARG_INFO(0, pattern)
     209                 : ZEND_END_ARG_INFO()
     210                 : 
     211                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_error_code, 0, 0, 1)
     212                 :         ZEND_ARG_INFO(0, nf)
     213                 : ZEND_END_ARG_INFO()
     214                 : 
     215                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format, 0, 0, 2)
     216                 :         ZEND_ARG_INFO(0, nf)
     217                 :         ZEND_ARG_INFO(0, num)
     218                 :         ZEND_ARG_INFO(0, type)
     219                 : ZEND_END_ARG_INFO()
     220                 : 
     221                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format_currency, 0, 0, 3)
     222                 :         ZEND_ARG_INFO(0, nf)
     223                 :         ZEND_ARG_INFO(0, num)
     224                 :         ZEND_ARG_INFO(0, currency)
     225                 : ZEND_END_ARG_INFO()
     226                 : 
     227                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_attribute, 0, 0, 2)
     228                 :         ZEND_ARG_INFO(0, nf)
     229                 :         ZEND_ARG_INFO(0, attr)
     230                 : ZEND_END_ARG_INFO()
     231                 : 
     232                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_attribute, 0, 0, 3)
     233                 :         ZEND_ARG_INFO(0, nf)
     234                 :         ZEND_ARG_INFO(0, attr)
     235                 :         ZEND_ARG_INFO(0, value)
     236                 : ZEND_END_ARG_INFO()
     237                 : 
     238                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_symbol, 0, 0, 3)
     239                 :         ZEND_ARG_INFO(0, nf)
     240                 :         ZEND_ARG_INFO(0, attr)
     241                 :         ZEND_ARG_INFO(0, symbol)
     242                 : ZEND_END_ARG_INFO()
     243                 : 
     244                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_pattern, 0, 0, 2)
     245                 :         ZEND_ARG_INFO(0, nf)
     246                 :         ZEND_ARG_INFO(0, pattern)
     247                 : ZEND_END_ARG_INFO()
     248                 : 
     249                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_locale, 0, 0, 1)
     250                 :         ZEND_ARG_INFO(0, nf)
     251                 :         ZEND_ARG_INFO(0, type)
     252                 : ZEND_END_ARG_INFO()
     253                 : 
     254                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_create, 0, 0, 2)
     255                 :         ZEND_ARG_INFO(0, locale)
     256                 :         ZEND_ARG_INFO(0, pattern)
     257                 : ZEND_END_ARG_INFO()
     258                 : 
     259                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_code, 0, 0, 1)
     260                 :         ZEND_ARG_INFO(0, nf)
     261                 : ZEND_END_ARG_INFO()
     262                 : 
     263                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_message, 0, 0, 1)
     264                 :         ZEND_ARG_INFO(0, coll)
     265                 : ZEND_END_ARG_INFO()
     266                 : 
     267                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format, 0, 0, 2)
     268                 :         ZEND_ARG_INFO(0, nf)
     269                 :         ZEND_ARG_INFO(0, args)
     270                 : ZEND_END_ARG_INFO()
     271                 : 
     272                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format_message, 0, 0, 3)
     273                 :         ZEND_ARG_INFO(0, locale)
     274                 :         ZEND_ARG_INFO(0, pattern)
     275                 :         ZEND_ARG_INFO(0, args)
     276                 : ZEND_END_ARG_INFO()
     277                 : 
     278                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
     279                 :         ZEND_ARG_INFO(0, nf)
     280                 :         ZEND_ARG_INFO(0, source)
     281                 : ZEND_END_ARG_INFO()
     282                 : 
     283                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_parse_message, 0, 0, 3)
     284                 :         ZEND_ARG_INFO(0, locale)
     285                 :         ZEND_ARG_INFO(0, pattern)
     286                 :         ZEND_ARG_INFO(0, source)
     287                 : ZEND_END_ARG_INFO()
     288                 : 
     289                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_set_pattern, 0, 0, 2)
     290                 :         ZEND_ARG_INFO(0, mf)
     291                 :         ZEND_ARG_INFO(0, pattern)
     292                 : ZEND_END_ARG_INFO()
     293                 : 
     294                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_locale, 0, 0, 1)
     295                 :         ZEND_ARG_INFO(0, mf)
     296                 : ZEND_END_ARG_INFO()
     297                 : 
     298                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
     299                 :         ZEND_ARG_INFO(0, mf)
     300                 :         ZEND_ARG_INFO(0, pattern)
     301                 : ZEND_END_ARG_INFO()
     302                 : 
     303                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
     304                 :         ZEND_ARG_INFO(0, mf)
     305                 :         ZEND_ARG_INFO(0, calendar)
     306                 : ZEND_END_ARG_INFO()
     307                 : 
     308                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0)
     309                 :         ZEND_ARG_INFO(0, args)
     310                 :         ZEND_ARG_INFO(0, array)
     311                 : ZEND_END_ARG_INFO()
     312                 : 
     313                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3)
     314                 :         ZEND_ARG_INFO(0, locale)
     315                 :         ZEND_ARG_INFO(0, date_type)
     316                 :         ZEND_ARG_INFO(0, time_type)
     317                 :         ZEND_ARG_INFO(0, timezone_str)
     318                 :         ZEND_ARG_INFO(0, calendar)
     319                 :         ZEND_ARG_INFO(0, pattern)
     320                 : ZEND_END_ARG_INFO()
     321                 : 
     322                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
     323                 :         ZEND_ARG_INFO(0, domain)
     324                 :         ZEND_ARG_INFO(0, option)
     325                 :         ZEND_ARG_INFO(0, status)
     326                 : ZEND_END_ARG_INFO()
     327                 : 
     328                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_utf8, 0, 0, 1)
     329                 :         ZEND_ARG_INFO(0, domain)
     330                 :         ZEND_ARG_INFO(0, option)
     331                 :         ZEND_ARG_INFO(0, status)
     332                 : ZEND_END_ARG_INFO()
     333                 : /* }}} */
     334                 : 
     335                 : /* {{{ intl_functions
     336                 :  *
     337                 :  * Every user visible function must have an entry in intl_functions[].
     338                 :  */
     339                 : zend_function_entry intl_functions[] = {
     340                 : 
     341                 :         /* collator functions */
     342                 :         PHP_FE( collator_create, collator_static_1_arg )
     343                 :         PHP_FE( collator_compare, collator_2_args )
     344                 :         PHP_FE( collator_get_attribute, collator_1_arg )
     345                 :         PHP_FE( collator_set_attribute, collator_2_args )
     346                 :         PHP_FE( collator_get_strength, collator_0_args )
     347                 :         PHP_FE( collator_set_strength, collator_1_arg )
     348                 :         PHP_FE( collator_sort, collator_sort_args )
     349                 :         PHP_FE( collator_sort_with_sort_keys, collator_sort_args )
     350                 :         PHP_FE( collator_asort, collator_sort_args )
     351                 :         PHP_FE( collator_get_locale, collator_1_arg )
     352                 :         PHP_FE( collator_get_error_code, collator_0_args )
     353                 :         PHP_FE( collator_get_error_message, collator_0_args )
     354                 :         PHP_FE( collator_get_sort_key, collator_2_args )
     355                 : 
     356                 :         /* formatter functions */
     357                 :         PHP_FE( numfmt_create, arginfo_numfmt_create )
     358                 :         PHP_FE( numfmt_format, arginfo_numfmt_format )
     359                 :         PHP_FE( numfmt_parse, numfmt_parse_arginfo )
     360                 :         PHP_FE( numfmt_format_currency, arginfo_numfmt_format_currency )
     361                 :         PHP_FE( numfmt_parse_currency, numfmt_parse_currency_arginfo )
     362                 :         PHP_FE( numfmt_set_attribute, arginfo_numfmt_set_attribute )
     363                 :         PHP_FE( numfmt_get_attribute, arginfo_numfmt_get_attribute )
     364                 :         PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_attribute )
     365                 :         PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_attribute )
     366                 :         PHP_FE( numfmt_set_symbol, arginfo_numfmt_set_symbol )
     367                 :         PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_attribute )
     368                 :         PHP_FE( numfmt_set_pattern, arginfo_numfmt_set_pattern )
     369                 :         PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_error_code )
     370                 :         PHP_FE( numfmt_get_locale, arginfo_numfmt_get_locale )
     371                 :         PHP_FE( numfmt_get_error_code, arginfo_numfmt_get_error_code )
     372                 :         PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_code )
     373                 : 
     374                 :         /* normalizer functions */
     375                 :         PHP_FE( normalizer_normalize, normalizer_args )
     376                 :         PHP_FE( normalizer_is_normalized, normalizer_args )
     377                 : 
     378                 :         /* Locale functions */
     379                 :         PHP_NAMED_FE( locale_get_default, zif_locale_get_default, locale_0_args )
     380                 :         PHP_NAMED_FE( locale_set_default, zif_locale_set_default, locale_1_arg )
     381                 :         PHP_FE( locale_get_primary_language, locale_1_arg )
     382                 :         PHP_FE( locale_get_script, locale_1_arg )
     383                 :         PHP_FE( locale_get_region, locale_1_arg )
     384                 :         PHP_FE( locale_get_keywords, locale_1_arg )
     385                 :         PHP_FE( locale_get_display_script, locale_2_args )
     386                 :         PHP_FE( locale_get_display_region, locale_2_args )
     387                 :         PHP_FE( locale_get_display_name, locale_2_args )
     388                 :         PHP_FE( locale_get_display_language, locale_2_args)
     389                 :         PHP_FE( locale_get_display_variant, locale_2_args )
     390                 :         PHP_FE( locale_compose, locale_1_arg )
     391                 :         PHP_FE( locale_parse, locale_1_arg )
     392                 :         PHP_FE( locale_get_all_variants, locale_1_arg )
     393                 :         PHP_FE( locale_filter_matches, locale_3_args )
     394                 :         PHP_FE( locale_canonicalize, locale_1_arg )
     395                 :         PHP_FE( locale_lookup, locale_4_args )
     396                 :         PHP_FE( locale_accept_from_http, locale_1_arg )
     397                 : 
     398                 :         /* MessageFormatter functions */
     399                 :         PHP_FE( msgfmt_create, arginfo_msgfmt_create )
     400                 :         PHP_FE( msgfmt_format, arginfo_msgfmt_format )
     401                 :         PHP_FE( msgfmt_format_message, arginfo_msgfmt_format_message )
     402                 :         PHP_FE( msgfmt_parse, arginfo_msgfmt_parse )
     403                 :         PHP_FE( msgfmt_parse_message, arginfo_numfmt_parse_message )
     404                 :         PHP_FE( msgfmt_set_pattern, arginfo_msgfmt_set_pattern )
     405                 :         PHP_FE( msgfmt_get_pattern, arginfo_msgfmt_get_locale )
     406                 :         PHP_FE( msgfmt_get_locale, arginfo_msgfmt_get_locale )
     407                 :         PHP_FE( msgfmt_get_error_code, arginfo_msgfmt_get_error_code )
     408                 :         PHP_FE( msgfmt_get_error_message, arginfo_msgfmt_get_error_message )
     409                 : 
     410                 :         /* IntlDateFormatter functions */
     411                 :         PHP_FE( datefmt_create, arginfo_datefmt_create )
     412                 :         PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale )
     413                 :         PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale )
     414                 :         PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale )
     415                 :         PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar )
     416                 :         PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale )
     417                 :         PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale )
     418                 :         PHP_FE( datefmt_set_timezone_id, arginfo_msgfmt_get_locale )
     419                 :         PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale )
     420                 :         PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern )
     421                 :         PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale )
     422                 :         PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale )
     423                 :         PHP_FE( datefmt_format, arginfo_datefmt_format )
     424                 :         PHP_FE( datefmt_parse, datefmt_parse_args )
     425                 :     PHP_FE( datefmt_localtime , datefmt_parse_args )
     426                 :         PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code )
     427                 :         PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
     428                 : 
     429                 :         /* grapheme functions */
     430                 :         PHP_FE( grapheme_strlen, grapheme_1_arg )
     431                 :         PHP_FE( grapheme_strpos, grapheme_search_args )
     432                 :         PHP_FE( grapheme_stripos, grapheme_search_args )
     433                 :         PHP_FE( grapheme_strrpos, grapheme_search_args )
     434                 :         PHP_FE( grapheme_strripos, grapheme_search_args )
     435                 :         PHP_FE( grapheme_substr, grapheme_substr_args )
     436                 :         PHP_FE( grapheme_strstr, grapheme_strstr_args )
     437                 :         PHP_FE( grapheme_stristr, grapheme_strstr_args )
     438                 :         PHP_FE( grapheme_extract, grapheme_extract_args )
     439                 : 
     440                 :         /* IDN functions */
     441                 :         PHP_FE(idn_to_ascii, arginfo_idn_to_ascii)
     442                 :         PHP_FE(idn_to_utf8, arginfo_idn_to_ascii)
     443                 : 
     444                 :         /* common functions */
     445                 :         PHP_FE( intl_get_error_code, intl_0_args )
     446                 :         PHP_FE( intl_get_error_message, intl_0_args )
     447                 :         PHP_FE( intl_is_failure, intl_1_arg )
     448                 :         PHP_FE( intl_error_name, intl_1_arg )
     449                 : 
     450                 :         { NULL, NULL, NULL }
     451                 : };
     452                 : /* }}} */
     453                 : 
     454                 : 
     455                 : /* {{{ INI Settings */
     456                 : PHP_INI_BEGIN()
     457                 :     STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
     458                 :     STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
     459                 : 
     460                 : PHP_INI_END()
     461                 : /* }}} */
     462                 : 
     463                 : 
     464                 : static PHP_GINIT_FUNCTION(intl);
     465                 : 
     466                 : /* {{{ intl_module_entry */
     467                 : zend_module_entry intl_module_entry = {
     468                 : #if ZEND_MODULE_API_NO >= 20010901
     469                 :         STANDARD_MODULE_HEADER,
     470                 : #endif
     471                 :         "intl",
     472                 :         intl_functions,
     473                 :         PHP_MINIT( intl ),
     474                 :         PHP_MSHUTDOWN( intl ),
     475                 :         PHP_RINIT( intl ),
     476                 :         PHP_RSHUTDOWN( intl ),
     477                 :         PHP_MINFO( intl ),
     478                 :         INTL_MODULE_VERSION,
     479                 :         PHP_MODULE_GLOBALS(intl),   /* globals descriptor */
     480                 :         PHP_GINIT(intl),            /* globals ctor */
     481                 :         NULL,                       /* globals dtor */
     482                 :         NULL,                       /* post deactivate */
     483                 :         STANDARD_MODULE_PROPERTIES_EX
     484                 : };
     485                 : /* }}} */
     486                 : 
     487                 : #ifdef COMPILE_DL_INTL
     488                 : ZEND_GET_MODULE( intl )
     489                 : #endif
     490                 : 
     491                 : /* {{{ intl_init_globals */
     492                 : static PHP_GINIT_FUNCTION(intl)
     493           17633 : {
     494           17633 :         memset( intl_globals, 0, sizeof(zend_intl_globals) );
     495           17633 : }
     496                 : /* }}} */
     497                 : 
     498                 : /* {{{ PHP_MINIT_FUNCTION
     499                 :  */
     500                 : PHP_MINIT_FUNCTION( intl )
     501           17633 : {
     502                 :         /* For the default locale php.ini setting */
     503           17633 :         REGISTER_INI_ENTRIES();
     504                 : 
     505           17633 :         REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_CS);
     506                 : 
     507                 :         /* Register 'Collator' PHP class */
     508           17633 :         collator_register_Collator_class( TSRMLS_C );
     509                 : 
     510                 :         /* Expose Collator constants to PHP scripts */
     511           17633 :         collator_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     512                 : 
     513                 :         /* Register 'NumberFormatter' PHP class */
     514           17633 :         formatter_register_class( TSRMLS_C );
     515                 : 
     516                 :         /* Expose NumberFormatter constants to PHP scripts */
     517           17633 :         formatter_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     518                 : 
     519                 :         /* Register 'Normalizer' PHP class */
     520           17633 :         normalizer_register_Normalizer_class( TSRMLS_C );
     521                 : 
     522                 :         /* Expose Normalizer constants to PHP scripts */
     523           17633 :         normalizer_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     524                 :         
     525                 :         /* Register 'Locale' PHP class */
     526           17633 :         locale_register_Locale_class( TSRMLS_C );
     527                 : 
     528                 :         /* Expose Locale constants to PHP scripts */
     529           17633 :         locale_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     530                 : 
     531           17633 :         msgformat_register_class(TSRMLS_C);
     532                 : 
     533           17633 :         grapheme_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     534                 : 
     535                 :         /* Register 'DateFormat' PHP class */
     536           17633 :         dateformat_register_IntlDateFormatter_class( TSRMLS_C );
     537                 : 
     538                 :         /* Expose DateFormat constants to PHP scripts */
     539           17633 :         dateformat_register_constants( INIT_FUNC_ARGS_PASSTHRU );
     540                 : 
     541                 :         /* Expose ICU error codes to PHP scripts. */
     542           17633 :         intl_expose_icu_error_codes( INIT_FUNC_ARGS_PASSTHRU );
     543                 : 
     544                 :         /* Expose IDN constants to PHP scripts. */
     545           17633 :         idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
     546                 : 
     547                 :         /* Global error handling. */
     548           17633 :         intl_error_init( NULL TSRMLS_CC );
     549                 : 
     550                 :         /* Set the default_locale value */
     551           17633 :         if( INTL_G(default_locale) == NULL ) {
     552           17631 :                 INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
     553                 :         }
     554                 : 
     555           17633 :         return SUCCESS;
     556                 : }
     557                 : /* }}} */
     558                 : 
     559                 : /* {{{ PHP_MSHUTDOWN_FUNCTION
     560                 :  */
     561                 : PHP_MSHUTDOWN_FUNCTION( intl )
     562           17665 : {
     563                 :     /* For the default locale php.ini setting */
     564           17665 :     UNREGISTER_INI_ENTRIES();
     565                 : 
     566           17665 :     return SUCCESS;
     567                 : }
     568                 : /* }}} */
     569                 : 
     570                 : /* {{{ PHP_RINIT_FUNCTION
     571                 :  */
     572                 : PHP_RINIT_FUNCTION( intl )
     573           17619 : {
     574                 :         /* Set the default_locale value */
     575           17619 :     if( INTL_G(default_locale) == NULL ) {
     576               0 :         INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
     577                 :     }
     578           17619 :         return SUCCESS;
     579                 : }
     580                 : /* }}} */
     581                 : 
     582                 : /* {{{ PHP_RSHUTDOWN_FUNCTION
     583                 :  */
     584                 : PHP_RSHUTDOWN_FUNCTION( intl )
     585           17651 : {
     586           17651 :         if(INTL_G(current_collator)) {
     587               0 :                 INTL_G(current_collator) = NULL;
     588                 :         }
     589           17651 :         if (INTL_G(grapheme_iterator)) {
     590               1 :                 grapheme_close_global_iterator( TSRMLS_C );
     591               1 :                 INTL_G(grapheme_iterator) = NULL;
     592                 :         }
     593                 : 
     594           17651 :         intl_error_reset( NULL TSRMLS_CC);
     595           17651 :         return SUCCESS;
     596                 : }
     597                 : /* }}} */
     598                 : 
     599                 : /* {{{ PHP_MINFO_FUNCTION
     600                 :  */
     601                 : PHP_MINFO_FUNCTION( intl )
     602              42 : {
     603              42 :         php_info_print_table_start();
     604              42 :         php_info_print_table_header( 2, "Internationalization support", "enabled" );
     605              42 :         php_info_print_table_row( 2, "version", INTL_MODULE_VERSION );
     606              42 :         php_info_print_table_row( 2, "ICU version", U_ICU_VERSION );
     607              42 :         php_info_print_table_end();
     608                 : 
     609                 :     /* For the default locale php.ini setting */
     610              42 :     DISPLAY_INI_ENTRIES() ;
     611              42 : }
     612                 : /* }}} */
     613                 : 
     614                 : /*
     615                 :  * Local variables:
     616                 :  * tab-width: 4
     617                 :  * c-basic-offset: 4
     618                 :  * End:
     619                 :  * vim600: noet sw=4 ts=4 fdm=marker
     620                 :  * vim<600: noet sw=4 ts=4
     621                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:01 +0000 (3 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.