This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Devel-PPPort to match 3.67
[perl5.git] / dist / Devel-PPPort / parts / inc / ppphdoc
CommitLineData
adfe19db
MHM
1################################################################################
2##
b2049988 3## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
4## Version 2.x, Copyright (C) 2001, Paul Marquess.
5## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
6##
7## This program is free software; you can redistribute it and/or
8## modify it under the same terms as Perl itself.
9##
10################################################################################
11
12=provides
13
14=dontwarn
15
16NEED_function
17NEED_function_GLOBAL
0d0f8426
MHM
18NEED_variable
19NEED_variable_GLOBAL
adfe19db
MHM
20DPPP_NAMESPACE
21
22=implementation
23
24=pod
25
26=head1 NAME
27
28ppport.h - Perl/Pollution/Portability version __VERSION__
29
30=head1 SYNOPSIS
31
4a582685
NC
32 perl ppport.h [options] [source files]
33
34 Searches current directory for files if no [source files] are given
adfe19db
MHM
35
36 --help show short help
37
78b4ff79
MHM
38 --version show version
39
adfe19db
MHM
40 --patch=file write one patch file with changes
41 --copy=suffix write changed copies with suffix
42 --diff=program use diff program and options
43
44 --compat-version=version provide compatibility with Perl version
45 --cplusplus accept C++ comments
46
47 --quiet don't output anything except fatal errors
48 --nodiag don't show diagnostics
49 --nohints don't show hints
50 --nochanges don't suggest changes
4a582685 51 --nofilter don't filter input files
adfe19db 52
7baf245a
KW
53 --strip strip all script and doc functionality
54 from ppport.h
0d0f8426 55
adfe19db 56 --list-provided list provided API
c8799aff
N
57 --list-unsupported list API that isn't supported all the way
58 back
04fc8b94 59 --api-info=name show Perl API portability information
adfe19db
MHM
60
61=head1 COMPATIBILITY
62
63This version of F<ppport.h> is designed to support operation with Perl
64installations back to __MIN_PERL__, and has been tested up to __MAX_PERL__.
65
66=head1 OPTIONS
67
68=head2 --help
69
70Display a brief usage summary.
71
78b4ff79
MHM
72=head2 --version
73
74Display the version of F<ppport.h>.
75
adfe19db
MHM
76=head2 --patch=I<file>
77
78If this option is given, a single patch file will be created if
79any changes are suggested. This requires a working diff program
80to be installed on your system.
81
82=head2 --copy=I<suffix>
83
84If this option is given, a copy of each file will be saved with
85the given suffix that contains the suggested changes. This does
679ad62d 86not require any external programs. Note that this does not
744ef08f 87automagically add a dot between the original filename and the
679ad62d
MHM
88suffix. If you want the dot, you have to include it in the option
89argument.
adfe19db
MHM
90
91If neither C<--patch> or C<--copy> are given, the default is to
92simply print the diffs for each file. This requires either
93C<Text::Diff> or a C<diff> program to be installed.
94
95=head2 --diff=I<program>
96
97Manually set the diff program and options to use. The default
98is to use C<Text::Diff>, when installed, and output unified
99context diffs.
100
101=head2 --compat-version=I<version>
102
103Tell F<ppport.h> to check for compatibility with the given
104Perl version. The default is to check for compatibility with Perl
105version __MIN_PERL__. You can use this option to reduce the output
106of F<ppport.h> if you intend to be backward compatible only
0d0f8426 107down to a certain Perl version.
adfe19db
MHM
108
109=head2 --cplusplus
110
111Usually, F<ppport.h> will detect C++ style comments and
112replace them with C style comments for portability reasons.
113Using this option instructs F<ppport.h> to leave C++
114comments untouched.
115
116=head2 --quiet
117
118Be quiet. Don't print anything except fatal errors.
119
120=head2 --nodiag
121
122Don't output any diagnostic messages. Only portability
123alerts will be printed.
124
125=head2 --nohints
126
127Don't output any hints. Hints often contain useful portability
679ad62d 128notes. Warnings will still be displayed.
adfe19db
MHM
129
130=head2 --nochanges
131
132Don't suggest any changes. Only give diagnostic output and hints
133unless these are also deactivated.
134
4a582685
NC
135=head2 --nofilter
136
137Don't filter the list of input files. By default, files not looking
138like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
139
0d0f8426
MHM
140=head2 --strip
141
142Strip all script and documentation functionality from F<ppport.h>.
143This reduces the size of F<ppport.h> dramatically and may be useful
144if you want to include F<ppport.h> in smaller modules without
145increasing their distribution size too much.
146
78b4ff79
MHM
147The stripped F<ppport.h> will have a C<--unstrip> option that allows
148you to undo the stripping, but only if an appropriate C<Devel::PPPort>
149module is installed.
150
adfe19db
MHM
151=head2 --list-provided
152
153Lists the API elements for which compatibility is provided by
154F<ppport.h>. Also lists if it must be explicitly requested,
679ad62d 155if it has dependencies, and if there are hints or warnings for it.
adfe19db
MHM
156
157=head2 --list-unsupported
158
c8799aff
N
159Lists the API elements that are known not to be FULLY supported by F<ppport.h>,
160and below which version of Perl they probably won't be available or work.
161By FULLY, we mean that support isn't provided all the way back to the first
162version of Perl that F<ppport.h> supports at all.
adfe19db 163
04fc8b94
MHM
164=head2 --api-info=I<name>
165
c8799aff 166Show portability information for elements matching I<name>.
9132e1a3
MHM
167If I<name> is surrounded by slashes, it is interpreted as a regular
168expression.
04fc8b94 169
c8799aff
N
170Normally, only API elements are shown, but if there are no matching API
171elements but there are some other matching elements, those are shown. This
172allows you to conveniently find when functions internal to the core
173implementation were added; only people working on the core are likely to find
174this last part useful.
175
adfe19db
MHM
176=head1 DESCRIPTION
177
178In order for a Perl extension (XS) module to be as portable as possible
179across differing versions of Perl itself, certain steps need to be taken.
180
181=over 4
182
183=item *
184
185Including this header is the first major one. This alone will give you
186access to a large part of the Perl API that hasn't been available in
187earlier Perl releases. Use
188
189 perl ppport.h --list-provided
190
191to see which API elements are provided by ppport.h.
192
193=item *
194
195You should avoid using deprecated parts of the API. For example, using
196global Perl variables without the C<PL_> prefix is deprecated. Also,
197some API functions used to have a C<perl_> prefix. Using this form is
198also deprecated. You can safely use the supported API, as F<ppport.h>
199will provide wrappers for older Perl versions.
200
201=item *
202
c8799aff
N
203Although the purpose of F<ppport.h> is to keep you from having to concern
204yourself with what version you are running under, there may arise instances
205where you have to do so. These macros, the same ones as in base Perl, are
206available to you in all versions, and are what you should use:
207
208=over 4
209
210=item C<PERL_VERSION_I<xx>(major, minor, patch)>
211
212Returns whether or not the perl currently being compiled has the specified
213relationship I<xx> to the perl given by the parameters. I<xx> is one of
214C<EQ>, C<NE>, C<LT>, C<LE>, C<GT>, C<GE>.
215
216For example,
217
218 #if PERL_VERSION_GT(5,24,2)
219 code that will only be compiled on perls after v5.24.2
220 #else
221 fallback code
222 #endif
223
224Note that this is usable in making compile-time decisions
225
226You may use the special value '*' for the final number to mean ALL possible
227values for it. Thus,
228
229 #if PERL_VERSION_EQ(5,31,'*')
230
231means all perls in the 5.31 series. And
232
233 #if PERL_VERSION_NE(5,24,'*')
234
235means all perls EXCEPT 5.24 ones. And
236
237 #if PERL_VERSION_LE(5,9,'*')
238
239is effectively
240
241 #if PERL_VERSION_LT(5,10,0)
242
243=back
244
245=item *
246
0d0f8426
MHM
247If you use one of a few functions or variables that were not present in
248earlier versions of Perl, and that can't be provided using a macro, you
249have to explicitly request support for these functions by adding one or
adfe19db
MHM
250more C<#define>s in your source code before the inclusion of F<ppport.h>.
251
0d0f8426
MHM
252These functions or variables will be marked C<explicit> in the list shown
253by C<--list-provided>.
adfe19db
MHM
254
255Depending on whether you module has a single or multiple files that
0d0f8426
MHM
256use such functions or variables, you want either C<static> or global
257variants.
adfe19db 258
0d0f8426
MHM
259For a C<static> function or variable (used only in a single source
260file), use:
adfe19db
MHM
261
262 #define NEED_function
0d0f8426 263 #define NEED_variable
adfe19db 264
0d0f8426
MHM
265For a global function or variable (used in multiple source files),
266use:
adfe19db
MHM
267
268 #define NEED_function_GLOBAL
0d0f8426 269 #define NEED_variable_GLOBAL
adfe19db 270
0d0f8426
MHM
271Note that you mustn't have more than one global request for the
272same function or variable in your project.
adfe19db
MHM
273
274 __EXPLICIT_API__
275
276To avoid namespace conflicts, you can change the namespace of the
0d0f8426
MHM
277explicitly exported functions / variables using the C<DPPP_NAMESPACE>
278macro. Just C<#define> the macro before including C<ppport.h>:
adfe19db
MHM
279
280 #define DPPP_NAMESPACE MyOwnNamespace_
281 #include "ppport.h"
282
283The default namespace is C<DPPP_>.
284
285=back
286
287The good thing is that most of the above can be checked by running
288F<ppport.h> on your source code. See the next section for
289details.
290
291=head1 EXAMPLES
292
293To verify whether F<ppport.h> is needed for your module, whether you
294should make any changes to your code, and whether any special defines
295should be used, F<ppport.h> can be run as a Perl script to check your
296source code. Simply say:
297
298 perl ppport.h
299
300The result will usually be a list of patches suggesting changes
301that should at least be acceptable, if not necessarily the most
302efficient solution, or a fix for all possible problems.
303
304If you know that your XS module uses features only available in
305newer Perl releases, if you're aware that it uses C++ comments,
306and if you want all suggestions as a single patch file, you could
307use something like this:
308
309 perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
310
311If you only want your code to be scanned without any suggestions
312for changes, use:
313
314 perl ppport.h --nochanges
315
316You can specify a different C<diff> program or options, using
317the C<--diff> option:
318
319 perl ppport.h --diff='diff -C 10'
320
321This would output context diffs with 10 lines of context.
322
679ad62d
MHM
323If you want to create patched copies of your files instead, use:
324
325 perl ppport.h --copy=.new
326
9132e1a3
MHM
327To display portability information for the C<newSVpvn> function,
328use:
329
330 perl ppport.h --api-info=newSVpvn
331
332Since the argument to C<--api-info> can be a regular expression,
333you can use
334
335 perl ppport.h --api-info=/_nomg$/
336
337to display portability information for all C<_nomg> functions or
338
339 perl ppport.h --api-info=/./
340
341to display information for all known API elements.
342
adfe19db
MHM
343=head1 BUGS
344
47547e39
KW
345Some of the suggested edits and/or generated patches may not compile as-is
346without tweaking manually. This is generally due to the need for an extra
347parameter to be added to the call to prevent buffer overflow.
348
adfe19db
MHM
349If this version of F<ppport.h> is causing failure during
350the compilation of this module, please check if newer versions
351of either this module or C<Devel::PPPort> are available on CPAN
352before sending a bug report.
353
354If F<ppport.h> was generated using the latest version of
355C<Devel::PPPort> and is causing failure of this module, please
c8799aff 356file a bug report at L<https://github.com/Dual-Life/Devel-PPPort/issues>
adfe19db
MHM
357
358Please include the following information:
359
360=over 4
361
362=item 1.
363
364The complete output from running "perl -V"
365
366=item 2.
367
368This file.
369
370=item 3.
371
372The name and version of the module you were trying to build.
373
374=item 4.
375
376A full log of the build that failed.
377
378=item 5.
379
380Any other information that you think could be relevant.
381
382=back
383
384For the latest version of this code, please get the C<Devel::PPPort>
385module from CPAN.
386
387=head1 COPYRIGHT
388
b2049988 389Version 3.x, Copyright (c) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
390
391Version 2.x, Copyright (C) 2001, Paul Marquess.
392
393Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
394
395This program is free software; you can redistribute it and/or
396modify it under the same terms as Perl itself.
397
398=head1 SEE ALSO
399
400See L<Devel::PPPort>.
401
c07deaaf 402=cut