Re: [PATCH] Optimize split //
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / parts / inc / ppphdoc
CommitLineData
adfe19db 1################################################################################
2##
d2dacc4f 3## $Revision: 28 $
adfe19db 4## $Author: mhx $
d2dacc4f 5## $Date: 2007/01/02 12:32:32 +0100 $
adfe19db 6##
7################################################################################
8##
d2dacc4f 9## Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz.
adfe19db 10## Version 2.x, Copyright (C) 2001, Paul Marquess.
11## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
12##
13## This program is free software; you can redistribute it and/or
14## modify it under the same terms as Perl itself.
15##
16################################################################################
17
18=provides
19
20=dontwarn
21
22NEED_function
23NEED_function_GLOBAL
0d0f8426 24NEED_variable
25NEED_variable_GLOBAL
adfe19db 26DPPP_NAMESPACE
27
28=implementation
29
30=pod
31
32=head1 NAME
33
34ppport.h - Perl/Pollution/Portability version __VERSION__
35
36=head1 SYNOPSIS
37
4a582685 38 perl ppport.h [options] [source files]
39
40 Searches current directory for files if no [source files] are given
adfe19db 41
42 --help show short help
43
78b4ff79 44 --version show version
45
adfe19db 46 --patch=file write one patch file with changes
47 --copy=suffix write changed copies with suffix
48 --diff=program use diff program and options
49
50 --compat-version=version provide compatibility with Perl version
51 --cplusplus accept C++ comments
52
53 --quiet don't output anything except fatal errors
54 --nodiag don't show diagnostics
55 --nohints don't show hints
56 --nochanges don't suggest changes
4a582685 57 --nofilter don't filter input files
adfe19db 58
0d0f8426 59 --strip strip all script and doc functionality from
78b4ff79 60 ppport.h
0d0f8426 61
adfe19db 62 --list-provided list provided API
63 --list-unsupported list unsupported API
04fc8b94 64 --api-info=name show Perl API portability information
adfe19db 65
66=head1 COMPATIBILITY
67
68This version of F<ppport.h> is designed to support operation with Perl
69installations back to __MIN_PERL__, and has been tested up to __MAX_PERL__.
70
71=head1 OPTIONS
72
73=head2 --help
74
75Display a brief usage summary.
76
78b4ff79 77=head2 --version
78
79Display the version of F<ppport.h>.
80
adfe19db 81=head2 --patch=I<file>
82
83If this option is given, a single patch file will be created if
84any changes are suggested. This requires a working diff program
85to be installed on your system.
86
87=head2 --copy=I<suffix>
88
89If this option is given, a copy of each file will be saved with
90the given suffix that contains the suggested changes. This does
91not require any external programs.
92
93If neither C<--patch> or C<--copy> are given, the default is to
94simply print the diffs for each file. This requires either
95C<Text::Diff> or a C<diff> program to be installed.
96
97=head2 --diff=I<program>
98
99Manually set the diff program and options to use. The default
100is to use C<Text::Diff>, when installed, and output unified
101context diffs.
102
103=head2 --compat-version=I<version>
104
105Tell F<ppport.h> to check for compatibility with the given
106Perl version. The default is to check for compatibility with Perl
107version __MIN_PERL__. You can use this option to reduce the output
108of F<ppport.h> if you intend to be backward compatible only
0d0f8426 109down to a certain Perl version.
adfe19db 110
111=head2 --cplusplus
112
113Usually, F<ppport.h> will detect C++ style comments and
114replace them with C style comments for portability reasons.
115Using this option instructs F<ppport.h> to leave C++
116comments untouched.
117
118=head2 --quiet
119
120Be quiet. Don't print anything except fatal errors.
121
122=head2 --nodiag
123
124Don't output any diagnostic messages. Only portability
125alerts will be printed.
126
127=head2 --nohints
128
129Don't output any hints. Hints often contain useful portability
130notes.
131
132=head2 --nochanges
133
134Don't suggest any changes. Only give diagnostic output and hints
135unless these are also deactivated.
136
4a582685 137=head2 --nofilter
138
139Don't filter the list of input files. By default, files not looking
140like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
141
0d0f8426 142=head2 --strip
143
144Strip all script and documentation functionality from F<ppport.h>.
145This reduces the size of F<ppport.h> dramatically and may be useful
146if you want to include F<ppport.h> in smaller modules without
147increasing their distribution size too much.
148
78b4ff79 149The stripped F<ppport.h> will have a C<--unstrip> option that allows
150you to undo the stripping, but only if an appropriate C<Devel::PPPort>
151module is installed.
152
adfe19db 153=head2 --list-provided
154
155Lists the API elements for which compatibility is provided by
156F<ppport.h>. Also lists if it must be explicitly requested,
157if it has dependencies, and if there are hints for it.
158
159=head2 --list-unsupported
160
161Lists the API elements that are known not to be supported by
162F<ppport.h> and below which version of Perl they probably
163won't be available or work.
164
04fc8b94 165=head2 --api-info=I<name>
166
167Show portability information for API elements matching I<name>.
9132e1a3 168If I<name> is surrounded by slashes, it is interpreted as a regular
169expression.
04fc8b94 170
adfe19db 171=head1 DESCRIPTION
172
173In order for a Perl extension (XS) module to be as portable as possible
174across differing versions of Perl itself, certain steps need to be taken.
175
176=over 4
177
178=item *
179
180Including this header is the first major one. This alone will give you
181access to a large part of the Perl API that hasn't been available in
182earlier Perl releases. Use
183
184 perl ppport.h --list-provided
185
186to see which API elements are provided by ppport.h.
187
188=item *
189
190You should avoid using deprecated parts of the API. For example, using
191global Perl variables without the C<PL_> prefix is deprecated. Also,
192some API functions used to have a C<perl_> prefix. Using this form is
193also deprecated. You can safely use the supported API, as F<ppport.h>
194will provide wrappers for older Perl versions.
195
196=item *
197
0d0f8426 198If you use one of a few functions or variables that were not present in
199earlier versions of Perl, and that can't be provided using a macro, you
200have to explicitly request support for these functions by adding one or
adfe19db 201more C<#define>s in your source code before the inclusion of F<ppport.h>.
202
0d0f8426 203These functions or variables will be marked C<explicit> in the list shown
204by C<--list-provided>.
adfe19db 205
206Depending on whether you module has a single or multiple files that
0d0f8426 207use such functions or variables, you want either C<static> or global
208variants.
adfe19db 209
0d0f8426 210For a C<static> function or variable (used only in a single source
211file), use:
adfe19db 212
213 #define NEED_function
0d0f8426 214 #define NEED_variable
adfe19db 215
0d0f8426 216For a global function or variable (used in multiple source files),
217use:
adfe19db 218
219 #define NEED_function_GLOBAL
0d0f8426 220 #define NEED_variable_GLOBAL
adfe19db 221
0d0f8426 222Note that you mustn't have more than one global request for the
223same function or variable in your project.
adfe19db 224
225 __EXPLICIT_API__
226
227To avoid namespace conflicts, you can change the namespace of the
0d0f8426 228explicitly exported functions / variables using the C<DPPP_NAMESPACE>
229macro. Just C<#define> the macro before including C<ppport.h>:
adfe19db 230
231 #define DPPP_NAMESPACE MyOwnNamespace_
232 #include "ppport.h"
233
234The default namespace is C<DPPP_>.
235
236=back
237
238The good thing is that most of the above can be checked by running
239F<ppport.h> on your source code. See the next section for
240details.
241
242=head1 EXAMPLES
243
244To verify whether F<ppport.h> is needed for your module, whether you
245should make any changes to your code, and whether any special defines
246should be used, F<ppport.h> can be run as a Perl script to check your
247source code. Simply say:
248
249 perl ppport.h
250
251The result will usually be a list of patches suggesting changes
252that should at least be acceptable, if not necessarily the most
253efficient solution, or a fix for all possible problems.
254
255If you know that your XS module uses features only available in
256newer Perl releases, if you're aware that it uses C++ comments,
257and if you want all suggestions as a single patch file, you could
258use something like this:
259
260 perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
261
262If you only want your code to be scanned without any suggestions
263for changes, use:
264
265 perl ppport.h --nochanges
266
267You can specify a different C<diff> program or options, using
268the C<--diff> option:
269
270 perl ppport.h --diff='diff -C 10'
271
272This would output context diffs with 10 lines of context.
273
9132e1a3 274To display portability information for the C<newSVpvn> function,
275use:
276
277 perl ppport.h --api-info=newSVpvn
278
279Since the argument to C<--api-info> can be a regular expression,
280you can use
281
282 perl ppport.h --api-info=/_nomg$/
283
284to display portability information for all C<_nomg> functions or
285
286 perl ppport.h --api-info=/./
287
288to display information for all known API elements.
289
adfe19db 290=head1 BUGS
291
292If this version of F<ppport.h> is causing failure during
293the compilation of this module, please check if newer versions
294of either this module or C<Devel::PPPort> are available on CPAN
295before sending a bug report.
296
297If F<ppport.h> was generated using the latest version of
298C<Devel::PPPort> and is causing failure of this module, please
299file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
300
301Please include the following information:
302
303=over 4
304
305=item 1.
306
307The complete output from running "perl -V"
308
309=item 2.
310
311This file.
312
313=item 3.
314
315The name and version of the module you were trying to build.
316
317=item 4.
318
319A full log of the build that failed.
320
321=item 5.
322
323Any other information that you think could be relevant.
324
325=back
326
327For the latest version of this code, please get the C<Devel::PPPort>
328module from CPAN.
329
330=head1 COPYRIGHT
331
d2dacc4f 332Version 3.x, Copyright (c) 2004-2007, Marcus Holland-Moritz.
adfe19db 333
334Version 2.x, Copyright (C) 2001, Paul Marquess.
335
336Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
337
338This program is free software; you can redistribute it and/or
339modify it under the same terms as Perl itself.
340
341=head1 SEE ALSO
342
343See L<Devel::PPPort>.
344
c07deaaf 345=cut
346