CVS update: php31/ext/standard

From: Date: Thu, 20 Aug 1998 12:50:12 +0000
Subject: CVS update: php31/ext/standard
Groups: php.dev 
Request: Send a blank email to php-dev+get-349@lists.php.net to get a copy of this message
Date: Thursday August 20, 1998 @ 8:50 Author: rasmus Update of /repository/php31/ext/standard In directory asf:/export/home/rasmus/php31/ext/standard Modified Files: basic_functions.c basic_functions.h Log Message: Add ausort() function Index: php31/ext/standard/basic_functions.c diff -c php31/ext/standard/basic_functions.c:2.4 php31/ext/standard/basic_functions.c:2.5 *** php31/ext/standard/basic_functions.c:2.4 Fri Aug 14 01:09:59 1998 --- php31/ext/standard/basic_functions.c Thu Aug 20 08:50:12 1998 *************** *** 100,105 **** --- 100,106 ---- {"sort", php3_sort, first_arg_force_ref}, {"rsort", php3_rsort, first_arg_force_ref}, {"usort", php3_user_sort, first_arg_force_ref}, + {"uasort", php3_auser_sort, first_arg_force_ref}, {"array_walk", php3_array_walk, first_arg_force_ref}, {"sizeof", php3_count, first_arg_allow_ref}, {"count", php3_count, first_arg_allow_ref}, *************** *** 770,775 **** --- 771,801 ---- user_compare_func_name = old_compare_func; return; } + user_compare_func_name = old_compare_func; + RETURN_TRUE; + } + + void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS) + { + pval *array; + pval *old_compare_func; + TLS_VARS; + + old_compare_func = user_compare_func_name; + if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) { + user_compare_func_name = old_compare_func; + WRONG_PARAM_COUNT; + } + if (!(array->type & IS_HASH)) { + php3_error(E_WARNING, "Wrong datatype in uasort() call"); + user_compare_func_name = old_compare_func; + return; + } + convert_to_string(user_compare_func_name); + if (_php3_hash_sort(array->value.ht, array_user_compare, 0) == FAILURE) { + user_compare_func_name = old_compare_func; + return; + } user_compare_func_name = old_compare_func; RETURN_TRUE; } Index: php31/ext/standard/basic_functions.h diff -c php31/ext/standard/basic_functions.h:2.1 php31/ext/standard/basic_functions.h:2.2 *** php31/ext/standard/basic_functions.h:2.1 Fri Aug 14 01:09:59 1998 --- php31/ext/standard/basic_functions.h Thu Aug 20 08:50:12 1998 *************** *** 29,35 **** */ ! /* $Id: basic_functions.h,v 2.1 1998/08/14 05:09:59 shane Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H --- 29,35 ---- */ ! /* $Id: basic_functions.h,v 2.2 1998/08/20 12:50:12 rasmus Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H *************** *** 49,54 **** --- 49,55 ---- extern void php3_asort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_arsort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS); extern void php3_sort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_rsort(INTERNAL_FUNCTION_PARAMETERS); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#349) next »