cvs: php4 /ext/standard basic_functions.c config.m4 php_string.h string.c

From: Date: Fri, 02 Aug 2002 10:08:54 +0000
Subject: cvs: php4 /ext/standard basic_functions.c config.m4 php_string.h string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13090@lists.php.net to get a copy of this message
hholzgra Fri Aug 2 06:08:54 2002 EDT Modified files: /php4/ext/standard basic_functions.c config.m4 php_string.h string.c Log: added money_format() function this is similar to C-libs strfmon(), using the same format string semantics but a different function prototype, so i decided to give it a more speaking name similar to number_format() Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.488 php4/ext/standard/basic_functions.c:1.489 --- php4/ext/standard/basic_functions.c:1.488 Sun Jul 28 15:18:08 2002 +++ php4/ext/standard/basic_functions.c Fri Aug 2 06:08:53 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.488 2002/07/28 19:18:08 sesser Exp $ */ +/* $Id: basic_functions.c,v 1.489 2002/08/02 10:08:53 hholzgra Exp $ */ #include "php.h" #include "php_streams.h" @@ -319,6 +319,10 @@ #ifdef HAVE_STRCOLL PHP_FE(strcoll, NULL) +#endif + +#ifdef HAVE_STRFMON + PHP_FE(money_format, NULL) #endif PHP_FE(substr, NULL) Index: php4/ext/standard/config.m4 diff -u php4/ext/standard/config.m4:1.38 php4/ext/standard/config.m4:1.39 --- php4/ext/standard/config.m4:1.38 Sun Jul 28 15:18:08 2002 +++ php4/ext/standard/config.m4 Fri Aug 2 06:08:53 2002 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.38 2002/07/28 19:18:08 sesser Exp $ -*- sh -*- +dnl $Id: config.m4,v 1.39 2002/08/02 10:08:53 hholzgra Exp $ -*- sh -*- divert(3)dnl @@ -226,6 +226,8 @@ ]) AC_CHECK_FUNCS(fnmatch glob) + +AC_CHECK_FUNCS(strfmon) if test "$PHP_SAPI" = "cgi"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) Index: php4/ext/standard/php_string.h diff -u php4/ext/standard/php_string.h:1.58 php4/ext/standard/php_string.h:1.59 --- php4/ext/standard/php_string.h:1.58 Sat Jul 13 00:13:43 2002 +++ php4/ext/standard/php_string.h Fri Aug 2 06:08:53 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.58 2002/07/13 04:13:43 sniper Exp $ */ +/* $Id: php_string.h,v 1.59 2002/08/02 10:08:53 hholzgra Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -85,7 +85,9 @@ #ifdef HAVE_STRCOLL PHP_FUNCTION(strcoll); #endif - +#if HAVE_STRFMON +PHP_FUNCTION(money_format); +#endif #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MINIT_FUNCTION(localeconv); Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.279 php4/ext/standard/string.c:1.280 --- php4/ext/standard/string.c:1.279 Fri Aug 2 02:53:48 2002 +++ php4/ext/standard/string.c Fri Aug 2 06:08:53 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.279 2002/08/02 06:53:48 hirokawa Exp $ */ +/* $Id: string.c,v 1.280 2002/08/02 10:08:53 hholzgra Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -3903,6 +3903,28 @@ } /* }}} */ + +#if HAVE_STRFMON +/* {{{ proto string money_format(string format , float value) + Convert monetary value(s) to string */ + +PHP_FUNCTION(money_format) { + int format_len, str_len = 1024; + char *format, *str = emalloc(str_len); + double value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", + &format, &format_len, &value) == FAILURE) { + return; + } + + str_len = strfmon(str, str_len, format, value); + + RETURN_STRINGL(erealloc(str, strlen), str_len, 0); +} + +/* }}} */ +#endif /* * Local variables:

« previous php.cvs (#13090) next »