Formatting: kill off "stealth whitespace"
[nasm.git] / misc / fmtinsns.pl
blob323ab9c5884315f41e9270a4e9a97b458667d8a1
1 #!/usr/bin/perl
3 # Re-align the columns in insns.dat
6 @cols = (0, 16, 40, 72);
8 while ($line = <STDIN>) {
9 chomp $line;
10 if ($line !~ /^\s*(\;.*|)$/) {
11 ($ln = $line) =~ s/\s+$//;
12 @fields = split(/\s+/, $line);
13 if (scalar(@fields) == 4) {
14 $c = 0;
15 $line = '';
16 for ($i = 0; $i < scalar(@fields); $i++) {
17 if ($i > 0 && $c >= $cols[$i]) {
18 $line .= ' ';
19 $c++;
21 while ($c < $cols[$i]) {
22 $line .= "\t";
23 $c = ($c+8) & ~7;
25 $line .= $fields[$i];
26 $c += length($fields[$i]);
30 print $line, "\n";