You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
3.8 KiB

  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. #
  18. my $filename = $ARGV[0];
  19. open(IN,"< $filename") || die("Couldn't open input file: $filename");
  20. while (<IN>) {
  21. if ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)\s*[:]\s*public\s([^\s]+)/) {
  22. $classname = $1;
  23. $baseclass = $2;
  24. last;
  25. }
  26. elsif ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)/) {
  27. $classname = $1;
  28. $baseclass = "";
  29. last;
  30. }
  31. }
  32. open(OUT,">out.html") || die("Could not write to out.html");
  33. print OUT <<"END1";
  34. <h3>
  35. <font color="#000000">$filename:</font></h3>
  36. <div id="$classname"><font face="Courier New,Courier"><font size=-1>class
  37. $classname
  38. END1
  39. if ($baseclass ne "") {
  40. print OUT <<"END2";
  41. : public $baseclass
  42. END2
  43. }
  44. print OUT <<"END3";
  45. </font></font>
  46. <table>
  47. END3
  48. while (<IN>) {
  49. if ($_=~/^\s*public\s*:/) {
  50. print OUT <<"END5";
  51. <tr ALIGN=LEFT VALIGN=TOP>
  52. <td><font face="Courier New,Courier"><font size=-1>{</font></font></td>
  53. <td></td>
  54. <td></td>
  55. <td></td>
  56. </tr>
  57. <tr ALIGN=LEFT VALIGN=TOP>
  58. <td><font face="Courier New,Courier"><font size=-1>public:</font></font></td>
  59. <td></td>
  60. <td></td>
  61. <td></td>
  62. </tr>
  63. END5
  64. last;
  65. }
  66. }
  67. while (<IN>) {
  68. if ($_=~/^\s*(virtual)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) {
  69. $a=$1;
  70. $b=$2;
  71. $c=$3;
  72. while ($c!~/\)/) {
  73. $c.=<IN>;
  74. }
  75. print OUT <<"END";
  76. <tr ALIGN=LEFT VALIGN=TOP>
  77. <td></td>
  78. <td><font face="Courier New,Courier"><font size=-1>$a</font></font></td>
  79. <td><font face="Courier New,Courier"><font size=-1>$b</font></font></td>
  80. <td><font face="Courier New,Courier"><font size=-1>$c</font></font></td>
  81. </tr>
  82. END
  83. } elsif ($_=~/^\s*(static)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) {
  84. $a=$1;
  85. $b=$2;
  86. $c=$3;
  87. while ($c!~/\)/) {
  88. $c.=<IN>;
  89. }
  90. print OUT <<"END";
  91. <tr ALIGN=LEFT VALIGN=TOP>
  92. <td></td>
  93. <td><font face="Courier New,Courier"><font size=-1>$a</font></font></td>
  94. <td><font face="Courier New,Courier"><font size=-1>$b</font></font></td>
  95. <td><font face="Courier New,Courier"><font size=-1>$c</font></font></td>
  96. </tr>
  97. END
  98. } elsif ($_=~/^\s*(enum)\s+([^\s]+)\s*{/) {
  99. print OUT <<"END2";
  100. <tr ALIGN=LEFT VALIGN=TOP>
  101. <td></td>
  102. <td><font face="Courier New,Courier"><font size=-1>$1</font></font></td>
  103. <td><font face="Courier New,Courier"><font size=-1>$2 {</font></font></td>
  104. <td></td>
  105. </tr>
  106. END2
  107. while (<IN>) {
  108. if ($_=~/([^\s]+)\s*=\s*([^\s,]+),?(\s|$)/) {
  109. print OUT <<"END3";
  110. <tr ALIGN=LEFT VALIGN=TOP>
  111. <td></td>
  112. <td></td>
  113. <td><font face="Courier New,Courier"><font size=-1>$1</font></font></td>
  114. <td><font face="Courier New,Courier"><font size=-1>= $2,</font></font></td>
  115. </tr>
  116. END3
  117. }
  118. if ($_=~/}\s*;/) {
  119. print OUT <<"END4";
  120. <tr ALIGN=LEFT VALIGN=TOP>
  121. <td></td>
  122. <td><font face="Courier New,Courier"><font size=-1>};</font></font></td>
  123. <td></td>
  124. <td></td>
  125. </tr>
  126. END4
  127. last;
  128. }
  129. }
  130. }
  131. # enum ExceptionCode {
  132. # INVALID_EXPRESSION_ERR = 51,
  133. # TYPE_ERR = 52,
  134. # };
  135. }
  136. print OUT <<"END6";
  137. <tr ALIGN=LEFT VALIGN=TOP>
  138. <td><font face="Courier New,Courier"><font size=-1>};</font></font></td>
  139. <td></td>
  140. <td></td>
  141. <td></td>
  142. </tr>
  143. </table>
  144. </div>
  145. END6
  146. close(OUT);
  147. close(IN);