diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2013-10-19 12:20:28 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-10-19 12:20:28 -0700 |
commit | f9f8017ea1fab40bf0fcd3da63d3eae2f9b43a94 (patch) | |
tree | 79230d69c6d0a489abd9f8e6f9bdf610698eb194 | |
parent | 36ccfa5fb42bed46cee2fa11316d14ac77f90b01 (diff) | |
download | nasm-f9f8017ea1fab40bf0fcd3da63d3eae2f9b43a94.tar.gz |
macros.pl: Remove superfluous whitespace
Squeeze multiple whitespace characters together, since they have no
semantic function.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rwxr-xr-x | macros.pl | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -52,8 +52,30 @@ my $tasm_count = 0; sub charcify(@) { my $l = ''; my $c, $o; + my $space = 1; + my $quote = 0; + foreach $o (unpack("C*", join('',@_))) { $c = pack("C", $o); + if ($quote) { + if ($o == $quote) { + $quote = 0; + } + } elsif ($c =~ /^[\'\"\`]$/) { + $quote = $o; + } else { + if ($c =~ /\s/) { + next if ($space); + $o = 32; + $c = ' '; + $space = 1; + } elsif ($o > 126) { + $space = 1; # Implicit space after compacted directive + } else { + $space = 0; + } + } + if ($o < 32 || $o > 126 || $c eq '"' || $c eq "\\") { $l .= sprintf("%3d,", $o); } else { |