Newer
Older
# Copyright 1999-2002,2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Gareth Reakes
committed
my $filename = $ARGV[0];
open(IN,"< $filename") || die("Couldn't open input file: $filename");
while (<IN>) {
Alberto Massari
committed
if ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)\s*[:]\s*public\s([^\s]+)/) {
Gareth Reakes
committed
$classname = $1;
Alberto Massari
committed
$baseclass = $2;
last;
}
elsif ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)/) {
$classname = $1;
$baseclass = "";
Gareth Reakes
committed
last;
}
}
open(OUT,">out.html") || die("Could not write to out.html");
print OUT <<"END1";
<h3>
<font color="#000000">$filename:</font></h3>
<div id="$classname"><font face="Courier New,Courier"><font size=-1>class
Alberto Massari
committed
$classname
Gareth Reakes
committed
END1
Alberto Massari
committed
if ($baseclass ne "") {
print OUT <<"END2";
: public $baseclass
END2
}
print OUT <<"END3";
</font></font>
<table>
END3
Gareth Reakes
committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
while (<IN>) {
if ($_=~/^\s*public\s*:/) {
print OUT <<"END5";
<tr ALIGN=LEFT VALIGN=TOP>
<td><font face="Courier New,Courier"><font size=-1>{</font></font></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr ALIGN=LEFT VALIGN=TOP>
<td><font face="Courier New,Courier"><font size=-1>public:</font></font></td>
<td></td>
<td></td>
<td></td>
</tr>
END5
last;
}
}
while (<IN>) {
if ($_=~/^\s*(virtual)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) {
$a=$1;
$b=$2;
$c=$3;
while ($c!~/\)/) {
$c.=<IN>;
}
print OUT <<"END";
<tr ALIGN=LEFT VALIGN=TOP>
<td></td>
<td><font face="Courier New,Courier"><font size=-1>$a</font></font></td>
<td><font face="Courier New,Courier"><font size=-1>$b</font></font></td>
Alberto Massari
committed
<td><font face="Courier New,Courier"><font size=-1>$c</font></font></td>
</tr>
END
} elsif ($_=~/^\s*(static)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) {
$a=$1;
$b=$2;
$c=$3;
while ($c!~/\)/) {
$c.=<IN>;
}
print OUT <<"END";
<tr ALIGN=LEFT VALIGN=TOP>
<td></td>
<td><font face="Courier New,Courier"><font size=-1>$a</font></font></td>
<td><font face="Courier New,Courier"><font size=-1>$b</font></font></td>
Gareth Reakes
committed
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<td><font face="Courier New,Courier"><font size=-1>$c</font></font></td>
</tr>
END
} elsif ($_=~/^\s*(enum)\s+([^\s]+)\s*{/) {
print OUT <<"END2";
<tr ALIGN=LEFT VALIGN=TOP>
<td></td>
<td><font face="Courier New,Courier"><font size=-1>$1</font></font></td>
<td><font face="Courier New,Courier"><font size=-1>$2 {</font></font></td>
<td></td>
</tr>
END2
while (<IN>) {
if ($_=~/([^\s]+)\s*=\s*([^\s,]+),?(\s|$)/) {
print OUT <<"END3";
<tr ALIGN=LEFT VALIGN=TOP>
<td></td>
<td></td>
<td><font face="Courier New,Courier"><font size=-1>$1</font></font></td>
<td><font face="Courier New,Courier"><font size=-1>= $2,</font></font></td>
</tr>
END3
}
if ($_=~/}\s*;/) {
print OUT <<"END4";
<tr ALIGN=LEFT VALIGN=TOP>
<td></td>
Alberto Massari
committed
<td><font face="Courier New,Courier"><font size=-1>};</font></font></td>
Gareth Reakes
committed
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<td></td>
<td></td>
</tr>
END4
last;
}
}
}
# enum ExceptionCode {
# INVALID_EXPRESSION_ERR = 51,
# TYPE_ERR = 52,
# };
}
print OUT <<"END6";
<tr ALIGN=LEFT VALIGN=TOP>
<td><font face="Courier New,Courier"><font size=-1>};</font></font></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Alberto Massari
committed
</div>
Gareth Reakes
committed
END6
close(OUT);
close(IN);