CVS update: php31/ext/standard

From: Date: Tue, 25 Aug 1998 12:26:55 +0000
Subject: CVS update: php31/ext/standard
Groups: php.dev 
Request: Send a blank email to php-dev+get-565@lists.php.net to get a copy of this message
Date: Tuesday August 25, 1998 @ 8:26 Author: ssb Update of /repository/php31/ext/standard In directory asf:/tmp/cvs-serv15323 Modified Files: basic_functions.c basic_functions.h math.c phpmath.h Log Message: new functions: deg2rad(), rad2deg() new constant: M_PI Index: php31/ext/standard/basic_functions.c diff -c php31/ext/standard/basic_functions.c:2.7 php31/ext/standard/basic_functions.c:2.8 *** php31/ext/standard/basic_functions.c:2.7 Fri Aug 21 15:17:36 1998 --- php31/ext/standard/basic_functions.c Tue Aug 25 08:26:54 1998 *************** *** 226,231 **** --- 226,233 ---- {"log", php3_log, NULL}, {"log10", php3_log10, NULL}, {"sqrt", php3_sqrt, NULL}, + {"deg2rad", php3_deg2rad, NULL}, + {"rad2deg", php3_rad2deg, NULL}, {"bindec", php3_bindec, NULL}, {"hexdec", php3_hexdec, NULL}, {"octdec", php3_octdec, NULL}, *************** *** 261,268 **** {"leak", php3_leak, NULL}, {"error_log", php3_error_log, NULL}, ! {"call_user_func", php3_call_user_func, NULL}, ! {"call_user_method", php3_call_user_method, NULL}, PHP3_FE(register_shutdown_function, NULL) PHP3_FE(memory_status, NULL) --- 263,270 ---- {"leak", php3_leak, NULL}, {"error_log", php3_error_log, NULL}, ! {"call_user_func", php3_call_user_func, NULL}, ! {"call_user_method", php3_call_user_method, NULL}, PHP3_FE(register_shutdown_function, NULL) PHP3_FE(memory_status, NULL) *************** *** 271,277 **** }; php3_module_entry basic_functions_module = { ! "Basic Functions", basic_functions, NULL, NULL, php3_rinit_basic, php3_rshutdown_basic, NULL, STANDARD_MODULE_PROPERTIES }; #if HAVE_PUTENV --- 273,286 ---- }; php3_module_entry basic_functions_module = { ! "Basic Functions", /* extension name */ ! basic_functions, /* function list */ ! php3_minit_basic, /* process startup */ ! NULL, /* process shutdown */ ! php3_rinit_basic, /* request startup */ ! php3_rshutdown_basic, /* request shutdown */ ! NULL, /* extension info */ ! STANDARD_MODULE_PROPERTIES }; #if HAVE_PUTENV *************** *** 299,304 **** --- 308,321 ---- efree(pe->key); } #endif + + int php3_minit_basic(INIT_FUNC_ARGS) + { + TLS_VARS; + + REGISTER_DOUBLE_CONSTANT("M_PI", M_PI, CONST_CS | CONST_PERSISTENT); + return SUCCESS; + } int php3_rinit_basic(INIT_FUNC_ARGS) { Index: php31/ext/standard/basic_functions.h diff -c php31/ext/standard/basic_functions.h:2.3 php31/ext/standard/basic_functions.h:2.4 *** php31/ext/standard/basic_functions.h:2.3 Thu Aug 20 20:15:27 1998 --- php31/ext/standard/basic_functions.h Tue Aug 25 08:26:54 1998 *************** *** 29,35 **** */ ! /* $Id: basic_functions.h,v 2.3 1998/08/21 00:15:27 zeev Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H --- 29,35 ---- */ ! /* $Id: basic_functions.h,v 2.4 1998/08/25 12:26:54 ssb Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H *************** *** 37,42 **** --- 37,43 ---- extern php3_module_entry basic_functions_module; #define basic_functions_module_ptr &basic_functions_module + extern int php3_minit_basic(INIT_FUNC_ARGS); extern int php3_rinit_basic(INIT_FUNC_ARGS); extern int php3_rshutdown_basic(void); extern void int_value(INTERNAL_FUNCTION_PARAMETERS); Index: php31/ext/standard/math.c diff -c php31/ext/standard/math.c:2.1 php31/ext/standard/math.c:2.2 *** php31/ext/standard/math.c:2.1 Fri Aug 14 13:29:59 1998 --- php31/ext/standard/math.c Tue Aug 25 08:26:54 1998 *************** *** 284,289 **** --- 284,315 ---- } + void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS) + { + pval *deg; + TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &deg) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_double(deg); + RETVAL_DOUBLE((deg->value.dval / 180.0) * M_PI); + } + + + void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS) + { + pval *rad; + TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &rad) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_double(rad); + RETVAL_DOUBLE((rad->value.dval / M_PI) * 180); + } + + /* * Convert a string representation of a base(2-36) number to a long. */ Index: php31/ext/standard/phpmath.h diff -c php31/ext/standard/phpmath.h:2.0 php31/ext/standard/phpmath.h:2.1 *** php31/ext/standard/phpmath.h:2.0 Fri Jul 3 09:14:35 1998 --- php31/ext/standard/phpmath.h Tue Aug 25 08:26:55 1998 *************** *** 29,35 **** */ ! /* $Id: phpmath.h,v 2.0 1998/07/03 13:14:35 rasmus Exp $ */ #ifndef _PHPMATH_H #define _PHPMATH_H --- 29,35 ---- */ ! /* $Id: phpmath.h,v 2.1 1998/08/25 12:26:55 ssb Exp $ */ #ifndef _PHPMATH_H #define _PHPMATH_H *************** *** 59,63 **** --- 59,65 ---- extern void php3_hexdec(INTERNAL_FUNCTION_PARAMETERS); extern void php3_octdec(INTERNAL_FUNCTION_PARAMETERS); extern void php3_number_format(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS); #endif /* _PHPMATH_H */ -- 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 (#565) next »