]> git.saurik.com Git - apple/javascriptcore.git/blame - docs/make-bytecode-docs.pl
JavaScriptCore-521.tar.gz
[apple/javascriptcore.git] / docs / make-bytecode-docs.pl
CommitLineData
9dae56ea
A
1#!/usr/bin/perl -w
2
3use strict;
4
5open MACHINE, "<" . $ARGV[0];
6open OUTPUT, ">" . $ARGV[1];
7
8my @undocumented = ();
9
10print OUTPUT "<style>p code \{ font-size: 14px; \}</style>\n";
11
12while (<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
38close OUTPUT;
39
40for my $undoc (@undocumented) {
41 print "UNDOCUMENTED: ${undoc}\n";
42}