# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You 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. # # my $filename = $ARGV[0]; open(IN,"< $filename") || die("Couldn't open input file: $filename"); while () { if ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)\s*[:]\s*public\s([^\s]+)/) { $classname = $1; $baseclass = $2; last; } elsif ($_=~/^\s*class\s+[A-Z0-9_]+_EXPORT\s+([^\s]+)/) { $classname = $1; $baseclass = ""; last; } } open(OUT,">out.html") || die("Could not write to out.html"); print OUT <<"END1";

$filename:

class $classname END1 if ($baseclass ne "") { print OUT <<"END2"; : public $baseclass END2 } print OUT <<"END3"; END3 while () { if ($_=~/^\s*public\s*:/) { print OUT <<"END5"; END5 last; } } while () { if ($_=~/^\s*(virtual)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) { $a=$1; $b=$2; $c=$3; while ($c!~/\)/) { $c.=; } print OUT <<"END"; END } elsif ($_=~/^\s*(static)\s+([^\s\(][^\(]*[^\s\(])\s+([^\s\(]+\(.*)/) { $a=$1; $b=$2; $c=$3; while ($c!~/\)/) { $c.=; } print OUT <<"END"; END } elsif ($_=~/^\s*(enum)\s+([^\s]+)\s*{/) { print OUT <<"END2"; END2 while () { if ($_=~/([^\s]+)\s*=\s*([^\s,]+),?(\s|$)/) { print OUT <<"END3"; END3 } if ($_=~/}\s*;/) { print OUT <<"END4"; END4 last; } } } # enum ExceptionCode { # INVALID_EXPRESSION_ERR = 51, # TYPE_ERR = 52, # }; } print OUT <<"END6";
{
public:
$a $b $c
$a $b $c
$1 $2 {
$1 = $2,
};
};
END6 close(OUT); close(IN);