cvs: php4 / configure.in /ext/standard basic_functions.c html.c php_string.h string.c
| From: | Wez Furlong | Date: | Wed, 04 Jul 2001 10:10:31 +0000 |
| Subject: | cvs: php4 / configure.in /ext/standard basic_functions.c html.c php_string.h string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6072@lists.php.net to get a copy of this message | ||
wez Wed Jul 4 06:10:31 2001 EDT
Modified files:
/php4 configure.in
/php4/ext/standard basic_functions.c html.c php_string.h string.c
Log:
(PHP nl_langinfo) Added function when provided by OS
(PHP htmlentities, htmlspecialchars) Uses nl_langinfo to determine charset
@- Added nl_langinfo() (when OS provides it) that returns locale
information. (Wez Furlong)
# There are a lot of constants used by nl_langinfo; should we do something
# along the lines of what we do for syslog?
Index: php4/configure.in diff -u php4/configure.in:1.257 php4/configure.in:1.258 --- php4/configure.in:1.257 Tue Jun 26 10:36:45 2001 +++ php4/configure.in Wed Jul 4 06:10:29 2001 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.257 2001/06/26 14:36:45 sniper Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.258 2001/07/04 10:10:29 wez Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -290,6 +290,7 @@ fcntl.h \ grp.h \ ieeefp.h \ +langinfo.h \ limits.h \ locale.h \ netinet/in.h \ @@ -388,6 +389,7 @@ memmove \ mkstemp \ mmap \ +nl_langinfo \ putenv \ random \ rand_r \ Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.354 php4/ext/standard/basic_functions.c:1.355 --- php4/ext/standard/basic_functions.c:1.354 Mon Jul 2 07:11:58 2001 +++ php4/ext/standard/basic_functions.c Wed Jul 4 06:10:29 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.354 2001/07/02 11:11:58 derick Exp $ */ +/* $Id: basic_functions.c,v 1.355 2001/07/04 10:10:29 wez Exp $ */ #include "php.h" #include "php_main.h" @@ -193,6 +193,11 @@ PHP_FE(implode, NULL) PHP_FE(setlocale, NULL) PHP_FE(localeconv, NULL) +#if HAVE_NL_LANGINFO + PHP_FE(nl_langinfo, NULL) +#else + PHP_FALIAS(nl_langinfo, warn_not_available, NULL) +#endif PHP_FE(soundex, NULL) PHP_FE(levenshtein, NULL) PHP_FE(chr, NULL) @@ -759,7 +764,9 @@ #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MINIT(localeconv)(INIT_FUNC_ARGS_PASSTHRU); #endif - +#if defined(HAVE_NL_LANGINFO) + PHP_MINIT(nl_langinfo)(INIT_FUNC_ARGS_PASSTHRU); +#endif #if HAVE_CRYPT PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU); #endif Index: php4/ext/standard/html.c diff -u php4/ext/standard/html.c:1.29 php4/ext/standard/html.c:1.30 --- php4/ext/standard/html.c:1.29 Wed Jun 6 09:05:51 2001 +++ php4/ext/standard/html.c Wed Jul 4 06:10:29 2001 @@ -14,10 +14,11 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | | Jaakko Hyvätti <jaakko.hyvatti@iki.fi> | + | Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: html.c,v 1.29 2001/06/06 13:05:51 rasmus Exp $ */ +/* $Id: html.c,v 1.30 2001/07/04 10:10:29 wez Exp $ */ #include "php.h" #include "reg.h" @@ -26,6 +27,9 @@ #if HAVE_LOCALE_H #include <locale.h> #endif +#if HAVE_LANGINFO_H +#include <langinfo.h> +#endif /* This must be fixed to handle the input string according to LC_CTYPE. Defaults to ISO-8859-1 for now. */ @@ -218,41 +222,50 @@ enum entity_charset charset = cs_8859_1; int len; -#if HAVE_LOCALE_H + /* Guarantee default behaviour */ if (charset_hint == NULL) - { - /* try to figure out the charset from the locale */ - char * localename; - char * dot, * at; - - /* lang[_territory][.codeset][@modifier] */ - localename = setlocale(LC_CTYPE, NULL); - - dot = strchr(localename, '.'); - if (dot) { - dot++; - /* locale specifies a codeset */ - at = strchr(dot, '@'); - if (at) - len = at - dot; - else - len = strlen(dot); - charset_hint = dot; + return cs_8859_1; + + if (strlen(charset_hint) == 0) { + /* try to detect the charset for the locale */ +#if HAVE_NL_LANGINFO + charset_hint = nl_langinfo(CODESET); +#endif +#if HAVE_LOCALE_H + if (charset_hint == NULL) + { + /* try to figure out the charset from the locale */ + char * localename; + char * dot, * at; + + /* lang[_territory][.codeset][@modifier] */ + localename = setlocale(LC_CTYPE, NULL); + + dot = strchr(localename, '.'); + if (dot) { + dot++; + /* locale specifies a codeset */ + at = strchr(dot, '@'); + if (at) + len = at - dot; + else + len = strlen(dot); + charset_hint = dot; + } + else { + /* no explicit name; see if the name itself + * is the charset */ + charset_hint = localename; + len = strlen(charset_hint); + } } - else { - /* no explicit name; see if the name itself - * is the charset */ - charset_hint = localename; + else len = strlen(charset_hint); - } - } - else - len = strlen(charset_hint); #else - if (charset_hint) - len = strlen(charset_hint); + if (charset_hint) + len = strlen(charset_hint); #endif - + } if (charset_hint) { /* now walk the charset map and look for the codeset */ for (i = 0; charset_map[i].codeset; i++) { @@ -262,7 +275,6 @@ } } } - return charset; } /* }}} */ Index: php4/ext/standard/php_string.h diff -u php4/ext/standard/php_string.h:1.38 php4/ext/standard/php_string.h:1.39 --- php4/ext/standard/php_string.h:1.38 Fri Jun 22 20:51:03 2001 +++ php4/ext/standard/php_string.h Wed Jul 4 06:10:29 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.38 2001/06/23 00:51:03 hholzgra Exp $ */ +/* $Id: php_string.h,v 1.39 2001/07/04 10:10:29 wez Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -66,6 +66,7 @@ PHP_FUNCTION(nl2br); PHP_FUNCTION(setlocale); PHP_FUNCTION(localeconv); +PHP_FUNCTION(nl_langinfo); PHP_FUNCTION(stristr); PHP_FUNCTION(chunk_split); PHP_FUNCTION(parse_str); @@ -87,6 +88,9 @@ #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MINIT_FUNCTION(localeconv); PHP_MSHUTDOWN_FUNCTION(localeconv); +#endif +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo); #endif #define strnatcmp(a, b) \ Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.200 php4/ext/standard/string.c:1.201 --- php4/ext/standard/string.c:1.200 Fri Jun 22 20:51:03 2001 +++ php4/ext/standard/string.c Wed Jul 4 06:10:30 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.200 2001/06/23 00:51:03 hholzgra Exp $ */ +/* $Id: string.c,v 1.201 2001/07/04 10:10:30 wez Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -30,6 +30,9 @@ #ifdef HAVE_LOCALE_H # include <locale.h> #endif +#ifdef HAVE_LANGINFO_H +# include <langinfo.h> +#endif #include "scanf.h" #include "zend_API.h" #include "zend_execute.h" @@ -224,6 +227,122 @@ (*s2)->value.str.val + (*s2)->value.str.len)); } /* }}} */ + +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo) +{ +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_3); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_4); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_5); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_6); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_7); + REGISTER_NL_LANGINFO_CONSTANT(DAY_1); + REGISTER_NL_LANGINFO_CONSTANT(DAY_2); + REGISTER_NL_LANGINFO_CONSTANT(DAY_3); + REGISTER_NL_LANGINFO_CONSTANT(DAY_4); + REGISTER_NL_LANGINFO_CONSTANT(DAY_5); + REGISTER_NL_LANGINFO_CONSTANT(DAY_6); + REGISTER_NL_LANGINFO_CONSTANT(DAY_7); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_1); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_2); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_3); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_4); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_5); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_6); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_7); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_8); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_9); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_10); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_11); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_12); + REGISTER_NL_LANGINFO_CONSTANT(MON_1); + REGISTER_NL_LANGINFO_CONSTANT(MON_2); + REGISTER_NL_LANGINFO_CONSTANT(MON_3); + REGISTER_NL_LANGINFO_CONSTANT(MON_4); + REGISTER_NL_LANGINFO_CONSTANT(MON_5); + REGISTER_NL_LANGINFO_CONSTANT(MON_6); + REGISTER_NL_LANGINFO_CONSTANT(MON_7); + REGISTER_NL_LANGINFO_CONSTANT(MON_8); + REGISTER_NL_LANGINFO_CONSTANT(MON_9); + REGISTER_NL_LANGINFO_CONSTANT(MON_10); + REGISTER_NL_LANGINFO_CONSTANT(MON_11); + REGISTER_NL_LANGINFO_CONSTANT(MON_12); + REGISTER_NL_LANGINFO_CONSTANT(AM_STR); + REGISTER_NL_LANGINFO_CONSTANT(PM_STR); + REGISTER_NL_LANGINFO_CONSTANT(D_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(D_FMT); + REGISTER_NL_LANGINFO_CONSTANT(T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(T_FMT_AMPM); + REGISTER_NL_LANGINFO_CONSTANT(ERA); + REGISTER_NL_LANGINFO_CONSTANT(ERA_YEAR); + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ERA_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ALT_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(INT_CURR_SYMBOL); +#ifdef CURRENCY_SYMBOL + REGISTER_NL_LANGINFO_CONSTANT(CURRENCY_SYMBOL); +#endif +#ifdef CRNCYSTR + REGISTER_NL_LANGINFO_CONSTANT(CRNCYSTR); +#endif + REGISTER_NL_LANGINFO_CONSTANT(MON_DECIMAL_POINT); + REGISTER_NL_LANGINFO_CONSTANT(MON_THOUSANDS_SEP); + REGISTER_NL_LANGINFO_CONSTANT(MON_GROUPING); + REGISTER_NL_LANGINFO_CONSTANT(POSITIVE_SIGN); + REGISTER_NL_LANGINFO_CONSTANT(NEGATIVE_SIGN); + REGISTER_NL_LANGINFO_CONSTANT(INT_FRAC_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(FRAC_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(P_CS_PRECEDES); + REGISTER_NL_LANGINFO_CONSTANT(P_SEP_BY_SPACE); + REGISTER_NL_LANGINFO_CONSTANT(N_CS_PRECEDES); + REGISTER_NL_LANGINFO_CONSTANT(N_SEP_BY_SPACE); + REGISTER_NL_LANGINFO_CONSTANT(P_SIGN_POSN); + REGISTER_NL_LANGINFO_CONSTANT(N_SIGN_POSN); +#ifdef DECIMAL_POINT + REGISTER_NL_LANGINFO_CONSTANT(DECIMAL_POINT); +#endif +#ifdef RADIXCHAR + REGISTER_NL_LANGINFO_CONSTANT(RADIXCHAR); +#endif +#ifdef THOUSANDS_SEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSANDS_SEP); +#endif +#ifdef THOUSEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSEP); +#endif + REGISTER_NL_LANGINFO_CONSTANT(GROUPING); + REGISTER_NL_LANGINFO_CONSTANT(YESEXPR); + REGISTER_NL_LANGINFO_CONSTANT(NOEXPR); + REGISTER_NL_LANGINFO_CONSTANT(YESSTR); + REGISTER_NL_LANGINFO_CONSTANT(NOSTR); +#ifdef CODESET + REGISTER_NL_LANGINFO_CONSTANT(CODESET); +#endif +#undef REGISTER_NL_LANGINFO_CONSTANT + return SUCCESS; +} +PHP_FUNCTION(nl_langinfo) +{ + zval ** item; + char * value; + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long_ex(item); + value = nl_langinfo(Z_LVAL_PP(item)); + if (value == NULL) { + RETURN_FALSE; + } + else { + RETURN_STRING(value, 1); + } +} +#endif #ifdef HAVE_STRCOLL /* {{{ proto int strcoll(string str1, string str2)
Index: php4/configure.in diff -u php4/configure.in:1.257 php4/configure.in:1.258 --- php4/configure.in:1.257 Tue Jun 26 10:36:45 2001 +++ php4/configure.in Wed Jul 4 06:10:29 2001 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.257 2001/06/26 14:36:45 sniper Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.258 2001/07/04 10:10:29 wez Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -290,6 +290,7 @@ fcntl.h \ grp.h \ ieeefp.h \ +langinfo.h \ limits.h \ locale.h \ netinet/in.h \ @@ -388,6 +389,7 @@ memmove \ mkstemp \ mmap \ +nl_langinfo \ putenv \ random \ rand_r \ Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.354 php4/ext/standard/basic_functions.c:1.355 --- php4/ext/standard/basic_functions.c:1.354 Mon Jul 2 07:11:58 2001 +++ php4/ext/standard/basic_functions.c Wed Jul 4 06:10:29 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.354 2001/07/02 11:11:58 derick Exp $ */ +/* $Id: basic_functions.c,v 1.355 2001/07/04 10:10:29 wez Exp $ */ #include "php.h" #include "php_main.h" @@ -193,6 +193,11 @@ PHP_FE(implode, NULL) PHP_FE(setlocale, NULL) PHP_FE(localeconv, NULL) +#if HAVE_NL_LANGINFO + PHP_FE(nl_langinfo, NULL) +#else + PHP_FALIAS(nl_langinfo, warn_not_available, NULL) +#endif PHP_FE(soundex, NULL) PHP_FE(levenshtein, NULL) PHP_FE(chr, NULL) @@ -759,7 +764,9 @@ #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MINIT(localeconv)(INIT_FUNC_ARGS_PASSTHRU); #endif - +#if defined(HAVE_NL_LANGINFO) + PHP_MINIT(nl_langinfo)(INIT_FUNC_ARGS_PASSTHRU); +#endif #if HAVE_CRYPT PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU); #endif Index: php4/ext/standard/html.c diff -u php4/ext/standard/html.c:1.29 php4/ext/standard/html.c:1.30 --- php4/ext/standard/html.c:1.29 Wed Jun 6 09:05:51 2001 +++ php4/ext/standard/html.c Wed Jul 4 06:10:29 2001 @@ -14,10 +14,11 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | | Jaakko Hyvätti <jaakko.hyvatti@iki.fi> | + | Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: html.c,v 1.29 2001/06/06 13:05:51 rasmus Exp $ */ +/* $Id: html.c,v 1.30 2001/07/04 10:10:29 wez Exp $ */ #include "php.h" #include "reg.h" @@ -26,6 +27,9 @@ #if HAVE_LOCALE_H #include <locale.h> #endif +#if HAVE_LANGINFO_H +#include <langinfo.h> +#endif /* This must be fixed to handle the input string according to LC_CTYPE. Defaults to ISO-8859-1 for now. */ @@ -218,41 +222,50 @@ enum entity_charset charset = cs_8859_1; int len; -#if HAVE_LOCALE_H + /* Guarantee default behaviour */ if (charset_hint == NULL) - { - /* try to figure out the charset from the locale */ - char * localename; - char * dot, * at; - - /* lang[_territory][.codeset][@modifier] */ - localename = setlocale(LC_CTYPE, NULL); - - dot = strchr(localename, '.'); - if (dot) { - dot++; - /* locale specifies a codeset */ - at = strchr(dot, '@'); - if (at) - len = at - dot; - else - len = strlen(dot); - charset_hint = dot; + return cs_8859_1; + + if (strlen(charset_hint) == 0) { + /* try to detect the charset for the locale */ +#if HAVE_NL_LANGINFO + charset_hint = nl_langinfo(CODESET); +#endif +#if HAVE_LOCALE_H + if (charset_hint == NULL) + { + /* try to figure out the charset from the locale */ + char * localename; + char * dot, * at; + + /* lang[_territory][.codeset][@modifier] */ + localename = setlocale(LC_CTYPE, NULL); + + dot = strchr(localename, '.'); + if (dot) { + dot++; + /* locale specifies a codeset */ + at = strchr(dot, '@'); + if (at) + len = at - dot; + else + len = strlen(dot); + charset_hint = dot; + } + else { + /* no explicit name; see if the name itself + * is the charset */ + charset_hint = localename; + len = strlen(charset_hint); + } } - else { - /* no explicit name; see if the name itself - * is the charset */ - charset_hint = localename; + else len = strlen(charset_hint); - } - } - else - len = strlen(charset_hint); #else - if (charset_hint) - len = strlen(charset_hint); + if (charset_hint) + len = strlen(charset_hint); #endif - + } if (charset_hint) { /* now walk the charset map and look for the codeset */ for (i = 0; charset_map[i].codeset; i++) { @@ -262,7 +275,6 @@ } } } - return charset; } /* }}} */ Index: php4/ext/standard/php_string.h diff -u php4/ext/standard/php_string.h:1.38 php4/ext/standard/php_string.h:1.39 --- php4/ext/standard/php_string.h:1.38 Fri Jun 22 20:51:03 2001 +++ php4/ext/standard/php_string.h Wed Jul 4 06:10:29 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.38 2001/06/23 00:51:03 hholzgra Exp $ */ +/* $Id: php_string.h,v 1.39 2001/07/04 10:10:29 wez Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -66,6 +66,7 @@ PHP_FUNCTION(nl2br); PHP_FUNCTION(setlocale); PHP_FUNCTION(localeconv); +PHP_FUNCTION(nl_langinfo); PHP_FUNCTION(stristr); PHP_FUNCTION(chunk_split); PHP_FUNCTION(parse_str); @@ -87,6 +88,9 @@ #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MINIT_FUNCTION(localeconv); PHP_MSHUTDOWN_FUNCTION(localeconv); +#endif +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo); #endif #define strnatcmp(a, b) \ Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.200 php4/ext/standard/string.c:1.201 --- php4/ext/standard/string.c:1.200 Fri Jun 22 20:51:03 2001 +++ php4/ext/standard/string.c Wed Jul 4 06:10:30 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.200 2001/06/23 00:51:03 hholzgra Exp $ */ +/* $Id: string.c,v 1.201 2001/07/04 10:10:30 wez Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -30,6 +30,9 @@ #ifdef HAVE_LOCALE_H # include <locale.h> #endif +#ifdef HAVE_LANGINFO_H +# include <langinfo.h> +#endif #include "scanf.h" #include "zend_API.h" #include "zend_execute.h" @@ -224,6 +227,122 @@ (*s2)->value.str.val + (*s2)->value.str.len)); } /* }}} */ + +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo) +{ +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_3); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_4); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_5); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_6); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_7); + REGISTER_NL_LANGINFO_CONSTANT(DAY_1); + REGISTER_NL_LANGINFO_CONSTANT(DAY_2); + REGISTER_NL_LANGINFO_CONSTANT(DAY_3); + REGISTER_NL_LANGINFO_CONSTANT(DAY_4); + REGISTER_NL_LANGINFO_CONSTANT(DAY_5); + REGISTER_NL_LANGINFO_CONSTANT(DAY_6); + REGISTER_NL_LANGINFO_CONSTANT(DAY_7); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_1); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_2); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_3); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_4); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_5); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_6); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_7); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_8); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_9); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_10); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_11); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_12); + REGISTER_NL_LANGINFO_CONSTANT(MON_1); + REGISTER_NL_LANGINFO_CONSTANT(MON_2); + REGISTER_NL_LANGINFO_CONSTANT(MON_3); + REGISTER_NL_LANGINFO_CONSTANT(MON_4); + REGISTER_NL_LANGINFO_CONSTANT(MON_5); + REGISTER_NL_LANGINFO_CONSTANT(MON_6); + REGISTER_NL_LANGINFO_CONSTANT(MON_7); + REGISTER_NL_LANGINFO_CONSTANT(MON_8); + REGISTER_NL_LANGINFO_CONSTANT(MON_9); + REGISTER_NL_LANGINFO_CONSTANT(MON_10); + REGISTER_NL_LANGINFO_CONSTANT(MON_11); + REGISTER_NL_LANGINFO_CONSTANT(MON_12); + REGISTER_NL_LANGINFO_CONSTANT(AM_STR); + REGISTER_NL_LANGINFO_CONSTANT(PM_STR); + REGISTER_NL_LANGINFO_CONSTANT(D_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(D_FMT); + REGISTER_NL_LANGINFO_CONSTANT(T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(T_FMT_AMPM); + REGISTER_NL_LANGINFO_CONSTANT(ERA); + REGISTER_NL_LANGINFO_CONSTANT(ERA_YEAR); + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ERA_T_FMT); + REGISTER_NL_LANGINFO_CONSTANT(ALT_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(INT_CURR_SYMBOL); +#ifdef CURRENCY_SYMBOL + REGISTER_NL_LANGINFO_CONSTANT(CURRENCY_SYMBOL); +#endif +#ifdef CRNCYSTR + REGISTER_NL_LANGINFO_CONSTANT(CRNCYSTR); +#endif + REGISTER_NL_LANGINFO_CONSTANT(MON_DECIMAL_POINT); + REGISTER_NL_LANGINFO_CONSTANT(MON_THOUSANDS_SEP); + REGISTER_NL_LANGINFO_CONSTANT(MON_GROUPING); + REGISTER_NL_LANGINFO_CONSTANT(POSITIVE_SIGN); + REGISTER_NL_LANGINFO_CONSTANT(NEGATIVE_SIGN); + REGISTER_NL_LANGINFO_CONSTANT(INT_FRAC_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(FRAC_DIGITS); + REGISTER_NL_LANGINFO_CONSTANT(P_CS_PRECEDES); + REGISTER_NL_LANGINFO_CONSTANT(P_SEP_BY_SPACE); + REGISTER_NL_LANGINFO_CONSTANT(N_CS_PRECEDES); + REGISTER_NL_LANGINFO_CONSTANT(N_SEP_BY_SPACE); + REGISTER_NL_LANGINFO_CONSTANT(P_SIGN_POSN); + REGISTER_NL_LANGINFO_CONSTANT(N_SIGN_POSN); +#ifdef DECIMAL_POINT + REGISTER_NL_LANGINFO_CONSTANT(DECIMAL_POINT); +#endif +#ifdef RADIXCHAR + REGISTER_NL_LANGINFO_CONSTANT(RADIXCHAR); +#endif +#ifdef THOUSANDS_SEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSANDS_SEP); +#endif +#ifdef THOUSEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSEP); +#endif + REGISTER_NL_LANGINFO_CONSTANT(GROUPING); + REGISTER_NL_LANGINFO_CONSTANT(YESEXPR); + REGISTER_NL_LANGINFO_CONSTANT(NOEXPR); + REGISTER_NL_LANGINFO_CONSTANT(YESSTR); + REGISTER_NL_LANGINFO_CONSTANT(NOSTR); +#ifdef CODESET + REGISTER_NL_LANGINFO_CONSTANT(CODESET); +#endif +#undef REGISTER_NL_LANGINFO_CONSTANT + return SUCCESS; +} +PHP_FUNCTION(nl_langinfo) +{ + zval ** item; + char * value; + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long_ex(item); + value = nl_langinfo(Z_LVAL_PP(item)); + if (value == NULL) { + RETURN_FALSE; + } + else { + RETURN_STRING(value, 1); + } +} +#endif #ifdef HAVE_STRCOLL /* {{{ proto int strcoll(string str1, string str2)