#!/usr/bin/perl -w
use strict;
open MACHINE, "<" . $ARGV[0];
open OUTPUT, ">" . $ARGV[1];
my @undocumented = ();
print OUTPUT "\n";
while () {
if (/^ *DEFINE_OPCODE/) {
chomp;
s/^ *DEFINE_OPCODE\(op_//;
s/\).*$//;
my $opcode = $_;
$_ = ;
chomp;
if (m|/\* |) {
my $format = $_;
$format =~ s|.* /\* ||;
my $doc = "";
while () {
if (m|\*/|) {
last;
}
$doc .= $_ . " ";
}
print OUTPUT "${opcode}
\nFormat: \n${format}\n
\n\n${doc}\n
\n";
} else {
push @undocumented, $opcode;
}
}
}
close OUTPUT;
for my $undoc (@undocumented) {
print "UNDOCUMENTED: ${undoc}\n";
}