From: <pra...@us...> - 2007-11-16 23:55:07
|
Revision: 1262 http://oorexx.svn.sourceforge.net/oorexx/?rev=1262&view=rev Author: pragmatic_lee Date: 2007-11-16 15:55:07 -0800 (Fri, 16 Nov 2007) Log Message: ----------- Changed the way numeric digits is set Modified Paths: -------------- incubator/decimalFormat/decimalFormat.cls Modified: incubator/decimalFormat/decimalFormat.cls =================================================================== --- incubator/decimalFormat/decimalFormat.cls 2007-11-16 22:40:47 UTC (rev 1261) +++ incubator/decimalFormat/decimalFormat.cls 2007-11-16 23:55:07 UTC (rev 1262) @@ -503,9 +503,21 @@ -- do the actual formatting of the input number ::method format expose pPrefix pPattern pSuffix nPrefix nPattern nSuffix zero_prefix zPattern zero_suffix input have_zMask decimalSeparator groupingSeparator +-- an arbitrary value for now use strict arg input --- an arbitrary value for now - numeric digits 30 + +-- set numeric digits to the length of input + the number of zeros in the decimal part of the patterns + adder = 0 + parse var pPattern .'.'dec_p + ph0 = dec_p~countStr('0') + if ph0 > adder then + adder = ph0 + parse var nPattern .'.'dec_p + ph0 = dec_p~countStr('0') + if ph0 > adder then + adder = ph0 + numeric digits input~length + adder + if \input~datatype('n') then raise syntax 93.904 array(1,arg(1)) @@ -553,7 +565,19 @@ ::method format2 expose output input output zPattern have_zMask groupingSize use strict arg mask2use - numeric digits 30 + +-- set numeric digits to the length of input + the number of zeros in the decimal part of the patterns + adder = 0 + parse var pPattern .'.'dec_p + ph0 = dec_p~countStr('0') + if ph0 > adder then + adder = ph0 + parse var nPattern .'.'dec_p + ph0 = dec_p~countStr('0') + if ph0 > adder then + adder = ph0 + numeric digits input~length + adder + parse var mask2use m_part1'.'m_part2 -- format input based on the length of the decimal portion of the mask if m_part2 \== '' then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pra...@us...> - 2007-11-18 18:59:25
|
Revision: 1269 http://oorexx.svn.sourceforge.net/oorexx/?rev=1269&view=rev Author: pragmatic_lee Date: 2007-11-18 10:59:29 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Move check for decimalSeparator/groupingSeparator to just before they are applied. Ascertain that a comma does not follow a decimal in mask portion of patterns Modified Paths: -------------- incubator/decimalFormat/decimalFormat.cls Modified: incubator/decimalFormat/decimalFormat.cls =================================================================== --- incubator/decimalFormat/decimalFormat.cls 2007-11-18 12:33:05 UTC (rev 1268) +++ incubator/decimalFormat/decimalFormat.cls 2007-11-18 18:59:29 UTC (rev 1269) @@ -64,6 +64,11 @@ zPattern + +Beta .3.1 11/18/07 + Move check for decimalSeparator/groupingSeparator to just before they are applied. + Ascertain that a comma does not follow a decimal in mask portion of patterns + */ -- get the grouping for the specified pattern @@ -234,8 +239,10 @@ use strict arg new_separator if new_separator~length <> 1 then raise syntax 93.900 array('Decimal Separator Must Have A Length of 1') +/* if new_separator = groupingSeparator then raise syntax 93.900 array('Decimal Separator Can Not Be The Same As The Grouping Separator') +*/ decimalSeparator = new_separator return 0 @@ -246,8 +253,10 @@ use strict arg new_separator if new_separator~length <> 1 then raise syntax 93.900 array('Grouping Separator Must Have A Length of 1') +/* if new_separator = decimalSeparator then raise syntax 93.900 array('Grouping Separator Can Not Be The Same As The Decimal Separator') +*/ groupingSeparator = new_separator return 0 @@ -434,6 +443,18 @@ raise syntax 93.900 array('The Mask Portion Of The Negative Pattern Can Not Contain Characters Other Than "#,0."') else raise syntax 93.900 array('The Mask Portion Of The Positive Pattern Can Not Contain Characters Other Than "#,0."') + +-- verify that there is no more than 1 decimal in the pattern mask + first_d = the_mask~pos('.') + if first_d > 0 then + next_c = the_mask~pos(',',first_d+1) + if next_c > 0 then + if np = 'N' then + raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Negative Pattern') + else + raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Positive Pattern') + + return 0 -- do the actual formatting of the input number @@ -491,6 +512,11 @@ end -- ELP Fix (possibly use a mutable buffer) + +-- ihere + if groupingSeparator = decimalSeparator then + raise syntax 93.900 array('Grouping & Decimal Separators Can Not Be The Same') + if groupingSeparator \= ',' then output = output~changeStr(',',.endOfLine) if decimalSeparator \= '.' then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pra...@us...> - 2007-11-18 19:16:26
|
Revision: 1270 http://oorexx.svn.sourceforge.net/oorexx/?rev=1270&view=rev Author: pragmatic_lee Date: 2007-11-18 11:16:30 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Check for comma after decimal had a problem - fixed Modified Paths: -------------- incubator/decimalFormat/decimalFormat.cls Modified: incubator/decimalFormat/decimalFormat.cls =================================================================== --- incubator/decimalFormat/decimalFormat.cls 2007-11-18 18:59:29 UTC (rev 1269) +++ incubator/decimalFormat/decimalFormat.cls 2007-11-18 19:16:30 UTC (rev 1270) @@ -269,6 +269,7 @@ ::attribute pattern set expose mask use strict arg mask +say 1 mask self~validateMask return 0 @@ -447,14 +448,15 @@ -- verify that there is no more than 1 decimal in the pattern mask first_d = the_mask~pos('.') if first_d > 0 then - next_c = the_mask~pos(',',first_d+1) - if next_c > 0 then - if np = 'N' then - raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Negative Pattern') - else - raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Positive Pattern') + do + next_c = the_mask~pos(',',first_d+1) + if next_c > 0 then + if np = 'N' then + raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Negative Pattern') + else + raise syntax 93.900 array('A Comma Can Not Follow A Decimal In The Mask Portion Of The Positive Pattern') + end - return 0 -- do the actual formatting of the input number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pra...@us...> - 2007-11-26 19:14:11
|
Revision: 1310 http://oorexx.svn.sourceforge.net/oorexx/?rev=1310&view=rev Author: pragmatic_lee Date: 2007-11-26 11:14:15 -0800 (Mon, 26 Nov 2007) Log Message: ----------- Cleaned up "expose" statements Modified Paths: -------------- incubator/decimalFormat/decimalFormat.cls Modified: incubator/decimalFormat/decimalFormat.cls =================================================================== --- incubator/decimalFormat/decimalFormat.cls 2007-11-26 17:39:28 UTC (rev 1309) +++ incubator/decimalFormat/decimalFormat.cls 2007-11-26 19:14:15 UTC (rev 1310) @@ -91,7 +91,7 @@ -- get/set positive grouping ::attribute pGrouping get ::attribute pGrouping set - expose pGrouping pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose pGrouping pMask use strict arg new_grouping if \new_grouping~datatype('O') then raise syntax 93.900 array('Positive Grouping Indicator Must Be A Logical Value') @@ -113,7 +113,7 @@ -- get/set negative grouping ::attribute nGrouping get ::attribute nGrouping set - expose nGrouping pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose nGrouping nMask use strict arg new_grouping if \new_grouping~datatype('O') then raise syntax 93.900 array('Negative Grouping Indicator Must Be A Logical Value') @@ -135,7 +135,7 @@ -- get/set postive prefix ::attribute pPrefix get ::attribute pPrefix set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose pPrefix use strict arg new_pattern pPrefix = new_pattern self~buildMask @@ -144,7 +144,7 @@ -- get/set positive pattern ::attribute pMask get ::attribute pMask set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose pMask use strict arg new_pattern pMask = new_pattern self~buildMask @@ -153,7 +153,7 @@ -- get/set positive suffix ::attribute pSuffix get ::attribute pSuffix set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose pSuffix use strict arg new_pattern pSuffix = new_pattern self~buildMask @@ -162,7 +162,7 @@ -- get/set negative prefix ::attribute nPrefix get ::attribute nPrefix set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose nPrefix use strict arg new_pattern nPrefix = new_pattern self~buildMask @@ -171,7 +171,7 @@ -- get/set negative pattern ::attribute nMask get ::attribute nMask set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose nMask use strict arg new_pattern nMask = new_pattern self~buildMask @@ -180,7 +180,7 @@ -- get/set negative suffix ::attribute nSuffix get ::attribute nSuffix set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose nSuffix use strict arg new_pattern nSuffix = new_pattern self~buildMask @@ -188,7 +188,7 @@ ::attribute zMask get ::attribute zMask set - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask have_zMask + expose zMask have_zMask use strict arg new_pattern zMask = new_pattern have_zMask = .true @@ -235,13 +235,12 @@ if new_separator~length <> 1 then raise syntax 93.900 array('Decimal Separator Must Have A Length of 1') decimalSeparator = new_separator - return 0 -- get/set groupingSeparator ::attribute groupingSeparator get ::attribute groupingSeparator set - expose groupingSeparator decimalSeparator + expose groupingSeparator use strict arg new_separator if new_separator~length <> 1 then raise syntax 93.900 array('Grouping Separator Must Have A Length of 1') @@ -470,7 +469,7 @@ -- do the actual formatting of the input number ::method format - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zero_prefix zMask zero_suffix input have_zMask decimalSeparator groupingSeparator + expose pPrefix pMask pSuffix nPrefix nMask nSuffix zMask zero_suffix input have_zMask decimalSeparator groupingSeparator use strict arg input -- set numeric digits to the length of input + the number of zeros in the decimal part of the patterns @@ -539,7 +538,7 @@ -- internal use only ::method format2 - expose output input output zMask have_zMask groupingSize + expose output input zMask have_zMask groupingSize use strict arg mask2use -- set numeric digits to the length of input + the number of zeros in the decimal part of the patterns @@ -658,7 +657,7 @@ return output ::method doZero - expose pPrefix pMask pSuffix nPrefix nMask nSuffix zero_prefix zMask zero_suffix input have_zMask decimalSeparator groupingSeparator + expose pPrefix pMask pSuffix parse var pMask pt1'.'pt2 p0 = pt1~countStr('0') p1 = pt2~countStr('0') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |