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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "ExtUtils::ParseXS 3pm"
.TH ExtUtils::ParseXS 3pm 2023-11-28 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
ExtUtils::ParseXS \- converts Perl XS code into C code
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\& use ExtUtils::ParseXS;
\&
\& my $pxs = ExtUtils::ParseXS\->new;
\& $pxs\->process_file( filename => \*(Aqfoo.xs\*(Aq );
\&
\& $pxs\->process_file( filename => \*(Aqfoo.xs\*(Aq,
\& output => \*(Aqbar.c\*(Aq,
\& \*(AqC++\*(Aq => 1,
\& typemap => \*(Aqpath/to/typemap\*(Aq,
\& hiertype => 1,
\& except => 1,
\& versioncheck => 1,
\& linenumbers => 1,
\& optimize => 1,
\& prototypes => 1,
\& die_on_error => 0,
\& );
\&
\& # Legacy non\-OO interface using a singleton:
\& use ExtUtils::ParseXS qw(process_file);
\& process_file( filename => \*(Aqfoo.xs\*(Aq );
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
\&\f(CW\*(C`ExtUtils::ParseXS\*(C'\fR will compile XS code into C code by embedding the constructs
necessary to let C functions manipulate Perl values and creates the glue
necessary to let Perl access those functions. The compiler uses typemaps to
determine how to map C function parameters and variables to Perl values.
.PP
The compiler will search for typemap files called \fItypemap\fR. It will use
the following search path to find default typemaps, with the rightmost
typemap taking precedence.
.PP
.Vb 1
\& ../../../typemap:../../typemap:../typemap:typemap
.Ve
.SH EXPORT
.IX Header "EXPORT"
None by default. \f(CWprocess_file()\fR and/or \f(CWreport_error_count()\fR
may be exported upon request. Using the functional interface is
discouraged.
.SH METHODS
.IX Header "METHODS"
.ie n .IP $pxs\->\fBnew()\fR 4
.el .IP \f(CW$pxs\fR\->\fBnew()\fR 4
.IX Item "$pxs->new()"
Returns a new, empty XS parser/compiler object.
.ie n .IP $pxs\->\fBprocess_file()\fR 4
.el .IP \f(CW$pxs\fR\->\fBprocess_file()\fR 4
.IX Item "$pxs->process_file()"
This method processes an XS file and sends output to a C file.
The method may be called as a function (this is the legacy
interface) and will then use a singleton as invocant.
.Sp
Named parameters control how the processing is done.
The following parameters are accepted:
.RS 4
.IP \fBC++\fR 4
.IX Item "C++"
Adds \f(CW\*(C`extern "C"\*(C'\fR to the C code. Default is false.
.IP \fBhiertype\fR 4
.IX Item "hiertype"
Retains \f(CW\*(C`::\*(C'\fR in type names so that C++ hierarchical types can be
mapped. Default is false.
.IP \fBexcept\fR 4
.IX Item "except"
Adds exception handling stubs to the C code. Default is false.
.IP \fBtypemap\fR 4
.IX Item "typemap"
Indicates that a user-supplied typemap should take precedence over the
default typemaps. A single typemap may be specified as a string, or
multiple typemaps can be specified in an array reference, with the
last typemap having the highest precedence.
.IP \fBprototypes\fR 4
.IX Item "prototypes"
Generates prototype code for all xsubs. Default is false.
.IP \fBversioncheck\fR 4
.IX Item "versioncheck"
Makes sure at run time that the object file (derived from the \f(CW\*(C`.xs\*(C'\fR
file) and the \f(CW\*(C`.pm\*(C'\fR files have the same version number. Default is
true.
.IP \fBlinenumbers\fR 4
.IX Item "linenumbers"
Adds \f(CW\*(C`#line\*(C'\fR directives to the C output so error messages will look
like they came from the original XS file. Default is true.
.IP \fBoptimize\fR 4
.IX Item "optimize"
Enables certain optimizations. The only optimization that is currently
affected is the use of \fItarget\fRs by the output C code (see perlguts).
Not optimizing may significantly slow down the generated code, but this is the way
\&\fBxsubpp\fR of 5.005 and earlier operated. Default is to optimize.
.IP \fBinout\fR 4
.IX Item "inout"
Enable recognition of \f(CW\*(C`IN\*(C'\fR, \f(CW\*(C`OUT_LIST\*(C'\fR and \f(CW\*(C`INOUT_LIST\*(C'\fR
declarations. Default is true.
.IP \fBargtypes\fR 4
.IX Item "argtypes"
Enable recognition of ANSI-like descriptions of function signature.
Default is true.
.IP \fBs\fR 4
.IX Item "s"
\&\fIMaintainer note:\fR I have no clue what this does. Strips function prefixes?
.IP \fBdie_on_error\fR 4
.IX Item "die_on_error"
Normally ExtUtils::ParseXS will terminate the program with an \f(CWexit(1)\fR after
printing the details of the exception to STDERR via (warn). This can be awkward
when it is used programmatically and not via xsubpp, so this option can be used
to cause it to die instead by providing a true value. When not provided this
defaults to the value of \f(CW$ExtUtils::ParseXS::DIE_ON_ERROR\fR which in turn
defaults to false.
.RE
.RS 4
.RE
.ie n .IP $pxs\->\fBreport_error_count()\fR 4
.el .IP \f(CW$pxs\fR\->\fBreport_error_count()\fR 4
.IX Item "$pxs->report_error_count()"
This method returns the number of [a certain kind of] errors
encountered during processing of the XS file.
.Sp
The method may be called as a function (this is the legacy
interface) and will then use a singleton as invocant.
.SH AUTHOR
.IX Header "AUTHOR"
Based on xsubpp code, written by Larry Wall.
.PP
Maintained by:
.IP \(bu 4
Ken Williams, <ken@mathforum.org>
.IP \(bu 4
David Golden, <dagolden@cpan.org>
.IP \(bu 4
James Keenan, <jkeenan@cpan.org>
.IP \(bu 4
Steffen Mueller, <smueller@cpan.org>
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright 2002\-2014 by Ken Williams, David Golden and other contributors. All
rights reserved.
.PP
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
.PP
Based on the \f(CW\*(C`ExtUtils::xsubpp\*(C'\fR code by Larry Wall and the Perl 5
Porters, which was released under the same license terms.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
perl, ExtUtils::xsubpp, ExtUtils::MakeMaker, perlxs, perlxstut.
|