Skip to content
Snippets Groups Projects
Commit da90366c authored by Gareth Reakes's avatar Gareth Reakes
Browse files

A basic perl script that takes a DOM header file and creates the format we use...

A basic perl script that takes a DOM header file and creates the format we use in our HTML bindings file. Perl script by Steven White.


git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175152 13f79535-47bb-0310-9956-ffa450edef68
parent 3fe57bc7
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/perl
my $filename = $ARGV[0];
open(IN,"< $filename") || die("Couldn't open input file: $filename");
while (<IN>) {
if ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)/) {
$classname = $1;
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
$classname</font></font>
<table>
END1
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>
<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><font face="Courier New,Courier"><font size=-1>};</font></font></td>
<td></td>
<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>
END6
close(OUT);
close(IN);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment