File: write_pperl_h

package info (click to toggle)
pperl 0.25-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 296 kB
  • ctags: 45
  • sloc: perl: 864; ansic: 730; makefile: 57; sh: 23
file content (47 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!perl -w
use strict;

my $debug = shift || 0;
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/^\s*log_error.*// # lose log_error calls
          unless $debug;
        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

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