elixer          Tue Jan 16 17:10:51 2001 EDT

  Modified files:              
    /php4/ext/standard  basic_functions.c php_string.h string.c 
  Log:
  Added string comparison function strcoll().  It uses the current locale to
  do the comparisons.
  @- Added localeconv() and strcoll() functions for localization. (Sean)
  
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.297 
php4/ext/standard/basic_functions.c:1.298
--- php4/ext/standard/basic_functions.c:1.297   Sun Jan 14 08:36:30 2001
+++ php4/ext/standard/basic_functions.c Tue Jan 16 17:10:50 2001
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.297 2001/01/14 16:36:30 elixer Exp $ */
+/* $Id: basic_functions.c,v 1.298 2001/01/17 01:10:50 elixer Exp $ */
 
 #include "php.h"
 #include "php_main.h"
@@ -162,6 +162,11 @@
        PHP_FE(strstr,                                                                 
 NULL)
        PHP_FE(stristr,                                                                
 NULL)
        PHP_FE(strrchr,                                                                
 NULL)
+#ifdef HAVE_STRCOLL
+       PHP_FE(strcoll,                                                                
+ NULL)
+#else
+       PHP_FALIAS(strcoll, warn_not_available,                 NULL)
+#endif
        PHP_FE(substr,                                                                 
 NULL)
        PHP_FE(substr_replace,                                                  NULL)
        PHP_FE(quotemeta,                                                              
 NULL)
Index: php4/ext/standard/php_string.h
diff -u php4/ext/standard/php_string.h:1.33 php4/ext/standard/php_string.h:1.34
--- php4/ext/standard/php_string.h:1.33 Mon Jan 15 02:48:48 2001
+++ php4/ext/standard/php_string.h      Tue Jan 16 17:10:50 2001
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_string.h,v 1.33 2001/01/15 10:48:48 zeev Exp $ */
+/* $Id: php_string.h,v 1.34 2001/01/17 01:10:50 elixer Exp $ */
 
 /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
 
@@ -79,9 +79,12 @@
 PHP_FUNCTION(substr_count);
 PHP_FUNCTION(str_pad);
 PHP_FUNCTION(sscanf);
+#ifdef HAVE_STRCOLL
+PHP_FUNCTION(strcoll);
+#endif
 
 
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#ifdef ZTS
 PHP_MINIT_FUNCTION(localeconv);
 PHP_MSHUTDOWN_FUNCTION(localeconv);
 #endif
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.183 php4/ext/standard/string.c:1.184
--- php4/ext/standard/string.c:1.183    Sun Jan 14 08:36:30 2001
+++ php4/ext/standard/string.c  Tue Jan 16 17:10:50 2001
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.183 2001/01/14 16:36:30 elixer Exp $ */
+/* $Id: string.c,v 1.184 2001/01/17 01:10:50 elixer Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -209,6 +209,24 @@
                                                        (*s2)->value.str.val + 
(*s2)->value.str.len));
 }
 /* }}} */
+
+#ifdef HAVE_STRCOLL
+/* {{{ proto int strcoll(string str1, string str2)
+   Compare two strings using the current locale */
+PHP_FUNCTION(strcoll)
+{
+       zval **s1, **s2;
+
+       if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(s1);
+       convert_to_string_ex(s2);
+
+       RETURN_LONG(strcoll((const char *)(*s1)->value.str.val, (const char 
+*)(*s2)->value.str.val));
+}
+#endif
 
 PHPAPI void php_trim(zval *str, zval * return_value, int mode)
 /* mode 1 : trim left



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to