Reformat insns.dat to uniform column width

Add a script to reformat insns.dat to uniform width, and use it.
This commit is contained in:
H. Peter Anvin 2007-09-22 22:02:34 -07:00
parent 20dec371dc
commit 438ed48c49
2 changed files with 1897 additions and 1864 deletions

3728
insns.dat

File diff suppressed because it is too large Load Diff

33
misc/fmtinsns.pl Executable file
View File

@ -0,0 +1,33 @@
#!/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";
}