CVS update: php3/functions

From: Date: Sun, 03 Jan 1999 17:32:03 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-3209@lists.php.net to get a copy of this message
Date: Sunday January 3, 1999 @ 12:32 Author: rasmus Update of /repository/php3/functions In directory asf:/home/rasmus/php3/functions Modified Files: basic_functions.c Log Message: Add prototypes Index: php3/functions/basic_functions.c diff -c php3/functions/basic_functions.c:1.245 php3/functions/basic_functions.c:1.246 *** php3/functions/basic_functions.c:1.245 Fri Jan 1 12:59:07 1999 --- php3/functions/basic_functions.c Sun Jan 3 12:32:01 1999 *************** *** 28,34 **** +----------------------------------------------------------------------+ */ ! /* $Id: basic_functions.c,v 1.245 1999/01/01 17:59:07 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 28,34 ---- +----------------------------------------------------------------------+ */ ! /* $Id: basic_functions.c,v 1.246 1999/01/03 17:32:01 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 388,394 **** /******************** * System Functions * ********************/ ! void php3_getenv(INTERNAL_FUNCTION_PARAMETERS) { #if FHTTPD --- 388,395 ---- /******************** * System Functions * ********************/ ! /* {{{ proto string getenv(string varname) ! Get the value of an environment variable */ void php3_getenv(INTERNAL_FUNCTION_PARAMETERS) { #if FHTTPD *************** *** 439,446 **** } RETURN_FALSE; } ! #if HAVE_PUTENV void php3_putenv(INTERNAL_FUNCTION_PARAMETERS) { --- 440,449 ---- } RETURN_FALSE; } ! /* }}} */ + /* {{{ proto void putenv(string setting) + Set the value of an environment variable */ #if HAVE_PUTENV void php3_putenv(INTERNAL_FUNCTION_PARAMETERS) { *************** *** 488,495 **** } } #endif ! void php3_error_reporting(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; --- 491,500 ---- } } #endif ! /* }}} */ + /* {{{ proto int error_reporting([int level]) + Set/get the current error reporting level */ void php3_error_reporting(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; *************** *** 514,520 **** --- 519,528 ---- RETVAL_LONG(old_error_reporting); } + /* }}} */ + /* {{{ proto int short_tags(int state) + Turn the short tags option on or off - returns previous state */ void php3_toggle_short_open_tag(INTERNAL_FUNCTION_PARAMETERS) { pval *value; int ret; *************** *** 529,539 **** php3_ini.short_open_tag = value->value.lval; RETURN_LONG(ret); } /******************* * Basic Functions * *******************/ ! void int_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num, *arg_base; --- 537,549 ---- php3_ini.short_open_tag = value->value.lval; RETURN_LONG(ret); } + /* }}} */ /******************* * Basic Functions * *******************/ ! /* {{{ proto int intval(mixed var [, int base]) ! Get the integer value of a variable using the optional base for the conversion */ void int_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num, *arg_base; *************** *** 560,567 **** convert_to_long_base(num, base); *return_value = *num; } ! void double_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num; --- 570,579 ---- convert_to_long_base(num, base); *return_value = *num; } ! /* }}} */ + /* {{{ proto double doubleval(mixed var) + Get the double-precision value of a variable */ void double_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num; *************** *** 572,579 **** convert_to_double(num); *return_value = *num; } ! void string_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num; --- 584,593 ---- convert_to_double(num); *return_value = *num; } + /* }}} */ ! /* {{{ proto string strval(mixed var) ! Get the string value of a variable */ void string_value(INTERNAL_FUNCTION_PARAMETERS) { pval *num; *************** *** 585,590 **** --- 599,605 ---- *return_value = *num; pval_copy_constructor(return_value); } + /* }}} */ static int array_key_compare(const void *a, const void *b) { *************** *** 609,616 **** return r; } } - void php3_key_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; --- 624,632 ---- return r; } } + /* {{{ proto int ksort(array array_arg) + Sort an array by key */ void php3_key_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 632,643 **** } RETURN_TRUE; } - /* the current implementation of count() is a definite example of what * user functions should NOT look like. It's a hack, until we get * unset() to work right in 3.1 */ void php3_count(INTERNAL_FUNCTION_PARAMETERS) { pval *array; --- 648,661 ---- } RETURN_TRUE; } + /* }}} */ /* the current implementation of count() is a definite example of what * user functions should NOT look like. It's a hack, until we get * unset() to work right in 3.1 */ + /* {{{ proto int count(mixed var) + Count the number of elements in a variable (usually an array) */ void php3_count(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 667,673 **** RETURN_LONG(num_elements); } ! /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. --- 685,691 ---- RETURN_LONG(num_elements); } ! /* }}} */ /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. *************** *** 725,730 **** --- 743,750 ---- return array_data_compare(a,b)*-1; } + /* {{{ proto void asort(array array_arg) + Sort an array and maintain index association */ void php3_asort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 746,752 **** --- 766,775 ---- } RETURN_TRUE; } + /* }}} */ + /* {{{ proto void arsort(array array_arg) + Sort an array in reverse order and maintain index association */ void php3_arsort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 768,774 **** --- 791,800 ---- } RETURN_TRUE; } + /* }}} */ + /* {{{ proto void sort(array array_arg) + Sort an array */ void php3_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 790,796 **** --- 816,826 ---- } RETURN_TRUE; } + /* }}} */ + + /* {{{ proto void rsort(array array_arg) + Sort an array in reverse order */ void php3_rsort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 812,817 **** --- 842,848 ---- } RETURN_TRUE; } + /* }}} */ static int array_user_compare(const void *a, const void *b) *************** *** 834,841 **** return 0; } } - void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; --- 865,873 ---- return 0; } } + /* {{{ proto void usort(array array_arg, string cmp_function) + Sort an array by values using a user-defined comparison function */ void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 860,866 **** --- 892,902 ---- user_compare_func_name = old_compare_func; RETURN_TRUE; } + /* }}} */ + + /* {{{ proto void uasort(array array_arg, string cmp_function) + Sort an array with a user-defined comparison function and maintain index association */ void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 885,892 **** user_compare_func_name = old_compare_func; RETURN_TRUE; } - static int array_user_key_compare(const void *a, const void *b) { Bucket *f; --- 921,928 ---- user_compare_func_name = old_compare_func; RETURN_TRUE; } + /* }}} */ static int array_user_key_compare(const void *a, const void *b) { Bucket *f; *************** *** 931,938 **** return 0; } } - void php3_user_key_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; --- 967,975 ---- return 0; } } + /* {{{ proto void uksort(array array_arg, string cmp_function) + Sort an array by keys using a user-defined comparison function */ void php3_user_key_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 957,964 **** user_compare_func_name = old_compare_func; RETURN_TRUE; } ! void array_end(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; --- 994,1003 ---- user_compare_func_name = old_compare_func; RETURN_TRUE; } + /* }}} */ ! /* {{{ proto mixed end(array array_arg) ! Advances array argument's internal pointer to the last element and return it */ void array_end(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; *************** *** 987,994 **** *return_value = *entry; pval_copy_constructor(return_value); } ! void array_prev(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; --- 1026,1035 ---- *return_value = *entry; pval_copy_constructor(return_value); } ! /* }}} */ + /* {{{ proto mixed prev(array array_arg) + Move array argument's internal pointer to the previous element and return it */ void array_prev(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; *************** *** 1010,1016 **** --- 1051,1060 ---- *return_value = *entry; pval_copy_constructor(return_value); } + /* }}} */ + /* {{{ proto mixed next(array array_arg) + Move array argument's internal pointer to the next element and return it */ void array_next(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; *************** *** 1032,1038 **** --- 1076,1085 ---- *return_value = *entry; pval_copy_constructor(return_value); } + /* }}} */ + /* {{{ proto array each(array array_arg) + Return next key/value pair from an array */ void array_each(INTERNAL_FUNCTION_PARAMETERS) { pval *array,*entry,real_entry; *************** *** 1075,1081 **** _php3_hash_pointer_update(return_value->value.ht, "key", sizeof("key"), (void *) inserted_pointer); _php3_hash_move_forward(array->value.ht); } ! void array_reset(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; --- 1122,1131 ---- _php3_hash_pointer_update(return_value->value.ht, "key", sizeof("key"), (void *) inserted_pointer); _php3_hash_move_forward(array->value.ht); } ! /* }}} */ ! ! /* {{{ proto mixed reset(array array_arg) ! Set array argument's internal pointer to the first element and return it */ void array_reset(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; *************** *** 1102,1108 **** --- 1152,1161 ---- *return_value = *entry; pval_copy_constructor(return_value); } + /* }}} */ + /* proto mixed current(array array_arg) + Return the element currently pointed to by the internal array pointer */ void array_current(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *entry; *************** *** 1120,1127 **** *return_value = *entry; pval_copy_constructor(return_value); } ! void array_current_key(INTERNAL_FUNCTION_PARAMETERS) { pval *array; --- 1173,1182 ---- *return_value = *entry; pval_copy_constructor(return_value); } + /* }}} */ ! /* {{{ proto mixed key(array array_arg) ! Return the key of the element currently pointed to by the internal array pointer */ void array_current_key(INTERNAL_FUNCTION_PARAMETERS) { pval *array; *************** *** 1152,1158 **** --- 1207,1216 ---- return; } } + /* }}} */ + /* {{{ proto void flush(void) + Flush the output buffer */ #ifdef __cplusplus void php3_flush(HashTable *) #else *************** *** 1178,1185 **** GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid); #endif } ! void php3_sleep(INTERNAL_FUNCTION_PARAMETERS) { pval *num; --- 1236,1245 ---- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid); #endif } ! /* }}} */ + /* {{{ proto void sleep(int seconds) + Delay for a given number of seconds */ void php3_sleep(INTERNAL_FUNCTION_PARAMETERS) { pval *num; *************** *** 1190,1196 **** --- 1250,1259 ---- convert_to_long(num); sleep(num->value.lval); } + /* }}} */ + /* {{{ proto void usleep(int micro_seconds) + Delay for a given number of micro seconds */ void php3_usleep(INTERNAL_FUNCTION_PARAMETERS) { #if HAVE_USLEEP *************** *** 1203,1209 **** --- 1266,1275 ---- usleep(num->value.lval); #endif } + /* }}} */ + /* {{{ proto string gettype(mixed var) + Returns the type of the variable */ void php3_gettype(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; *************** *** 1238,1245 **** RETVAL_STRING("unknown type",1); } } ! void php3_settype(INTERNAL_FUNCTION_PARAMETERS) { pval *var, *type; --- 1304,1313 ---- RETVAL_STRING("unknown type",1); } } ! /* }}} */ + /* {{{ proto int settype(string var, string type) + Set the type of the variable */ void php3_settype(INTERNAL_FUNCTION_PARAMETERS) { pval *var, *type; *************** *** 1269,1276 **** } RETVAL_TRUE; } ! void php3_min(INTERNAL_FUNCTION_PARAMETERS) { int argc=ARG_COUNT(ht); --- 1337,1346 ---- } RETVAL_TRUE; } + /* }}} */ ! /* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, ...]]) ! Return the lowest value in an array or a series of arguments */ void php3_min(INTERNAL_FUNCTION_PARAMETERS) { int argc=ARG_COUNT(ht); *************** *** 1303,1310 **** } } } ! void php3_max(INTERNAL_FUNCTION_PARAMETERS) { int argc=ARG_COUNT(ht); --- 1373,1382 ---- } } } ! /* }}} */ + /* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, ...]]) + Return the highest value in an array or a series of arguments */ void php3_max(INTERNAL_FUNCTION_PARAMETERS) { int argc=ARG_COUNT(ht); *************** *** 1337,1342 **** --- 1409,1415 ---- } } } + /* }}} */ static pval *php3_array_walk_func_name; *************** *** 1351,1356 **** --- 1424,1431 ---- return 0; } + /* {{{ proto int array_walk(array array_arg, string function) + Apply the given function on every element of the argument array */ void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *old_walk_func_name; TLS_VARS; *************** *** 1370,1375 **** --- 1445,1451 ---- php3_array_walk_func_name = old_walk_func_name; RETURN_TRUE; } + /* }}} */ #if 0 void php3_max(INTERNAL_FUNCTION_PARAMETERS) *************** *** 1440,1453 **** } #endif void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS) { TLS_VARS; RETURN_STRING(_php3_get_current_user(),1); } ! void php3_get_cfg_var(INTERNAL_FUNCTION_PARAMETERS) { pval *varname; --- 1516,1533 ---- } #endif + /* {{{ proto string get_current_user(void) + Get the name of the owner of the current PHP script */ void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS) { TLS_VARS; RETURN_STRING(_php3_get_current_user(),1); } + /* }}} */ ! /* {{{ proto string get_cfg_var(string option_name) ! Get the value of a PHP configuration option */ void php3_get_cfg_var(INTERNAL_FUNCTION_PARAMETERS) { pval *varname; *************** *** 1464,1470 **** --- 1544,1553 ---- } RETURN_STRING(value,1); } + /* }}} */ + /* proto int set_magic_quotes_runtime(int new_setting) + Set the current active configuration setting of magic_quotes_runtime and return previous */ void php3_set_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS) { pval *new_setting; *************** *** 1477,1492 **** php3_ini.magic_quotes_runtime=new_setting->value.lval; RETURN_TRUE; } ! void php3_get_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS) { RETURN_LONG(php3_ini.magic_quotes_runtime); } void php3_get_magic_quotes_gpc(INTERNAL_FUNCTION_PARAMETERS) { RETURN_LONG(php3_ini.magic_quotes_gpc); } void php3_is_type(INTERNAL_FUNCTION_PARAMETERS,int type) { --- 1560,1582 ---- php3_ini.magic_quotes_runtime=new_setting->value.lval; RETURN_TRUE; } ! /* }}} */ ! ! /* proto int get_magic_quotes_runtime(void) ! Get the current active configuration setting of magic_quotes_runtime */ void php3_get_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS) { RETURN_LONG(php3_ini.magic_quotes_runtime); } + /* }}} */ + /* {{{ proto int get_magic_quotes_gpc(void) + Get the current active configuration setting of magic_quotes_gpc */ void php3_get_magic_quotes_gpc(INTERNAL_FUNCTION_PARAMETERS) { RETURN_LONG(php3_ini.magic_quotes_gpc); } + /* }}} */ void php3_is_type(INTERNAL_FUNCTION_PARAMETERS,int type) { *************** *** 1501,1515 **** RETURN_FALSE; } } - void php3_is_long(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); } void php3_is_double(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE); } void php3_is_string(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING); } void php3_is_array(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY); } ! void php3_is_object(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT); } void php3_leak(INTERNAL_FUNCTION_PARAMETERS) { int leakbytes=3; --- 1591,1624 ---- RETURN_FALSE; } } + /* {{{ proto int is_long(mixed var) + Returns true if variable is a long (integer) */ void php3_is_long(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); } + /* }}} */ + + /* {{{ proto int is_double(mixed var) + Returns true if variable is a double */ void php3_is_double(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE); } + /* }}} */ + + /* {{{ proto int is_string(mixed var) + Returns true if variable is a string */ void php3_is_string(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING); } + /* }}} */ + + /* {{{ proto int is_array(mixed var) + Returns true if variable is an array */ void php3_is_array(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY); } ! /* }}} */ + /* {{{ proto int is_object(mixed var) + Returns true if variable is an object */ + void php3_is_object(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT); } + /* }}} */ + /* {{{ proto void leak(int bytes) + Leak memory - only useful for debugging internal PHP memory manager issues */ void php3_leak(INTERNAL_FUNCTION_PARAMETERS) { int leakbytes=3; *************** *** 1524,1529 **** --- 1633,1639 ---- emalloc(leakbytes); } + /* }}} */ /* 1st arg = error message *************** *** 1537,1543 **** 2 = send via tcp/ip to 3rd parameter (name or ip:port) 3 = save to file in 3rd parameter */ ! void php3_error_log(INTERNAL_FUNCTION_PARAMETERS) { pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL; --- 1647,1654 ---- 2 = send via tcp/ip to 3rd parameter (name or ip:port) 3 = save to file in 3rd parameter */ ! /* {{{ proto int error_log(string message, int message_type [, string destination] [, string extra_headers]) ! Send an error message somewhere */ void php3_error_log(INTERNAL_FUNCTION_PARAMETERS) { pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL; *************** *** 1601,1606 **** --- 1712,1718 ---- RETURN_TRUE; } + /* }}} */ PHPAPI int _php3_error_log(int opt_err,char *message,char *opt,char *headers){ FILE *logfile; *************** *** 1644,1651 **** } return SUCCESS; } - void php3_call_user_func(INTERNAL_FUNCTION_PARAMETERS) { pval **params; --- 1756,1764 ---- } return SUCCESS; } + /* {{{ proto mixed call_user_func(???) + ??? */ void php3_call_user_func(INTERNAL_FUNCTION_PARAMETERS) { pval **params; *************** *** 1669,1676 **** } efree(params); } ! void php3_call_user_method(INTERNAL_FUNCTION_PARAMETERS) { pval **params; --- 1782,1791 ---- } efree(params); } + /* }}} */ ! /* {{{ proto mixed call_user_method(???) ! ??? */ void php3_call_user_method(INTERNAL_FUNCTION_PARAMETERS) { pval **params; *************** *** 1699,1705 **** } efree(params); } ! void user_shutdown_function_dtor(pval *user_shutdown_function_name) { --- 1814,1820 ---- } efree(params); } ! /* }}} */ void user_shutdown_function_dtor(pval *user_shutdown_function_name) { -- 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 (#3209) next »