1 ################################################################################
3 # PPPort_xs.PL -- generate RealPPPort.xs
5 ################################################################################
9 # $Date: 2006/07/21 19:21:40 +0200 $
11 ################################################################################
13 # Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
14 # Version 2.x, Copyright (C) 2001, Paul Marquess.
15 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
17 # This program is free software; you can redistribute it and/or
18 # modify it under the same terms as Perl itself.
20 ################################################################################
24 require "parts/ppptools.pl";
27 xshead => { code => '', header => "/* ---- from __FILE__ ---- */" },
28 xsinit => { code => '', header => "/* ---- from __FILE__ ---- */" },
29 xsmisc => { code => '', header => "/* ---- from __FILE__ ---- */" },
30 xsboot => { code => '', header => "/* ---- from __FILE__ ---- */", indent => "\t" },
31 xsubs => { code => '', header => "##".('-' x 70)."\n## XSUBs from __FILE__\n##".('-' x 70)."\n" },
34 if (exists $ENV{PERL_NO_GET_CONTEXT} && $ENV{PERL_NO_GET_CONTEXT}) {
35 $SECTION{xshead}{code} .= <<END;
36 #define PERL_NO_GET_CONTEXT
43 for $file (all_files_in_dir('parts/inc')) {
44 my $spec = parse_partspec($file);
47 for $sec (keys %SECTION) {
48 if (exists $spec->{$sec}) {
49 $msg++ or print "adding XS code from $file\n";
50 if (exists $SECTION{$sec}{header}) {
51 my $header = $SECTION{$sec}{header};
52 $header =~ s/__FILE__/$file/g;
53 $SECTION{$sec}{code} .= $header . "\n";
55 $SECTION{$sec}{code} .= $spec->{$sec} . "\n";
60 my $data = do { local $/; <DATA> };
62 for $sec (keys %SECTION) {
63 my $code = $SECTION{$sec}{code};
64 if (exists $SECTION{$sec}{indent}) {
65 $code =~ s/^/$SECTION{$sec}{indent}/gm;
67 $code =~ s/[\r\n]+$//;
68 $data =~ s/^__\U$sec\E__$/$code/m;
71 open FH, ">RealPPPort.xs" or die "RealPPPort.xs: $!\n";
78 /*******************************************************************************
80 * !!!!! Do NOT edit this file directly! -- Edit PPPort_xs.PL instead. !!!!!
82 ********************************************************************************
84 * Perl/Pollution/Portability
86 ********************************************************************************
90 * $Date: 2006/07/21 19:21:40 +0200 $
92 ********************************************************************************
94 * Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
95 * Version 2.x, Copyright (C) 2001, Paul Marquess.
96 * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
98 * This program is free software; you can redistribute it and/or
99 * modify it under the same terms as Perl itself.
101 *******************************************************************************/
103 /* ========== BEGIN XSHEAD ================================================== */
107 /* =========== END XSHEAD =================================================== */
113 /* ========== BEGIN XSINIT ================================================== */
117 /* =========== END XSINIT =================================================== */
121 /* ========== BEGIN XSMISC ================================================== */
125 /* =========== END XSMISC =================================================== */
127 MODULE = Devel::PPPort PACKAGE = Devel::PPPort