sniper Thu Mar 31 03:18:41 2005 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /Zend zend_config.w32.h zend_operators.c zend_operators.h /php-src/ext/standard array.c Log: MFH: Added SORT_LOCALE_STRING for array sorting http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.865&r2=1.1247.2.866&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.865 php-src/NEWS:1.1247.2.866 --- php-src/NEWS:1.1247.2.865 Wed Mar 30 09:18:36 2005 +++ php-src/NEWS Thu Mar 31 03:18:39 2005 @@ -1,5 +1,9 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 20??, Version 4.?.? +- Added the sorting flag SORT_LOCALE_STRING to the sort() functions which makes + them sort based on the current locale. (Derick) + 31 Mar 2005, Version 4.3.11 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony) - Added checks for negative values to gmp_sqrt(), gmp_powm(), gmp_sqrtrem() http://cvs.php.net/diff.php/Zend/zend_config.w32.h?r1=1.26.4.3&r2=1.26.4.4&ty=u Index: Zend/zend_config.w32.h diff -u Zend/zend_config.w32.h:1.26.4.3 Zend/zend_config.w32.h:1.26.4.4 --- Zend/zend_config.w32.h:1.26.4.3 Mon Mar 24 17:56:29 2003 +++ Zend/zend_config.w32.h Thu Mar 31 03:18:39 2005 @@ -45,6 +45,7 @@ #define HAVE_STDARG_H 1 #define HAVE_SNPRINTF 1 #define HAVE_VSNPRINTF 1 +#define HAVE_STRCOLL 1 #define snprintf _snprintf #define strcasecmp(s1, s2) stricmp(s1, s2) http://cvs.php.net/diff.php/Zend/zend_operators.c?r1=1.129.2.9&r2=1.129.2.10&ty=u Index: Zend/zend_operators.c diff -u Zend/zend_operators.c:1.129.2.9 Zend/zend_operators.c:1.129.2.10 --- Zend/zend_operators.c:1.129.2.9 Mon Nov 29 04:15:28 2004 +++ Zend/zend_operators.c Thu Mar 31 03:18:39 2005 @@ -1108,6 +1108,35 @@ return SUCCESS; } +#if HAVE_STRCOLL +ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +{ + zval op1_copy, op2_copy; + int use_copy1, use_copy2; + + zend_make_printable_zval(op1, &op1_copy, &use_copy1); + zend_make_printable_zval(op2, &op2_copy, &use_copy2); + + if (use_copy1) { + op1 = &op1_copy; + } + if (use_copy2) { + op2 = &op2_copy; + } + + result->value.lval = strcoll(op1->value.str.val, op2->value.str.val); + result->type = IS_LONG; + + if (use_copy1) { + zval_dtor(op1); + } + if (use_copy2) { + zval_dtor(op2); + } + return SUCCESS; +} +#endif + ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; http://cvs.php.net/diff.php/Zend/zend_operators.h?r1=1.55.2.6&r2=1.55.2.7&ty=u Index: Zend/zend_operators.h diff -u Zend/zend_operators.h:1.55.2.6 Zend/zend_operators.h:1.55.2.7 --- Zend/zend_operators.h:1.55.2.6 Tue Mar 15 10:49:29 2005 +++ Zend/zend_operators.h Thu Mar 31 03:18:40 2005 @@ -169,6 +169,9 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +#if HAVE_STRCOLL +ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +#endif ZEND_API void zend_str_tolower(char *str, unsigned int length); ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.42&r2=1.199.2.43&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.199.2.42 php-src/ext/standard/array.c:1.199.2.43 --- php-src/ext/standard/array.c:1.199.2.42 Thu Dec 23 11:40:03 2004 +++ php-src/ext/standard/array.c Thu Mar 31 03:18:40 2005 @@ -22,7 +22,7 @@ */ -/* $Id: array.c,v 1.199.2.42 2004/12/23 16:40:03 tony2001 Exp $ */ +/* $Id: array.c,v 1.199.2.43 2005/03/31 08:18:40 sniper Exp $ */ #include "php.h" #include "php_ini.h" @@ -66,6 +66,7 @@ #define SORT_REGULAR 0 #define SORT_NUMERIC 1 #define SORT_STRING 2 +#define SORT_LOCALE_STRING 5 #define SORT_DESC 3 #define SORT_ASC 4 @@ -103,6 +104,8 @@ REGISTER_LONG_CONSTANT("SORT_REGULAR", SORT_REGULAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SORT_NUMERIC", SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SORT_STRING", SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); @@ -132,6 +135,12 @@ ARRAYG(compare_func) = string_compare_function; break; +#if HAVE_STRCOLL + case SORT_LOCALE_STRING: + ARRAYG(compare_func) = string_locale_compare_function; + break; +#endif + case SORT_REGULAR: default: ARRAYG(compare_func) = compare_function;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php