]> git.saurik.com Git - apple/javascriptcore.git/blame - docs/make-bytecode-docs.pl
JavaScriptCore-903.5.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
14957cd0 10print OUTPUT "<!-- Generated from Interpreter.cpp by make-bytecode-docs.pl. -->\n";
9dae56ea
A
11print OUTPUT "<style>p code \{ font-size: 14px; \}</style>\n";
12
13while (<MACHINE>) {
14 if (/^ *DEFINE_OPCODE/) {
15 chomp;
16 s/^ *DEFINE_OPCODE\(op_//;
17 s/\).*$//;
18 my $opcode = $_;
19 $_ = <MACHINE>;
20 chomp;
21 if (m|/\* |) {
22 my $format = $_;
23 $format =~ s|.* /\* ||;
24 my $doc = "";
25 while (<MACHINE>) {
26 if (m|\*/|) {
27 last;
28 }
29 $doc .= $_ . " ";
30 }
31
32 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";
33 } else {
34 push @undocumented, $opcode;
35 }
36 }
37}
38
39close OUTPUT;
40
41for my $undoc (@undocumented) {
42 print "UNDOCUMENTED: ${undoc}\n";
43}