diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-22 22:02:34 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-22 22:02:34 -0700 |
commit | 438ed48c49520be295ec9d3cae69d426d840dbda (patch) | |
tree | 0e75dd0d72cd84dece611d7bc295427c4c3a50fc /misc | |
parent | 20dec371dcb7024960fb3d3184416e85918d3eb3 (diff) | |
download | nasm-438ed48c49520be295ec9d3cae69d426d840dbda.tar.gz |
Reformat insns.dat to uniform column width
Add a script to reformat insns.dat to uniform width, and use it.
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/fmtinsns.pl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/misc/fmtinsns.pl b/misc/fmtinsns.pl new file mode 100755 index 00000000..831ead4c --- /dev/null +++ b/misc/fmtinsns.pl @@ -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"; +} + + |