#!./perl
BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)) }

die "Must be executed from Tk distribution directory\n" unless -f "tkperl.c";
open(STDOUT, ">lib/TkEnglish.pm") || die "open failed: $!";
print <<'EOH';
package TkEnglish;

require Exporter;
@ISA = (Exporter);

# This file is generated automatically by makeenglish from the
# TkPerl distribution.

EOH
@ARGV = <*.c>;
while (<>) {
    if (/"-([a-z]+)"/ && !$found{$1}) {
        $found{$1} = 1;
        print qq(sub \u$1 { "-$1" }\n);
    }
}
print "\n\@EXPORT = qw(\n";
foreach (sort keys %found) {
    print "    &\u$_\n";
}
print <<'EOT';
);

1;
EOT
