Re: [PATCH] number_format enhancements

From: Date: Mon, 24 Jul 2006 04:30:28 +0000
Subject: Re: [PATCH] number_format enhancements
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-24917@lists.php.net to get a copy of this message
Matt W wrote:
Hi,
Give some basic userland examples about what you propose to change, please ... (I guess these are a part of the .phpt)
In the .phpt file, it is userland code where you can see examples of how the changes work. :-) Sure, but I was meaning , in so far you extend the functionality of number_format , then you will need to extend the doc.
Some draft of this doc extension would be usefull , even in this test phase and especially for "userland" people.
I'm on Windows, so I don't know how you apply the .diff to your source download -- shouldn't diff work somehow? :-/ Well, I uploaded the full math.c file for 5.2 and 6 if you want to grab that to replace yours (ext/standard/math.c) and experiment with the changes. http://realplain.com/php/math.c-number_format_enhancements.tar.gz (5.2/6.0 directories with the file.) I applied the patch http://realplain.com/php/number_format_enhancements_5_2.diff to the snap:
[php5.2-200607222030]$ patch -p3 -b -i /home/bertrand/A/mattW/number_format/5.2/number_format_enhancements_5_2.diff No problem , I could check I get the right ext/standard/math.c by diffing whith the math.c you published in this tar.gz. $ diff ext/standard/math.c ~/A/mattW/number_format/5.2/ 981c981
<       int is_negative=0, trim_dec=0;
---
      int is_negative = 0, trim_dec = 0;
so just a litle cleaning difference.
As a note , the patch also corrected ext/standard/basic_functions.c (seperator ==> separator) which I guess is needed too :) make clean , configure , make Then , using your original .phpt : $ export TEST_PHP_EXECUTABLE=/home/bertrand/php/php5.2-200607222030/sapi/cli/php $ sapi/cli/php run-tests.php ~/A/mattW/number_format.phpt =====================================================================
CWD         : /home/bertrand/php/php5.2-200607222030
PHP         : /home/bertrand/php/php5.2-200607222030/sapi/cli/php
PHP_SAPI    : cli
PHP_VERSION : 5.2.0-dev ZEND_VERSION: 2.2.0
PHP_OS      : Linux - Linux ancilla.toggg.net 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686
INI actual : /usr/local/lib/php.ini More .INIs : Extra dirs : ===================================================================== Running selected tests. PASS number_format() function [/home/bertrand/A/mattW/number_format.phpt] Nice ! Just not sure if the .phpt wouldn't need some more cases ("classical" ones).
Glad you like the idea. :-) I just hope functionality like this can be added -- using my patch or not, or slightly different semantics... All I want is a no extra 0's option and not be forced to include 2 unnecessary decimal-related parameters to "get to" thousands separator when I don't want any decimals! ;-D Actually , I was talking about the way you *propose* things , not about the things themselves.
Errmmm.... not sure I'm not boring the list with such "userland" blabla, I just hope it can serve some of my "ignorant" colleagues. Cheers -- toggg

« previous php.internals (#24917) next »