This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [NOT OK] 23353 OpenVMS 7.2 VAX
[perl5.git] / ext / Devel / PPPort / PPPort_xs.PL
CommitLineData
adfe19db
MHM
1################################################################################
2#
3# PPPort_xs.PL -- generate PPPort.xs
4#
5################################################################################
6#
7# $Revision: 7 $
8# $Author: mhx $
9# $Date: 2004/08/13 12:49:19 +0200 $
10#
11################################################################################
12#
13# Version 3.x, Copyright (C) 2004, Marcus Holland-Moritz.
14# Version 2.x, Copyright (C) 2001, Paul Marquess.
15# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
16#
17# This program is free software; you can redistribute it and/or
18# modify it under the same terms as Perl itself.
19#
20################################################################################
21
22use strict;
23$^W = 1;
24require "parts/ppptools.pl";
25
26my %SECTION = (
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" },
32);
33
34if (exists $ENV{PERL_NO_GET_CONTEXT} && $ENV{PERL_NO_GET_CONTEXT}) {
35$SECTION{xshead}{code} .= <<END;
36#define PERL_NO_GET_CONTEXT
37END
38}
39
40my $file;
41my $sec;
42
43for $file (glob 'parts/inc/*') {
44 my $spec = parse_partspec($file);
45
46 my $msg = 0;
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";
54 }
55 $SECTION{$sec}{code} .= $spec->{$sec} . "\n";
56 }
57 }
58}
59
60my $data = do { local $/; <DATA> };
61
62for $sec (keys %SECTION) {
63 my $code = $SECTION{$sec}{code};
64 if (exists $SECTION{$sec}{indent}) {
65 $code =~ s/^/$SECTION{$sec}{indent}/gm;
66 }
67 $code =~ s/[\r\n]+$//;
68 $data =~ s/^__\U$sec\E__$/$code/m;
69}
70
71open FH, ">PPPort.xs" or die "PPPort.xs: $!\n";
72print FH $data;
73close FH;
74
75exit 0;
76
77__DATA__
78/*******************************************************************************
79*
80* !!!!! Do NOT edit this file directly! -- Edit PPPort_xs.PL instead. !!!!!
81*
82********************************************************************************
83*
84* Perl/Pollution/Portability
85*
86********************************************************************************
87*
88* $Revision: 7 $
89* $Author: mhx $
90* $Date: 2004/08/13 12:49:19 +0200 $
91*
92********************************************************************************
93*
94* Version 3.x, Copyright (C) 2004, Marcus Holland-Moritz.
95* Version 2.x, Copyright (C) 2001, Paul Marquess.
96* Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
97*
98* This program is free software; you can redistribute it and/or
99* modify it under the same terms as Perl itself.
100*
101*******************************************************************************/
102
103/* ========== BEGIN XSHEAD ================================================== */
104
105__XSHEAD__
106
107/* =========== END XSHEAD =================================================== */
108
109#include "EXTERN.h"
110#include "perl.h"
111#include "XSUB.h"
112
113/* ========== BEGIN XSINIT ================================================== */
114
115__XSINIT__
116
117/* =========== END XSINIT =================================================== */
118
119#include "ppport.h"
120
121/* ========== BEGIN XSMISC ================================================== */
122
123__XSMISC__
124
125/* =========== END XSMISC =================================================== */
126
127MODULE = Devel::PPPort PACKAGE = Devel::PPPort
128
129BOOT:
130__XSBOOT__
131
132__XSUBS__