This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/misc: Add withinCOUNT and inRANGE
[perl5.git] / dist / Devel-PPPort / RealPPPort_xs.PL
CommitLineData
adfe19db
MHM
1################################################################################
2#
3bfe1c68 3# RealPPPort_xs.PL -- generate RealPPPort.xs
adfe19db
MHM
4#
5################################################################################
6#
b2049988 7# Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
8# Version 2.x, Copyright (C) 2001, Paul Marquess.
9# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
10#
11# This program is free software; you can redistribute it and/or
12# modify it under the same terms as Perl itself.
13#
14################################################################################
15
16use strict;
17$^W = 1;
874389ae 18require "./parts/ppptools.pl";
adfe19db
MHM
19
20my %SECTION = (
cac25305
MHM
21 xshead => { code => '', header => "/* ---- code from __FILE__ ---- */" },
22 xsinit => { code => '', header => "/* ---- code from __FILE__ ---- */" },
23 xsmisc => { code => '', header => "/* ---- code from __FILE__ ---- */" },
24 xsboot => { code => '', header => "/* ---- code from __FILE__ ---- */", indent => "\t" },
25 xsubs => { code => '', header => <<ENDHEADER },
26##----------------------------------------------------------------------
27## XSUBs for testing the implementation in __FILE__
28##----------------------------------------------------------------------
29ENDHEADER
adfe19db
MHM
30);
31
b2049988 32if (not exists $ENV{PERL_NO_GET_CONTEXT} or $ENV{PERL_NO_GET_CONTEXT}) {
adfe19db
MHM
33$SECTION{xshead}{code} .= <<END;
34#define PERL_NO_GET_CONTEXT
35END
36}
37
38my $file;
39my $sec;
40
1d088ed8 41for $file (all_files_in_dir('parts/inc')) {
adfe19db
MHM
42 my $spec = parse_partspec($file);
43
44 my $msg = 0;
45 for $sec (keys %SECTION) {
46 if (exists $spec->{$sec}) {
47 $msg++ or print "adding XS code from $file\n";
48 if (exists $SECTION{$sec}{header}) {
49 my $header = $SECTION{$sec}{header};
50 $header =~ s/__FILE__/$file/g;
51 $SECTION{$sec}{code} .= $header . "\n";
52 }
53 $SECTION{$sec}{code} .= $spec->{$sec} . "\n";
54 }
55 }
56}
57
58my $data = do { local $/; <DATA> };
59
60for $sec (keys %SECTION) {
61 my $code = $SECTION{$sec}{code};
62 if (exists $SECTION{$sec}{indent}) {
63 $code =~ s/^/$SECTION{$sec}{indent}/gm;
64 }
65 $code =~ s/[\r\n]+$//;
66 $data =~ s/^__\U$sec\E__$/$code/m;
67}
68
78b4ff79 69open FH, ">RealPPPort.xs" or die "RealPPPort.xs: $!\n";
adfe19db
MHM
70print FH $data;
71close FH;
72
73exit 0;
74
75__DATA__
76/*******************************************************************************
77*
4fefab01 78* !!!!! Do NOT edit this file directly! -- Edit RealPPPort_xs.PL instead. !!!!!
adfe19db 79*
cac25305
MHM
80* This file was automatically generated from the definition files in the
81* parts/inc/ subdirectory by PPPort_xs.PL. To learn more about how all this
82* works, please read the F<HACKERS> file that came with this distribution.
83*
adfe19db
MHM
84********************************************************************************
85*
86* Perl/Pollution/Portability
87*
88********************************************************************************
89*
b2049988 90* Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
91* Version 2.x, Copyright (C) 2001, Paul Marquess.
92* Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
93*
94* This program is free software; you can redistribute it and/or
95* modify it under the same terms as Perl itself.
96*
97*******************************************************************************/
98
99/* ========== BEGIN XSHEAD ================================================== */
100
101__XSHEAD__
102
103/* =========== END XSHEAD =================================================== */
104
105#include "EXTERN.h"
106#include "perl.h"
107#include "XSUB.h"
108
109/* ========== BEGIN XSINIT ================================================== */
110
111__XSINIT__
112
113/* =========== END XSINIT =================================================== */
114
115#include "ppport.h"
116
117/* ========== BEGIN XSMISC ================================================== */
118
119__XSMISC__
120
121/* =========== END XSMISC =================================================== */
122
b2049988 123MODULE = Devel::PPPort PACKAGE = Devel::PPPort
adfe19db
MHM
124
125BOOT:
126__XSBOOT__
127
128__XSUBS__