File: PPPort_xs.PL

package info (click to toggle)
perl 5.24.1-3+deb9u5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,716 kB
  • sloc: perl: 559,611; ansic: 293,886; sh: 67,316; pascal: 7,632; cpp: 3,895; makefile: 2,436; xml: 2,410; yacc: 989; sed: 6; lisp: 1
file content (128 lines) | stat: -rw-r--r-- 3,862 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
################################################################################
#
#  PPPort_xs.PL -- generate RealPPPort.xs
#
################################################################################
#
#  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
#  Version 2.x, Copyright (C) 2001, Paul Marquess.
#  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
#
#  This program is free software; you can redistribute it and/or
#  modify it under the same terms as Perl itself.
#
################################################################################

use strict;
$^W = 1;
require "parts/ppptools.pl";

my %SECTION = (
  xshead => { code => '', header => "/* ---- code from __FILE__ ---- */" },
  xsinit => { code => '', header => "/* ---- code from __FILE__ ---- */" },
  xsmisc => { code => '', header => "/* ---- code from __FILE__ ---- */" },
  xsboot => { code => '', header => "/* ---- code from __FILE__ ---- */", indent => "\t" },
  xsubs  => { code => '', header => <<ENDHEADER },
##----------------------------------------------------------------------
##  XSUBs for testing the implementation in __FILE__
##----------------------------------------------------------------------
ENDHEADER
);

if (not exists $ENV{PERL_NO_GET_CONTEXT} or $ENV{PERL_NO_GET_CONTEXT}) {
$SECTION{xshead}{code} .= <<END;
#define PERL_NO_GET_CONTEXT
END
}

my $file;
my $sec;

for $file (sort(all_files_in_dir('parts/inc'))) {
  my $spec = parse_partspec($file);

  my $msg = 0;
  for $sec (keys %SECTION) {
    if (exists $spec->{$sec}) {
      $msg++ or print "adding XS code from $file\n";
      if (exists $SECTION{$sec}{header}) {
        my $header = $SECTION{$sec}{header};
        $header =~ s/__FILE__/$file/g;
        $SECTION{$sec}{code} .= $header . "\n";
      }
      $SECTION{$sec}{code} .= $spec->{$sec} . "\n";
    }
  }
}

my $data = do { local $/; <DATA> };

for $sec (keys %SECTION) {
  my $code = $SECTION{$sec}{code};
  if (exists $SECTION{$sec}{indent}) {
    $code =~ s/^/$SECTION{$sec}{indent}/gm;
  }
  $code =~ s/[\r\n]+$//;
  $data =~ s/^__\U$sec\E__$/$code/m;
}

open FH, ">RealPPPort.xs" or die "RealPPPort.xs: $!\n";
print FH $data;
close FH;

exit 0;

__DATA__
/*******************************************************************************
*
*  !!!!! Do NOT edit this file directly! -- Edit PPPort_xs.PL instead. !!!!!
*
*  This file was automatically generated from the definition files in the
*  parts/inc/ subdirectory by PPPort_xs.PL. To learn more about how all this
*  works, please read the F<HACKERS> file that came with this distribution.
*
********************************************************************************
*
*  Perl/Pollution/Portability
*
********************************************************************************
*
*  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
*  Version 2.x, Copyright (C) 2001, Paul Marquess.
*  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
*
*  This program is free software; you can redistribute it and/or
*  modify it under the same terms as Perl itself.
*
*******************************************************************************/

/* ========== BEGIN XSHEAD ================================================== */

__XSHEAD__

/* =========== END XSHEAD =================================================== */

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

/* ========== BEGIN XSINIT ================================================== */

__XSINIT__

/* =========== END XSINIT =================================================== */

#include "ppport.h"

/* ========== BEGIN XSMISC ================================================== */

__XSMISC__

/* =========== END XSMISC =================================================== */

MODULE = Devel::PPPort          PACKAGE = Devel::PPPort

BOOT:
__XSBOOT__

__XSUBS__