CVS update: php3/functions

From: Date: Tue, 25 Aug 1998 12:26:53 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-564@lists.php.net to get a copy of this message
Date: Tuesday August 25, 1998 @ 8:26 Author: ssb Update of /repository/php3/functions In directory asf:/tmp/cvs-serv15332 Modified Files: basic_functions.c basic_functions.h math.c phpmath.h Log Message: new functions: deg2rad(), rad2deg() new constant: M_PI Index: php3/functions/basic_functions.c diff -c php3/functions/basic_functions.c:1.211 php3/functions/basic_functions.c:1.212 *** php3/functions/basic_functions.c:1.211 Sun Aug 23 10:20:02 1998 --- php3/functions/basic_functions.c Tue Aug 25 08:26:52 1998 *************** *** 233,238 **** --- 233,240 ---- {"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}, *************** *** 269,275 **** {"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) --- 271,277 ---- {"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) *************** *** 277,283 **** }; 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 --- 279,292 ---- }; 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 *************** *** 305,310 **** --- 314,327 ---- 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: php3/functions/basic_functions.h diff -c php3/functions/basic_functions.h:1.29 php3/functions/basic_functions.h:1.30 *** php3/functions/basic_functions.h:1.29 Tue Aug 18 17:08:58 1998 --- php3/functions/basic_functions.h Tue Aug 25 08:26:53 1998 *************** *** 29,35 **** */ ! /* $Id: basic_functions.h,v 1.29 1998/08/18 21:08:58 rasmus Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H --- 29,35 ---- */ ! /* $Id: basic_functions.h,v 1.30 1998/08/25 12:26:53 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: php3/functions/math.c diff -c php3/functions/math.c:1.36 php3/functions/math.c:1.37 *** php3/functions/math.c:1.36 Tue Jul 28 18:00:16 1998 --- php3/functions/math.c Tue Aug 25 08:26:53 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: php3/functions/phpmath.h diff -c php3/functions/phpmath.h:1.11 php3/functions/phpmath.h:1.12 *** php3/functions/phpmath.h:1.11 Wed Apr 29 09:24:25 1998 --- php3/functions/phpmath.h Tue Aug 25 08:26:53 1998 *************** *** 29,35 **** */ ! /* $Id: phpmath.h,v 1.11 1998/04/29 13:24:25 ssb Exp $ */ #ifndef _PHPMATH_H #define _PHPMATH_H --- 29,35 ---- */ ! /* $Id: phpmath.h,v 1.12 1998/08/25 12:26:53 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 (#564) next »