#!/usr/bin/env perl use strict; use warnings; use utf8; my @acc; my @mth; my @ctor; my $class = $ARGV[0]; my $file = $ARGV[1]; $file or die "No filename specified\n"; open my $fh, "<:utf8", $file or die "$file: $!"; while (<$fh>) { /^\s*\// and next; if (/ACC \((.+), (\w+)(.*), (\d)\)/) { my $type = $1; my $name = $2; my $wantklass = $4; if (length $3) { if ($type eq "char") { $type = "char *" } } if ($wantklass) { $wantklass = "char const *klass"; } else { $wantklass = ""; } push @acc, [$type, $name, $wantklass]; } elsif (/MTH (void|bool|int|unsigned int) (.+);/) { push @mth, [$1, $2]; } } for (@acc) { print <[0] $class\::$_->[1] ($_->[2]) CODE: RETVAL = THIS->$_->[1]; OUTPUT: RETVAL CODE } for (@mth) { print <[0] $class\::$_->[1] CODE }