diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-04-23 15:31:48 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-04-23 15:31:48 +0000 |
commit | 0ccab2bc1ed9d8d9446194047fec5d4b241a67bf (patch) | |
tree | a15b688925b1f25ba7b2b38fdcf4449ac03e4d7f /Porting | |
parent | 7cd34c574e0ec69b213965d5f60d415cf5b25f64 (diff) | |
download | perl-0ccab2bc1ed9d8d9446194047fec5d4b241a67bf.tar.gz |
Switch to hex format for integer constants in regcharclass.h
(Yves Orton). Also, avoid trailing spaces.
p4raw-id: //depot/perl@31037
Diffstat (limited to 'Porting')
-rw-r--r-- | Porting/regcharclass.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Porting/regcharclass.pl b/Porting/regcharclass.pl index 21372dad11..c895440585 100644 --- a/Porting/regcharclass.pl +++ b/Porting/regcharclass.pl @@ -5,6 +5,8 @@ use Text::Wrap qw(wrap); use Encode; use Data::Dumper; +our $hex_fmt="0x%02X"; + # Author: Yves Orton (demerphq) 2007. =pod @@ -222,9 +224,9 @@ sub _cond { # map the ranges into conditions @r= map { # singleton - $_->[0] == $_->[1] ? "$alu==$_->[0]" : + $_->[0] == $_->[1] ? sprintf("$alu == $hex_fmt",$_->[0]) : # range - "($_->[0]<=$alu && $alu<=$_->[1])" + sprintf("($hex_fmt <= $alu && $alu <= $hex_fmt)",@$_) } @r; # return the joined results. return '( ' . join( " || ", @r ) . ' )'; @@ -242,8 +244,8 @@ sub combine { my $alu=shift; local $_ = shift; my $txt= $_->[0] == $_->[1] - ? "$alu==$_->[0]" - : "($_->[0]<=$alu && $alu<=$_->[1])"; + ? sprintf("$alu == $hex_fmt",$_->[0]) + : sprintf("($hex_fmt <= $alu && $alu <= $hex_fmt)",@$_); return $txt unless @_; return "( $txt || ( $alu > $_->[1] && \n".combine($alu,@_)." ) )"; } @@ -362,7 +364,9 @@ sub _optree_to_ternary { sub _macro($) { my $str= shift; my @lines= split /[^\S\n]*\n/, $str; - return join( "\\\n", map { sprintf "%-76s", $_ } @lines ) . "\n\n"; + my $macro = join( "\\\n", map { sprintf "%-76s", $_ } @lines ); + $macro =~ s/ *$//; + return $macro . "\n\n"; } # default type extensions. 'uln' dont have one because normally |