mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
34 lines
572 B
Perl
34 lines
572 B
Perl
|
#!/usr/bin/perl
|
||
|
#
|
||
|
# Re-align the columns in insns.dat
|
||
|
#
|
||
|
|
||
|
@cols = (0, 16, 40, 72);
|
||
|
|
||
|
while ($line = <STDIN>) {
|
||
|
chomp $line;
|
||
|
if ($line !~ /^\s*(\;.*|)$/) {
|
||
|
($ln = $line) =~ s/\s+$//;
|
||
|
@fields = split(/\s+/, $line);
|
||
|
if (scalar(@fields) == 4) {
|
||
|
$c = 0;
|
||
|
$line = '';
|
||
|
for ($i = 0; $i < scalar(@fields); $i++) {
|
||
|
if ($i > 0 && $c >= $cols[$i]) {
|
||
|
$line .= ' ';
|
||
|
$c++;
|
||
|
}
|
||
|
while ($c < $cols[$i]) {
|
||
|
$line .= "\t";
|
||
|
$c = ($c+8) & ~7;
|
||
|
}
|
||
|
$line .= $fields[$i];
|
||
|
$c += length($fields[$i]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
print $line, "\n";
|
||
|
}
|
||
|
|
||
|
|