1 #!/usr/bin/perl -w 2 3 use strict; 4 5 open MACHINE, "<" . $ARGV[0]; 6 open OUTPUT, ">" . $ARGV[1]; 7 8 my @undocumented = (); 9 10 print OUTPUT "<style>p code \{ font-size: 14px; \}</style>\n"; 11 12 while (<MACHINE>) { 13 if (/^ *DEFINE_OPCODE/) { 14 chomp; 15 s/^ *DEFINE_OPCODE\(op_//; 16 s/\).*$//; 17 my $opcode = $_; 18 $_ = <MACHINE>; 19 chomp; 20 if (m|/\* |) { 21 my $format = $_; 22 $format =~ s|.* /\* ||; 23 my $doc = ""; 24 while (<MACHINE>) { 25 if (m|\*/|) { 26 last; 27 } 28 $doc .= $_ . " "; 29 } 30 31 print OUTPUT "<h2><code>${opcode}</code></h2>\n<p><b>Format: </b><code>\n${format}\n</code></p>\n<p>\n${doc}\n</p>\n"; 32 } else { 33 push @undocumented, $opcode; 34 } 35 } 36 } 37 38 close OUTPUT; 39 40 for my $undoc (@undocumented) { 41 print "UNDOCUMENTED: ${undoc}\n"; 42 } 43