summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-22 22:02:34 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-22 22:02:34 -0700
commit438ed48c49520be295ec9d3cae69d426d840dbda (patch)
tree0e75dd0d72cd84dece611d7bc295427c4c3a50fc /misc
parent20dec371dcb7024960fb3d3184416e85918d3eb3 (diff)
downloadnasm-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-xmisc/fmtinsns.pl33
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";
+}
+
+