From da90366c3e1ae3e64669220f2445807ee96817e1 Mon Sep 17 00:00:00 2001
From: Gareth Reakes <gareth@apache.org>
Date: Wed, 20 Aug 2003 11:33:50 +0000
Subject: [PATCH] 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
---
 scripts/createBindingsFormatFromHPP.pl | 139 +++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100755 scripts/createBindingsFormatFromHPP.pl

diff --git a/scripts/createBindingsFormatFromHPP.pl b/scripts/createBindingsFormatFromHPP.pl
new file mode 100755
index 000000000..447da39e7
--- /dev/null
+++ b/scripts/createBindingsFormatFromHPP.pl
@@ -0,0 +1,139 @@
+#!/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);
-- 
GitLab