#!perl -w
use strict;

open(PPERL, ">pperl.h") || die "Can't write to pperl.h: $!";
open(PPERL_HEAD, "<pperl.h.header") || die "Can't read pperl.h.header: $!";



print PPERL <<'EOT';
/* pperl.h - autogenerated from pperl.h.header by write_pperl_h */

#define perl_header ""\
EOT

sub spool {
    while (<PPERL_HEAD>) {
        last if /#### Your Code Here ####/;
        s/\\/\\\\/g; # double up all backslashes
        s/"/\\"/g; # backslash all quotes
        s/^(.*)$/"$1\\n"\\/; # wrap in quotes
        print PPERL $_;
    }
}

spool();

print PPERL << 'EOT';
"\n"

#define perl_footer ""\
EOT

spool();

print PPERL << 'EOT';
"\n"

EOT

print PPERL '#define PPERL_VERSION "'. `grep 'VERSION =' PPerl.pm | cut -d"'" -f2` . "\"\n";
close PPERL;
close PPERL_HEAD;
