Upgrade ppport.h from 3.16 to 3.17.
[gitmo/Class-MOP.git] / ppport.h
1 #if 0
2 <<'SKIP';
3 #endif
4 /*
5 ----------------------------------------------------------------------
6
7     ppport.h -- Perl/Pollution/Portability Version 3.17
8
9     Automatically created by Devel::PPPort running under perl 5.010000.
10
11     Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
12     includes in parts/inc/ instead.
13
14     Use 'perldoc ppport.h' to view the documentation below.
15
16 ----------------------------------------------------------------------
17
18 SKIP
19
20 =pod
21
22 =head1 NAME
23
24 ppport.h - Perl/Pollution/Portability version 3.17
25
26 =head1 SYNOPSIS
27
28   perl ppport.h [options] [source files]
29
30   Searches current directory for files if no [source files] are given
31
32   --help                      show short help
33
34   --version                   show version
35
36   --patch=file                write one patch file with changes
37   --copy=suffix               write changed copies with suffix
38   --diff=program              use diff program and options
39
40   --compat-version=version    provide compatibility with Perl version
41   --cplusplus                 accept C++ comments
42
43   --quiet                     don't output anything except fatal errors
44   --nodiag                    don't show diagnostics
45   --nohints                   don't show hints
46   --nochanges                 don't suggest changes
47   --nofilter                  don't filter input files
48
49   --strip                     strip all script and doc functionality from
50                               ppport.h
51
52   --list-provided             list provided API
53   --list-unsupported          list unsupported API
54   --api-info=name             show Perl API portability information
55
56 =head1 COMPATIBILITY
57
58 This version of F<ppport.h> is designed to support operation with Perl
59 installations back to 5.003, and has been tested up to 5.10.0.
60
61 =head1 OPTIONS
62
63 =head2 --help
64
65 Display a brief usage summary.
66
67 =head2 --version
68
69 Display the version of F<ppport.h>.
70
71 =head2 --patch=I<file>
72
73 If this option is given, a single patch file will be created if
74 any changes are suggested. This requires a working diff program
75 to be installed on your system.
76
77 =head2 --copy=I<suffix>
78
79 If this option is given, a copy of each file will be saved with
80 the given suffix that contains the suggested changes. This does
81 not require any external programs. Note that this does not
82 automagially add a dot between the original filename and the
83 suffix. If you want the dot, you have to include it in the option
84 argument.
85
86 If neither C<--patch> or C<--copy> are given, the default is to
87 simply print the diffs for each file. This requires either
88 C<Text::Diff> or a C<diff> program to be installed.
89
90 =head2 --diff=I<program>
91
92 Manually set the diff program and options to use. The default
93 is to use C<Text::Diff>, when installed, and output unified
94 context diffs.
95
96 =head2 --compat-version=I<version>
97
98 Tell F<ppport.h> to check for compatibility with the given
99 Perl version. The default is to check for compatibility with Perl
100 version 5.003. You can use this option to reduce the output
101 of F<ppport.h> if you intend to be backward compatible only
102 down to a certain Perl version.
103
104 =head2 --cplusplus
105
106 Usually, F<ppport.h> will detect C++ style comments and
107 replace them with C style comments for portability reasons.
108 Using this option instructs F<ppport.h> to leave C++
109 comments untouched.
110
111 =head2 --quiet
112
113 Be quiet. Don't print anything except fatal errors.
114
115 =head2 --nodiag
116
117 Don't output any diagnostic messages. Only portability
118 alerts will be printed.
119
120 =head2 --nohints
121
122 Don't output any hints. Hints often contain useful portability
123 notes. Warnings will still be displayed.
124
125 =head2 --nochanges
126
127 Don't suggest any changes. Only give diagnostic output and hints
128 unless these are also deactivated.
129
130 =head2 --nofilter
131
132 Don't filter the list of input files. By default, files not looking
133 like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
134
135 =head2 --strip
136
137 Strip all script and documentation functionality from F<ppport.h>.
138 This reduces the size of F<ppport.h> dramatically and may be useful
139 if you want to include F<ppport.h> in smaller modules without
140 increasing their distribution size too much.
141
142 The stripped F<ppport.h> will have a C<--unstrip> option that allows
143 you to undo the stripping, but only if an appropriate C<Devel::PPPort>
144 module is installed.
145
146 =head2 --list-provided
147
148 Lists the API elements for which compatibility is provided by
149 F<ppport.h>. Also lists if it must be explicitly requested,
150 if it has dependencies, and if there are hints or warnings for it.
151
152 =head2 --list-unsupported
153
154 Lists the API elements that are known not to be supported by
155 F<ppport.h> and below which version of Perl they probably
156 won't be available or work.
157
158 =head2 --api-info=I<name>
159
160 Show portability information for API elements matching I<name>.
161 If I<name> is surrounded by slashes, it is interpreted as a regular
162 expression.
163
164 =head1 DESCRIPTION
165
166 In order for a Perl extension (XS) module to be as portable as possible
167 across differing versions of Perl itself, certain steps need to be taken.
168
169 =over 4
170
171 =item *
172
173 Including this header is the first major one. This alone will give you
174 access to a large part of the Perl API that hasn't been available in
175 earlier Perl releases. Use
176
177     perl ppport.h --list-provided
178
179 to see which API elements are provided by ppport.h.
180
181 =item *
182
183 You should avoid using deprecated parts of the API. For example, using
184 global Perl variables without the C<PL_> prefix is deprecated. Also,
185 some API functions used to have a C<perl_> prefix. Using this form is
186 also deprecated. You can safely use the supported API, as F<ppport.h>
187 will provide wrappers for older Perl versions.
188
189 =item *
190
191 If you use one of a few functions or variables that were not present in
192 earlier versions of Perl, and that can't be provided using a macro, you
193 have to explicitly request support for these functions by adding one or
194 more C<#define>s in your source code before the inclusion of F<ppport.h>.
195
196 These functions or variables will be marked C<explicit> in the list shown
197 by C<--list-provided>.
198
199 Depending on whether you module has a single or multiple files that
200 use such functions or variables, you want either C<static> or global
201 variants.
202
203 For a C<static> function or variable (used only in a single source
204 file), use:
205
206     #define NEED_function
207     #define NEED_variable
208
209 For a global function or variable (used in multiple source files),
210 use:
211
212     #define NEED_function_GLOBAL
213     #define NEED_variable_GLOBAL
214
215 Note that you mustn't have more than one global request for the
216 same function or variable in your project.
217
218     Function / Variable       Static Request               Global Request
219     -----------------------------------------------------------------------------------------
220     PL_parser                 NEED_PL_parser               NEED_PL_parser_GLOBAL
221     PL_signals                NEED_PL_signals              NEED_PL_signals_GLOBAL
222     eval_pv()                 NEED_eval_pv                 NEED_eval_pv_GLOBAL
223     grok_bin()                NEED_grok_bin                NEED_grok_bin_GLOBAL
224     grok_hex()                NEED_grok_hex                NEED_grok_hex_GLOBAL
225     grok_number()             NEED_grok_number             NEED_grok_number_GLOBAL
226     grok_numeric_radix()      NEED_grok_numeric_radix      NEED_grok_numeric_radix_GLOBAL
227     grok_oct()                NEED_grok_oct                NEED_grok_oct_GLOBAL
228     load_module()             NEED_load_module             NEED_load_module_GLOBAL
229     my_snprintf()             NEED_my_snprintf             NEED_my_snprintf_GLOBAL
230     my_sprintf()              NEED_my_sprintf              NEED_my_sprintf_GLOBAL
231     my_strlcat()              NEED_my_strlcat              NEED_my_strlcat_GLOBAL
232     my_strlcpy()              NEED_my_strlcpy              NEED_my_strlcpy_GLOBAL
233     newCONSTSUB()             NEED_newCONSTSUB             NEED_newCONSTSUB_GLOBAL
234     newRV_noinc()             NEED_newRV_noinc             NEED_newRV_noinc_GLOBAL
235     newSVpvn_flags()          NEED_newSVpvn_flags          NEED_newSVpvn_flags_GLOBAL
236     newSVpvn_share()          NEED_newSVpvn_share          NEED_newSVpvn_share_GLOBAL
237     pv_display()              NEED_pv_display              NEED_pv_display_GLOBAL
238     pv_escape()               NEED_pv_escape               NEED_pv_escape_GLOBAL
239     pv_pretty()               NEED_pv_pretty               NEED_pv_pretty_GLOBAL
240     sv_2pv_flags()            NEED_sv_2pv_flags            NEED_sv_2pv_flags_GLOBAL
241     sv_2pvbyte()              NEED_sv_2pvbyte              NEED_sv_2pvbyte_GLOBAL
242     sv_catpvf_mg()            NEED_sv_catpvf_mg            NEED_sv_catpvf_mg_GLOBAL
243     sv_catpvf_mg_nocontext()  NEED_sv_catpvf_mg_nocontext  NEED_sv_catpvf_mg_nocontext_GLOBAL
244     sv_pvn_force_flags()      NEED_sv_pvn_force_flags      NEED_sv_pvn_force_flags_GLOBAL
245     sv_setpvf_mg()            NEED_sv_setpvf_mg            NEED_sv_setpvf_mg_GLOBAL
246     sv_setpvf_mg_nocontext()  NEED_sv_setpvf_mg_nocontext  NEED_sv_setpvf_mg_nocontext_GLOBAL
247     vload_module()            NEED_vload_module            NEED_vload_module_GLOBAL
248     vnewSVpvf()               NEED_vnewSVpvf               NEED_vnewSVpvf_GLOBAL
249     warner()                  NEED_warner                  NEED_warner_GLOBAL
250
251 To avoid namespace conflicts, you can change the namespace of the
252 explicitly exported functions / variables using the C<DPPP_NAMESPACE>
253 macro. Just C<#define> the macro before including C<ppport.h>:
254
255     #define DPPP_NAMESPACE MyOwnNamespace_
256     #include "ppport.h"
257
258 The default namespace is C<DPPP_>.
259
260 =back
261
262 The good thing is that most of the above can be checked by running
263 F<ppport.h> on your source code. See the next section for
264 details.
265
266 =head1 EXAMPLES
267
268 To verify whether F<ppport.h> is needed for your module, whether you
269 should make any changes to your code, and whether any special defines
270 should be used, F<ppport.h> can be run as a Perl script to check your
271 source code. Simply say:
272
273     perl ppport.h
274
275 The result will usually be a list of patches suggesting changes
276 that should at least be acceptable, if not necessarily the most
277 efficient solution, or a fix for all possible problems.
278
279 If you know that your XS module uses features only available in
280 newer Perl releases, if you're aware that it uses C++ comments,
281 and if you want all suggestions as a single patch file, you could
282 use something like this:
283
284     perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
285
286 If you only want your code to be scanned without any suggestions
287 for changes, use:
288
289     perl ppport.h --nochanges
290
291 You can specify a different C<diff> program or options, using
292 the C<--diff> option:
293
294     perl ppport.h --diff='diff -C 10'
295
296 This would output context diffs with 10 lines of context.
297
298 If you want to create patched copies of your files instead, use:
299
300     perl ppport.h --copy=.new
301
302 To display portability information for the C<newSVpvn> function,
303 use:
304
305     perl ppport.h --api-info=newSVpvn
306
307 Since the argument to C<--api-info> can be a regular expression,
308 you can use
309
310     perl ppport.h --api-info=/_nomg$/
311
312 to display portability information for all C<_nomg> functions or
313
314     perl ppport.h --api-info=/./
315
316 to display information for all known API elements.
317
318 =head1 BUGS
319
320 If this version of F<ppport.h> is causing failure during
321 the compilation of this module, please check if newer versions
322 of either this module or C<Devel::PPPort> are available on CPAN
323 before sending a bug report.
324
325 If F<ppport.h> was generated using the latest version of
326 C<Devel::PPPort> and is causing failure of this module, please
327 file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
328
329 Please include the following information:
330
331 =over 4
332
333 =item 1.
334
335 The complete output from running "perl -V"
336
337 =item 2.
338
339 This file.
340
341 =item 3.
342
343 The name and version of the module you were trying to build.
344
345 =item 4.
346
347 A full log of the build that failed.
348
349 =item 5.
350
351 Any other information that you think could be relevant.
352
353 =back
354
355 For the latest version of this code, please get the C<Devel::PPPort>
356 module from CPAN.
357
358 =head1 COPYRIGHT
359
360 Version 3.x, Copyright (c) 2004-2009, Marcus Holland-Moritz.
361
362 Version 2.x, Copyright (C) 2001, Paul Marquess.
363
364 Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
365
366 This program is free software; you can redistribute it and/or
367 modify it under the same terms as Perl itself.
368
369 =head1 SEE ALSO
370
371 See L<Devel::PPPort>.
372
373 =cut
374
375 use strict;
376
377 # Disable broken TRIE-optimization
378 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
379
380 my $VERSION = 3.17;
381
382 my %opt = (
383   quiet     => 0,
384   diag      => 1,
385   hints     => 1,
386   changes   => 1,
387   cplusplus => 0,
388   filter    => 1,
389   strip     => 0,
390   version   => 0,
391 );
392
393 my($ppport) = $0 =~ /([\w.]+)$/;
394 my $LF = '(?:\r\n|[\r\n])';   # line feed
395 my $HS = "[ \t]";             # horizontal whitespace
396
397 # Never use C comments in this file!
398 my $ccs  = '/'.'*';
399 my $cce  = '*'.'/';
400 my $rccs = quotemeta $ccs;
401 my $rcce = quotemeta $cce;
402
403 eval {
404   require Getopt::Long;
405   Getopt::Long::GetOptions(\%opt, qw(
406     help quiet diag! filter! hints! changes! cplusplus strip version
407     patch=s copy=s diff=s compat-version=s
408     list-provided list-unsupported api-info=s
409   )) or usage();
410 };
411
412 if ($@ and grep /^-/, @ARGV) {
413   usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
414   die "Getopt::Long not found. Please don't use any options.\n";
415 }
416
417 if ($opt{version}) {
418   print "This is $0 $VERSION.\n";
419   exit 0;
420 }
421
422 usage() if $opt{help};
423 strip() if $opt{strip};
424
425 if (exists $opt{'compat-version'}) {
426   my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) };
427   if ($@) {
428     die "Invalid version number format: '$opt{'compat-version'}'\n";
429   }
430   die "Only Perl 5 is supported\n" if $r != 5;
431   die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000;
432   $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s;
433 }
434 else {
435   $opt{'compat-version'} = 5;
436 }
437
438 my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/
439                 ? ( $1 => {
440                       ($2                  ? ( base     => $2 ) : ()),
441                       ($3                  ? ( todo     => $3 ) : ()),
442                       (index($4, 'v') >= 0 ? ( varargs  => 1  ) : ()),
443                       (index($4, 'p') >= 0 ? ( provided => 1  ) : ()),
444                       (index($4, 'n') >= 0 ? ( nothxarg => 1  ) : ()),
445                     } )
446                 : die "invalid spec: $_" } qw(
447 AvFILLp|5.004050||p
448 AvFILL|||
449 CLASS|||n
450 CPERLscope|5.005000||p
451 CX_CURPAD_SAVE|||
452 CX_CURPAD_SV|||
453 CopFILEAV|5.006000||p
454 CopFILEGV_set|5.006000||p
455 CopFILEGV|5.006000||p
456 CopFILESV|5.006000||p
457 CopFILE_set|5.006000||p
458 CopFILE|5.006000||p
459 CopSTASHPV_set|5.006000||p
460 CopSTASHPV|5.006000||p
461 CopSTASH_eq|5.006000||p
462 CopSTASH_set|5.006000||p
463 CopSTASH|5.006000||p
464 CopyD|5.009002||p
465 Copy|||
466 CvPADLIST|||
467 CvSTASH|||
468 CvWEAKOUTSIDE|||
469 DEFSV_set|5.011000||p
470 DEFSV|5.004050||p
471 END_EXTERN_C|5.005000||p
472 ENTER|||
473 ERRSV|5.004050||p
474 EXTEND|||
475 EXTERN_C|5.005000||p
476 F0convert|||n
477 FREETMPS|||
478 GIMME_V||5.004000|n
479 GIMME|||n
480 GROK_NUMERIC_RADIX|5.007002||p
481 G_ARRAY|||
482 G_DISCARD|||
483 G_EVAL|||
484 G_METHOD|5.006001||p
485 G_NOARGS|||
486 G_SCALAR|||
487 G_VOID||5.004000|
488 GetVars|||
489 GvSV|||
490 Gv_AMupdate|||
491 HEf_SVKEY||5.004000|
492 HeHASH||5.004000|
493 HeKEY||5.004000|
494 HeKLEN||5.004000|
495 HePV||5.004000|
496 HeSVKEY_force||5.004000|
497 HeSVKEY_set||5.004000|
498 HeSVKEY||5.004000|
499 HeUTF8||5.011000|
500 HeVAL||5.004000|
501 HvNAME|||
502 INT2PTR|5.006000||p
503 IN_LOCALE_COMPILETIME|5.007002||p
504 IN_LOCALE_RUNTIME|5.007002||p
505 IN_LOCALE|5.007002||p
506 IN_PERL_COMPILETIME|5.008001||p
507 IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p
508 IS_NUMBER_INFINITY|5.007002||p
509 IS_NUMBER_IN_UV|5.007002||p
510 IS_NUMBER_NAN|5.007003||p
511 IS_NUMBER_NEG|5.007002||p
512 IS_NUMBER_NOT_INT|5.007002||p
513 IVSIZE|5.006000||p
514 IVTYPE|5.006000||p
515 IVdf|5.006000||p
516 LEAVE|||
517 LVRET|||
518 MARK|||
519 MULTICALL||5.011000|
520 MY_CXT_CLONE|5.009002||p
521 MY_CXT_INIT|5.007003||p
522 MY_CXT|5.007003||p
523 MoveD|5.009002||p
524 Move|||
525 NOOP|5.005000||p
526 NUM2PTR|5.006000||p
527 NVTYPE|5.006000||p
528 NVef|5.006001||p
529 NVff|5.006001||p
530 NVgf|5.006001||p
531 Newxc|5.009003||p
532 Newxz|5.009003||p
533 Newx|5.009003||p
534 Nullav|||
535 Nullch|||
536 Nullcv|||
537 Nullhv|||
538 Nullsv|||
539 ORIGMARK|||
540 PAD_BASE_SV|||
541 PAD_CLONE_VARS|||
542 PAD_COMPNAME_FLAGS|||
543 PAD_COMPNAME_GEN_set|||
544 PAD_COMPNAME_GEN|||
545 PAD_COMPNAME_OURSTASH|||
546 PAD_COMPNAME_PV|||
547 PAD_COMPNAME_TYPE|||
548 PAD_DUP|||
549 PAD_RESTORE_LOCAL|||
550 PAD_SAVE_LOCAL|||
551 PAD_SAVE_SETNULLPAD|||
552 PAD_SETSV|||
553 PAD_SET_CUR_NOSAVE|||
554 PAD_SET_CUR|||
555 PAD_SVl|||
556 PAD_SV|||
557 PERLIO_FUNCS_CAST|5.009003||p
558 PERLIO_FUNCS_DECL|5.009003||p
559 PERL_ABS|5.008001||p
560 PERL_BCDVERSION|5.011000||p
561 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
562 PERL_HASH|5.004000||p
563 PERL_INT_MAX|5.004000||p
564 PERL_INT_MIN|5.004000||p
565 PERL_LONG_MAX|5.004000||p
566 PERL_LONG_MIN|5.004000||p
567 PERL_MAGIC_arylen|5.007002||p
568 PERL_MAGIC_backref|5.007002||p
569 PERL_MAGIC_bm|5.007002||p
570 PERL_MAGIC_collxfrm|5.007002||p
571 PERL_MAGIC_dbfile|5.007002||p
572 PERL_MAGIC_dbline|5.007002||p
573 PERL_MAGIC_defelem|5.007002||p
574 PERL_MAGIC_envelem|5.007002||p
575 PERL_MAGIC_env|5.007002||p
576 PERL_MAGIC_ext|5.007002||p
577 PERL_MAGIC_fm|5.007002||p
578 PERL_MAGIC_glob|5.011000||p
579 PERL_MAGIC_isaelem|5.007002||p
580 PERL_MAGIC_isa|5.007002||p
581 PERL_MAGIC_mutex|5.011000||p
582 PERL_MAGIC_nkeys|5.007002||p
583 PERL_MAGIC_overload_elem|5.007002||p
584 PERL_MAGIC_overload_table|5.007002||p
585 PERL_MAGIC_overload|5.007002||p
586 PERL_MAGIC_pos|5.007002||p
587 PERL_MAGIC_qr|5.007002||p
588 PERL_MAGIC_regdata|5.007002||p
589 PERL_MAGIC_regdatum|5.007002||p
590 PERL_MAGIC_regex_global|5.007002||p
591 PERL_MAGIC_shared_scalar|5.007003||p
592 PERL_MAGIC_shared|5.007003||p
593 PERL_MAGIC_sigelem|5.007002||p
594 PERL_MAGIC_sig|5.007002||p
595 PERL_MAGIC_substr|5.007002||p
596 PERL_MAGIC_sv|5.007002||p
597 PERL_MAGIC_taint|5.007002||p
598 PERL_MAGIC_tiedelem|5.007002||p
599 PERL_MAGIC_tiedscalar|5.007002||p
600 PERL_MAGIC_tied|5.007002||p
601 PERL_MAGIC_utf8|5.008001||p
602 PERL_MAGIC_uvar_elem|5.007003||p
603 PERL_MAGIC_uvar|5.007002||p
604 PERL_MAGIC_vec|5.007002||p
605 PERL_MAGIC_vstring|5.008001||p
606 PERL_PV_ESCAPE_ALL|5.009004||p
607 PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p
608 PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p
609 PERL_PV_ESCAPE_NOCLEAR|5.009004||p
610 PERL_PV_ESCAPE_QUOTE|5.009004||p
611 PERL_PV_ESCAPE_RE|5.009005||p
612 PERL_PV_ESCAPE_UNI_DETECT|5.009004||p
613 PERL_PV_ESCAPE_UNI|5.009004||p
614 PERL_PV_PRETTY_DUMP|5.009004||p
615 PERL_PV_PRETTY_ELLIPSES|5.010000||p
616 PERL_PV_PRETTY_LTGT|5.009004||p
617 PERL_PV_PRETTY_NOCLEAR|5.010000||p
618 PERL_PV_PRETTY_QUOTE|5.009004||p
619 PERL_PV_PRETTY_REGPROP|5.009004||p
620 PERL_QUAD_MAX|5.004000||p
621 PERL_QUAD_MIN|5.004000||p
622 PERL_REVISION|5.006000||p
623 PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p
624 PERL_SCAN_DISALLOW_PREFIX|5.007003||p
625 PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p
626 PERL_SCAN_SILENT_ILLDIGIT|5.008001||p
627 PERL_SHORT_MAX|5.004000||p
628 PERL_SHORT_MIN|5.004000||p
629 PERL_SIGNALS_UNSAFE_FLAG|5.008001||p
630 PERL_SUBVERSION|5.006000||p
631 PERL_UCHAR_MAX|5.004000||p
632 PERL_UCHAR_MIN|5.004000||p
633 PERL_UINT_MAX|5.004000||p
634 PERL_UINT_MIN|5.004000||p
635 PERL_ULONG_MAX|5.004000||p
636 PERL_ULONG_MIN|5.004000||p
637 PERL_UNUSED_ARG|5.009003||p
638 PERL_UNUSED_CONTEXT|5.009004||p
639 PERL_UNUSED_DECL|5.007002||p
640 PERL_UNUSED_VAR|5.007002||p
641 PERL_UQUAD_MAX|5.004000||p
642 PERL_UQUAD_MIN|5.004000||p
643 PERL_USE_GCC_BRACE_GROUPS|5.009004||p
644 PERL_USHORT_MAX|5.004000||p
645 PERL_USHORT_MIN|5.004000||p
646 PERL_VERSION|5.006000||p
647 PL_DBsignal|5.005000||p
648 PL_DBsingle|||pn
649 PL_DBsub|||pn
650 PL_DBtrace|||pn
651 PL_Sv|5.005000||p
652 PL_bufend|5.011000||p
653 PL_bufptr|5.011000||p
654 PL_compiling|5.004050||p
655 PL_copline|5.011000||p
656 PL_curcop|5.004050||p
657 PL_curstash|5.004050||p
658 PL_debstash|5.004050||p
659 PL_defgv|5.004050||p
660 PL_diehook|5.004050||p
661 PL_dirty|5.004050||p
662 PL_dowarn|||pn
663 PL_errgv|5.004050||p
664 PL_expect|5.011000||p
665 PL_hexdigit|5.005000||p
666 PL_hints|5.005000||p
667 PL_last_in_gv|||n
668 PL_laststatval|5.005000||p
669 PL_lex_state|5.011000||p
670 PL_lex_stuff|5.011000||p
671 PL_linestr|5.011000||p
672 PL_modglobal||5.005000|n
673 PL_na|5.004050||pn
674 PL_no_modify|5.006000||p
675 PL_ofsgv|||n
676 PL_parser|5.009005||p
677 PL_perl_destruct_level|5.004050||p
678 PL_perldb|5.004050||p
679 PL_ppaddr|5.006000||p
680 PL_rsfp_filters|5.004050||p
681 PL_rsfp|5.004050||p
682 PL_rs|||n
683 PL_signals|5.008001||p
684 PL_stack_base|5.004050||p
685 PL_stack_sp|5.004050||p
686 PL_statcache|5.005000||p
687 PL_stdingv|5.004050||p
688 PL_sv_arenaroot|5.004050||p
689 PL_sv_no|5.004050||pn
690 PL_sv_undef|5.004050||pn
691 PL_sv_yes|5.004050||pn
692 PL_tainted|5.004050||p
693 PL_tainting|5.004050||p
694 PL_tokenbuf|5.011000||p
695 POP_MULTICALL||5.011000|
696 POPi|||n
697 POPl|||n
698 POPn|||n
699 POPpbytex||5.007001|n
700 POPpx||5.005030|n
701 POPp|||n
702 POPs|||n
703 PTR2IV|5.006000||p
704 PTR2NV|5.006000||p
705 PTR2UV|5.006000||p
706 PTR2nat|5.009003||p
707 PTR2ul|5.007001||p
708 PTRV|5.006000||p
709 PUSHMARK|||
710 PUSH_MULTICALL||5.011000|
711 PUSHi|||
712 PUSHmortal|5.009002||p
713 PUSHn|||
714 PUSHp|||
715 PUSHs|||
716 PUSHu|5.004000||p
717 PUTBACK|||
718 PerlIO_clearerr||5.007003|
719 PerlIO_close||5.007003|
720 PerlIO_context_layers||5.009004|
721 PerlIO_eof||5.007003|
722 PerlIO_error||5.007003|
723 PerlIO_fileno||5.007003|
724 PerlIO_fill||5.007003|
725 PerlIO_flush||5.007003|
726 PerlIO_get_base||5.007003|
727 PerlIO_get_bufsiz||5.007003|
728 PerlIO_get_cnt||5.007003|
729 PerlIO_get_ptr||5.007003|
730 PerlIO_read||5.007003|
731 PerlIO_seek||5.007003|
732 PerlIO_set_cnt||5.007003|
733 PerlIO_set_ptrcnt||5.007003|
734 PerlIO_setlinebuf||5.007003|
735 PerlIO_stderr||5.007003|
736 PerlIO_stdin||5.007003|
737 PerlIO_stdout||5.007003|
738 PerlIO_tell||5.007003|
739 PerlIO_unread||5.007003|
740 PerlIO_write||5.007003|
741 Perl_signbit||5.009005|n
742 PoisonFree|5.009004||p
743 PoisonNew|5.009004||p
744 PoisonWith|5.009004||p
745 Poison|5.008000||p
746 RETVAL|||n
747 Renewc|||
748 Renew|||
749 SAVECLEARSV|||
750 SAVECOMPPAD|||
751 SAVEPADSV|||
752 SAVETMPS|||
753 SAVE_DEFSV|5.004050||p
754 SPAGAIN|||
755 SP|||
756 START_EXTERN_C|5.005000||p
757 START_MY_CXT|5.007003||p
758 STMT_END|||p
759 STMT_START|||p
760 STR_WITH_LEN|5.009003||p
761 ST|||
762 SV_CONST_RETURN|5.009003||p
763 SV_COW_DROP_PV|5.008001||p
764 SV_COW_SHARED_HASH_KEYS|5.009005||p
765 SV_GMAGIC|5.007002||p
766 SV_HAS_TRAILING_NUL|5.009004||p
767 SV_IMMEDIATE_UNREF|5.007001||p
768 SV_MUTABLE_RETURN|5.009003||p
769 SV_NOSTEAL|5.009002||p
770 SV_SMAGIC|5.009003||p
771 SV_UTF8_NO_ENCODING|5.008001||p
772 SVf_UTF8|5.006000||p
773 SVf|5.006000||p
774 SVt_IV|||
775 SVt_NV|||
776 SVt_PVAV|||
777 SVt_PVCV|||
778 SVt_PVHV|||
779 SVt_PVMG|||
780 SVt_PV|||
781 Safefree|||
782 Slab_Alloc|||
783 Slab_Free|||
784 Slab_to_rw|||
785 StructCopy|||
786 SvCUR_set|||
787 SvCUR|||
788 SvEND|||
789 SvGAMAGIC||5.006001|
790 SvGETMAGIC|5.004050||p
791 SvGROW|||
792 SvIOK_UV||5.006000|
793 SvIOK_notUV||5.006000|
794 SvIOK_off|||
795 SvIOK_only_UV||5.006000|
796 SvIOK_only|||
797 SvIOK_on|||
798 SvIOKp|||
799 SvIOK|||
800 SvIVX|||
801 SvIV_nomg|5.009001||p
802 SvIV_set|||
803 SvIVx|||
804 SvIV|||
805 SvIsCOW_shared_hash||5.008003|
806 SvIsCOW||5.008003|
807 SvLEN_set|||
808 SvLEN|||
809 SvLOCK||5.007003|
810 SvMAGIC_set|5.009003||p
811 SvNIOK_off|||
812 SvNIOKp|||
813 SvNIOK|||
814 SvNOK_off|||
815 SvNOK_only|||
816 SvNOK_on|||
817 SvNOKp|||
818 SvNOK|||
819 SvNVX|||
820 SvNV_set|||
821 SvNVx|||
822 SvNV|||
823 SvOK|||
824 SvOOK_offset||5.011000|
825 SvOOK|||
826 SvPOK_off|||
827 SvPOK_only_UTF8||5.006000|
828 SvPOK_only|||
829 SvPOK_on|||
830 SvPOKp|||
831 SvPOK|||
832 SvPVX_const|5.009003||p
833 SvPVX_mutable|5.009003||p
834 SvPVX|||
835 SvPV_const|5.009003||p
836 SvPV_flags_const_nolen|5.009003||p
837 SvPV_flags_const|5.009003||p
838 SvPV_flags_mutable|5.009003||p
839 SvPV_flags|5.007002||p
840 SvPV_force_flags_mutable|5.009003||p
841 SvPV_force_flags_nolen|5.009003||p
842 SvPV_force_flags|5.007002||p
843 SvPV_force_mutable|5.009003||p
844 SvPV_force_nolen|5.009003||p
845 SvPV_force_nomg_nolen|5.009003||p
846 SvPV_force_nomg|5.007002||p
847 SvPV_force|||p
848 SvPV_mutable|5.009003||p
849 SvPV_nolen_const|5.009003||p
850 SvPV_nolen|5.006000||p
851 SvPV_nomg_const_nolen|5.009003||p
852 SvPV_nomg_const|5.009003||p
853 SvPV_nomg|5.007002||p
854 SvPV_renew|5.009003||p
855 SvPV_set|||
856 SvPVbyte_force||5.009002|
857 SvPVbyte_nolen||5.006000|
858 SvPVbytex_force||5.006000|
859 SvPVbytex||5.006000|
860 SvPVbyte|5.006000||p
861 SvPVutf8_force||5.006000|
862 SvPVutf8_nolen||5.006000|
863 SvPVutf8x_force||5.006000|
864 SvPVutf8x||5.006000|
865 SvPVutf8||5.006000|
866 SvPVx|||
867 SvPV|||
868 SvREFCNT_dec|||
869 SvREFCNT_inc_NN|5.009004||p
870 SvREFCNT_inc_simple_NN|5.009004||p
871 SvREFCNT_inc_simple_void_NN|5.009004||p
872 SvREFCNT_inc_simple_void|5.009004||p
873 SvREFCNT_inc_simple|5.009004||p
874 SvREFCNT_inc_void_NN|5.009004||p
875 SvREFCNT_inc_void|5.009004||p
876 SvREFCNT_inc|||p
877 SvREFCNT|||
878 SvROK_off|||
879 SvROK_on|||
880 SvROK|||
881 SvRV_set|5.009003||p
882 SvRV|||
883 SvRXOK||5.009005|
884 SvRX||5.009005|
885 SvSETMAGIC|||
886 SvSHARED_HASH|5.009003||p
887 SvSHARE||5.007003|
888 SvSTASH_set|5.009003||p
889 SvSTASH|||
890 SvSetMagicSV_nosteal||5.004000|
891 SvSetMagicSV||5.004000|
892 SvSetSV_nosteal||5.004000|
893 SvSetSV|||
894 SvTAINTED_off||5.004000|
895 SvTAINTED_on||5.004000|
896 SvTAINTED||5.004000|
897 SvTAINT|||
898 SvTRUE|||
899 SvTYPE|||
900 SvUNLOCK||5.007003|
901 SvUOK|5.007001|5.006000|p
902 SvUPGRADE|||
903 SvUTF8_off||5.006000|
904 SvUTF8_on||5.006000|
905 SvUTF8||5.006000|
906 SvUVXx|5.004000||p
907 SvUVX|5.004000||p
908 SvUV_nomg|5.009001||p
909 SvUV_set|5.009003||p
910 SvUVx|5.004000||p
911 SvUV|5.004000||p
912 SvVOK||5.008001|
913 SvVSTRING_mg|5.009004||p
914 THIS|||n
915 UNDERBAR|5.009002||p
916 UTF8_MAXBYTES|5.009002||p
917 UVSIZE|5.006000||p
918 UVTYPE|5.006000||p
919 UVXf|5.007001||p
920 UVof|5.006000||p
921 UVuf|5.006000||p
922 UVxf|5.006000||p
923 WARN_ALL|5.006000||p
924 WARN_AMBIGUOUS|5.006000||p
925 WARN_ASSERTIONS|5.011000||p
926 WARN_BAREWORD|5.006000||p
927 WARN_CLOSED|5.006000||p
928 WARN_CLOSURE|5.006000||p
929 WARN_DEBUGGING|5.006000||p
930 WARN_DEPRECATED|5.006000||p
931 WARN_DIGIT|5.006000||p
932 WARN_EXEC|5.006000||p
933 WARN_EXITING|5.006000||p
934 WARN_GLOB|5.006000||p
935 WARN_INPLACE|5.006000||p
936 WARN_INTERNAL|5.006000||p
937 WARN_IO|5.006000||p
938 WARN_LAYER|5.008000||p
939 WARN_MALLOC|5.006000||p
940 WARN_MISC|5.006000||p
941 WARN_NEWLINE|5.006000||p
942 WARN_NUMERIC|5.006000||p
943 WARN_ONCE|5.006000||p
944 WARN_OVERFLOW|5.006000||p
945 WARN_PACK|5.006000||p
946 WARN_PARENTHESIS|5.006000||p
947 WARN_PIPE|5.006000||p
948 WARN_PORTABLE|5.006000||p
949 WARN_PRECEDENCE|5.006000||p
950 WARN_PRINTF|5.006000||p
951 WARN_PROTOTYPE|5.006000||p
952 WARN_QW|5.006000||p
953 WARN_RECURSION|5.006000||p
954 WARN_REDEFINE|5.006000||p
955 WARN_REGEXP|5.006000||p
956 WARN_RESERVED|5.006000||p
957 WARN_SEMICOLON|5.006000||p
958 WARN_SEVERE|5.006000||p
959 WARN_SIGNAL|5.006000||p
960 WARN_SUBSTR|5.006000||p
961 WARN_SYNTAX|5.006000||p
962 WARN_TAINT|5.006000||p
963 WARN_THREADS|5.008000||p
964 WARN_UNINITIALIZED|5.006000||p
965 WARN_UNOPENED|5.006000||p
966 WARN_UNPACK|5.006000||p
967 WARN_UNTIE|5.006000||p
968 WARN_UTF8|5.006000||p
969 WARN_VOID|5.006000||p
970 XCPT_CATCH|5.009002||p
971 XCPT_RETHROW|5.009002||p
972 XCPT_TRY_END|5.009002||p
973 XCPT_TRY_START|5.009002||p
974 XPUSHi|||
975 XPUSHmortal|5.009002||p
976 XPUSHn|||
977 XPUSHp|||
978 XPUSHs|||
979 XPUSHu|5.004000||p
980 XSRETURN_EMPTY|||
981 XSRETURN_IV|||
982 XSRETURN_NO|||
983 XSRETURN_NV|||
984 XSRETURN_PV|||
985 XSRETURN_UNDEF|||
986 XSRETURN_UV|5.008001||p
987 XSRETURN_YES|||
988 XSRETURN|||p
989 XST_mIV|||
990 XST_mNO|||
991 XST_mNV|||
992 XST_mPV|||
993 XST_mUNDEF|||
994 XST_mUV|5.008001||p
995 XST_mYES|||
996 XS_VERSION_BOOTCHECK|||
997 XS_VERSION|||
998 XSprePUSH|5.006000||p
999 XS|||
1000 ZeroD|5.009002||p
1001 Zero|||
1002 _aMY_CXT|5.007003||p
1003 _pMY_CXT|5.007003||p
1004 aMY_CXT_|5.007003||p
1005 aMY_CXT|5.007003||p
1006 aTHXR_|5.011000||p
1007 aTHXR|5.011000||p
1008 aTHX_|5.006000||p
1009 aTHX|5.006000||p
1010 add_data|||n
1011 addmad|||
1012 allocmy|||
1013 amagic_call|||
1014 amagic_cmp_locale|||
1015 amagic_cmp|||
1016 amagic_i_ncmp|||
1017 amagic_ncmp|||
1018 any_dup|||
1019 ao|||
1020 append_elem|||
1021 append_list|||
1022 append_madprops|||
1023 apply_attrs_my|||
1024 apply_attrs_string||5.006001|
1025 apply_attrs|||
1026 apply|||
1027 atfork_lock||5.007003|n
1028 atfork_unlock||5.007003|n
1029 av_arylen_p||5.009003|
1030 av_clear|||
1031 av_create_and_push||5.009005|
1032 av_create_and_unshift_one||5.009005|
1033 av_delete||5.006000|
1034 av_exists||5.006000|
1035 av_extend|||
1036 av_fetch|||
1037 av_fill|||
1038 av_iter_p||5.011000|
1039 av_len|||
1040 av_make|||
1041 av_pop|||
1042 av_push|||
1043 av_reify|||
1044 av_shift|||
1045 av_store|||
1046 av_undef|||
1047 av_unshift|||
1048 ax|||n
1049 bad_type|||
1050 bind_match|||
1051 block_end|||
1052 block_gimme||5.004000|
1053 block_start|||
1054 boolSV|5.004000||p
1055 boot_core_PerlIO|||
1056 boot_core_UNIVERSAL|||
1057 boot_core_mro|||
1058 boot_core_xsutils|||
1059 bytes_from_utf8||5.007001|
1060 bytes_to_uni|||n
1061 bytes_to_utf8||5.006001|
1062 call_argv|5.006000||p
1063 call_atexit||5.006000|
1064 call_list||5.004000|
1065 call_method|5.006000||p
1066 call_pv|5.006000||p
1067 call_sv|5.006000||p
1068 calloc||5.007002|n
1069 cando|||
1070 cast_i32||5.006000|
1071 cast_iv||5.006000|
1072 cast_ulong||5.006000|
1073 cast_uv||5.006000|
1074 check_type_and_open|||
1075 check_uni|||
1076 checkcomma|||
1077 checkposixcc|||
1078 ckWARN|5.006000||p
1079 ck_anoncode|||
1080 ck_bitop|||
1081 ck_concat|||
1082 ck_defined|||
1083 ck_delete|||
1084 ck_die|||
1085 ck_each|||
1086 ck_eof|||
1087 ck_eval|||
1088 ck_exec|||
1089 ck_exists|||
1090 ck_exit|||
1091 ck_ftst|||
1092 ck_fun|||
1093 ck_glob|||
1094 ck_grep|||
1095 ck_index|||
1096 ck_join|||
1097 ck_lfun|||
1098 ck_listiob|||
1099 ck_match|||
1100 ck_method|||
1101 ck_null|||
1102 ck_open|||
1103 ck_readline|||
1104 ck_repeat|||
1105 ck_require|||
1106 ck_return|||
1107 ck_rfun|||
1108 ck_rvconst|||
1109 ck_sassign|||
1110 ck_select|||
1111 ck_shift|||
1112 ck_sort|||
1113 ck_spair|||
1114 ck_split|||
1115 ck_subr|||
1116 ck_substr|||
1117 ck_svconst|||
1118 ck_trunc|||
1119 ck_unpack|||
1120 ckwarn_d||5.009003|
1121 ckwarn||5.009003|
1122 cl_and|||n
1123 cl_anything|||n
1124 cl_init_zero|||n
1125 cl_init|||n
1126 cl_is_anything|||n
1127 cl_or|||n
1128 clear_placeholders|||
1129 closest_cop|||
1130 convert|||
1131 cop_free|||
1132 cr_textfilter|||
1133 create_eval_scope|||
1134 croak_nocontext|||vn
1135 croak_xs_usage||5.011000|
1136 croak|||v
1137 csighandler||5.009003|n
1138 curmad|||
1139 custom_op_desc||5.007003|
1140 custom_op_name||5.007003|
1141 cv_ckproto_len|||
1142 cv_clone|||
1143 cv_const_sv||5.004000|
1144 cv_dump|||
1145 cv_undef|||
1146 cx_dump||5.005000|
1147 cx_dup|||
1148 cxinc|||
1149 dAXMARK|5.009003||p
1150 dAX|5.007002||p
1151 dITEMS|5.007002||p
1152 dMARK|||
1153 dMULTICALL||5.009003|
1154 dMY_CXT_SV|5.007003||p
1155 dMY_CXT|5.007003||p
1156 dNOOP|5.006000||p
1157 dORIGMARK|||
1158 dSP|||
1159 dTHR|5.004050||p
1160 dTHXR|5.011000||p
1161 dTHXa|5.006000||p
1162 dTHXoa|5.006000||p
1163 dTHX|5.006000||p
1164 dUNDERBAR|5.009002||p
1165 dVAR|5.009003||p
1166 dXCPT|5.009002||p
1167 dXSARGS|||
1168 dXSI32|||
1169 dXSTARG|5.006000||p
1170 deb_curcv|||
1171 deb_nocontext|||vn
1172 deb_stack_all|||
1173 deb_stack_n|||
1174 debop||5.005000|
1175 debprofdump||5.005000|
1176 debprof|||
1177 debstackptrs||5.007003|
1178 debstack||5.007003|
1179 debug_start_match|||
1180 deb||5.007003|v
1181 del_sv|||
1182 delete_eval_scope|||
1183 delimcpy||5.004000|
1184 deprecate_old|||
1185 deprecate|||
1186 despatch_signals||5.007001|
1187 destroy_matcher|||
1188 die_nocontext|||vn
1189 die_where|||
1190 die|||v
1191 dirp_dup|||
1192 div128|||
1193 djSP|||
1194 do_aexec5|||
1195 do_aexec|||
1196 do_aspawn|||
1197 do_binmode||5.004050|
1198 do_chomp|||
1199 do_chop|||
1200 do_close|||
1201 do_dump_pad|||
1202 do_eof|||
1203 do_exec3|||
1204 do_execfree|||
1205 do_exec|||
1206 do_gv_dump||5.006000|
1207 do_gvgv_dump||5.006000|
1208 do_hv_dump||5.006000|
1209 do_ipcctl|||
1210 do_ipcget|||
1211 do_join|||
1212 do_kv|||
1213 do_magic_dump||5.006000|
1214 do_msgrcv|||
1215 do_msgsnd|||
1216 do_oddball|||
1217 do_op_dump||5.006000|
1218 do_op_xmldump|||
1219 do_open9||5.006000|
1220 do_openn||5.007001|
1221 do_open||5.004000|
1222 do_pmop_dump||5.006000|
1223 do_pmop_xmldump|||
1224 do_print|||
1225 do_readline|||
1226 do_seek|||
1227 do_semop|||
1228 do_shmio|||
1229 do_smartmatch|||
1230 do_spawn_nowait|||
1231 do_spawn|||
1232 do_sprintf|||
1233 do_sv_dump||5.006000|
1234 do_sysseek|||
1235 do_tell|||
1236 do_trans_complex_utf8|||
1237 do_trans_complex|||
1238 do_trans_count_utf8|||
1239 do_trans_count|||
1240 do_trans_simple_utf8|||
1241 do_trans_simple|||
1242 do_trans|||
1243 do_vecget|||
1244 do_vecset|||
1245 do_vop|||
1246 docatch|||
1247 doeval|||
1248 dofile|||
1249 dofindlabel|||
1250 doform|||
1251 doing_taint||5.008001|n
1252 dooneliner|||
1253 doopen_pm|||
1254 doparseform|||
1255 dopoptoeval|||
1256 dopoptogiven|||
1257 dopoptolabel|||
1258 dopoptoloop|||
1259 dopoptosub_at|||
1260 dopoptowhen|||
1261 doref||5.009003|
1262 dounwind|||
1263 dowantarray|||
1264 dump_all||5.006000|
1265 dump_eval||5.006000|
1266 dump_exec_pos|||
1267 dump_fds|||
1268 dump_form||5.006000|
1269 dump_indent||5.006000|v
1270 dump_mstats|||
1271 dump_packsubs||5.006000|
1272 dump_sub||5.006000|
1273 dump_sv_child|||
1274 dump_trie_interim_list|||
1275 dump_trie_interim_table|||
1276 dump_trie|||
1277 dump_vindent||5.006000|
1278 dumpuntil|||
1279 dup_attrlist|||
1280 emulate_cop_io|||
1281 eval_pv|5.006000||p
1282 eval_sv|5.006000||p
1283 exec_failed|||
1284 expect_number|||
1285 fbm_compile||5.005000|
1286 fbm_instr||5.005000|
1287 feature_is_enabled|||
1288 fetch_cop_label||5.011000|
1289 filter_add|||
1290 filter_del|||
1291 filter_gets|||
1292 filter_read|||
1293 find_and_forget_pmops|||
1294 find_array_subscript|||
1295 find_beginning|||
1296 find_byclass|||
1297 find_hash_subscript|||
1298 find_in_my_stash|||
1299 find_runcv||5.008001|
1300 find_rundefsvoffset||5.009002|
1301 find_script|||
1302 find_uninit_var|||
1303 first_symbol|||n
1304 fold_constants|||
1305 forbid_setid|||
1306 force_ident|||
1307 force_list|||
1308 force_next|||
1309 force_version|||
1310 force_word|||
1311 forget_pmop|||
1312 form_nocontext|||vn
1313 form||5.004000|v
1314 fp_dup|||
1315 fprintf_nocontext|||vn
1316 free_global_struct|||
1317 free_tied_hv_pool|||
1318 free_tmps|||
1319 gen_constant_list|||
1320 get_arena|||
1321 get_aux_mg|||
1322 get_av|5.006000||p
1323 get_context||5.006000|n
1324 get_cvn_flags||5.009005|
1325 get_cv|5.006000||p
1326 get_db_sub|||
1327 get_debug_opts|||
1328 get_hash_seed|||
1329 get_hv|5.006000||p
1330 get_isa_hash|||
1331 get_mstats|||
1332 get_no_modify|||
1333 get_num|||
1334 get_op_descs||5.005000|
1335 get_op_names||5.005000|
1336 get_opargs|||
1337 get_ppaddr||5.006000|
1338 get_re_arg|||
1339 get_sv|5.006000||p
1340 get_vtbl||5.005030|
1341 getcwd_sv||5.007002|
1342 getenv_len|||
1343 glob_2number|||
1344 glob_2pv|||
1345 glob_assign_glob|||
1346 glob_assign_ref|||
1347 gp_dup|||
1348 gp_free|||
1349 gp_ref|||
1350 grok_bin|5.007003||p
1351 grok_hex|5.007003||p
1352 grok_number|5.007002||p
1353 grok_numeric_radix|5.007002||p
1354 grok_oct|5.007003||p
1355 group_end|||
1356 gv_AVadd|||
1357 gv_HVadd|||
1358 gv_IOadd|||
1359 gv_SVadd|||
1360 gv_autoload4||5.004000|
1361 gv_check|||
1362 gv_const_sv||5.009003|
1363 gv_dump||5.006000|
1364 gv_efullname3||5.004000|
1365 gv_efullname4||5.006001|
1366 gv_efullname|||
1367 gv_ename|||
1368 gv_fetchfile_flags||5.009005|
1369 gv_fetchfile|||
1370 gv_fetchmeth_autoload||5.007003|
1371 gv_fetchmethod_autoload||5.004000|
1372 gv_fetchmethod_flags||5.011000|
1373 gv_fetchmethod|||
1374 gv_fetchmeth|||
1375 gv_fetchpvn_flags||5.009002|
1376 gv_fetchpv|||
1377 gv_fetchsv||5.009002|
1378 gv_fullname3||5.004000|
1379 gv_fullname4||5.006001|
1380 gv_fullname|||
1381 gv_get_super_pkg|||
1382 gv_handler||5.007001|
1383 gv_init_sv|||
1384 gv_init|||
1385 gv_name_set||5.009004|
1386 gv_stashpvn|5.004000||p
1387 gv_stashpvs||5.009003|
1388 gv_stashpv|||
1389 gv_stashsv|||
1390 he_dup|||
1391 hek_dup|||
1392 hfreeentries|||
1393 hsplit|||
1394 hv_assert||5.011000|
1395 hv_auxinit|||n
1396 hv_backreferences_p|||
1397 hv_clear_placeholders||5.009001|
1398 hv_clear|||
1399 hv_common_key_len||5.010000|
1400 hv_common||5.010000|
1401 hv_copy_hints_hv|||
1402 hv_delayfree_ent||5.004000|
1403 hv_delete_common|||
1404 hv_delete_ent||5.004000|
1405 hv_delete|||
1406 hv_eiter_p||5.009003|
1407 hv_eiter_set||5.009003|
1408 hv_exists_ent||5.004000|
1409 hv_exists|||
1410 hv_fetch_ent||5.004000|
1411 hv_fetchs|5.009003||p
1412 hv_fetch|||
1413 hv_free_ent||5.004000|
1414 hv_iterinit|||
1415 hv_iterkeysv||5.004000|
1416 hv_iterkey|||
1417 hv_iternext_flags||5.008000|
1418 hv_iternextsv|||
1419 hv_iternext|||
1420 hv_iterval|||
1421 hv_kill_backrefs|||
1422 hv_ksplit||5.004000|
1423 hv_magic_check|||n
1424 hv_magic|||
1425 hv_name_set||5.009003|
1426 hv_notallowed|||
1427 hv_placeholders_get||5.009003|
1428 hv_placeholders_p||5.009003|
1429 hv_placeholders_set||5.009003|
1430 hv_riter_p||5.009003|
1431 hv_riter_set||5.009003|
1432 hv_scalar||5.009001|
1433 hv_store_ent||5.004000|
1434 hv_store_flags||5.008000|
1435 hv_stores|5.009004||p
1436 hv_store|||
1437 hv_undef|||
1438 ibcmp_locale||5.004000|
1439 ibcmp_utf8||5.007003|
1440 ibcmp|||
1441 incline|||
1442 incpush_if_exists|||
1443 incpush_use_sep|||
1444 incpush|||
1445 ingroup|||
1446 init_argv_symbols|||
1447 init_debugger|||
1448 init_global_struct|||
1449 init_i18nl10n||5.006000|
1450 init_i18nl14n||5.006000|
1451 init_ids|||
1452 init_interp|||
1453 init_main_stash|||
1454 init_perllib|||
1455 init_postdump_symbols|||
1456 init_predump_symbols|||
1457 init_stacks||5.005000|
1458 init_tm||5.007002|
1459 instr|||
1460 intro_my|||
1461 intuit_method|||
1462 intuit_more|||
1463 invert|||
1464 io_close|||
1465 isALNUMC|5.006000||p
1466 isALNUM|||
1467 isALPHA|||
1468 isASCII|5.006000||p
1469 isBLANK|5.006001||p
1470 isCNTRL|5.006000||p
1471 isDIGIT|||
1472 isGRAPH|5.006000||p
1473 isLOWER|||
1474 isPRINT|5.004000||p
1475 isPSXSPC|5.006001||p
1476 isPUNCT|5.006000||p
1477 isSPACE|||
1478 isUPPER|||
1479 isXDIGIT|5.006000||p
1480 is_an_int|||
1481 is_gv_magical_sv|||
1482 is_handle_constructor|||n
1483 is_list_assignment|||
1484 is_lvalue_sub||5.007001|
1485 is_uni_alnum_lc||5.006000|
1486 is_uni_alnumc_lc||5.006000|
1487 is_uni_alnumc||5.006000|
1488 is_uni_alnum||5.006000|
1489 is_uni_alpha_lc||5.006000|
1490 is_uni_alpha||5.006000|
1491 is_uni_ascii_lc||5.006000|
1492 is_uni_ascii||5.006000|
1493 is_uni_cntrl_lc||5.006000|
1494 is_uni_cntrl||5.006000|
1495 is_uni_digit_lc||5.006000|
1496 is_uni_digit||5.006000|
1497 is_uni_graph_lc||5.006000|
1498 is_uni_graph||5.006000|
1499 is_uni_idfirst_lc||5.006000|
1500 is_uni_idfirst||5.006000|
1501 is_uni_lower_lc||5.006000|
1502 is_uni_lower||5.006000|
1503 is_uni_print_lc||5.006000|
1504 is_uni_print||5.006000|
1505 is_uni_punct_lc||5.006000|
1506 is_uni_punct||5.006000|
1507 is_uni_space_lc||5.006000|
1508 is_uni_space||5.006000|
1509 is_uni_upper_lc||5.006000|
1510 is_uni_upper||5.006000|
1511 is_uni_xdigit_lc||5.006000|
1512 is_uni_xdigit||5.006000|
1513 is_utf8_alnumc||5.006000|
1514 is_utf8_alnum||5.006000|
1515 is_utf8_alpha||5.006000|
1516 is_utf8_ascii||5.006000|
1517 is_utf8_char_slow|||n
1518 is_utf8_char||5.006000|
1519 is_utf8_cntrl||5.006000|
1520 is_utf8_common|||
1521 is_utf8_digit||5.006000|
1522 is_utf8_graph||5.006000|
1523 is_utf8_idcont||5.008000|
1524 is_utf8_idfirst||5.006000|
1525 is_utf8_lower||5.006000|
1526 is_utf8_mark||5.006000|
1527 is_utf8_print||5.006000|
1528 is_utf8_punct||5.006000|
1529 is_utf8_space||5.006000|
1530 is_utf8_string_loclen||5.009003|
1531 is_utf8_string_loc||5.008001|
1532 is_utf8_string||5.006001|
1533 is_utf8_upper||5.006000|
1534 is_utf8_xdigit||5.006000|
1535 isa_lookup|||
1536 items|||n
1537 ix|||n
1538 jmaybe|||
1539 join_exact|||
1540 keyword|||
1541 leave_scope|||
1542 lex_end|||
1543 lex_start|||
1544 linklist|||
1545 listkids|||
1546 list|||
1547 load_module_nocontext|||vn
1548 load_module|5.006000||pv
1549 localize|||
1550 looks_like_bool|||
1551 looks_like_number|||
1552 lop|||
1553 mPUSHi|5.009002||p
1554 mPUSHn|5.009002||p
1555 mPUSHp|5.009002||p
1556 mPUSHs|5.011000||p
1557 mPUSHu|5.009002||p
1558 mXPUSHi|5.009002||p
1559 mXPUSHn|5.009002||p
1560 mXPUSHp|5.009002||p
1561 mXPUSHs|5.011000||p
1562 mXPUSHu|5.009002||p
1563 mad_free|||
1564 madlex|||
1565 madparse|||
1566 magic_clear_all_env|||
1567 magic_clearenv|||
1568 magic_clearhint|||
1569 magic_clearisa|||
1570 magic_clearpack|||
1571 magic_clearsig|||
1572 magic_dump||5.006000|
1573 magic_existspack|||
1574 magic_freearylen_p|||
1575 magic_freeovrld|||
1576 magic_getarylen|||
1577 magic_getdefelem|||
1578 magic_getnkeys|||
1579 magic_getpack|||
1580 magic_getpos|||
1581 magic_getsig|||
1582 magic_getsubstr|||
1583 magic_gettaint|||
1584 magic_getuvar|||
1585 magic_getvec|||
1586 magic_get|||
1587 magic_killbackrefs|||
1588 magic_len|||
1589 magic_methcall|||
1590 magic_methpack|||
1591 magic_nextpack|||
1592 magic_regdata_cnt|||
1593 magic_regdatum_get|||
1594 magic_regdatum_set|||
1595 magic_scalarpack|||
1596 magic_set_all_env|||
1597 magic_setamagic|||
1598 magic_setarylen|||
1599 magic_setcollxfrm|||
1600 magic_setdbline|||
1601 magic_setdefelem|||
1602 magic_setenv|||
1603 magic_sethint|||
1604 magic_setisa|||
1605 magic_setmglob|||
1606 magic_setnkeys|||
1607 magic_setpack|||
1608 magic_setpos|||
1609 magic_setregexp|||
1610 magic_setsig|||
1611 magic_setsubstr|||
1612 magic_settaint|||
1613 magic_setutf8|||
1614 magic_setuvar|||
1615 magic_setvec|||
1616 magic_set|||
1617 magic_sizepack|||
1618 magic_wipepack|||
1619 make_matcher|||
1620 make_trie_failtable|||
1621 make_trie|||
1622 malloc_good_size|||n
1623 malloced_size|||n
1624 malloc||5.007002|n
1625 markstack_grow|||
1626 matcher_matches_sv|||
1627 measure_struct|||
1628 memEQ|5.004000||p
1629 memNE|5.004000||p
1630 mem_collxfrm|||
1631 mem_log_common|||n
1632 mess_alloc|||
1633 mess_nocontext|||vn
1634 mess||5.006000|v
1635 method_common|||
1636 mfree||5.007002|n
1637 mg_clear|||
1638 mg_copy|||
1639 mg_dup|||
1640 mg_find|||
1641 mg_free|||
1642 mg_get|||
1643 mg_length||5.005000|
1644 mg_localize|||
1645 mg_magical|||
1646 mg_set|||
1647 mg_size||5.005000|
1648 mini_mktime||5.007002|
1649 missingterm|||
1650 mode_from_discipline|||
1651 modkids|||
1652 mod|||
1653 more_bodies|||
1654 more_sv|||
1655 moreswitches|||
1656 mro_get_from_name||5.011000|
1657 mro_get_linear_isa_dfs|||
1658 mro_get_linear_isa||5.009005|
1659 mro_get_private_data||5.011000|
1660 mro_isa_changed_in|||
1661 mro_meta_dup|||
1662 mro_meta_init|||
1663 mro_method_changed_in||5.009005|
1664 mro_register||5.011000|
1665 mro_set_mro||5.011000|
1666 mro_set_private_data||5.011000|
1667 mul128|||
1668 mulexp10|||n
1669 my_atof2||5.007002|
1670 my_atof||5.006000|
1671 my_attrs|||
1672 my_bcopy|||n
1673 my_betoh16|||n
1674 my_betoh32|||n
1675 my_betoh64|||n
1676 my_betohi|||n
1677 my_betohl|||n
1678 my_betohs|||n
1679 my_bzero|||n
1680 my_chsize|||
1681 my_clearenv|||
1682 my_cxt_index|||
1683 my_cxt_init|||
1684 my_dirfd||5.009005|
1685 my_exit_jump|||
1686 my_exit|||
1687 my_failure_exit||5.004000|
1688 my_fflush_all||5.006000|
1689 my_fork||5.007003|n
1690 my_htobe16|||n
1691 my_htobe32|||n
1692 my_htobe64|||n
1693 my_htobei|||n
1694 my_htobel|||n
1695 my_htobes|||n
1696 my_htole16|||n
1697 my_htole32|||n
1698 my_htole64|||n
1699 my_htolei|||n
1700 my_htolel|||n
1701 my_htoles|||n
1702 my_htonl|||
1703 my_kid|||
1704 my_letoh16|||n
1705 my_letoh32|||n
1706 my_letoh64|||n
1707 my_letohi|||n
1708 my_letohl|||n
1709 my_letohs|||n
1710 my_lstat|||
1711 my_memcmp||5.004000|n
1712 my_memset|||n
1713 my_ntohl|||
1714 my_pclose||5.004000|
1715 my_popen_list||5.007001|
1716 my_popen||5.004000|
1717 my_setenv|||
1718 my_snprintf|5.009004||pvn
1719 my_socketpair||5.007003|n
1720 my_sprintf|5.009003||pvn
1721 my_stat|||
1722 my_strftime||5.007002|
1723 my_strlcat|5.009004||pn
1724 my_strlcpy|5.009004||pn
1725 my_swabn|||n
1726 my_swap|||
1727 my_unexec|||
1728 my_vsnprintf||5.009004|n
1729 need_utf8|||n
1730 newANONATTRSUB||5.006000|
1731 newANONHASH|||
1732 newANONLIST|||
1733 newANONSUB|||
1734 newASSIGNOP|||
1735 newATTRSUB||5.006000|
1736 newAVREF|||
1737 newAV|||
1738 newBINOP|||
1739 newCONDOP|||
1740 newCONSTSUB|5.004050||p
1741 newCVREF|||
1742 newDEFSVOP|||
1743 newFORM|||
1744 newFOROP|||
1745 newGIVENOP||5.009003|
1746 newGIVWHENOP|||
1747 newGP|||
1748 newGVOP|||
1749 newGVREF|||
1750 newGVgen|||
1751 newHVREF|||
1752 newHVhv||5.005000|
1753 newHV|||
1754 newIO|||
1755 newLISTOP|||
1756 newLOGOP|||
1757 newLOOPEX|||
1758 newLOOPOP|||
1759 newMADPROP|||
1760 newMADsv|||
1761 newMYSUB|||
1762 newNULLLIST|||
1763 newOP|||
1764 newPADOP|||
1765 newPMOP|||
1766 newPROG|||
1767 newPVOP|||
1768 newRANGE|||
1769 newRV_inc|5.004000||p
1770 newRV_noinc|5.004000||p
1771 newRV|||
1772 newSLICEOP|||
1773 newSTATEOP|||
1774 newSUB|||
1775 newSVOP|||
1776 newSVREF|||
1777 newSV_type||5.009005|
1778 newSVhek||5.009003|
1779 newSViv|||
1780 newSVnv|||
1781 newSVpvf_nocontext|||vn
1782 newSVpvf||5.004000|v
1783 newSVpvn_flags|5.011000||p
1784 newSVpvn_share|5.007001||p
1785 newSVpvn_utf8|5.011000||p
1786 newSVpvn|5.004050||p
1787 newSVpvs_flags|5.011000||p
1788 newSVpvs_share||5.009003|
1789 newSVpvs|5.009003||p
1790 newSVpv|||
1791 newSVrv|||
1792 newSVsv|||
1793 newSVuv|5.006000||p
1794 newSV|||
1795 newTOKEN|||
1796 newUNOP|||
1797 newWHENOP||5.009003|
1798 newWHILEOP||5.009003|
1799 newXS_flags||5.009004|
1800 newXSproto||5.006000|
1801 newXS||5.006000|
1802 new_collate||5.006000|
1803 new_constant|||
1804 new_ctype||5.006000|
1805 new_he|||
1806 new_logop|||
1807 new_numeric||5.006000|
1808 new_stackinfo||5.005000|
1809 new_version||5.009000|
1810 new_warnings_bitfield|||
1811 next_symbol|||
1812 nextargv|||
1813 nextchar|||
1814 ninstr|||
1815 no_bareword_allowed|||
1816 no_fh_allowed|||
1817 no_op|||
1818 not_a_number|||
1819 nothreadhook||5.008000|
1820 nuke_stacks|||
1821 num_overflow|||n
1822 offer_nice_chunk|||
1823 oopsAV|||
1824 oopsHV|||
1825 op_clear|||
1826 op_const_sv|||
1827 op_dump||5.006000|
1828 op_free|||
1829 op_getmad_weak|||
1830 op_getmad|||
1831 op_null||5.007002|
1832 op_refcnt_dec|||
1833 op_refcnt_inc|||
1834 op_refcnt_lock||5.009002|
1835 op_refcnt_unlock||5.009002|
1836 op_xmldump|||
1837 open_script|||
1838 pMY_CXT_|5.007003||p
1839 pMY_CXT|5.007003||p
1840 pTHX_|5.006000||p
1841 pTHX|5.006000||p
1842 packWARN|5.007003||p
1843 pack_cat||5.007003|
1844 pack_rec|||
1845 package|||
1846 packlist||5.008001|
1847 pad_add_anon|||
1848 pad_add_name|||
1849 pad_alloc|||
1850 pad_block_start|||
1851 pad_check_dup|||
1852 pad_compname_type|||
1853 pad_findlex|||
1854 pad_findmy|||
1855 pad_fixup_inner_anons|||
1856 pad_free|||
1857 pad_leavemy|||
1858 pad_new|||
1859 pad_peg|||n
1860 pad_push|||
1861 pad_reset|||
1862 pad_setsv|||
1863 pad_sv||5.011000|
1864 pad_swipe|||
1865 pad_tidy|||
1866 pad_undef|||
1867 parse_body|||
1868 parse_unicode_opts|||
1869 parser_dup|||
1870 parser_free|||
1871 path_is_absolute|||n
1872 peep|||
1873 pending_Slabs_to_ro|||
1874 perl_alloc_using|||n
1875 perl_alloc|||n
1876 perl_clone_using|||n
1877 perl_clone|||n
1878 perl_construct|||n
1879 perl_destruct||5.007003|n
1880 perl_free|||n
1881 perl_parse||5.006000|n
1882 perl_run|||n
1883 pidgone|||
1884 pm_description|||
1885 pmflag|||
1886 pmop_dump||5.006000|
1887 pmop_xmldump|||
1888 pmruntime|||
1889 pmtrans|||
1890 pop_scope|||
1891 pregcomp||5.009005|
1892 pregexec|||
1893 pregfree2||5.011000|
1894 pregfree|||
1895 prepend_elem|||
1896 prepend_madprops|||
1897 printbuf|||
1898 printf_nocontext|||vn
1899 process_special_blocks|||
1900 ptr_table_clear||5.009005|
1901 ptr_table_fetch||5.009005|
1902 ptr_table_find|||n
1903 ptr_table_free||5.009005|
1904 ptr_table_new||5.009005|
1905 ptr_table_split||5.009005|
1906 ptr_table_store||5.009005|
1907 push_scope|||
1908 put_byte|||
1909 pv_display|5.006000||p
1910 pv_escape|5.009004||p
1911 pv_pretty|5.009004||p
1912 pv_uni_display||5.007003|
1913 qerror|||
1914 qsortsvu|||
1915 re_compile||5.009005|
1916 re_croak2|||
1917 re_dup_guts|||
1918 re_intuit_start||5.009005|
1919 re_intuit_string||5.006000|
1920 readpipe_override|||
1921 realloc||5.007002|n
1922 reentrant_free|||
1923 reentrant_init|||
1924 reentrant_retry|||vn
1925 reentrant_size|||
1926 ref_array_or_hash|||
1927 refcounted_he_chain_2hv|||
1928 refcounted_he_fetch|||
1929 refcounted_he_free|||
1930 refcounted_he_new_common|||
1931 refcounted_he_new|||
1932 refcounted_he_value|||
1933 refkids|||
1934 refto|||
1935 ref||5.011000|
1936 reg_check_named_buff_matched|||
1937 reg_named_buff_all||5.009005|
1938 reg_named_buff_exists||5.009005|
1939 reg_named_buff_fetch||5.009005|
1940 reg_named_buff_firstkey||5.009005|
1941 reg_named_buff_iter|||
1942 reg_named_buff_nextkey||5.009005|
1943 reg_named_buff_scalar||5.009005|
1944 reg_named_buff|||
1945 reg_namedseq|||
1946 reg_node|||
1947 reg_numbered_buff_fetch|||
1948 reg_numbered_buff_length|||
1949 reg_numbered_buff_store|||
1950 reg_qr_package|||
1951 reg_recode|||
1952 reg_scan_name|||
1953 reg_skipcomment|||
1954 reg_temp_copy|||
1955 reganode|||
1956 regatom|||
1957 regbranch|||
1958 regclass_swash||5.009004|
1959 regclass|||
1960 regcppop|||
1961 regcppush|||
1962 regcurly|||n
1963 regdump_extflags|||
1964 regdump||5.005000|
1965 regdupe_internal|||
1966 regexec_flags||5.005000|
1967 regfree_internal||5.009005|
1968 reghop3|||n
1969 reghop4|||n
1970 reghopmaybe3|||n
1971 reginclass|||
1972 reginitcolors||5.006000|
1973 reginsert|||
1974 regmatch|||
1975 regnext||5.005000|
1976 regpiece|||
1977 regpposixcc|||
1978 regprop|||
1979 regrepeat|||
1980 regtail_study|||
1981 regtail|||
1982 regtry|||
1983 reguni|||
1984 regwhite|||n
1985 reg|||
1986 repeatcpy|||
1987 report_evil_fh|||
1988 report_uninit|||
1989 require_pv||5.006000|
1990 require_tie_mod|||
1991 restore_magic|||
1992 rninstr|||
1993 rsignal_restore|||
1994 rsignal_save|||
1995 rsignal_state||5.004000|
1996 rsignal||5.004000|
1997 run_body|||
1998 run_user_filter|||
1999 runops_debug||5.005000|
2000 runops_standard||5.005000|
2001 rvpv_dup|||
2002 rxres_free|||
2003 rxres_restore|||
2004 rxres_save|||
2005 safesyscalloc||5.006000|n
2006 safesysfree||5.006000|n
2007 safesysmalloc||5.006000|n
2008 safesysrealloc||5.006000|n
2009 same_dirent|||
2010 save_I16||5.004000|
2011 save_I32|||
2012 save_I8||5.006000|
2013 save_adelete||5.011000|
2014 save_aelem||5.004050|
2015 save_alloc||5.006000|
2016 save_aptr|||
2017 save_ary|||
2018 save_bool||5.008001|
2019 save_clearsv|||
2020 save_delete|||
2021 save_destructor_x||5.006000|
2022 save_destructor||5.006000|
2023 save_freeop|||
2024 save_freepv|||
2025 save_freesv|||
2026 save_generic_pvref||5.006001|
2027 save_generic_svref||5.005030|
2028 save_gp||5.004000|
2029 save_hash|||
2030 save_hek_flags|||n
2031 save_helem_flags||5.011000|
2032 save_helem||5.004050|
2033 save_hints|||
2034 save_hptr|||
2035 save_int|||
2036 save_item|||
2037 save_iv||5.005000|
2038 save_lines|||
2039 save_list|||
2040 save_long|||
2041 save_magic|||
2042 save_mortalizesv||5.007001|
2043 save_nogv|||
2044 save_op|||
2045 save_padsv_and_mortalize||5.011000|
2046 save_pptr|||
2047 save_pushi32ptr|||
2048 save_pushptri32ptr|||
2049 save_pushptrptr|||
2050 save_pushptr||5.011000|
2051 save_re_context||5.006000|
2052 save_scalar_at|||
2053 save_scalar|||
2054 save_set_svflags||5.009000|
2055 save_shared_pvref||5.007003|
2056 save_sptr|||
2057 save_svref|||
2058 save_vptr||5.006000|
2059 savepvn|||
2060 savepvs||5.009003|
2061 savepv|||
2062 savesharedpvn||5.009005|
2063 savesharedpv||5.007003|
2064 savestack_grow_cnt||5.008001|
2065 savestack_grow|||
2066 savesvpv||5.009002|
2067 sawparens|||
2068 scalar_mod_type|||n
2069 scalarboolean|||
2070 scalarkids|||
2071 scalarseq|||
2072 scalarvoid|||
2073 scalar|||
2074 scan_bin||5.006000|
2075 scan_commit|||
2076 scan_const|||
2077 scan_formline|||
2078 scan_heredoc|||
2079 scan_hex|||
2080 scan_ident|||
2081 scan_inputsymbol|||
2082 scan_num||5.007001|
2083 scan_oct|||
2084 scan_pat|||
2085 scan_str|||
2086 scan_subst|||
2087 scan_trans|||
2088 scan_version||5.009001|
2089 scan_vstring||5.009005|
2090 scan_word|||
2091 scope|||
2092 screaminstr||5.005000|
2093 search_const|||
2094 seed||5.008001|
2095 sequence_num|||
2096 sequence_tail|||
2097 sequence|||
2098 set_context||5.006000|n
2099 set_numeric_local||5.006000|
2100 set_numeric_radix||5.006000|
2101 set_numeric_standard||5.006000|
2102 setdefout|||
2103 share_hek_flags|||
2104 share_hek||5.004000|
2105 si_dup|||
2106 sighandler|||n
2107 simplify_sort|||
2108 skipspace0|||
2109 skipspace1|||
2110 skipspace2|||
2111 skipspace|||
2112 softref2xv|||
2113 sortcv_stacked|||
2114 sortcv_xsub|||
2115 sortcv|||
2116 sortsv_flags||5.009003|
2117 sortsv||5.007003|
2118 space_join_names_mortal|||
2119 ss_dup|||
2120 stack_grow|||
2121 start_force|||
2122 start_glob|||
2123 start_subparse||5.004000|
2124 stashpv_hvname_match||5.011000|
2125 stdize_locale|||
2126 store_cop_label|||
2127 strEQ|||
2128 strGE|||
2129 strGT|||
2130 strLE|||
2131 strLT|||
2132 strNE|||
2133 str_to_version||5.006000|
2134 strip_return|||
2135 strnEQ|||
2136 strnNE|||
2137 study_chunk|||
2138 sub_crush_depth|||
2139 sublex_done|||
2140 sublex_push|||
2141 sublex_start|||
2142 sv_2bool|||
2143 sv_2cv|||
2144 sv_2io|||
2145 sv_2iuv_common|||
2146 sv_2iuv_non_preserve|||
2147 sv_2iv_flags||5.009001|
2148 sv_2iv|||
2149 sv_2mortal|||
2150 sv_2num|||
2151 sv_2nv|||
2152 sv_2pv_flags|5.007002||p
2153 sv_2pv_nolen|5.006000||p
2154 sv_2pvbyte_nolen|5.006000||p
2155 sv_2pvbyte|5.006000||p
2156 sv_2pvutf8_nolen||5.006000|
2157 sv_2pvutf8||5.006000|
2158 sv_2pv|||
2159 sv_2uv_flags||5.009001|
2160 sv_2uv|5.004000||p
2161 sv_add_arena|||
2162 sv_add_backref|||
2163 sv_backoff|||
2164 sv_bless|||
2165 sv_cat_decode||5.008001|
2166 sv_catpv_mg|5.004050||p
2167 sv_catpvf_mg_nocontext|||pvn
2168 sv_catpvf_mg|5.006000|5.004000|pv
2169 sv_catpvf_nocontext|||vn
2170 sv_catpvf||5.004000|v
2171 sv_catpvn_flags||5.007002|
2172 sv_catpvn_mg|5.004050||p
2173 sv_catpvn_nomg|5.007002||p
2174 sv_catpvn|||
2175 sv_catpvs|5.009003||p
2176 sv_catpv|||
2177 sv_catsv_flags||5.007002|
2178 sv_catsv_mg|5.004050||p
2179 sv_catsv_nomg|5.007002||p
2180 sv_catsv|||
2181 sv_catxmlpvn|||
2182 sv_catxmlsv|||
2183 sv_chop|||
2184 sv_clean_all|||
2185 sv_clean_objs|||
2186 sv_clear|||
2187 sv_cmp_locale||5.004000|
2188 sv_cmp|||
2189 sv_collxfrm|||
2190 sv_compile_2op||5.008001|
2191 sv_copypv||5.007003|
2192 sv_dec|||
2193 sv_del_backref|||
2194 sv_derived_from||5.004000|
2195 sv_destroyable||5.010000|
2196 sv_does||5.009004|
2197 sv_dump|||
2198 sv_dup|||
2199 sv_eq|||
2200 sv_exp_grow|||
2201 sv_force_normal_flags||5.007001|
2202 sv_force_normal||5.006000|
2203 sv_free2|||
2204 sv_free_arenas|||
2205 sv_free|||
2206 sv_gets||5.004000|
2207 sv_grow|||
2208 sv_i_ncmp|||
2209 sv_inc|||
2210 sv_insert_flags||5.011000|
2211 sv_insert|||
2212 sv_isa|||
2213 sv_isobject|||
2214 sv_iv||5.005000|
2215 sv_kill_backrefs|||
2216 sv_len_utf8||5.006000|
2217 sv_len|||
2218 sv_magic_portable|5.011000|5.004000|p
2219 sv_magicext||5.007003|
2220 sv_magic|||
2221 sv_mortalcopy|||
2222 sv_ncmp|||
2223 sv_newmortal|||
2224 sv_newref|||
2225 sv_nolocking||5.007003|
2226 sv_nosharing||5.007003|
2227 sv_nounlocking|||
2228 sv_nv||5.005000|
2229 sv_peek||5.005000|
2230 sv_pos_b2u_midway|||
2231 sv_pos_b2u||5.006000|
2232 sv_pos_u2b_cached|||
2233 sv_pos_u2b_forwards|||n
2234 sv_pos_u2b_midway|||n
2235 sv_pos_u2b||5.006000|
2236 sv_pvbyten_force||5.006000|
2237 sv_pvbyten||5.006000|
2238 sv_pvbyte||5.006000|
2239 sv_pvn_force_flags|5.007002||p
2240 sv_pvn_force|||
2241 sv_pvn_nomg|5.007003|5.005000|p
2242 sv_pvn||5.005000|
2243 sv_pvutf8n_force||5.006000|
2244 sv_pvutf8n||5.006000|
2245 sv_pvutf8||5.006000|
2246 sv_pv||5.006000|
2247 sv_recode_to_utf8||5.007003|
2248 sv_reftype|||
2249 sv_release_COW|||
2250 sv_replace|||
2251 sv_report_used|||
2252 sv_reset|||
2253 sv_rvweaken||5.006000|
2254 sv_setiv_mg|5.004050||p
2255 sv_setiv|||
2256 sv_setnv_mg|5.006000||p
2257 sv_setnv|||
2258 sv_setpv_mg|5.004050||p
2259 sv_setpvf_mg_nocontext|||pvn
2260 sv_setpvf_mg|5.006000|5.004000|pv
2261 sv_setpvf_nocontext|||vn
2262 sv_setpvf||5.004000|v
2263 sv_setpviv_mg||5.008001|
2264 sv_setpviv||5.008001|
2265 sv_setpvn_mg|5.004050||p
2266 sv_setpvn|||
2267 sv_setpvs|5.009004||p
2268 sv_setpv|||
2269 sv_setref_iv|||
2270 sv_setref_nv|||
2271 sv_setref_pvn|||
2272 sv_setref_pv|||
2273 sv_setref_uv||5.007001|
2274 sv_setsv_cow|||
2275 sv_setsv_flags||5.007002|
2276 sv_setsv_mg|5.004050||p
2277 sv_setsv_nomg|5.007002||p
2278 sv_setsv|||
2279 sv_setuv_mg|5.004050||p
2280 sv_setuv|5.004000||p
2281 sv_tainted||5.004000|
2282 sv_taint||5.004000|
2283 sv_true||5.005000|
2284 sv_unglob|||
2285 sv_uni_display||5.007003|
2286 sv_unmagic|||
2287 sv_unref_flags||5.007001|
2288 sv_unref|||
2289 sv_untaint||5.004000|
2290 sv_upgrade|||
2291 sv_usepvn_flags||5.009004|
2292 sv_usepvn_mg|5.004050||p
2293 sv_usepvn|||
2294 sv_utf8_decode||5.006000|
2295 sv_utf8_downgrade||5.006000|
2296 sv_utf8_encode||5.006000|
2297 sv_utf8_upgrade_flags_grow||5.011000|
2298 sv_utf8_upgrade_flags||5.007002|
2299 sv_utf8_upgrade_nomg||5.007002|
2300 sv_utf8_upgrade||5.007001|
2301 sv_uv|5.005000||p
2302 sv_vcatpvf_mg|5.006000|5.004000|p
2303 sv_vcatpvfn||5.004000|
2304 sv_vcatpvf|5.006000|5.004000|p
2305 sv_vsetpvf_mg|5.006000|5.004000|p
2306 sv_vsetpvfn||5.004000|
2307 sv_vsetpvf|5.006000|5.004000|p
2308 sv_xmlpeek|||
2309 svtype|||
2310 swallow_bom|||
2311 swap_match_buff|||
2312 swash_fetch||5.007002|
2313 swash_get|||
2314 swash_init||5.006000|
2315 sys_init3||5.010000|n
2316 sys_init||5.010000|n
2317 sys_intern_clear|||
2318 sys_intern_dup|||
2319 sys_intern_init|||
2320 sys_term||5.010000|n
2321 taint_env|||
2322 taint_proper|||
2323 tmps_grow||5.006000|
2324 toLOWER|||
2325 toUPPER|||
2326 to_byte_substr|||
2327 to_uni_fold||5.007003|
2328 to_uni_lower_lc||5.006000|
2329 to_uni_lower||5.007003|
2330 to_uni_title_lc||5.006000|
2331 to_uni_title||5.007003|
2332 to_uni_upper_lc||5.006000|
2333 to_uni_upper||5.007003|
2334 to_utf8_case||5.007003|
2335 to_utf8_fold||5.007003|
2336 to_utf8_lower||5.007003|
2337 to_utf8_substr|||
2338 to_utf8_title||5.007003|
2339 to_utf8_upper||5.007003|
2340 token_free|||
2341 token_getmad|||
2342 tokenize_use|||
2343 tokeq|||
2344 tokereport|||
2345 too_few_arguments|||
2346 too_many_arguments|||
2347 uiv_2buf|||n
2348 unlnk|||
2349 unpack_rec|||
2350 unpack_str||5.007003|
2351 unpackstring||5.008001|
2352 unshare_hek_or_pvn|||
2353 unshare_hek|||
2354 unsharepvn||5.004000|
2355 unwind_handler_stack|||
2356 update_debugger_info|||
2357 upg_version||5.009005|
2358 usage|||
2359 utf16_to_utf8_reversed||5.006001|
2360 utf16_to_utf8||5.006001|
2361 utf8_distance||5.006000|
2362 utf8_hop||5.006000|
2363 utf8_length||5.007001|
2364 utf8_mg_pos_cache_update|||
2365 utf8_to_bytes||5.006001|
2366 utf8_to_uvchr||5.007001|
2367 utf8_to_uvuni||5.007001|
2368 utf8n_to_uvchr|||
2369 utf8n_to_uvuni||5.007001|
2370 utilize|||
2371 uvchr_to_utf8_flags||5.007003|
2372 uvchr_to_utf8|||
2373 uvuni_to_utf8_flags||5.007003|
2374 uvuni_to_utf8||5.007001|
2375 validate_suid|||
2376 varname|||
2377 vcmp||5.009000|
2378 vcroak||5.006000|
2379 vdeb||5.007003|
2380 vdie_common|||
2381 vdie_croak_common|||
2382 vdie|||
2383 vform||5.006000|
2384 visit|||
2385 vivify_defelem|||
2386 vivify_ref|||
2387 vload_module|5.006000||p
2388 vmess||5.006000|
2389 vnewSVpvf|5.006000|5.004000|p
2390 vnormal||5.009002|
2391 vnumify||5.009000|
2392 vstringify||5.009000|
2393 vverify||5.009003|
2394 vwarner||5.006000|
2395 vwarn||5.006000|
2396 wait4pid|||
2397 warn_nocontext|||vn
2398 warner_nocontext|||vn
2399 warner|5.006000|5.004000|pv
2400 warn|||v
2401 watch|||
2402 whichsig|||
2403 write_no_mem|||
2404 write_to_stderr|||
2405 xmldump_all|||
2406 xmldump_attr|||
2407 xmldump_eval|||
2408 xmldump_form|||
2409 xmldump_indent|||v
2410 xmldump_packsubs|||
2411 xmldump_sub|||
2412 xmldump_vindent|||
2413 yyerror|||
2414 yylex|||
2415 yyparse|||
2416 yywarn|||
2417 );
2418
2419 if (exists $opt{'list-unsupported'}) {
2420   my $f;
2421   for $f (sort { lc $a cmp lc $b } keys %API) {
2422     next unless $API{$f}{todo};
2423     print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n";
2424   }
2425   exit 0;
2426 }
2427
2428 # Scan for possible replacement candidates
2429
2430 my(%replace, %need, %hints, %warnings, %depends);
2431 my $replace = 0;
2432 my($hint, $define, $function);
2433
2434 sub find_api
2435 {
2436   my $code = shift;
2437   $code =~ s{
2438     / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
2439   | "[^"\\]*(?:\\.[^"\\]*)*"
2440   | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx;
2441   grep { exists $API{$_} } $code =~ /(\w+)/mg;
2442 }
2443
2444 while (<DATA>) {
2445   if ($hint) {
2446     my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings;
2447     if (m{^\s*\*\s(.*?)\s*$}) {
2448       for (@{$hint->[1]}) {
2449         $h->{$_} ||= '';  # suppress warning with older perls
2450         $h->{$_} .= "$1\n";
2451       }
2452     }
2453     else { undef $hint }
2454   }
2455
2456   $hint = [$1, [split /,?\s+/, $2]]
2457       if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$};
2458
2459   if ($define) {
2460     if ($define->[1] =~ /\\$/) {
2461       $define->[1] .= $_;
2462     }
2463     else {
2464       if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) {
2465         my @n = find_api($define->[1]);
2466         push @{$depends{$define->[0]}}, @n if @n
2467       }
2468       undef $define;
2469     }
2470   }
2471
2472   $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)};
2473
2474   if ($function) {
2475     if (/^}/) {
2476       if (exists $API{$function->[0]}) {
2477         my @n = find_api($function->[1]);
2478         push @{$depends{$function->[0]}}, @n if @n
2479       }
2480       undef $function;
2481     }
2482     else {
2483       $function->[1] .= $_;
2484     }
2485   }
2486
2487   $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)};
2488
2489   $replace     = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$};
2490   $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)};
2491   $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce};
2492   $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$};
2493
2494   if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) {
2495     my @deps = map { s/\s+//g; $_ } split /,/, $3;
2496     my $d;
2497     for $d (map { s/\s+//g; $_ } split /,/, $1) {
2498       push @{$depends{$d}}, @deps;
2499     }
2500   }
2501
2502   $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)};
2503 }
2504
2505 for (values %depends) {
2506   my %s;
2507   $_ = [sort grep !$s{$_}++, @$_];
2508 }
2509
2510 if (exists $opt{'api-info'}) {
2511   my $f;
2512   my $count = 0;
2513   my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$";
2514   for $f (sort { lc $a cmp lc $b } keys %API) {
2515     next unless $f =~ /$match/;
2516     print "\n=== $f ===\n\n";
2517     my $info = 0;
2518     if ($API{$f}{base} || $API{$f}{todo}) {
2519       my $base = format_version($API{$f}{base} || $API{$f}{todo});
2520       print "Supported at least starting from perl-$base.\n";
2521       $info++;
2522     }
2523     if ($API{$f}{provided}) {
2524       my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003";
2525       print "Support by $ppport provided back to perl-$todo.\n";
2526       print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f};
2527       print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f};
2528       print "\n$hints{$f}" if exists $hints{$f};
2529       print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f};
2530       $info++;
2531     }
2532     print "No portability information available.\n" unless $info;
2533     $count++;
2534   }
2535   $count or print "Found no API matching '$opt{'api-info'}'.";
2536   print "\n";
2537   exit 0;
2538 }
2539
2540 if (exists $opt{'list-provided'}) {
2541   my $f;
2542   for $f (sort { lc $a cmp lc $b } keys %API) {
2543     next unless $API{$f}{provided};
2544     my @flags;
2545     push @flags, 'explicit' if exists $need{$f};
2546     push @flags, 'depend'   if exists $depends{$f};
2547     push @flags, 'hint'     if exists $hints{$f};
2548     push @flags, 'warning'  if exists $warnings{$f};
2549     my $flags = @flags ? '  ['.join(', ', @flags).']' : '';
2550     print "$f$flags\n";
2551   }
2552   exit 0;
2553 }
2554
2555 my @files;
2556 my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc );
2557 my $srcext = join '|', map { quotemeta $_ } @srcext;
2558
2559 if (@ARGV) {
2560   my %seen;
2561   for (@ARGV) {
2562     if (-e) {
2563       if (-f) {
2564         push @files, $_ unless $seen{$_}++;
2565       }
2566       else { warn "'$_' is not a file.\n" }
2567     }
2568     else {
2569       my @new = grep { -f } glob $_
2570           or warn "'$_' does not exist.\n";
2571       push @files, grep { !$seen{$_}++ } @new;
2572     }
2573   }
2574 }
2575 else {
2576   eval {
2577     require File::Find;
2578     File::Find::find(sub {
2579       $File::Find::name =~ /($srcext)$/i
2580           and push @files, $File::Find::name;
2581     }, '.');
2582   };
2583   if ($@) {
2584     @files = map { glob "*$_" } @srcext;
2585   }
2586 }
2587
2588 if (!@ARGV || $opt{filter}) {
2589   my(@in, @out);
2590   my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files;
2591   for (@files) {
2592     my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i;
2593     push @{ $out ? \@out : \@in }, $_;
2594   }
2595   if (@ARGV && @out) {
2596     warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out);
2597   }
2598   @files = @in;
2599 }
2600
2601 die "No input files given!\n" unless @files;
2602
2603 my(%files, %global, %revreplace);
2604 %revreplace = reverse %replace;
2605 my $filename;
2606 my $patch_opened = 0;
2607
2608 for $filename (@files) {
2609   unless (open IN, "<$filename") {
2610     warn "Unable to read from $filename: $!\n";
2611     next;
2612   }
2613
2614   info("Scanning $filename ...");
2615
2616   my $c = do { local $/; <IN> };
2617   close IN;
2618
2619   my %file = (orig => $c, changes => 0);
2620
2621   # Temporarily remove C/XS comments and strings from the code
2622   my @ccom;
2623
2624   $c =~ s{
2625     ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]*
2626     | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* )
2627   | ( ^$HS*\#[^\r\n]*
2628     | "[^"\\]*(?:\\.[^"\\]*)*"
2629     | '[^'\\]*(?:\\.[^'\\]*)*'
2630     | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) )
2631   }{ defined $2 and push @ccom, $2;
2632      defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex;
2633
2634   $file{ccom} = \@ccom;
2635   $file{code} = $c;
2636   $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m;
2637
2638   my $func;
2639
2640   for $func (keys %API) {
2641     my $match = $func;
2642     $match .= "|$revreplace{$func}" if exists $revreplace{$func};
2643     if ($c =~ /\b(?:Perl_)?($match)\b/) {
2644       $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func};
2645       $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/;
2646       if (exists $API{$func}{provided}) {
2647         $file{uses_provided}{$func}++;
2648         if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) {
2649           $file{uses}{$func}++;
2650           my @deps = rec_depend($func);
2651           if (@deps) {
2652             $file{uses_deps}{$func} = \@deps;
2653             for (@deps) {
2654               $file{uses}{$_} = 0 unless exists $file{uses}{$_};
2655             }
2656           }
2657           for ($func, @deps) {
2658             $file{needs}{$_} = 'static' if exists $need{$_};
2659           }
2660         }
2661       }
2662       if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) {
2663         if ($c =~ /\b$func\b/) {
2664           $file{uses_todo}{$func}++;
2665         }
2666       }
2667     }
2668   }
2669
2670   while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) {
2671     if (exists $need{$2}) {
2672       $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++;
2673     }
2674     else { warning("Possibly wrong #define $1 in $filename") }
2675   }
2676
2677   for (qw(uses needs uses_todo needed_global needed_static)) {
2678     for $func (keys %{$file{$_}}) {
2679       push @{$global{$_}{$func}}, $filename;
2680     }
2681   }
2682
2683   $files{$filename} = \%file;
2684 }
2685
2686 # Globally resolve NEED_'s
2687 my $need;
2688 for $need (keys %{$global{needs}}) {
2689   if (@{$global{needs}{$need}} > 1) {
2690     my @targets = @{$global{needs}{$need}};
2691     my @t = grep $files{$_}{needed_global}{$need}, @targets;
2692     @targets = @t if @t;
2693     @t = grep /\.xs$/i, @targets;
2694     @targets = @t if @t;
2695     my $target = shift @targets;
2696     $files{$target}{needs}{$need} = 'global';
2697     for (@{$global{needs}{$need}}) {
2698       $files{$_}{needs}{$need} = 'extern' if $_ ne $target;
2699     }
2700   }
2701 }
2702
2703 for $filename (@files) {
2704   exists $files{$filename} or next;
2705
2706   info("=== Analyzing $filename ===");
2707
2708   my %file = %{$files{$filename}};
2709   my $func;
2710   my $c = $file{code};
2711   my $warnings = 0;
2712
2713   for $func (sort keys %{$file{uses_Perl}}) {
2714     if ($API{$func}{varargs}) {
2715       unless ($API{$func}{nothxarg}) {
2716         my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))}
2717                               { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge);
2718         if ($changes) {
2719           warning("Doesn't pass interpreter argument aTHX to Perl_$func");
2720           $file{changes} += $changes;
2721         }
2722       }
2723     }
2724     else {
2725       warning("Uses Perl_$func instead of $func");
2726       $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*}
2727                                 {$func$1(}g);
2728     }
2729   }
2730
2731   for $func (sort keys %{$file{uses_replace}}) {
2732     warning("Uses $func instead of $replace{$func}");
2733     $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
2734   }
2735
2736   for $func (sort keys %{$file{uses_provided}}) {
2737     if ($file{uses}{$func}) {
2738       if (exists $file{uses_deps}{$func}) {
2739         diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}}));
2740       }
2741       else {
2742         diag("Uses $func");
2743       }
2744     }
2745     $warnings += hint($func);
2746   }
2747
2748   unless ($opt{quiet}) {
2749     for $func (sort keys %{$file{uses_todo}}) {
2750       print "*** WARNING: Uses $func, which may not be portable below perl ",
2751             format_version($API{$func}{todo}), ", even with '$ppport'\n";
2752       $warnings++;
2753     }
2754   }
2755
2756   for $func (sort keys %{$file{needed_static}}) {
2757     my $message = '';
2758     if (not exists $file{uses}{$func}) {
2759       $message = "No need to define NEED_$func if $func is never used";
2760     }
2761     elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
2762       $message = "No need to define NEED_$func when already needed globally";
2763     }
2764     if ($message) {
2765       diag($message);
2766       $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
2767     }
2768   }
2769
2770   for $func (sort keys %{$file{needed_global}}) {
2771     my $message = '';
2772     if (not exists $global{uses}{$func}) {
2773       $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
2774     }
2775     elsif (exists $file{needs}{$func}) {
2776       if ($file{needs}{$func} eq 'extern') {
2777         $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
2778       }
2779       elsif ($file{needs}{$func} eq 'static') {
2780         $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
2781       }
2782     }
2783     if ($message) {
2784       diag($message);
2785       $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
2786     }
2787   }
2788
2789   $file{needs_inc_ppport} = keys %{$file{uses}};
2790
2791   if ($file{needs_inc_ppport}) {
2792     my $pp = '';
2793
2794     for $func (sort keys %{$file{needs}}) {
2795       my $type = $file{needs}{$func};
2796       next if $type eq 'extern';
2797       my $suffix = $type eq 'global' ? '_GLOBAL' : '';
2798       unless (exists $file{"needed_$type"}{$func}) {
2799         if ($type eq 'global') {
2800           diag("Files [@{$global{needs}{$func}}] need $func, adding global request");
2801         }
2802         else {
2803           diag("File needs $func, adding static request");
2804         }
2805         $pp .= "#define NEED_$func$suffix\n";
2806       }
2807     }
2808
2809     if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
2810       $pp = '';
2811       $file{changes}++;
2812     }
2813
2814     unless ($file{has_inc_ppport}) {
2815       diag("Needs to include '$ppport'");
2816       $pp .= qq(#include "$ppport"\n)
2817     }
2818
2819     if ($pp) {
2820       $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms)
2821                      || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m)
2822                      || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m)
2823                      || ($c =~ s/^/$pp/);
2824     }
2825   }
2826   else {
2827     if ($file{has_inc_ppport}) {
2828       diag("No need to include '$ppport'");
2829       $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m);
2830     }
2831   }
2832
2833   # put back in our C comments
2834   my $ix;
2835   my $cppc = 0;
2836   my @ccom = @{$file{ccom}};
2837   for $ix (0 .. $#ccom) {
2838     if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) {
2839       $cppc++;
2840       $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/;
2841     }
2842     else {
2843       $c =~ s/$rccs$ix$rcce/$ccom[$ix]/;
2844     }
2845   }
2846
2847   if ($cppc) {
2848     my $s = $cppc != 1 ? 's' : '';
2849     warning("Uses $cppc C++ style comment$s, which is not portable");
2850   }
2851
2852   my $s = $warnings != 1 ? 's' : '';
2853   my $warn = $warnings ? " ($warnings warning$s)" : '';
2854   info("Analysis completed$warn");
2855
2856   if ($file{changes}) {
2857     if (exists $opt{copy}) {
2858       my $newfile = "$filename$opt{copy}";
2859       if (-e $newfile) {
2860         error("'$newfile' already exists, refusing to write copy of '$filename'");
2861       }
2862       else {
2863         local *F;
2864         if (open F, ">$newfile") {
2865           info("Writing copy of '$filename' with changes to '$newfile'");
2866           print F $c;
2867           close F;
2868         }
2869         else {
2870           error("Cannot open '$newfile' for writing: $!");
2871         }
2872       }
2873     }
2874     elsif (exists $opt{patch} || $opt{changes}) {
2875       if (exists $opt{patch}) {
2876         unless ($patch_opened) {
2877           if (open PATCH, ">$opt{patch}") {
2878             $patch_opened = 1;
2879           }
2880           else {
2881             error("Cannot open '$opt{patch}' for writing: $!");
2882             delete $opt{patch};
2883             $opt{changes} = 1;
2884             goto fallback;
2885           }
2886         }
2887         mydiff(\*PATCH, $filename, $c);
2888       }
2889       else {
2890 fallback:
2891         info("Suggested changes:");
2892         mydiff(\*STDOUT, $filename, $c);
2893       }
2894     }
2895     else {
2896       my $s = $file{changes} == 1 ? '' : 's';
2897       info("$file{changes} potentially required change$s detected");
2898     }
2899   }
2900   else {
2901     info("Looks good");
2902   }
2903 }
2904
2905 close PATCH if $patch_opened;
2906
2907 exit 0;
2908
2909
2910 sub try_use { eval "use @_;"; return $@ eq '' }
2911
2912 sub mydiff
2913 {
2914   local *F = shift;
2915   my($file, $str) = @_;
2916   my $diff;
2917
2918   if (exists $opt{diff}) {
2919     $diff = run_diff($opt{diff}, $file, $str);
2920   }
2921
2922   if (!defined $diff and try_use('Text::Diff')) {
2923     $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' });
2924     $diff = <<HEADER . $diff;
2925 --- $file
2926 +++ $file.patched
2927 HEADER
2928   }
2929
2930   if (!defined $diff) {
2931     $diff = run_diff('diff -u', $file, $str);
2932   }
2933
2934   if (!defined $diff) {
2935     $diff = run_diff('diff', $file, $str);
2936   }
2937
2938   if (!defined $diff) {
2939     error("Cannot generate a diff. Please install Text::Diff or use --copy.");
2940     return;
2941   }
2942
2943   print F $diff;
2944 }
2945
2946 sub run_diff
2947 {
2948   my($prog, $file, $str) = @_;
2949   my $tmp = 'dppptemp';
2950   my $suf = 'aaa';
2951   my $diff = '';
2952   local *F;
2953
2954   while (-e "$tmp.$suf") { $suf++ }
2955   $tmp = "$tmp.$suf";
2956
2957   if (open F, ">$tmp") {
2958     print F $str;
2959     close F;
2960
2961     if (open F, "$prog $file $tmp |") {
2962       while (<F>) {
2963         s/\Q$tmp\E/$file.patched/;
2964         $diff .= $_;
2965       }
2966       close F;
2967       unlink $tmp;
2968       return $diff;
2969     }
2970
2971     unlink $tmp;
2972   }
2973   else {
2974     error("Cannot open '$tmp' for writing: $!");
2975   }
2976
2977   return undef;
2978 }
2979
2980 sub rec_depend
2981 {
2982   my($func, $seen) = @_;
2983   return () unless exists $depends{$func};
2984   $seen = {%{$seen||{}}};
2985   return () if $seen->{$func}++;
2986   my %s;
2987   grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}};
2988 }
2989
2990 sub parse_version
2991 {
2992   my $ver = shift;
2993
2994   if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) {
2995     return ($1, $2, $3);
2996   }
2997   elsif ($ver !~ /^\d+\.[\d_]+$/) {
2998     die "cannot parse version '$ver'\n";
2999   }
3000
3001   $ver =~ s/_//g;
3002   $ver =~ s/$/000000/;
3003
3004   my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
3005
3006   $v = int $v;
3007   $s = int $s;
3008
3009   if ($r < 5 || ($r == 5 && $v < 6)) {
3010     if ($s % 10) {
3011       die "cannot parse version '$ver'\n";
3012     }
3013   }
3014
3015   return ($r, $v, $s);
3016 }
3017
3018 sub format_version
3019 {
3020   my $ver = shift;
3021
3022   $ver =~ s/$/000000/;
3023   my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
3024
3025   $v = int $v;
3026   $s = int $s;
3027
3028   if ($r < 5 || ($r == 5 && $v < 6)) {
3029     if ($s % 10) {
3030       die "invalid version '$ver'\n";
3031     }
3032     $s /= 10;
3033
3034     $ver = sprintf "%d.%03d", $r, $v;
3035     $s > 0 and $ver .= sprintf "_%02d", $s;
3036
3037     return $ver;
3038   }
3039
3040   return sprintf "%d.%d.%d", $r, $v, $s;
3041 }
3042
3043 sub info
3044 {
3045   $opt{quiet} and return;
3046   print @_, "\n";
3047 }
3048
3049 sub diag
3050 {
3051   $opt{quiet} and return;
3052   $opt{diag} and print @_, "\n";
3053 }
3054
3055 sub warning
3056 {
3057   $opt{quiet} and return;
3058   print "*** ", @_, "\n";
3059 }
3060
3061 sub error
3062 {
3063   print "*** ERROR: ", @_, "\n";
3064 }
3065
3066 my %given_hints;
3067 my %given_warnings;
3068 sub hint
3069 {
3070   $opt{quiet} and return;
3071   my $func = shift;
3072   my $rv = 0;
3073   if (exists $warnings{$func} && !$given_warnings{$func}++) {
3074     my $warn = $warnings{$func};
3075     $warn =~ s!^!*** !mg;
3076     print "*** WARNING: $func\n", $warn;
3077     $rv++;
3078   }
3079   if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) {
3080     my $hint = $hints{$func};
3081     $hint =~ s/^/   /mg;
3082     print "   --- hint for $func ---\n", $hint;
3083   }
3084   $rv;
3085 }
3086
3087 sub usage
3088 {
3089   my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
3090   my %M = ( 'I' => '*' );
3091   $usage =~ s/^\s*perl\s+\S+/$^X $0/;
3092   $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
3093
3094   print <<ENDUSAGE;
3095
3096 Usage: $usage
3097
3098 See perldoc $0 for details.
3099
3100 ENDUSAGE
3101
3102   exit 2;
3103 }
3104
3105 sub strip
3106 {
3107   my $self = do { local(@ARGV,$/)=($0); <> };
3108   my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
3109   $copy =~ s/^(?=\S+)/    /gms;
3110   $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
3111   $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
3112 if (\@ARGV && \$ARGV[0] eq '--unstrip') {
3113   eval { require Devel::PPPort };
3114   \$@ and die "Cannot require Devel::PPPort, please install.\\n";
3115   if (eval \$Devel::PPPort::VERSION < $VERSION) {
3116     die "$0 was originally generated with Devel::PPPort $VERSION.\\n"
3117       . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n"
3118       . "Please install a newer version, or --unstrip will not work.\\n";
3119   }
3120   Devel::PPPort::WriteFile(\$0);
3121   exit 0;
3122 }
3123 print <<END;
3124
3125 Sorry, but this is a stripped version of \$0.
3126
3127 To be able to use its original script and doc functionality,
3128 please try to regenerate this file using:
3129
3130   \$^X \$0 --unstrip
3131
3132 END
3133 /ms;
3134   my($pl, $c) = $self =~ /(.*^__DATA__)(.*)/ms;
3135   $c =~ s{
3136     / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
3137   | ( "[^"\\]*(?:\\.[^"\\]*)*"
3138     | '[^'\\]*(?:\\.[^'\\]*)*' )
3139   | ($HS+) }{ defined $2 ? ' ' : ($1 || '') }gsex;
3140   $c =~ s!\s+$!!mg;
3141   $c =~ s!^$LF!!mg;
3142   $c =~ s!^\s*#\s*!#!mg;
3143   $c =~ s!^\s+!!mg;
3144
3145   open OUT, ">$0" or die "cannot strip $0: $!\n";
3146   print OUT "$pl$c\n";
3147
3148   exit 0;
3149 }
3150
3151 __DATA__
3152 */
3153
3154 #ifndef _P_P_PORTABILITY_H_
3155 #define _P_P_PORTABILITY_H_
3156
3157 #ifndef DPPP_NAMESPACE
3158 #  define DPPP_NAMESPACE DPPP_
3159 #endif
3160
3161 #define DPPP_CAT2(x,y) CAT2(x,y)
3162 #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
3163
3164 #ifndef PERL_REVISION
3165 #  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
3166 #    define PERL_PATCHLEVEL_H_IMPLICIT
3167 #    include <patchlevel.h>
3168 #  endif
3169 #  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
3170 #    include <could_not_find_Perl_patchlevel.h>
3171 #  endif
3172 #  ifndef PERL_REVISION
3173 #    define PERL_REVISION       (5)
3174      /* Replace: 1 */
3175 #    define PERL_VERSION        PATCHLEVEL
3176 #    define PERL_SUBVERSION     SUBVERSION
3177      /* Replace PERL_PATCHLEVEL with PERL_VERSION */
3178      /* Replace: 0 */
3179 #  endif
3180 #endif
3181
3182 #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
3183 #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
3184
3185 /* It is very unlikely that anyone will try to use this with Perl 6
3186    (or greater), but who knows.
3187  */
3188 #if PERL_REVISION != 5
3189 #  error ppport.h only works with Perl version 5
3190 #endif /* PERL_REVISION != 5 */
3191 #ifndef dTHR
3192 #  define dTHR                           dNOOP
3193 #endif
3194 #ifndef dTHX
3195 #  define dTHX                           dNOOP
3196 #endif
3197
3198 #ifndef dTHXa
3199 #  define dTHXa(x)                       dNOOP
3200 #endif
3201 #ifndef pTHX
3202 #  define pTHX                           void
3203 #endif
3204
3205 #ifndef pTHX_
3206 #  define pTHX_
3207 #endif
3208
3209 #ifndef aTHX
3210 #  define aTHX
3211 #endif
3212
3213 #ifndef aTHX_
3214 #  define aTHX_
3215 #endif
3216
3217 #if (PERL_BCDVERSION < 0x5006000)
3218 #  ifdef USE_THREADS
3219 #    define aTHXR  thr
3220 #    define aTHXR_ thr,
3221 #  else
3222 #    define aTHXR
3223 #    define aTHXR_
3224 #  endif
3225 #  define dTHXR  dTHR
3226 #else
3227 #  define aTHXR  aTHX
3228 #  define aTHXR_ aTHX_
3229 #  define dTHXR  dTHX
3230 #endif
3231 #ifndef dTHXoa
3232 #  define dTHXoa(x)                      dTHXa(x)
3233 #endif
3234
3235 #ifdef I_LIMITS
3236 #  include <limits.h>
3237 #endif
3238
3239 #ifndef PERL_UCHAR_MIN
3240 #  define PERL_UCHAR_MIN ((unsigned char)0)
3241 #endif
3242
3243 #ifndef PERL_UCHAR_MAX
3244 #  ifdef UCHAR_MAX
3245 #    define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
3246 #  else
3247 #    ifdef MAXUCHAR
3248 #      define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
3249 #    else
3250 #      define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
3251 #    endif
3252 #  endif
3253 #endif
3254
3255 #ifndef PERL_USHORT_MIN
3256 #  define PERL_USHORT_MIN ((unsigned short)0)
3257 #endif
3258
3259 #ifndef PERL_USHORT_MAX
3260 #  ifdef USHORT_MAX
3261 #    define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
3262 #  else
3263 #    ifdef MAXUSHORT
3264 #      define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
3265 #    else
3266 #      ifdef USHRT_MAX
3267 #        define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
3268 #      else
3269 #        define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
3270 #      endif
3271 #    endif
3272 #  endif
3273 #endif
3274
3275 #ifndef PERL_SHORT_MAX
3276 #  ifdef SHORT_MAX
3277 #    define PERL_SHORT_MAX ((short)SHORT_MAX)
3278 #  else
3279 #    ifdef MAXSHORT    /* Often used in <values.h> */
3280 #      define PERL_SHORT_MAX ((short)MAXSHORT)
3281 #    else
3282 #      ifdef SHRT_MAX
3283 #        define PERL_SHORT_MAX ((short)SHRT_MAX)
3284 #      else
3285 #        define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
3286 #      endif
3287 #    endif
3288 #  endif
3289 #endif
3290
3291 #ifndef PERL_SHORT_MIN
3292 #  ifdef SHORT_MIN
3293 #    define PERL_SHORT_MIN ((short)SHORT_MIN)
3294 #  else
3295 #    ifdef MINSHORT
3296 #      define PERL_SHORT_MIN ((short)MINSHORT)
3297 #    else
3298 #      ifdef SHRT_MIN
3299 #        define PERL_SHORT_MIN ((short)SHRT_MIN)
3300 #      else
3301 #        define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
3302 #      endif
3303 #    endif
3304 #  endif
3305 #endif
3306
3307 #ifndef PERL_UINT_MAX
3308 #  ifdef UINT_MAX
3309 #    define PERL_UINT_MAX ((unsigned int)UINT_MAX)
3310 #  else
3311 #    ifdef MAXUINT
3312 #      define PERL_UINT_MAX ((unsigned int)MAXUINT)
3313 #    else
3314 #      define PERL_UINT_MAX (~(unsigned int)0)
3315 #    endif
3316 #  endif
3317 #endif
3318
3319 #ifndef PERL_UINT_MIN
3320 #  define PERL_UINT_MIN ((unsigned int)0)
3321 #endif
3322
3323 #ifndef PERL_INT_MAX
3324 #  ifdef INT_MAX
3325 #    define PERL_INT_MAX ((int)INT_MAX)
3326 #  else
3327 #    ifdef MAXINT    /* Often used in <values.h> */
3328 #      define PERL_INT_MAX ((int)MAXINT)
3329 #    else
3330 #      define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
3331 #    endif
3332 #  endif
3333 #endif
3334
3335 #ifndef PERL_INT_MIN
3336 #  ifdef INT_MIN
3337 #    define PERL_INT_MIN ((int)INT_MIN)
3338 #  else
3339 #    ifdef MININT
3340 #      define PERL_INT_MIN ((int)MININT)
3341 #    else
3342 #      define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
3343 #    endif
3344 #  endif
3345 #endif
3346
3347 #ifndef PERL_ULONG_MAX
3348 #  ifdef ULONG_MAX
3349 #    define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
3350 #  else
3351 #    ifdef MAXULONG
3352 #      define PERL_ULONG_MAX ((unsigned long)MAXULONG)
3353 #    else
3354 #      define PERL_ULONG_MAX (~(unsigned long)0)
3355 #    endif
3356 #  endif
3357 #endif
3358
3359 #ifndef PERL_ULONG_MIN
3360 #  define PERL_ULONG_MIN ((unsigned long)0L)
3361 #endif
3362
3363 #ifndef PERL_LONG_MAX
3364 #  ifdef LONG_MAX
3365 #    define PERL_LONG_MAX ((long)LONG_MAX)
3366 #  else
3367 #    ifdef MAXLONG
3368 #      define PERL_LONG_MAX ((long)MAXLONG)
3369 #    else
3370 #      define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
3371 #    endif
3372 #  endif
3373 #endif
3374
3375 #ifndef PERL_LONG_MIN
3376 #  ifdef LONG_MIN
3377 #    define PERL_LONG_MIN ((long)LONG_MIN)
3378 #  else
3379 #    ifdef MINLONG
3380 #      define PERL_LONG_MIN ((long)MINLONG)
3381 #    else
3382 #      define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
3383 #    endif
3384 #  endif
3385 #endif
3386
3387 #if defined(HAS_QUAD) && (defined(convex) || defined(uts))
3388 #  ifndef PERL_UQUAD_MAX
3389 #    ifdef ULONGLONG_MAX
3390 #      define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX)
3391 #    else
3392 #      ifdef MAXULONGLONG
3393 #        define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG)
3394 #      else
3395 #        define PERL_UQUAD_MAX (~(unsigned long long)0)
3396 #      endif
3397 #    endif
3398 #  endif
3399
3400 #  ifndef PERL_UQUAD_MIN
3401 #    define PERL_UQUAD_MIN ((unsigned long long)0L)
3402 #  endif
3403
3404 #  ifndef PERL_QUAD_MAX
3405 #    ifdef LONGLONG_MAX
3406 #      define PERL_QUAD_MAX ((long long)LONGLONG_MAX)
3407 #    else
3408 #      ifdef MAXLONGLONG
3409 #        define PERL_QUAD_MAX ((long long)MAXLONGLONG)
3410 #      else
3411 #        define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1))
3412 #      endif
3413 #    endif
3414 #  endif
3415
3416 #  ifndef PERL_QUAD_MIN
3417 #    ifdef LONGLONG_MIN
3418 #      define PERL_QUAD_MIN ((long long)LONGLONG_MIN)
3419 #    else
3420 #      ifdef MINLONGLONG
3421 #        define PERL_QUAD_MIN ((long long)MINLONGLONG)
3422 #      else
3423 #        define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
3424 #      endif
3425 #    endif
3426 #  endif
3427 #endif
3428
3429 /* This is based on code from 5.003 perl.h */
3430 #ifdef HAS_QUAD
3431 #  ifdef cray
3432 #ifndef IVTYPE
3433 #  define IVTYPE                         int
3434 #endif
3435
3436 #ifndef IV_MIN
3437 #  define IV_MIN                         PERL_INT_MIN
3438 #endif
3439
3440 #ifndef IV_MAX
3441 #  define IV_MAX                         PERL_INT_MAX
3442 #endif
3443
3444 #ifndef UV_MIN
3445 #  define UV_MIN                         PERL_UINT_MIN
3446 #endif
3447
3448 #ifndef UV_MAX
3449 #  define UV_MAX                         PERL_UINT_MAX
3450 #endif
3451
3452 #    ifdef INTSIZE
3453 #ifndef IVSIZE
3454 #  define IVSIZE                         INTSIZE
3455 #endif
3456
3457 #    endif
3458 #  else
3459 #    if defined(convex) || defined(uts)
3460 #ifndef IVTYPE
3461 #  define IVTYPE                         long long
3462 #endif
3463
3464 #ifndef IV_MIN
3465 #  define IV_MIN                         PERL_QUAD_MIN
3466 #endif
3467
3468 #ifndef IV_MAX
3469 #  define IV_MAX                         PERL_QUAD_MAX
3470 #endif
3471
3472 #ifndef UV_MIN
3473 #  define UV_MIN                         PERL_UQUAD_MIN
3474 #endif
3475
3476 #ifndef UV_MAX
3477 #  define UV_MAX                         PERL_UQUAD_MAX
3478 #endif
3479
3480 #      ifdef LONGLONGSIZE
3481 #ifndef IVSIZE
3482 #  define IVSIZE                         LONGLONGSIZE
3483 #endif
3484
3485 #      endif
3486 #    else
3487 #ifndef IVTYPE
3488 #  define IVTYPE                         long
3489 #endif
3490
3491 #ifndef IV_MIN
3492 #  define IV_MIN                         PERL_LONG_MIN
3493 #endif
3494
3495 #ifndef IV_MAX
3496 #  define IV_MAX                         PERL_LONG_MAX
3497 #endif
3498
3499 #ifndef UV_MIN
3500 #  define UV_MIN                         PERL_ULONG_MIN
3501 #endif
3502
3503 #ifndef UV_MAX
3504 #  define UV_MAX                         PERL_ULONG_MAX
3505 #endif
3506
3507 #      ifdef LONGSIZE
3508 #ifndef IVSIZE
3509 #  define IVSIZE                         LONGSIZE
3510 #endif
3511
3512 #      endif
3513 #    endif
3514 #  endif
3515 #ifndef IVSIZE
3516 #  define IVSIZE                         8
3517 #endif
3518
3519 #ifndef PERL_QUAD_MIN
3520 #  define PERL_QUAD_MIN                  IV_MIN
3521 #endif
3522
3523 #ifndef PERL_QUAD_MAX
3524 #  define PERL_QUAD_MAX                  IV_MAX
3525 #endif
3526
3527 #ifndef PERL_UQUAD_MIN
3528 #  define PERL_UQUAD_MIN                 UV_MIN
3529 #endif
3530
3531 #ifndef PERL_UQUAD_MAX
3532 #  define PERL_UQUAD_MAX                 UV_MAX
3533 #endif
3534
3535 #else
3536 #ifndef IVTYPE
3537 #  define IVTYPE                         long
3538 #endif
3539
3540 #ifndef IV_MIN
3541 #  define IV_MIN                         PERL_LONG_MIN
3542 #endif
3543
3544 #ifndef IV_MAX
3545 #  define IV_MAX                         PERL_LONG_MAX
3546 #endif
3547
3548 #ifndef UV_MIN
3549 #  define UV_MIN                         PERL_ULONG_MIN
3550 #endif
3551
3552 #ifndef UV_MAX
3553 #  define UV_MAX                         PERL_ULONG_MAX
3554 #endif
3555
3556 #endif
3557
3558 #ifndef IVSIZE
3559 #  ifdef LONGSIZE
3560 #    define IVSIZE LONGSIZE
3561 #  else
3562 #    define IVSIZE 4 /* A bold guess, but the best we can make. */
3563 #  endif
3564 #endif
3565 #ifndef UVTYPE
3566 #  define UVTYPE                         unsigned IVTYPE
3567 #endif
3568
3569 #ifndef UVSIZE
3570 #  define UVSIZE                         IVSIZE
3571 #endif
3572 #ifndef sv_setuv
3573 #  define sv_setuv(sv, uv)               \
3574                STMT_START {                         \
3575                  UV TeMpUv = uv;                    \
3576                  if (TeMpUv <= IV_MAX)              \
3577                    sv_setiv(sv, TeMpUv);            \
3578                  else                               \
3579                    sv_setnv(sv, (double)TeMpUv);    \
3580                } STMT_END
3581 #endif
3582 #ifndef newSVuv
3583 #  define newSVuv(uv)                    ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
3584 #endif
3585 #ifndef sv_2uv
3586 #  define sv_2uv(sv)                     ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
3587 #endif
3588
3589 #ifndef SvUVX
3590 #  define SvUVX(sv)                      ((UV)SvIVX(sv))
3591 #endif
3592
3593 #ifndef SvUVXx
3594 #  define SvUVXx(sv)                     SvUVX(sv)
3595 #endif
3596
3597 #ifndef SvUV
3598 #  define SvUV(sv)                       (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
3599 #endif
3600
3601 #ifndef SvUVx
3602 #  define SvUVx(sv)                      ((PL_Sv = (sv)), SvUV(PL_Sv))
3603 #endif
3604
3605 /* Hint: sv_uv
3606  * Always use the SvUVx() macro instead of sv_uv().
3607  */
3608 #ifndef sv_uv
3609 #  define sv_uv(sv)                      SvUVx(sv)
3610 #endif
3611
3612 #if !defined(SvUOK) && defined(SvIOK_UV)
3613 #  define SvUOK(sv) SvIOK_UV(sv)
3614 #endif
3615 #ifndef XST_mUV
3616 #  define XST_mUV(i,v)                   (ST(i) = sv_2mortal(newSVuv(v))  )
3617 #endif
3618
3619 #ifndef XSRETURN_UV
3620 #  define XSRETURN_UV(v)                 STMT_START { XST_mUV(0,v);  XSRETURN(1); } STMT_END
3621 #endif
3622 #ifndef PUSHu
3623 #  define PUSHu(u)                       STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG;  } STMT_END
3624 #endif
3625
3626 #ifndef XPUSHu
3627 #  define XPUSHu(u)                      STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
3628 #endif
3629
3630 #ifdef HAS_MEMCMP
3631 #ifndef memNE
3632 #  define memNE(s1,s2,l)                 (memcmp(s1,s2,l))
3633 #endif
3634
3635 #ifndef memEQ
3636 #  define memEQ(s1,s2,l)                 (!memcmp(s1,s2,l))
3637 #endif
3638
3639 #else
3640 #ifndef memNE
3641 #  define memNE(s1,s2,l)                 (bcmp(s1,s2,l))
3642 #endif
3643
3644 #ifndef memEQ
3645 #  define memEQ(s1,s2,l)                 (!bcmp(s1,s2,l))
3646 #endif
3647
3648 #endif
3649 #ifndef MoveD
3650 #  define MoveD(s,d,n,t)                 memmove((char*)(d),(char*)(s), (n) * sizeof(t))
3651 #endif
3652
3653 #ifndef CopyD
3654 #  define CopyD(s,d,n,t)                 memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
3655 #endif
3656
3657 #ifdef HAS_MEMSET
3658 #ifndef ZeroD
3659 #  define ZeroD(d,n,t)                   memzero((char*)(d), (n) * sizeof(t))
3660 #endif
3661
3662 #else
3663 #ifndef ZeroD
3664 #  define ZeroD(d,n,t)                   ((void)memzero((char*)(d), (n) * sizeof(t)), d)
3665 #endif
3666
3667 #endif
3668 #ifndef PoisonWith
3669 #  define PoisonWith(d,n,t,b)            (void)memset((char*)(d), (U8)(b), (n) * sizeof(t))
3670 #endif
3671
3672 #ifndef PoisonNew
3673 #  define PoisonNew(d,n,t)               PoisonWith(d,n,t,0xAB)
3674 #endif
3675
3676 #ifndef PoisonFree
3677 #  define PoisonFree(d,n,t)              PoisonWith(d,n,t,0xEF)
3678 #endif
3679
3680 #ifndef Poison
3681 #  define Poison(d,n,t)                  PoisonFree(d,n,t)
3682 #endif
3683 #ifndef Newx
3684 #  define Newx(v,n,t)                    New(0,v,n,t)
3685 #endif
3686
3687 #ifndef Newxc
3688 #  define Newxc(v,n,t,c)                 Newc(0,v,n,t,c)
3689 #endif
3690
3691 #ifndef Newxz
3692 #  define Newxz(v,n,t)                   Newz(0,v,n,t)
3693 #endif
3694
3695 #ifndef PERL_UNUSED_DECL
3696 #  ifdef HASATTRIBUTE
3697 #    if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
3698 #      define PERL_UNUSED_DECL
3699 #    else
3700 #      define PERL_UNUSED_DECL __attribute__((unused))
3701 #    endif
3702 #  else
3703 #    define PERL_UNUSED_DECL
3704 #  endif
3705 #endif
3706
3707 #ifndef PERL_UNUSED_ARG
3708 #  if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
3709 #    include <note.h>
3710 #    define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
3711 #  else
3712 #    define PERL_UNUSED_ARG(x) ((void)x)
3713 #  endif
3714 #endif
3715
3716 #ifndef PERL_UNUSED_VAR
3717 #  define PERL_UNUSED_VAR(x) ((void)x)
3718 #endif
3719
3720 #ifndef PERL_UNUSED_CONTEXT
3721 #  ifdef USE_ITHREADS
3722 #    define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
3723 #  else
3724 #    define PERL_UNUSED_CONTEXT
3725 #  endif
3726 #endif
3727 #ifndef NOOP
3728 #  define NOOP                           /*EMPTY*/(void)0
3729 #endif
3730
3731 #ifndef dNOOP
3732 #  define dNOOP                          extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
3733 #endif
3734
3735 #ifndef NVTYPE
3736 #  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
3737 #    define NVTYPE long double
3738 #  else
3739 #    define NVTYPE double
3740 #  endif
3741 typedef NVTYPE NV;
3742 #endif
3743
3744 #ifndef INT2PTR
3745 #  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
3746 #    define PTRV                  UV
3747 #    define INT2PTR(any,d)        (any)(d)
3748 #  else
3749 #    if PTRSIZE == LONGSIZE
3750 #      define PTRV                unsigned long
3751 #    else
3752 #      define PTRV                unsigned
3753 #    endif
3754 #    define INT2PTR(any,d)        (any)(PTRV)(d)
3755 #  endif
3756 #endif
3757
3758 #ifndef PTR2ul
3759 #  if PTRSIZE == LONGSIZE
3760 #    define PTR2ul(p)     (unsigned long)(p)
3761 #  else
3762 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
3763 #  endif
3764 #endif
3765 #ifndef PTR2nat
3766 #  define PTR2nat(p)                     (PTRV)(p)
3767 #endif
3768
3769 #ifndef NUM2PTR
3770 #  define NUM2PTR(any,d)                 (any)PTR2nat(d)
3771 #endif
3772
3773 #ifndef PTR2IV
3774 #  define PTR2IV(p)                      INT2PTR(IV,p)
3775 #endif
3776
3777 #ifndef PTR2UV
3778 #  define PTR2UV(p)                      INT2PTR(UV,p)
3779 #endif
3780
3781 #ifndef PTR2NV
3782 #  define PTR2NV(p)                      NUM2PTR(NV,p)
3783 #endif
3784
3785 #undef START_EXTERN_C
3786 #undef END_EXTERN_C
3787 #undef EXTERN_C
3788 #ifdef __cplusplus
3789 #  define START_EXTERN_C extern "C" {
3790 #  define END_EXTERN_C }
3791 #  define EXTERN_C extern "C"
3792 #else
3793 #  define START_EXTERN_C
3794 #  define END_EXTERN_C
3795 #  define EXTERN_C extern
3796 #endif
3797
3798 #if defined(PERL_GCC_PEDANTIC)
3799 #  ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
3800 #    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
3801 #  endif
3802 #endif
3803
3804 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
3805 #  ifndef PERL_USE_GCC_BRACE_GROUPS
3806 #    define PERL_USE_GCC_BRACE_GROUPS
3807 #  endif
3808 #endif
3809
3810 #undef STMT_START
3811 #undef STMT_END
3812 #ifdef PERL_USE_GCC_BRACE_GROUPS
3813 #  define STMT_START    (void)( /* gcc supports ``({ STATEMENTS; })'' */
3814 #  define STMT_END      )
3815 #else
3816 #  if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
3817 #    define STMT_START  if (1)
3818 #    define STMT_END    else (void)0
3819 #  else
3820 #    define STMT_START  do
3821 #    define STMT_END    while (0)
3822 #  endif
3823 #endif
3824 #ifndef boolSV
3825 #  define boolSV(b)                      ((b) ? &PL_sv_yes : &PL_sv_no)
3826 #endif
3827
3828 /* DEFSV appears first in 5.004_56 */
3829 #ifndef DEFSV
3830 #  define DEFSV                          GvSV(PL_defgv)
3831 #endif
3832
3833 #ifndef SAVE_DEFSV
3834 #  define SAVE_DEFSV                     SAVESPTR(GvSV(PL_defgv))
3835 #endif
3836
3837 #ifndef DEFSV_set
3838 #  define DEFSV_set(sv)                  (DEFSV = (sv))
3839 #endif
3840
3841 /* Older perls (<=5.003) lack AvFILLp */
3842 #ifndef AvFILLp
3843 #  define AvFILLp                        AvFILL
3844 #endif
3845 #ifndef ERRSV
3846 #  define ERRSV                          get_sv("@",FALSE)
3847 #endif
3848
3849 /* Hint: gv_stashpvn
3850  * This function's backport doesn't support the length parameter, but
3851  * rather ignores it. Portability can only be ensured if the length
3852  * parameter is used for speed reasons, but the length can always be
3853  * correctly computed from the string argument.
3854  */
3855 #ifndef gv_stashpvn
3856 #  define gv_stashpvn(str,len,create)    gv_stashpv(str,create)
3857 #endif
3858
3859 /* Replace: 1 */
3860 #ifndef get_cv
3861 #  define get_cv                         perl_get_cv
3862 #endif
3863
3864 #ifndef get_sv
3865 #  define get_sv                         perl_get_sv
3866 #endif
3867
3868 #ifndef get_av
3869 #  define get_av                         perl_get_av
3870 #endif
3871
3872 #ifndef get_hv
3873 #  define get_hv                         perl_get_hv
3874 #endif
3875
3876 /* Replace: 0 */
3877 #ifndef dUNDERBAR
3878 #  define dUNDERBAR                      dNOOP
3879 #endif
3880
3881 #ifndef UNDERBAR
3882 #  define UNDERBAR                       DEFSV
3883 #endif
3884 #ifndef dAX
3885 #  define dAX                            I32 ax = MARK - PL_stack_base + 1
3886 #endif
3887
3888 #ifndef dITEMS
3889 #  define dITEMS                         I32 items = SP - MARK
3890 #endif
3891 #ifndef dXSTARG
3892 #  define dXSTARG                        SV * targ = sv_newmortal()
3893 #endif
3894 #ifndef dAXMARK
3895 #  define dAXMARK                        I32 ax = POPMARK; \
3896                                register SV ** const mark = PL_stack_base + ax++
3897 #endif
3898 #ifndef XSprePUSH
3899 #  define XSprePUSH                      (sp = PL_stack_base + ax - 1)
3900 #endif
3901
3902 #if (PERL_BCDVERSION < 0x5005000)
3903 #  undef XSRETURN
3904 #  define XSRETURN(off)                                   \
3905       STMT_START {                                        \
3906           PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
3907           return;                                         \
3908       } STMT_END
3909 #endif
3910 #ifndef PERL_ABS
3911 #  define PERL_ABS(x)                    ((x) < 0 ? -(x) : (x))
3912 #endif
3913 #ifndef dVAR
3914 #  define dVAR                           dNOOP
3915 #endif
3916 #ifndef SVf
3917 #  define SVf                            "_"
3918 #endif
3919 #ifndef UTF8_MAXBYTES
3920 #  define UTF8_MAXBYTES                  UTF8_MAXLEN
3921 #endif
3922 #ifndef CPERLscope
3923 #  define CPERLscope(x)                  x
3924 #endif
3925 #ifndef PERL_HASH
3926 #  define PERL_HASH(hash,str,len)        \
3927      STMT_START { \
3928         const char *s_PeRlHaSh = str; \
3929         I32 i_PeRlHaSh = len; \
3930         U32 hash_PeRlHaSh = 0; \
3931         while (i_PeRlHaSh--) \
3932             hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
3933         (hash) = hash_PeRlHaSh; \
3934     } STMT_END
3935 #endif
3936
3937 #ifndef PERLIO_FUNCS_DECL
3938 # ifdef PERLIO_FUNCS_CONST
3939 #  define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
3940 #  define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
3941 # else
3942 #  define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs
3943 #  define PERLIO_FUNCS_CAST(funcs) (funcs)
3944 # endif
3945 #endif
3946
3947 /* provide these typedefs for older perls */
3948 #if (PERL_BCDVERSION < 0x5009003)
3949
3950 # ifdef ARGSproto
3951 typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto);
3952 # else
3953 typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX);
3954 # endif
3955
3956 typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*);
3957
3958 #endif
3959 #ifndef isPSXSPC
3960 #  define isPSXSPC(c)                    (isSPACE(c) || (c) == '\v')
3961 #endif
3962
3963 #ifndef isBLANK
3964 #  define isBLANK(c)                     ((c) == ' ' || (c) == '\t')
3965 #endif
3966
3967 #ifdef EBCDIC
3968 #ifndef isALNUMC
3969 #  define isALNUMC(c)                    isalnum(c)
3970 #endif
3971
3972 #ifndef isASCII
3973 #  define isASCII(c)                     isascii(c)
3974 #endif
3975
3976 #ifndef isCNTRL
3977 #  define isCNTRL(c)                     iscntrl(c)
3978 #endif
3979
3980 #ifndef isGRAPH
3981 #  define isGRAPH(c)                     isgraph(c)
3982 #endif
3983
3984 #ifndef isPRINT
3985 #  define isPRINT(c)                     isprint(c)
3986 #endif
3987
3988 #ifndef isPUNCT
3989 #  define isPUNCT(c)                     ispunct(c)
3990 #endif
3991
3992 #ifndef isXDIGIT
3993 #  define isXDIGIT(c)                    isxdigit(c)
3994 #endif
3995
3996 #else
3997 # if (PERL_BCDVERSION < 0x5010000)
3998 /* Hint: isPRINT
3999  * The implementation in older perl versions includes all of the
4000  * isSPACE() characters, which is wrong. The version provided by
4001  * Devel::PPPort always overrides a present buggy version.
4002  */
4003 #  undef isPRINT
4004 # endif
4005 #ifndef isALNUMC
4006 #  define isALNUMC(c)                    (isALPHA(c) || isDIGIT(c))
4007 #endif
4008
4009 #ifndef isASCII
4010 #  define isASCII(c)                     ((c) <= 127)
4011 #endif
4012
4013 #ifndef isCNTRL
4014 #  define isCNTRL(c)                     ((c) < ' ' || (c) == 127)
4015 #endif
4016
4017 #ifndef isGRAPH
4018 #  define isGRAPH(c)                     (isALNUM(c) || isPUNCT(c))
4019 #endif
4020
4021 #ifndef isPRINT
4022 #  define isPRINT(c)                     (((c) >= 32 && (c) < 127))
4023 #endif
4024
4025 #ifndef isPUNCT
4026 #  define isPUNCT(c)                     (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64)  || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126))
4027 #endif
4028
4029 #ifndef isXDIGIT
4030 #  define isXDIGIT(c)                    (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
4031 #endif
4032
4033 #endif
4034
4035 #ifndef PERL_SIGNALS_UNSAFE_FLAG
4036
4037 #define PERL_SIGNALS_UNSAFE_FLAG 0x0001
4038
4039 #if (PERL_BCDVERSION < 0x5008000)
4040 #  define D_PPP_PERL_SIGNALS_INIT   PERL_SIGNALS_UNSAFE_FLAG
4041 #else
4042 #  define D_PPP_PERL_SIGNALS_INIT   0
4043 #endif
4044
4045 #if defined(NEED_PL_signals)
4046 static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT;
4047 #elif defined(NEED_PL_signals_GLOBAL)
4048 U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT;
4049 #else
4050 extern U32 DPPP_(my_PL_signals);
4051 #endif
4052 #define PL_signals DPPP_(my_PL_signals)
4053
4054 #endif
4055
4056 /* Hint: PL_ppaddr
4057  * Calling an op via PL_ppaddr requires passing a context argument
4058  * for threaded builds. Since the context argument is different for
4059  * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will
4060  * automatically be defined as the correct argument.
4061  */
4062
4063 #if (PERL_BCDVERSION <= 0x5005005)
4064 /* Replace: 1 */
4065 #  define PL_ppaddr                 ppaddr
4066 #  define PL_no_modify              no_modify
4067 /* Replace: 0 */
4068 #endif
4069
4070 #if (PERL_BCDVERSION <= 0x5004005)
4071 /* Replace: 1 */
4072 #  define PL_DBsignal               DBsignal
4073 #  define PL_DBsingle               DBsingle
4074 #  define PL_DBsub                  DBsub
4075 #  define PL_DBtrace                DBtrace
4076 #  define PL_Sv                     Sv
4077 #  define PL_bufend                 bufend
4078 #  define PL_bufptr                 bufptr
4079 #  define PL_compiling              compiling
4080 #  define PL_copline                copline
4081 #  define PL_curcop                 curcop
4082 #  define PL_curstash               curstash
4083 #  define PL_debstash               debstash
4084 #  define PL_defgv                  defgv
4085 #  define PL_diehook                diehook
4086 #  define PL_dirty                  dirty
4087 #  define PL_dowarn                 dowarn
4088 #  define PL_errgv                  errgv
4089 #  define PL_expect                 expect
4090 #  define PL_hexdigit               hexdigit
4091 #  define PL_hints                  hints
4092 #  define PL_laststatval            laststatval
4093 #  define PL_lex_state              lex_state
4094 #  define PL_lex_stuff              lex_stuff
4095 #  define PL_linestr                linestr
4096 #  define PL_na                     na
4097 #  define PL_perl_destruct_level    perl_destruct_level
4098 #  define PL_perldb                 perldb
4099 #  define PL_rsfp_filters           rsfp_filters
4100 #  define PL_rsfp                   rsfp
4101 #  define PL_stack_base             stack_base
4102 #  define PL_stack_sp               stack_sp
4103 #  define PL_statcache              statcache
4104 #  define PL_stdingv                stdingv
4105 #  define PL_sv_arenaroot           sv_arenaroot
4106 #  define PL_sv_no                  sv_no
4107 #  define PL_sv_undef               sv_undef
4108 #  define PL_sv_yes                 sv_yes
4109 #  define PL_tainted                tainted
4110 #  define PL_tainting               tainting
4111 #  define PL_tokenbuf               tokenbuf
4112 /* Replace: 0 */
4113 #endif
4114
4115 /* Warning: PL_parser
4116  * For perl versions earlier than 5.9.5, this is an always
4117  * non-NULL dummy. Also, it cannot be dereferenced. Don't
4118  * use it if you can avoid is and unless you absolutely know
4119  * what you're doing.
4120  * If you always check that PL_parser is non-NULL, you can
4121  * define DPPP_PL_parser_NO_DUMMY to avoid the creation of
4122  * a dummy parser structure.
4123  */
4124
4125 #if (PERL_BCDVERSION >= 0x5009005)
4126 # ifdef DPPP_PL_parser_NO_DUMMY
4127 #  define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \
4128                 (croak("panic: PL_parser == NULL in %s:%d", \
4129                        __FILE__, __LINE__), (yy_parser *) NULL))->var)
4130 # else
4131 #  ifdef DPPP_PL_parser_NO_DUMMY_WARNING
4132 #   define D_PPP_parser_dummy_warning(var)
4133 #  else
4134 #   define D_PPP_parser_dummy_warning(var) \
4135              warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__),
4136 #  endif
4137 #  define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \
4138                 (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var)
4139 #if defined(NEED_PL_parser)
4140 static yy_parser DPPP_(dummy_PL_parser);
4141 #elif defined(NEED_PL_parser_GLOBAL)
4142 yy_parser DPPP_(dummy_PL_parser);
4143 #else
4144 extern yy_parser DPPP_(dummy_PL_parser);
4145 #endif
4146
4147 # endif
4148
4149 /* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */
4150 /* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf
4151  * Do not use this variable unless you know exactly what you're
4152  * doint. It is internal to the perl parser and may change or even
4153  * be removed in the future. As of perl 5.9.5, you have to check
4154  * for (PL_parser != NULL) for this variable to have any effect.
4155  * An always non-NULL PL_parser dummy is provided for earlier
4156  * perl versions.
4157  * If PL_parser is NULL when you try to access this variable, a
4158  * dummy is being accessed instead and a warning is issued unless
4159  * you define DPPP_PL_parser_NO_DUMMY_WARNING.
4160  * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access
4161  * this variable will croak with a panic message.
4162  */
4163
4164 # define PL_expect         D_PPP_my_PL_parser_var(expect)
4165 # define PL_copline        D_PPP_my_PL_parser_var(copline)
4166 # define PL_rsfp           D_PPP_my_PL_parser_var(rsfp)
4167 # define PL_rsfp_filters   D_PPP_my_PL_parser_var(rsfp_filters)
4168 # define PL_linestr        D_PPP_my_PL_parser_var(linestr)
4169 # define PL_bufptr         D_PPP_my_PL_parser_var(bufptr)
4170 # define PL_bufend         D_PPP_my_PL_parser_var(bufend)
4171 # define PL_lex_state      D_PPP_my_PL_parser_var(lex_state)
4172 # define PL_lex_stuff      D_PPP_my_PL_parser_var(lex_stuff)
4173 # define PL_tokenbuf       D_PPP_my_PL_parser_var(tokenbuf)
4174
4175 #else
4176
4177 /* ensure that PL_parser != NULL and cannot be dereferenced */
4178 # define PL_parser         ((void *) 1)
4179
4180 #endif
4181 #ifndef mPUSHs
4182 #  define mPUSHs(s)                      PUSHs(sv_2mortal(s))
4183 #endif
4184
4185 #ifndef PUSHmortal
4186 #  define PUSHmortal                     PUSHs(sv_newmortal())
4187 #endif
4188
4189 #ifndef mPUSHp
4190 #  define mPUSHp(p,l)                    sv_setpvn(PUSHmortal, (p), (l))
4191 #endif
4192
4193 #ifndef mPUSHn
4194 #  define mPUSHn(n)                      sv_setnv(PUSHmortal, (NV)(n))
4195 #endif
4196
4197 #ifndef mPUSHi
4198 #  define mPUSHi(i)                      sv_setiv(PUSHmortal, (IV)(i))
4199 #endif
4200
4201 #ifndef mPUSHu
4202 #  define mPUSHu(u)                      sv_setuv(PUSHmortal, (UV)(u))
4203 #endif
4204 #ifndef mXPUSHs
4205 #  define mXPUSHs(s)                     XPUSHs(sv_2mortal(s))
4206 #endif
4207
4208 #ifndef XPUSHmortal
4209 #  define XPUSHmortal                    XPUSHs(sv_newmortal())
4210 #endif
4211
4212 #ifndef mXPUSHp
4213 #  define mXPUSHp(p,l)                   STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END
4214 #endif
4215
4216 #ifndef mXPUSHn
4217 #  define mXPUSHn(n)                     STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END
4218 #endif
4219
4220 #ifndef mXPUSHi
4221 #  define mXPUSHi(i)                     STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END
4222 #endif
4223
4224 #ifndef mXPUSHu
4225 #  define mXPUSHu(u)                     STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END
4226 #endif
4227
4228 /* Replace: 1 */
4229 #ifndef call_sv
4230 #  define call_sv                        perl_call_sv
4231 #endif
4232
4233 #ifndef call_pv
4234 #  define call_pv                        perl_call_pv
4235 #endif
4236
4237 #ifndef call_argv
4238 #  define call_argv                      perl_call_argv
4239 #endif
4240
4241 #ifndef call_method
4242 #  define call_method                    perl_call_method
4243 #endif
4244 #ifndef eval_sv
4245 #  define eval_sv                        perl_eval_sv
4246 #endif
4247
4248 /* Replace: 0 */
4249 #ifndef PERL_LOADMOD_DENY
4250 #  define PERL_LOADMOD_DENY              0x1
4251 #endif
4252
4253 #ifndef PERL_LOADMOD_NOIMPORT
4254 #  define PERL_LOADMOD_NOIMPORT          0x2
4255 #endif
4256
4257 #ifndef PERL_LOADMOD_IMPORT_OPS
4258 #  define PERL_LOADMOD_IMPORT_OPS        0x4
4259 #endif
4260
4261 #ifndef G_METHOD
4262 # define G_METHOD               64
4263 # ifdef call_sv
4264 #  undef call_sv
4265 # endif
4266 # if (PERL_BCDVERSION < 0x5006000)
4267 #  define call_sv(sv, flags)  ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \
4268                                 (flags) & ~G_METHOD) : perl_call_sv(sv, flags))
4269 # else
4270 #  define call_sv(sv, flags)  ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \
4271                                 (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags))
4272 # endif
4273 #endif
4274
4275 /* Replace perl_eval_pv with eval_pv */
4276
4277 #ifndef eval_pv
4278 #if defined(NEED_eval_pv)
4279 static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
4280 static
4281 #else
4282 extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
4283 #endif
4284
4285 #ifdef eval_pv
4286 #  undef eval_pv
4287 #endif
4288 #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
4289 #define Perl_eval_pv DPPP_(my_eval_pv)
4290
4291 #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
4292
4293 SV*
4294 DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
4295 {
4296     dSP;
4297     SV* sv = newSVpv(p, 0);
4298
4299     PUSHMARK(sp);
4300     eval_sv(sv, G_SCALAR);
4301     SvREFCNT_dec(sv);
4302
4303     SPAGAIN;
4304     sv = POPs;
4305     PUTBACK;
4306
4307     if (croak_on_error && SvTRUE(GvSV(errgv)))
4308         croak(SvPVx(GvSV(errgv), na));
4309
4310     return sv;
4311 }
4312
4313 #endif
4314 #endif
4315
4316 #ifndef vload_module
4317 #if defined(NEED_vload_module)
4318 static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args);
4319 static
4320 #else
4321 extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args);
4322 #endif
4323
4324 #ifdef vload_module
4325 #  undef vload_module
4326 #endif
4327 #define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d)
4328 #define Perl_vload_module DPPP_(my_vload_module)
4329
4330 #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL)
4331
4332 void
4333 DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args)
4334 {
4335     dTHR;
4336     dVAR;
4337     OP *veop, *imop;
4338
4339     OP * const modname = newSVOP(OP_CONST, 0, name);
4340     /* 5.005 has a somewhat hacky force_normal that doesn't croak on
4341        SvREADONLY() if PL_compling is true. Current perls take care in
4342        ck_require() to correctly turn off SvREADONLY before calling
4343        force_normal_flags(). This seems a better fix than fudging PL_compling
4344      */
4345     SvREADONLY_off(((SVOP*)modname)->op_sv);
4346     modname->op_private |= OPpCONST_BARE;
4347     if (ver) {
4348         veop = newSVOP(OP_CONST, 0, ver);
4349     }
4350     else
4351         veop = NULL;
4352     if (flags & PERL_LOADMOD_NOIMPORT) {
4353         imop = sawparens(newNULLLIST());
4354     }
4355     else if (flags & PERL_LOADMOD_IMPORT_OPS) {
4356         imop = va_arg(*args, OP*);
4357     }
4358     else {
4359         SV *sv;
4360         imop = NULL;
4361         sv = va_arg(*args, SV*);
4362         while (sv) {
4363             imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv));
4364             sv = va_arg(*args, SV*);
4365         }
4366     }
4367     {
4368         const line_t ocopline = PL_copline;
4369         COP * const ocurcop = PL_curcop;
4370         const int oexpect = PL_expect;
4371
4372 #if (PERL_BCDVERSION >= 0x5004000)
4373         utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
4374                 veop, modname, imop);
4375 #else
4376         utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(),
4377                 modname, imop);
4378 #endif
4379         PL_expect = oexpect;
4380         PL_copline = ocopline;
4381         PL_curcop = ocurcop;
4382     }
4383 }
4384
4385 #endif
4386 #endif
4387
4388 #ifndef load_module
4389 #if defined(NEED_load_module)
4390 static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...);
4391 static
4392 #else
4393 extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...);
4394 #endif
4395
4396 #ifdef load_module
4397 #  undef load_module
4398 #endif
4399 #define load_module DPPP_(my_load_module)
4400 #define Perl_load_module DPPP_(my_load_module)
4401
4402 #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
4403
4404 void
4405 DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...)
4406 {
4407     va_list args;
4408     va_start(args, ver);
4409     vload_module(flags, name, ver, &args);
4410     va_end(args);
4411 }
4412
4413 #endif
4414 #endif
4415 #ifndef newRV_inc
4416 #  define newRV_inc(sv)                  newRV(sv)   /* Replace */
4417 #endif
4418
4419 #ifndef newRV_noinc
4420 #if defined(NEED_newRV_noinc)
4421 static SV * DPPP_(my_newRV_noinc)(SV *sv);
4422 static
4423 #else
4424 extern SV * DPPP_(my_newRV_noinc)(SV *sv);
4425 #endif
4426
4427 #ifdef newRV_noinc
4428 #  undef newRV_noinc
4429 #endif
4430 #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a)
4431 #define Perl_newRV_noinc DPPP_(my_newRV_noinc)
4432
4433 #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
4434 SV *
4435 DPPP_(my_newRV_noinc)(SV *sv)
4436 {
4437   SV *rv = (SV *)newRV(sv);
4438   SvREFCNT_dec(sv);
4439   return rv;
4440 }
4441 #endif
4442 #endif
4443
4444 /* Hint: newCONSTSUB
4445  * Returns a CV* as of perl-5.7.1. This return value is not supported
4446  * by Devel::PPPort.
4447  */
4448
4449 /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
4450 #if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005)
4451 #if defined(NEED_newCONSTSUB)
4452 static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv);
4453 static
4454 #else
4455 extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv);
4456 #endif
4457
4458 #ifdef newCONSTSUB
4459 #  undef newCONSTSUB
4460 #endif
4461 #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c)
4462 #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB)
4463
4464 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
4465
4466 /* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */
4467 /* (There's no PL_parser in perl < 5.005, so this is completely safe)     */
4468 #define D_PPP_PL_copline PL_copline
4469
4470 void
4471 DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv)
4472 {
4473         U32 oldhints = PL_hints;
4474         HV *old_cop_stash = PL_curcop->cop_stash;
4475         HV *old_curstash = PL_curstash;
4476         line_t oldline = PL_curcop->cop_line;
4477         PL_curcop->cop_line = D_PPP_PL_copline;
4478
4479         PL_hints &= ~HINT_BLOCK_SCOPE;
4480         if (stash)
4481                 PL_curstash = PL_curcop->cop_stash = stash;
4482
4483         newSUB(
4484
4485 #if   (PERL_BCDVERSION < 0x5003022)
4486                 start_subparse(),
4487 #elif (PERL_BCDVERSION == 0x5003022)
4488                 start_subparse(0),
4489 #else  /* 5.003_23  onwards */
4490                 start_subparse(FALSE, 0),
4491 #endif
4492
4493                 newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)),
4494                 newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
4495                 newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
4496         );
4497
4498         PL_hints = oldhints;
4499         PL_curcop->cop_stash = old_cop_stash;
4500         PL_curstash = old_curstash;
4501         PL_curcop->cop_line = oldline;
4502 }
4503 #endif
4504 #endif
4505
4506 /*
4507  * Boilerplate macros for initializing and accessing interpreter-local
4508  * data from C.  All statics in extensions should be reworked to use
4509  * this, if you want to make the extension thread-safe.  See ext/re/re.xs
4510  * for an example of the use of these macros.
4511  *
4512  * Code that uses these macros is responsible for the following:
4513  * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
4514  * 2. Declare a typedef named my_cxt_t that is a structure that contains
4515  *    all the data that needs to be interpreter-local.
4516  * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
4517  * 4. Use the MY_CXT_INIT macro such that it is called exactly once
4518  *    (typically put in the BOOT: section).
4519  * 5. Use the members of the my_cxt_t structure everywhere as
4520  *    MY_CXT.member.
4521  * 6. Use the dMY_CXT macro (a declaration) in all the functions that
4522  *    access MY_CXT.
4523  */
4524
4525 #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
4526     defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)
4527
4528 #ifndef START_MY_CXT
4529
4530 /* This must appear in all extensions that define a my_cxt_t structure,
4531  * right after the definition (i.e. at file scope).  The non-threads
4532  * case below uses it to declare the data as static. */
4533 #define START_MY_CXT
4534
4535 #if (PERL_BCDVERSION < 0x5004068)
4536 /* Fetches the SV that keeps the per-interpreter data. */
4537 #define dMY_CXT_SV \
4538         SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
4539 #else /* >= perl5.004_68 */
4540 #define dMY_CXT_SV \
4541         SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,             \
4542                                   sizeof(MY_CXT_KEY)-1, TRUE)
4543 #endif /* < perl5.004_68 */
4544
4545 /* This declaration should be used within all functions that use the
4546  * interpreter-local data. */
4547 #define dMY_CXT \
4548         dMY_CXT_SV;                                                     \
4549         my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
4550
4551 /* Creates and zeroes the per-interpreter data.
4552  * (We allocate my_cxtp in a Perl SV so that it will be released when
4553  * the interpreter goes away.) */
4554 #define MY_CXT_INIT \
4555         dMY_CXT_SV;                                                     \
4556         /* newSV() allocates one more than needed */                    \
4557         my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
4558         Zero(my_cxtp, 1, my_cxt_t);                                     \
4559         sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
4560
4561 /* This macro must be used to access members of the my_cxt_t structure.
4562  * e.g. MYCXT.some_data */
4563 #define MY_CXT          (*my_cxtp)
4564
4565 /* Judicious use of these macros can reduce the number of times dMY_CXT
4566  * is used.  Use is similar to pTHX, aTHX etc. */
4567 #define pMY_CXT         my_cxt_t *my_cxtp
4568 #define pMY_CXT_        pMY_CXT,
4569 #define _pMY_CXT        ,pMY_CXT
4570 #define aMY_CXT         my_cxtp
4571 #define aMY_CXT_        aMY_CXT,
4572 #define _aMY_CXT        ,aMY_CXT
4573
4574 #endif /* START_MY_CXT */
4575
4576 #ifndef MY_CXT_CLONE
4577 /* Clones the per-interpreter data. */
4578 #define MY_CXT_CLONE \
4579         dMY_CXT_SV;                                                     \
4580         my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
4581         Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
4582         sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
4583 #endif
4584
4585 #else /* single interpreter */
4586
4587 #ifndef START_MY_CXT
4588
4589 #define START_MY_CXT    static my_cxt_t my_cxt;
4590 #define dMY_CXT_SV      dNOOP
4591 #define dMY_CXT         dNOOP
4592 #define MY_CXT_INIT     NOOP
4593 #define MY_CXT          my_cxt
4594
4595 #define pMY_CXT         void
4596 #define pMY_CXT_
4597 #define _pMY_CXT
4598 #define aMY_CXT
4599 #define aMY_CXT_
4600 #define _aMY_CXT
4601
4602 #endif /* START_MY_CXT */
4603
4604 #ifndef MY_CXT_CLONE
4605 #define MY_CXT_CLONE    NOOP
4606 #endif
4607
4608 #endif
4609
4610 #ifndef IVdf
4611 #  if IVSIZE == LONGSIZE
4612 #    define     IVdf      "ld"
4613 #    define     UVuf      "lu"
4614 #    define     UVof      "lo"
4615 #    define     UVxf      "lx"
4616 #    define     UVXf      "lX"
4617 #  else
4618 #    if IVSIZE == INTSIZE
4619 #      define   IVdf      "d"
4620 #      define   UVuf      "u"
4621 #      define   UVof      "o"
4622 #      define   UVxf      "x"
4623 #      define   UVXf      "X"
4624 #    endif
4625 #  endif
4626 #endif
4627
4628 #ifndef NVef
4629 #  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
4630       defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000)
4631             /* Not very likely, but let's try anyway. */
4632 #    define NVef          PERL_PRIeldbl
4633 #    define NVff          PERL_PRIfldbl
4634 #    define NVgf          PERL_PRIgldbl
4635 #  else
4636 #    define NVef          "e"
4637 #    define NVff          "f"
4638 #    define NVgf          "g"
4639 #  endif
4640 #endif
4641
4642 #ifndef SvREFCNT_inc
4643 #  ifdef PERL_USE_GCC_BRACE_GROUPS
4644 #    define SvREFCNT_inc(sv)            \
4645       ({                                \
4646           SV * const _sv = (SV*)(sv);   \
4647           if (_sv)                      \
4648                (SvREFCNT(_sv))++;       \
4649           _sv;                          \
4650       })
4651 #  else
4652 #    define SvREFCNT_inc(sv)    \
4653           ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL)
4654 #  endif
4655 #endif
4656
4657 #ifndef SvREFCNT_inc_simple
4658 #  ifdef PERL_USE_GCC_BRACE_GROUPS
4659 #    define SvREFCNT_inc_simple(sv)     \
4660       ({                                        \
4661           if (sv)                               \
4662                (SvREFCNT(sv))++;                \
4663           (SV *)(sv);                           \
4664       })
4665 #  else
4666 #    define SvREFCNT_inc_simple(sv) \
4667           ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL)
4668 #  endif
4669 #endif
4670
4671 #ifndef SvREFCNT_inc_NN
4672 #  ifdef PERL_USE_GCC_BRACE_GROUPS
4673 #    define SvREFCNT_inc_NN(sv)         \
4674       ({                                        \
4675           SV * const _sv = (SV*)(sv);   \
4676           SvREFCNT(_sv)++;              \
4677           _sv;                          \
4678       })
4679 #  else
4680 #    define SvREFCNT_inc_NN(sv) \
4681           (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv)
4682 #  endif
4683 #endif
4684
4685 #ifndef SvREFCNT_inc_void
4686 #  ifdef PERL_USE_GCC_BRACE_GROUPS
4687 #    define SvREFCNT_inc_void(sv)               \
4688       ({                                        \
4689           SV * const _sv = (SV*)(sv);   \
4690           if (_sv)                      \
4691               (void)(SvREFCNT(_sv)++);  \
4692       })
4693 #  else
4694 #    define SvREFCNT_inc_void(sv) \
4695           (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0)
4696 #  endif
4697 #endif
4698 #ifndef SvREFCNT_inc_simple_void
4699 #  define SvREFCNT_inc_simple_void(sv)   STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END
4700 #endif
4701
4702 #ifndef SvREFCNT_inc_simple_NN
4703 #  define SvREFCNT_inc_simple_NN(sv)     (++SvREFCNT(sv), (SV*)(sv))
4704 #endif
4705
4706 #ifndef SvREFCNT_inc_void_NN
4707 #  define SvREFCNT_inc_void_NN(sv)       (void)(++SvREFCNT((SV*)(sv)))
4708 #endif
4709
4710 #ifndef SvREFCNT_inc_simple_void_NN
4711 #  define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
4712 #endif
4713
4714 #if (PERL_BCDVERSION < 0x5006000)
4715 # define D_PPP_CONSTPV_ARG(x)  ((char *) (x))
4716 #else
4717 # define D_PPP_CONSTPV_ARG(x)  (x)
4718 #endif
4719 #ifndef newSVpvn
4720 #  define newSVpvn(data,len)             ((data)                                              \
4721                                     ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \
4722                                     : newSV(0))
4723 #endif
4724 #ifndef newSVpvn_utf8
4725 #  define newSVpvn_utf8(s, len, u)       newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0)
4726 #endif
4727 #ifndef SVf_UTF8
4728 #  define SVf_UTF8                       0
4729 #endif
4730
4731 #ifndef newSVpvn_flags
4732
4733 #if defined(NEED_newSVpvn_flags)
4734 static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags);
4735 static
4736 #else
4737 extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags);
4738 #endif
4739
4740 #ifdef newSVpvn_flags
4741 #  undef newSVpvn_flags
4742 #endif
4743 #define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c)
4744 #define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags)
4745
4746 #if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL)
4747
4748 SV *
4749 DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags)
4750 {
4751   SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len);
4752   SvFLAGS(sv) |= (flags & SVf_UTF8);
4753   return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv;
4754 }
4755
4756 #endif
4757
4758 #endif
4759
4760 /* Backwards compatibility stuff... :-( */
4761 #if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen)
4762 #  define NEED_sv_2pv_flags
4763 #endif
4764 #if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL)
4765 #  define NEED_sv_2pv_flags_GLOBAL
4766 #endif
4767
4768 /* Hint: sv_2pv_nolen
4769  * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen().
4770  */
4771 #ifndef sv_2pv_nolen
4772 #  define sv_2pv_nolen(sv)               SvPV_nolen(sv)
4773 #endif
4774
4775 #ifdef SvPVbyte
4776
4777 /* Hint: SvPVbyte
4778  * Does not work in perl-5.6.1, ppport.h implements a version
4779  * borrowed from perl-5.7.3.
4780  */
4781
4782 #if (PERL_BCDVERSION < 0x5007000)
4783
4784 #if defined(NEED_sv_2pvbyte)
4785 static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp);
4786 static
4787 #else
4788 extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp);
4789 #endif
4790
4791 #ifdef sv_2pvbyte
4792 #  undef sv_2pvbyte
4793 #endif
4794 #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b)
4795 #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte)
4796
4797 #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
4798
4799 char *
4800 DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp)
4801 {
4802   sv_utf8_downgrade(sv,0);
4803   return SvPV(sv,*lp);
4804 }
4805
4806 #endif
4807
4808 /* Hint: sv_2pvbyte
4809  * Use the SvPVbyte() macro instead of sv_2pvbyte().
4810  */
4811
4812 #undef SvPVbyte
4813
4814 #define SvPVbyte(sv, lp)                                                \
4815         ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK)                \
4816          ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp))
4817
4818 #endif
4819
4820 #else
4821
4822 #  define SvPVbyte          SvPV
4823 #  define sv_2pvbyte        sv_2pv
4824
4825 #endif
4826 #ifndef sv_2pvbyte_nolen
4827 #  define sv_2pvbyte_nolen(sv)           sv_2pv_nolen(sv)
4828 #endif
4829
4830 /* Hint: sv_pvn
4831  * Always use the SvPV() macro instead of sv_pvn().
4832  */
4833
4834 /* Hint: sv_pvn_force
4835  * Always use the SvPV_force() macro instead of sv_pvn_force().
4836  */
4837
4838 /* If these are undefined, they're not handled by the core anyway */
4839 #ifndef SV_IMMEDIATE_UNREF
4840 #  define SV_IMMEDIATE_UNREF             0
4841 #endif
4842
4843 #ifndef SV_GMAGIC
4844 #  define SV_GMAGIC                      0
4845 #endif
4846
4847 #ifndef SV_COW_DROP_PV
4848 #  define SV_COW_DROP_PV                 0
4849 #endif
4850
4851 #ifndef SV_UTF8_NO_ENCODING
4852 #  define SV_UTF8_NO_ENCODING            0
4853 #endif
4854
4855 #ifndef SV_NOSTEAL
4856 #  define SV_NOSTEAL                     0
4857 #endif
4858
4859 #ifndef SV_CONST_RETURN
4860 #  define SV_CONST_RETURN                0
4861 #endif
4862
4863 #ifndef SV_MUTABLE_RETURN
4864 #  define SV_MUTABLE_RETURN              0
4865 #endif
4866
4867 #ifndef SV_SMAGIC
4868 #  define SV_SMAGIC                      0
4869 #endif
4870
4871 #ifndef SV_HAS_TRAILING_NUL
4872 #  define SV_HAS_TRAILING_NUL            0
4873 #endif
4874
4875 #ifndef SV_COW_SHARED_HASH_KEYS
4876 #  define SV_COW_SHARED_HASH_KEYS        0
4877 #endif
4878
4879 #if (PERL_BCDVERSION < 0x5007002)
4880
4881 #if defined(NEED_sv_2pv_flags)
4882 static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
4883 static
4884 #else
4885 extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
4886 #endif
4887
4888 #ifdef sv_2pv_flags
4889 #  undef sv_2pv_flags
4890 #endif
4891 #define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c)
4892 #define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags)
4893
4894 #if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL)
4895
4896 char *
4897 DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
4898 {
4899   STRLEN n_a = (STRLEN) flags;
4900   return sv_2pv(sv, lp ? lp : &n_a);
4901 }
4902
4903 #endif
4904
4905 #if defined(NEED_sv_pvn_force_flags)
4906 static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
4907 static
4908 #else
4909 extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
4910 #endif
4911
4912 #ifdef sv_pvn_force_flags
4913 #  undef sv_pvn_force_flags
4914 #endif
4915 #define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c)
4916 #define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags)
4917
4918 #if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL)
4919
4920 char *
4921 DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
4922 {
4923   STRLEN n_a = (STRLEN) flags;
4924   return sv_pvn_force(sv, lp ? lp : &n_a);
4925 }
4926
4927 #endif
4928
4929 #endif
4930
4931 #if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) )
4932 # define DPPP_SVPV_NOLEN_LP_ARG &PL_na
4933 #else
4934 # define DPPP_SVPV_NOLEN_LP_ARG 0
4935 #endif
4936 #ifndef SvPV_const
4937 #  define SvPV_const(sv, lp)             SvPV_flags_const(sv, lp, SV_GMAGIC)
4938 #endif
4939
4940 #ifndef SvPV_mutable
4941 #  define SvPV_mutable(sv, lp)           SvPV_flags_mutable(sv, lp, SV_GMAGIC)
4942 #endif
4943 #ifndef SvPV_flags
4944 #  define SvPV_flags(sv, lp, flags)      \
4945                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4946                   ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags))
4947 #endif
4948 #ifndef SvPV_flags_const
4949 #  define SvPV_flags_const(sv, lp, flags) \
4950                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4951                   ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \
4952                   (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN))
4953 #endif
4954 #ifndef SvPV_flags_const_nolen
4955 #  define SvPV_flags_const_nolen(sv, flags) \
4956                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4957                   ? SvPVX_const(sv) : \
4958                   (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN))
4959 #endif
4960 #ifndef SvPV_flags_mutable
4961 #  define SvPV_flags_mutable(sv, lp, flags) \
4962                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4963                   ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \
4964                   sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
4965 #endif
4966 #ifndef SvPV_force
4967 #  define SvPV_force(sv, lp)             SvPV_force_flags(sv, lp, SV_GMAGIC)
4968 #endif
4969
4970 #ifndef SvPV_force_nolen
4971 #  define SvPV_force_nolen(sv)           SvPV_force_flags_nolen(sv, SV_GMAGIC)
4972 #endif
4973
4974 #ifndef SvPV_force_mutable
4975 #  define SvPV_force_mutable(sv, lp)     SvPV_force_flags_mutable(sv, lp, SV_GMAGIC)
4976 #endif
4977
4978 #ifndef SvPV_force_nomg
4979 #  define SvPV_force_nomg(sv, lp)        SvPV_force_flags(sv, lp, 0)
4980 #endif
4981
4982 #ifndef SvPV_force_nomg_nolen
4983 #  define SvPV_force_nomg_nolen(sv)      SvPV_force_flags_nolen(sv, 0)
4984 #endif
4985 #ifndef SvPV_force_flags
4986 #  define SvPV_force_flags(sv, lp, flags) \
4987                  ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4988                  ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags))
4989 #endif
4990 #ifndef SvPV_force_flags_nolen
4991 #  define SvPV_force_flags_nolen(sv, flags) \
4992                  ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4993                  ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags))
4994 #endif
4995 #ifndef SvPV_force_flags_mutable
4996 #  define SvPV_force_flags_mutable(sv, lp, flags) \
4997                  ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4998                  ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \
4999                   : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
5000 #endif
5001 #ifndef SvPV_nolen
5002 #  define SvPV_nolen(sv)                 \
5003                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
5004                   ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC))
5005 #endif
5006 #ifndef SvPV_nolen_const
5007 #  define SvPV_nolen_const(sv)           \
5008                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
5009                   ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN))
5010 #endif
5011 #ifndef SvPV_nomg
5012 #  define SvPV_nomg(sv, lp)              SvPV_flags(sv, lp, 0)
5013 #endif
5014
5015 #ifndef SvPV_nomg_const
5016 #  define SvPV_nomg_const(sv, lp)        SvPV_flags_const(sv, lp, 0)
5017 #endif
5018
5019 #ifndef SvPV_nomg_const_nolen
5020 #  define SvPV_nomg_const_nolen(sv)      SvPV_flags_const_nolen(sv, 0)
5021 #endif
5022 #ifndef SvPV_renew
5023 #  define SvPV_renew(sv,n)               STMT_START { SvLEN_set(sv, n); \
5024                  SvPV_set((sv), (char *) saferealloc(          \
5025                        (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \
5026                } STMT_END
5027 #endif
5028 #ifndef SvMAGIC_set
5029 #  define SvMAGIC_set(sv, val)           \
5030                 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
5031                 (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END
5032 #endif
5033
5034 #if (PERL_BCDVERSION < 0x5009003)
5035 #ifndef SvPVX_const
5036 #  define SvPVX_const(sv)                ((const char*) (0 + SvPVX(sv)))
5037 #endif
5038
5039 #ifndef SvPVX_mutable
5040 #  define SvPVX_mutable(sv)              (0 + SvPVX(sv))
5041 #endif
5042 #ifndef SvRV_set
5043 #  define SvRV_set(sv, val)              \
5044                 STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
5045                 (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END
5046 #endif
5047
5048 #else
5049 #ifndef SvPVX_const
5050 #  define SvPVX_const(sv)                ((const char*)((sv)->sv_u.svu_pv))
5051 #endif
5052
5053 #ifndef SvPVX_mutable
5054 #  define SvPVX_mutable(sv)              ((sv)->sv_u.svu_pv)
5055 #endif
5056 #ifndef SvRV_set
5057 #  define SvRV_set(sv, val)              \
5058                 STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
5059                 ((sv)->sv_u.svu_rv = (val)); } STMT_END
5060 #endif
5061
5062 #endif
5063 #ifndef SvSTASH_set
5064 #  define SvSTASH_set(sv, val)           \
5065                 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
5066                 (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END
5067 #endif
5068
5069 #if (PERL_BCDVERSION < 0x5004000)
5070 #ifndef SvUV_set
5071 #  define SvUV_set(sv, val)              \
5072                 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
5073                 (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END
5074 #endif
5075
5076 #else
5077 #ifndef SvUV_set
5078 #  define SvUV_set(sv, val)              \
5079                 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
5080                 (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END
5081 #endif
5082
5083 #endif
5084
5085 #if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf)
5086 #if defined(NEED_vnewSVpvf)
5087 static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args);
5088 static
5089 #else
5090 extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args);
5091 #endif
5092
5093 #ifdef vnewSVpvf
5094 #  undef vnewSVpvf
5095 #endif
5096 #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b)
5097 #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf)
5098
5099 #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
5100
5101 SV *
5102 DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args)
5103 {
5104   register SV *sv = newSV(0);
5105   sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
5106   return sv;
5107 }
5108
5109 #endif
5110 #endif
5111
5112 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf)
5113 #  define sv_vcatpvf(sv, pat, args)  sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
5114 #endif
5115
5116 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf)
5117 #  define sv_vsetpvf(sv, pat, args)  sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
5118 #endif
5119
5120 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg)
5121 #if defined(NEED_sv_catpvf_mg)
5122 static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
5123 static
5124 #else
5125 extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
5126 #endif
5127
5128 #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
5129
5130 #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
5131
5132 void
5133 DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
5134 {
5135   va_list args;
5136   va_start(args, pat);
5137   sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
5138   SvSETMAGIC(sv);
5139   va_end(args);
5140 }
5141
5142 #endif
5143 #endif
5144
5145 #ifdef PERL_IMPLICIT_CONTEXT
5146 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext)
5147 #if defined(NEED_sv_catpvf_mg_nocontext)
5148 static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...);
5149 static
5150 #else
5151 extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...);
5152 #endif
5153
5154 #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
5155 #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
5156
5157 #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
5158
5159 void
5160 DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...)
5161 {
5162   dTHX;
5163   va_list args;
5164   va_start(args, pat);
5165   sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
5166   SvSETMAGIC(sv);
5167   va_end(args);
5168 }
5169
5170 #endif
5171 #endif
5172 #endif
5173
5174 /* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */
5175 #ifndef sv_catpvf_mg
5176 #  ifdef PERL_IMPLICIT_CONTEXT
5177 #    define sv_catpvf_mg   Perl_sv_catpvf_mg_nocontext
5178 #  else
5179 #    define sv_catpvf_mg   Perl_sv_catpvf_mg
5180 #  endif
5181 #endif
5182
5183 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg)
5184 #  define sv_vcatpvf_mg(sv, pat, args)                                     \
5185    STMT_START {                                                            \
5186      sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
5187      SvSETMAGIC(sv);                                                       \
5188    } STMT_END
5189 #endif
5190
5191 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg)
5192 #if defined(NEED_sv_setpvf_mg)
5193 static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
5194 static
5195 #else
5196 extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
5197 #endif
5198
5199 #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
5200
5201 #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
5202
5203 void
5204 DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
5205 {
5206   va_list args;
5207   va_start(args, pat);
5208   sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
5209   SvSETMAGIC(sv);
5210   va_end(args);
5211 }
5212
5213 #endif
5214 #endif
5215
5216 #ifdef PERL_IMPLICIT_CONTEXT
5217 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext)
5218 #if defined(NEED_sv_setpvf_mg_nocontext)
5219 static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...);
5220 static
5221 #else
5222 extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...);
5223 #endif
5224
5225 #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
5226 #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
5227
5228 #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
5229
5230 void
5231 DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...)
5232 {
5233   dTHX;
5234   va_list args;
5235   va_start(args, pat);
5236   sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
5237   SvSETMAGIC(sv);
5238   va_end(args);
5239 }
5240
5241 #endif
5242 #endif
5243 #endif
5244
5245 /* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */
5246 #ifndef sv_setpvf_mg
5247 #  ifdef PERL_IMPLICIT_CONTEXT
5248 #    define sv_setpvf_mg   Perl_sv_setpvf_mg_nocontext
5249 #  else
5250 #    define sv_setpvf_mg   Perl_sv_setpvf_mg
5251 #  endif
5252 #endif
5253
5254 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg)
5255 #  define sv_vsetpvf_mg(sv, pat, args)                                     \
5256    STMT_START {                                                            \
5257      sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
5258      SvSETMAGIC(sv);                                                       \
5259    } STMT_END
5260 #endif
5261
5262 #ifndef newSVpvn_share
5263
5264 #if defined(NEED_newSVpvn_share)
5265 static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash);
5266 static
5267 #else
5268 extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash);
5269 #endif
5270
5271 #ifdef newSVpvn_share
5272 #  undef newSVpvn_share
5273 #endif
5274 #define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c)
5275 #define Perl_newSVpvn_share DPPP_(my_newSVpvn_share)
5276
5277 #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL)
5278
5279 SV *
5280 DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash)
5281 {
5282   SV *sv;
5283   if (len < 0)
5284     len = -len;
5285   if (!hash)
5286     PERL_HASH(hash, (char*) src, len);
5287   sv = newSVpvn((char *) src, len);
5288   sv_upgrade(sv, SVt_PVIV);
5289   SvIVX(sv) = hash;
5290   SvREADONLY_on(sv);
5291   SvPOK_on(sv);
5292   return sv;
5293 }
5294
5295 #endif
5296
5297 #endif
5298 #ifndef SvSHARED_HASH
5299 #  define SvSHARED_HASH(sv)              (0 + SvUVX(sv))
5300 #endif
5301 #ifndef WARN_ALL
5302 #  define WARN_ALL                       0
5303 #endif
5304
5305 #ifndef WARN_CLOSURE
5306 #  define WARN_CLOSURE                   1
5307 #endif
5308
5309 #ifndef WARN_DEPRECATED
5310 #  define WARN_DEPRECATED                2
5311 #endif
5312
5313 #ifndef WARN_EXITING
5314 #  define WARN_EXITING                   3
5315 #endif
5316
5317 #ifndef WARN_GLOB
5318 #  define WARN_GLOB                      4
5319 #endif
5320
5321 #ifndef WARN_IO
5322 #  define WARN_IO                        5
5323 #endif
5324
5325 #ifndef WARN_CLOSED
5326 #  define WARN_CLOSED                    6
5327 #endif
5328
5329 #ifndef WARN_EXEC
5330 #  define WARN_EXEC                      7
5331 #endif
5332
5333 #ifndef WARN_LAYER
5334 #  define WARN_LAYER                     8
5335 #endif
5336
5337 #ifndef WARN_NEWLINE
5338 #  define WARN_NEWLINE                   9
5339 #endif
5340
5341 #ifndef WARN_PIPE
5342 #  define WARN_PIPE                      10
5343 #endif
5344
5345 #ifndef WARN_UNOPENED
5346 #  define WARN_UNOPENED                  11
5347 #endif
5348
5349 #ifndef WARN_MISC
5350 #  define WARN_MISC                      12
5351 #endif
5352
5353 #ifndef WARN_NUMERIC
5354 #  define WARN_NUMERIC                   13
5355 #endif
5356
5357 #ifndef WARN_ONCE
5358 #  define WARN_ONCE                      14
5359 #endif
5360
5361 #ifndef WARN_OVERFLOW
5362 #  define WARN_OVERFLOW                  15
5363 #endif
5364
5365 #ifndef WARN_PACK
5366 #  define WARN_PACK                      16
5367 #endif
5368
5369 #ifndef WARN_PORTABLE
5370 #  define WARN_PORTABLE                  17
5371 #endif
5372
5373 #ifndef WARN_RECURSION
5374 #  define WARN_RECURSION                 18
5375 #endif
5376
5377 #ifndef WARN_REDEFINE
5378 #  define WARN_REDEFINE                  19
5379 #endif
5380
5381 #ifndef WARN_REGEXP
5382 #  define WARN_REGEXP                    20
5383 #endif
5384
5385 #ifndef WARN_SEVERE
5386 #  define WARN_SEVERE                    21
5387 #endif
5388
5389 #ifndef WARN_DEBUGGING
5390 #  define WARN_DEBUGGING                 22
5391 #endif
5392
5393 #ifndef WARN_INPLACE
5394 #  define WARN_INPLACE                   23
5395 #endif
5396
5397 #ifndef WARN_INTERNAL
5398 #  define WARN_INTERNAL                  24
5399 #endif
5400
5401 #ifndef WARN_MALLOC
5402 #  define WARN_MALLOC                    25
5403 #endif
5404
5405 #ifndef WARN_SIGNAL
5406 #  define WARN_SIGNAL                    26
5407 #endif
5408
5409 #ifndef WARN_SUBSTR
5410 #  define WARN_SUBSTR                    27
5411 #endif
5412
5413 #ifndef WARN_SYNTAX
5414 #  define WARN_SYNTAX                    28
5415 #endif
5416
5417 #ifndef WARN_AMBIGUOUS
5418 #  define WARN_AMBIGUOUS                 29
5419 #endif
5420
5421 #ifndef WARN_BAREWORD
5422 #  define WARN_BAREWORD                  30
5423 #endif
5424
5425 #ifndef WARN_DIGIT
5426 #  define WARN_DIGIT                     31
5427 #endif
5428
5429 #ifndef WARN_PARENTHESIS
5430 #  define WARN_PARENTHESIS               32
5431 #endif
5432
5433 #ifndef WARN_PRECEDENCE
5434 #  define WARN_PRECEDENCE                33
5435 #endif
5436
5437 #ifndef WARN_PRINTF
5438 #  define WARN_PRINTF                    34
5439 #endif
5440
5441 #ifndef WARN_PROTOTYPE
5442 #  define WARN_PROTOTYPE                 35
5443 #endif
5444
5445 #ifndef WARN_QW
5446 #  define WARN_QW                        36
5447 #endif
5448
5449 #ifndef WARN_RESERVED
5450 #  define WARN_RESERVED                  37
5451 #endif
5452
5453 #ifndef WARN_SEMICOLON
5454 #  define WARN_SEMICOLON                 38
5455 #endif
5456
5457 #ifndef WARN_TAINT
5458 #  define WARN_TAINT                     39
5459 #endif
5460
5461 #ifndef WARN_THREADS
5462 #  define WARN_THREADS                   40
5463 #endif
5464
5465 #ifndef WARN_UNINITIALIZED
5466 #  define WARN_UNINITIALIZED             41
5467 #endif
5468
5469 #ifndef WARN_UNPACK
5470 #  define WARN_UNPACK                    42
5471 #endif
5472
5473 #ifndef WARN_UNTIE
5474 #  define WARN_UNTIE                     43
5475 #endif
5476
5477 #ifndef WARN_UTF8
5478 #  define WARN_UTF8                      44
5479 #endif
5480
5481 #ifndef WARN_VOID
5482 #  define WARN_VOID                      45
5483 #endif
5484
5485 #ifndef WARN_ASSERTIONS
5486 #  define WARN_ASSERTIONS                46
5487 #endif
5488 #ifndef packWARN
5489 #  define packWARN(a)                    (a)
5490 #endif
5491
5492 #ifndef ckWARN
5493 #  ifdef G_WARN_ON
5494 #    define  ckWARN(a)                  (PL_dowarn & G_WARN_ON)
5495 #  else
5496 #    define  ckWARN(a)                  PL_dowarn
5497 #  endif
5498 #endif
5499
5500 #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner)
5501 #if defined(NEED_warner)
5502 static void DPPP_(my_warner)(U32 err, const char *pat, ...);
5503 static
5504 #else
5505 extern void DPPP_(my_warner)(U32 err, const char *pat, ...);
5506 #endif
5507
5508 #define Perl_warner DPPP_(my_warner)
5509
5510 #if defined(NEED_warner) || defined(NEED_warner_GLOBAL)
5511
5512 void
5513 DPPP_(my_warner)(U32 err, const char *pat, ...)
5514 {
5515   SV *sv;
5516   va_list args;
5517
5518   PERL_UNUSED_ARG(err);
5519
5520   va_start(args, pat);
5521   sv = vnewSVpvf(pat, &args);
5522   va_end(args);
5523   sv_2mortal(sv);
5524   warn("%s", SvPV_nolen(sv));
5525 }
5526
5527 #define warner  Perl_warner
5528
5529 #define Perl_warner_nocontext  Perl_warner
5530
5531 #endif
5532 #endif
5533
5534 /* concatenating with "" ensures that only literal strings are accepted as argument
5535  * note that STR_WITH_LEN() can't be used as argument to macros or functions that
5536  * under some configurations might be macros
5537  */
5538 #ifndef STR_WITH_LEN
5539 #  define STR_WITH_LEN(s)                (s ""), (sizeof(s)-1)
5540 #endif
5541 #ifndef newSVpvs
5542 #  define newSVpvs(str)                  newSVpvn(str "", sizeof(str) - 1)
5543 #endif
5544
5545 #ifndef newSVpvs_flags
5546 #  define newSVpvs_flags(str, flags)     newSVpvn_flags(str "", sizeof(str) - 1, flags)
5547 #endif
5548
5549 #ifndef sv_catpvs
5550 #  define sv_catpvs(sv, str)             sv_catpvn(sv, str "", sizeof(str) - 1)
5551 #endif
5552
5553 #ifndef sv_setpvs
5554 #  define sv_setpvs(sv, str)             sv_setpvn(sv, str "", sizeof(str) - 1)
5555 #endif
5556
5557 #ifndef hv_fetchs
5558 #  define hv_fetchs(hv, key, lval)       hv_fetch(hv, key "", sizeof(key) - 1, lval)
5559 #endif
5560
5561 #ifndef hv_stores
5562 #  define hv_stores(hv, key, val)        hv_store(hv, key "", sizeof(key) - 1, val, 0)
5563 #endif
5564 #ifndef SvGETMAGIC
5565 #  define SvGETMAGIC(x)                  STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
5566 #endif
5567 #ifndef PERL_MAGIC_sv
5568 #  define PERL_MAGIC_sv                  '\0'
5569 #endif
5570
5571 #ifndef PERL_MAGIC_overload
5572 #  define PERL_MAGIC_overload            'A'
5573 #endif
5574
5575 #ifndef PERL_MAGIC_overload_elem
5576 #  define PERL_MAGIC_overload_elem       'a'
5577 #endif
5578
5579 #ifndef PERL_MAGIC_overload_table
5580 #  define PERL_MAGIC_overload_table      'c'
5581 #endif
5582
5583 #ifndef PERL_MAGIC_bm
5584 #  define PERL_MAGIC_bm                  'B'
5585 #endif
5586
5587 #ifndef PERL_MAGIC_regdata
5588 #  define PERL_MAGIC_regdata             'D'
5589 #endif
5590
5591 #ifndef PERL_MAGIC_regdatum
5592 #  define PERL_MAGIC_regdatum            'd'
5593 #endif
5594
5595 #ifndef PERL_MAGIC_env
5596 #  define PERL_MAGIC_env                 'E'
5597 #endif
5598
5599 #ifndef PERL_MAGIC_envelem
5600 #  define PERL_MAGIC_envelem             'e'
5601 #endif
5602
5603 #ifndef PERL_MAGIC_fm
5604 #  define PERL_MAGIC_fm                  'f'
5605 #endif
5606
5607 #ifndef PERL_MAGIC_regex_global
5608 #  define PERL_MAGIC_regex_global        'g'
5609 #endif
5610
5611 #ifndef PERL_MAGIC_isa
5612 #  define PERL_MAGIC_isa                 'I'
5613 #endif
5614
5615 #ifndef PERL_MAGIC_isaelem
5616 #  define PERL_MAGIC_isaelem             'i'
5617 #endif
5618
5619 #ifndef PERL_MAGIC_nkeys
5620 #  define PERL_MAGIC_nkeys               'k'
5621 #endif
5622
5623 #ifndef PERL_MAGIC_dbfile
5624 #  define PERL_MAGIC_dbfile              'L'
5625 #endif
5626
5627 #ifndef PERL_MAGIC_dbline
5628 #  define PERL_MAGIC_dbline              'l'
5629 #endif
5630
5631 #ifndef PERL_MAGIC_mutex
5632 #  define PERL_MAGIC_mutex               'm'
5633 #endif
5634
5635 #ifndef PERL_MAGIC_shared
5636 #  define PERL_MAGIC_shared              'N'
5637 #endif
5638
5639 #ifndef PERL_MAGIC_shared_scalar
5640 #  define PERL_MAGIC_shared_scalar       'n'
5641 #endif
5642
5643 #ifndef PERL_MAGIC_collxfrm
5644 #  define PERL_MAGIC_collxfrm            'o'
5645 #endif
5646
5647 #ifndef PERL_MAGIC_tied
5648 #  define PERL_MAGIC_tied                'P'
5649 #endif
5650
5651 #ifndef PERL_MAGIC_tiedelem
5652 #  define PERL_MAGIC_tiedelem            'p'
5653 #endif
5654
5655 #ifndef PERL_MAGIC_tiedscalar
5656 #  define PERL_MAGIC_tiedscalar          'q'
5657 #endif
5658
5659 #ifndef PERL_MAGIC_qr
5660 #  define PERL_MAGIC_qr                  'r'
5661 #endif
5662
5663 #ifndef PERL_MAGIC_sig
5664 #  define PERL_MAGIC_sig                 'S'
5665 #endif
5666
5667 #ifndef PERL_MAGIC_sigelem
5668 #  define PERL_MAGIC_sigelem             's'
5669 #endif
5670
5671 #ifndef PERL_MAGIC_taint
5672 #  define PERL_MAGIC_taint               't'
5673 #endif
5674
5675 #ifndef PERL_MAGIC_uvar
5676 #  define PERL_MAGIC_uvar                'U'
5677 #endif
5678
5679 #ifndef PERL_MAGIC_uvar_elem
5680 #  define PERL_MAGIC_uvar_elem           'u'
5681 #endif
5682
5683 #ifndef PERL_MAGIC_vstring
5684 #  define PERL_MAGIC_vstring             'V'
5685 #endif
5686
5687 #ifndef PERL_MAGIC_vec
5688 #  define PERL_MAGIC_vec                 'v'
5689 #endif
5690
5691 #ifndef PERL_MAGIC_utf8
5692 #  define PERL_MAGIC_utf8                'w'
5693 #endif
5694
5695 #ifndef PERL_MAGIC_substr
5696 #  define PERL_MAGIC_substr              'x'
5697 #endif
5698
5699 #ifndef PERL_MAGIC_defelem
5700 #  define PERL_MAGIC_defelem             'y'
5701 #endif
5702
5703 #ifndef PERL_MAGIC_glob
5704 #  define PERL_MAGIC_glob                '*'
5705 #endif
5706
5707 #ifndef PERL_MAGIC_arylen
5708 #  define PERL_MAGIC_arylen              '#'
5709 #endif
5710
5711 #ifndef PERL_MAGIC_pos
5712 #  define PERL_MAGIC_pos                 '.'
5713 #endif
5714
5715 #ifndef PERL_MAGIC_backref
5716 #  define PERL_MAGIC_backref             '<'
5717 #endif
5718
5719 #ifndef PERL_MAGIC_ext
5720 #  define PERL_MAGIC_ext                 '~'
5721 #endif
5722
5723 /* That's the best we can do... */
5724 #ifndef sv_catpvn_nomg
5725 #  define sv_catpvn_nomg                 sv_catpvn
5726 #endif
5727
5728 #ifndef sv_catsv_nomg
5729 #  define sv_catsv_nomg                  sv_catsv
5730 #endif
5731
5732 #ifndef sv_setsv_nomg
5733 #  define sv_setsv_nomg                  sv_setsv
5734 #endif
5735
5736 #ifndef sv_pvn_nomg
5737 #  define sv_pvn_nomg                    sv_pvn
5738 #endif
5739
5740 #ifndef SvIV_nomg
5741 #  define SvIV_nomg                      SvIV
5742 #endif
5743
5744 #ifndef SvUV_nomg
5745 #  define SvUV_nomg                      SvUV
5746 #endif
5747
5748 #ifndef sv_catpv_mg
5749 #  define sv_catpv_mg(sv, ptr)          \
5750    STMT_START {                         \
5751      SV *TeMpSv = sv;                   \
5752      sv_catpv(TeMpSv,ptr);              \
5753      SvSETMAGIC(TeMpSv);                \
5754    } STMT_END
5755 #endif
5756
5757 #ifndef sv_catpvn_mg
5758 #  define sv_catpvn_mg(sv, ptr, len)    \
5759    STMT_START {                         \
5760      SV *TeMpSv = sv;                   \
5761      sv_catpvn(TeMpSv,ptr,len);         \
5762      SvSETMAGIC(TeMpSv);                \
5763    } STMT_END
5764 #endif
5765
5766 #ifndef sv_catsv_mg
5767 #  define sv_catsv_mg(dsv, ssv)         \
5768    STMT_START {                         \
5769      SV *TeMpSv = dsv;                  \
5770      sv_catsv(TeMpSv,ssv);              \
5771      SvSETMAGIC(TeMpSv);                \
5772    } STMT_END
5773 #endif
5774
5775 #ifndef sv_setiv_mg
5776 #  define sv_setiv_mg(sv, i)            \
5777    STMT_START {                         \
5778      SV *TeMpSv = sv;                   \
5779      sv_setiv(TeMpSv,i);                \
5780      SvSETMAGIC(TeMpSv);                \
5781    } STMT_END
5782 #endif
5783
5784 #ifndef sv_setnv_mg
5785 #  define sv_setnv_mg(sv, num)          \
5786    STMT_START {                         \
5787      SV *TeMpSv = sv;                   \
5788      sv_setnv(TeMpSv,num);              \
5789      SvSETMAGIC(TeMpSv);                \
5790    } STMT_END
5791 #endif
5792
5793 #ifndef sv_setpv_mg
5794 #  define sv_setpv_mg(sv, ptr)          \
5795    STMT_START {                         \
5796      SV *TeMpSv = sv;                   \
5797      sv_setpv(TeMpSv,ptr);              \
5798      SvSETMAGIC(TeMpSv);                \
5799    } STMT_END
5800 #endif
5801
5802 #ifndef sv_setpvn_mg
5803 #  define sv_setpvn_mg(sv, ptr, len)    \
5804    STMT_START {                         \
5805      SV *TeMpSv = sv;                   \
5806      sv_setpvn(TeMpSv,ptr,len);         \
5807      SvSETMAGIC(TeMpSv);                \
5808    } STMT_END
5809 #endif
5810
5811 #ifndef sv_setsv_mg
5812 #  define sv_setsv_mg(dsv, ssv)         \
5813    STMT_START {                         \
5814      SV *TeMpSv = dsv;                  \
5815      sv_setsv(TeMpSv,ssv);              \
5816      SvSETMAGIC(TeMpSv);                \
5817    } STMT_END
5818 #endif
5819
5820 #ifndef sv_setuv_mg
5821 #  define sv_setuv_mg(sv, i)            \
5822    STMT_START {                         \
5823      SV *TeMpSv = sv;                   \
5824      sv_setuv(TeMpSv,i);                \
5825      SvSETMAGIC(TeMpSv);                \
5826    } STMT_END
5827 #endif
5828
5829 #ifndef sv_usepvn_mg
5830 #  define sv_usepvn_mg(sv, ptr, len)    \
5831    STMT_START {                         \
5832      SV *TeMpSv = sv;                   \
5833      sv_usepvn(TeMpSv,ptr,len);         \
5834      SvSETMAGIC(TeMpSv);                \
5835    } STMT_END
5836 #endif
5837 #ifndef SvVSTRING_mg
5838 #  define SvVSTRING_mg(sv)               (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL)
5839 #endif
5840
5841 /* Hint: sv_magic_portable
5842  * This is a compatibility function that is only available with
5843  * Devel::PPPort. It is NOT in the perl core.
5844  * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when
5845  * it is being passed a name pointer with namlen == 0. In that
5846  * case, perl 5.8.0 and later store the pointer, not a copy of it.
5847  * The compatibility can be provided back to perl 5.004. With
5848  * earlier versions, the code will not compile.
5849  */
5850
5851 #if (PERL_BCDVERSION < 0x5004000)
5852
5853   /* code that uses sv_magic_portable will not compile */
5854
5855 #elif (PERL_BCDVERSION < 0x5008000)
5856
5857 #  define sv_magic_portable(sv, obj, how, name, namlen)     \
5858    STMT_START {                                             \
5859      SV *SvMp_sv = (sv);                                    \
5860      char *SvMp_name = (char *) (name);                     \
5861      I32 SvMp_namlen = (namlen);                            \
5862      if (SvMp_name && SvMp_namlen == 0)                     \
5863      {                                                      \
5864        MAGIC *mg;                                           \
5865        sv_magic(SvMp_sv, obj, how, 0, 0);                   \
5866        mg = SvMAGIC(SvMp_sv);                               \
5867        mg->mg_len = -42; /* XXX: this is the tricky part */ \
5868        mg->mg_ptr = SvMp_name;                              \
5869      }                                                      \
5870      else                                                   \
5871      {                                                      \
5872        sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \
5873      }                                                      \
5874    } STMT_END
5875
5876 #else
5877
5878 #  define sv_magic_portable(a, b, c, d, e)  sv_magic(a, b, c, d, e)
5879
5880 #endif
5881
5882 #ifdef USE_ITHREADS
5883 #ifndef CopFILE
5884 #  define CopFILE(c)                     ((c)->cop_file)
5885 #endif
5886
5887 #ifndef CopFILEGV
5888 #  define CopFILEGV(c)                   (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv)
5889 #endif
5890
5891 #ifndef CopFILE_set
5892 #  define CopFILE_set(c,pv)              ((c)->cop_file = savepv(pv))
5893 #endif
5894
5895 #ifndef CopFILESV
5896 #  define CopFILESV(c)                   (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
5897 #endif
5898
5899 #ifndef CopFILEAV
5900 #  define CopFILEAV(c)                   (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
5901 #endif
5902
5903 #ifndef CopSTASHPV
5904 #  define CopSTASHPV(c)                  ((c)->cop_stashpv)
5905 #endif
5906
5907 #ifndef CopSTASHPV_set
5908 #  define CopSTASHPV_set(c,pv)           ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch))
5909 #endif
5910
5911 #ifndef CopSTASH
5912 #  define CopSTASH(c)                    (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
5913 #endif
5914
5915 #ifndef CopSTASH_set
5916 #  define CopSTASH_set(c,hv)             CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch)
5917 #endif
5918
5919 #ifndef CopSTASH_eq
5920 #  define CopSTASH_eq(c,hv)              ((hv) && (CopSTASHPV(c) == HvNAME(hv) \
5921                                         || (CopSTASHPV(c) && HvNAME(hv) \
5922                                         && strEQ(CopSTASHPV(c), HvNAME(hv)))))
5923 #endif
5924
5925 #else
5926 #ifndef CopFILEGV
5927 #  define CopFILEGV(c)                   ((c)->cop_filegv)
5928 #endif
5929
5930 #ifndef CopFILEGV_set
5931 #  define CopFILEGV_set(c,gv)            ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
5932 #endif
5933
5934 #ifndef CopFILE_set
5935 #  define CopFILE_set(c,pv)              CopFILEGV_set((c), gv_fetchfile(pv))
5936 #endif
5937
5938 #ifndef CopFILESV
5939 #  define CopFILESV(c)                   (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
5940 #endif
5941
5942 #ifndef CopFILEAV
5943 #  define CopFILEAV(c)                   (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
5944 #endif
5945
5946 #ifndef CopFILE
5947 #  define CopFILE(c)                     (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
5948 #endif
5949
5950 #ifndef CopSTASH
5951 #  define CopSTASH(c)                    ((c)->cop_stash)
5952 #endif
5953
5954 #ifndef CopSTASH_set
5955 #  define CopSTASH_set(c,hv)             ((c)->cop_stash = (hv))
5956 #endif
5957
5958 #ifndef CopSTASHPV
5959 #  define CopSTASHPV(c)                  (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
5960 #endif
5961
5962 #ifndef CopSTASHPV_set
5963 #  define CopSTASHPV_set(c,pv)           CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
5964 #endif
5965
5966 #ifndef CopSTASH_eq
5967 #  define CopSTASH_eq(c,hv)              (CopSTASH(c) == (hv))
5968 #endif
5969
5970 #endif /* USE_ITHREADS */
5971 #ifndef IN_PERL_COMPILETIME
5972 #  define IN_PERL_COMPILETIME            (PL_curcop == &PL_compiling)
5973 #endif
5974
5975 #ifndef IN_LOCALE_RUNTIME
5976 #  define IN_LOCALE_RUNTIME              (PL_curcop->op_private & HINT_LOCALE)
5977 #endif
5978
5979 #ifndef IN_LOCALE_COMPILETIME
5980 #  define IN_LOCALE_COMPILETIME          (PL_hints & HINT_LOCALE)
5981 #endif
5982
5983 #ifndef IN_LOCALE
5984 #  define IN_LOCALE                      (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
5985 #endif
5986 #ifndef IS_NUMBER_IN_UV
5987 #  define IS_NUMBER_IN_UV                0x01
5988 #endif
5989
5990 #ifndef IS_NUMBER_GREATER_THAN_UV_MAX
5991 #  define IS_NUMBER_GREATER_THAN_UV_MAX  0x02
5992 #endif
5993
5994 #ifndef IS_NUMBER_NOT_INT
5995 #  define IS_NUMBER_NOT_INT              0x04
5996 #endif
5997
5998 #ifndef IS_NUMBER_NEG
5999 #  define IS_NUMBER_NEG                  0x08
6000 #endif
6001
6002 #ifndef IS_NUMBER_INFINITY
6003 #  define IS_NUMBER_INFINITY             0x10
6004 #endif
6005
6006 #ifndef IS_NUMBER_NAN
6007 #  define IS_NUMBER_NAN                  0x20
6008 #endif
6009 #ifndef GROK_NUMERIC_RADIX
6010 #  define GROK_NUMERIC_RADIX(sp, send)   grok_numeric_radix(sp, send)
6011 #endif
6012 #ifndef PERL_SCAN_GREATER_THAN_UV_MAX
6013 #  define PERL_SCAN_GREATER_THAN_UV_MAX  0x02
6014 #endif
6015
6016 #ifndef PERL_SCAN_SILENT_ILLDIGIT
6017 #  define PERL_SCAN_SILENT_ILLDIGIT      0x04
6018 #endif
6019
6020 #ifndef PERL_SCAN_ALLOW_UNDERSCORES
6021 #  define PERL_SCAN_ALLOW_UNDERSCORES    0x01
6022 #endif
6023
6024 #ifndef PERL_SCAN_DISALLOW_PREFIX
6025 #  define PERL_SCAN_DISALLOW_PREFIX      0x02
6026 #endif
6027
6028 #ifndef grok_numeric_radix
6029 #if defined(NEED_grok_numeric_radix)
6030 static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
6031 static
6032 #else
6033 extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
6034 #endif
6035
6036 #ifdef grok_numeric_radix
6037 #  undef grok_numeric_radix
6038 #endif
6039 #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
6040 #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
6041
6042 #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
6043 bool
6044 DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send)
6045 {
6046 #ifdef USE_LOCALE_NUMERIC
6047 #ifdef PL_numeric_radix_sv
6048     if (PL_numeric_radix_sv && IN_LOCALE) {
6049         STRLEN len;
6050         char* radix = SvPV(PL_numeric_radix_sv, len);
6051         if (*sp + len <= send && memEQ(*sp, radix, len)) {
6052             *sp += len;
6053             return TRUE;
6054         }
6055     }
6056 #else
6057     /* older perls don't have PL_numeric_radix_sv so the radix
6058      * must manually be requested from locale.h
6059      */
6060 #include <locale.h>
6061     dTHR;  /* needed for older threaded perls */
6062     struct lconv *lc = localeconv();
6063     char *radix = lc->decimal_point;
6064     if (radix && IN_LOCALE) {
6065         STRLEN len = strlen(radix);
6066         if (*sp + len <= send && memEQ(*sp, radix, len)) {
6067             *sp += len;
6068             return TRUE;
6069         }
6070     }
6071 #endif
6072 #endif /* USE_LOCALE_NUMERIC */
6073     /* always try "." if numeric radix didn't match because
6074      * we may have data from different locales mixed */
6075     if (*sp < send && **sp == '.') {
6076         ++*sp;
6077         return TRUE;
6078     }
6079     return FALSE;
6080 }
6081 #endif
6082 #endif
6083
6084 #ifndef grok_number
6085 #if defined(NEED_grok_number)
6086 static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
6087 static
6088 #else
6089 extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
6090 #endif
6091
6092 #ifdef grok_number
6093 #  undef grok_number
6094 #endif
6095 #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
6096 #define Perl_grok_number DPPP_(my_grok_number)
6097
6098 #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
6099 int
6100 DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep)
6101 {
6102   const char *s = pv;
6103   const char *send = pv + len;
6104   const UV max_div_10 = UV_MAX / 10;
6105   const char max_mod_10 = UV_MAX % 10;
6106   int numtype = 0;
6107   int sawinf = 0;
6108   int sawnan = 0;
6109
6110   while (s < send && isSPACE(*s))
6111     s++;
6112   if (s == send) {
6113     return 0;
6114   } else if (*s == '-') {
6115     s++;
6116     numtype = IS_NUMBER_NEG;
6117   }
6118   else if (*s == '+')
6119   s++;
6120
6121   if (s == send)
6122     return 0;
6123
6124   /* next must be digit or the radix separator or beginning of infinity */
6125   if (isDIGIT(*s)) {
6126     /* UVs are at least 32 bits, so the first 9 decimal digits cannot
6127        overflow.  */
6128     UV value = *s - '0';
6129     /* This construction seems to be more optimiser friendly.
6130        (without it gcc does the isDIGIT test and the *s - '0' separately)
6131        With it gcc on arm is managing 6 instructions (6 cycles) per digit.
6132        In theory the optimiser could deduce how far to unroll the loop
6133        before checking for overflow.  */
6134     if (++s < send) {
6135       int digit = *s - '0';
6136       if (digit >= 0 && digit <= 9) {
6137         value = value * 10 + digit;
6138         if (++s < send) {
6139           digit = *s - '0';
6140           if (digit >= 0 && digit <= 9) {
6141             value = value * 10 + digit;
6142             if (++s < send) {
6143               digit = *s - '0';
6144               if (digit >= 0 && digit <= 9) {
6145                 value = value * 10 + digit;
6146                 if (++s < send) {
6147                   digit = *s - '0';
6148                   if (digit >= 0 && digit <= 9) {
6149                     value = value * 10 + digit;
6150                     if (++s < send) {
6151                       digit = *s - '0';
6152                       if (digit >= 0 && digit <= 9) {
6153                         value = value * 10 + digit;
6154                         if (++s < send) {
6155                           digit = *s - '0';
6156                           if (digit >= 0 && digit <= 9) {
6157                             value = value * 10 + digit;
6158                             if (++s < send) {
6159                               digit = *s - '0';
6160                               if (digit >= 0 && digit <= 9) {
6161                                 value = value * 10 + digit;
6162                                 if (++s < send) {
6163                                   digit = *s - '0';
6164                                   if (digit >= 0 && digit <= 9) {
6165                                     value = value * 10 + digit;
6166                                     if (++s < send) {
6167                                       /* Now got 9 digits, so need to check
6168                                          each time for overflow.  */
6169                                       digit = *s - '0';
6170                                       while (digit >= 0 && digit <= 9
6171                                              && (value < max_div_10
6172                                                  || (value == max_div_10
6173                                                      && digit <= max_mod_10))) {
6174                                         value = value * 10 + digit;
6175                                         if (++s < send)
6176                                           digit = *s - '0';
6177                                         else
6178                                           break;
6179                                       }
6180                                       if (digit >= 0 && digit <= 9
6181                                           && (s < send)) {
6182                                         /* value overflowed.
6183                                            skip the remaining digits, don't
6184                                            worry about setting *valuep.  */
6185                                         do {
6186                                           s++;
6187                                         } while (s < send && isDIGIT(*s));
6188                                         numtype |=
6189                                           IS_NUMBER_GREATER_THAN_UV_MAX;
6190                                         goto skip_value;
6191                                       }
6192                                     }
6193                                   }
6194                                 }
6195                               }
6196                             }
6197                           }
6198                         }
6199                       }
6200                     }
6201                   }
6202                 }
6203               }
6204             }
6205           }
6206         }
6207       }
6208     }
6209     numtype |= IS_NUMBER_IN_UV;
6210     if (valuep)
6211       *valuep = value;
6212
6213   skip_value:
6214     if (GROK_NUMERIC_RADIX(&s, send)) {
6215       numtype |= IS_NUMBER_NOT_INT;
6216       while (s < send && isDIGIT(*s))  /* optional digits after the radix */
6217         s++;
6218     }
6219   }
6220   else if (GROK_NUMERIC_RADIX(&s, send)) {
6221     numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */
6222     /* no digits before the radix means we need digits after it */
6223     if (s < send && isDIGIT(*s)) {
6224       do {
6225         s++;
6226       } while (s < send && isDIGIT(*s));
6227       if (valuep) {
6228         /* integer approximation is valid - it's 0.  */
6229         *valuep = 0;
6230       }
6231     }
6232     else
6233       return 0;
6234   } else if (*s == 'I' || *s == 'i') {
6235     s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
6236     s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
6237     s++; if (s < send && (*s == 'I' || *s == 'i')) {
6238       s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
6239       s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
6240       s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
6241       s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
6242       s++;
6243     }
6244     sawinf = 1;
6245   } else if (*s == 'N' || *s == 'n') {
6246     /* XXX TODO: There are signaling NaNs and quiet NaNs. */
6247     s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
6248     s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
6249     s++;
6250     sawnan = 1;
6251   } else
6252     return 0;
6253
6254   if (sawinf) {
6255     numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
6256     numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
6257   } else if (sawnan) {
6258     numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
6259     numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
6260   } else if (s < send) {
6261     /* we can have an optional exponent part */
6262     if (*s == 'e' || *s == 'E') {
6263       /* The only flag we keep is sign.  Blow away any "it's UV"  */
6264       numtype &= IS_NUMBER_NEG;
6265       numtype |= IS_NUMBER_NOT_INT;
6266       s++;
6267       if (s < send && (*s == '-' || *s == '+'))
6268         s++;
6269       if (s < send && isDIGIT(*s)) {
6270         do {
6271           s++;
6272         } while (s < send && isDIGIT(*s));
6273       }
6274       else
6275       return 0;
6276     }
6277   }
6278   while (s < send && isSPACE(*s))
6279     s++;
6280   if (s >= send)
6281     return numtype;
6282   if (len == 10 && memEQ(pv, "0 but true", 10)) {
6283     if (valuep)
6284       *valuep = 0;
6285     return IS_NUMBER_IN_UV;
6286   }
6287   return 0;
6288 }
6289 #endif
6290 #endif
6291
6292 /*
6293  * The grok_* routines have been modified to use warn() instead of
6294  * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit,
6295  * which is why the stack variable has been renamed to 'xdigit'.
6296  */
6297
6298 #ifndef grok_bin
6299 #if defined(NEED_grok_bin)
6300 static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6301 static
6302 #else
6303 extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6304 #endif
6305
6306 #ifdef grok_bin
6307 #  undef grok_bin
6308 #endif
6309 #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
6310 #define Perl_grok_bin DPPP_(my_grok_bin)
6311
6312 #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
6313 UV
6314 DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
6315 {
6316     const char *s = start;
6317     STRLEN len = *len_p;
6318     UV value = 0;
6319     NV value_nv = 0;
6320
6321     const UV max_div_2 = UV_MAX / 2;
6322     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
6323     bool overflowed = FALSE;
6324
6325     if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
6326         /* strip off leading b or 0b.
6327            for compatibility silently suffer "b" and "0b" as valid binary
6328            numbers. */
6329         if (len >= 1) {
6330             if (s[0] == 'b') {
6331                 s++;
6332                 len--;
6333             }
6334             else if (len >= 2 && s[0] == '0' && s[1] == 'b') {
6335                 s+=2;
6336                 len-=2;
6337             }
6338         }
6339     }
6340
6341     for (; len-- && *s; s++) {
6342         char bit = *s;
6343         if (bit == '0' || bit == '1') {
6344             /* Write it in this wonky order with a goto to attempt to get the
6345                compiler to make the common case integer-only loop pretty tight.
6346                With gcc seems to be much straighter code than old scan_bin.  */
6347           redo:
6348             if (!overflowed) {
6349                 if (value <= max_div_2) {
6350                     value = (value << 1) | (bit - '0');
6351                     continue;
6352                 }
6353                 /* Bah. We're just overflowed.  */
6354                 warn("Integer overflow in binary number");
6355                 overflowed = TRUE;
6356                 value_nv = (NV) value;
6357             }
6358             value_nv *= 2.0;
6359             /* If an NV has not enough bits in its mantissa to
6360              * represent a UV this summing of small low-order numbers
6361              * is a waste of time (because the NV cannot preserve
6362              * the low-order bits anyway): we could just remember when
6363              * did we overflow and in the end just multiply value_nv by the
6364              * right amount. */
6365             value_nv += (NV)(bit - '0');
6366             continue;
6367         }
6368         if (bit == '_' && len && allow_underscores && (bit = s[1])
6369             && (bit == '0' || bit == '1'))
6370             {
6371                 --len;
6372                 ++s;
6373                 goto redo;
6374             }
6375         if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
6376             warn("Illegal binary digit '%c' ignored", *s);
6377         break;
6378     }
6379
6380     if (   ( overflowed && value_nv > 4294967295.0)
6381 #if UVSIZE > 4
6382         || (!overflowed && value > 0xffffffff  )
6383 #endif
6384         ) {
6385         warn("Binary number > 0b11111111111111111111111111111111 non-portable");
6386     }
6387     *len_p = s - start;
6388     if (!overflowed) {
6389         *flags = 0;
6390         return value;
6391     }
6392     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
6393     if (result)
6394         *result = value_nv;
6395     return UV_MAX;
6396 }
6397 #endif
6398 #endif
6399
6400 #ifndef grok_hex
6401 #if defined(NEED_grok_hex)
6402 static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6403 static
6404 #else
6405 extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6406 #endif
6407
6408 #ifdef grok_hex
6409 #  undef grok_hex
6410 #endif
6411 #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
6412 #define Perl_grok_hex DPPP_(my_grok_hex)
6413
6414 #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
6415 UV
6416 DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
6417 {
6418     const char *s = start;
6419     STRLEN len = *len_p;
6420     UV value = 0;
6421     NV value_nv = 0;
6422
6423     const UV max_div_16 = UV_MAX / 16;
6424     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
6425     bool overflowed = FALSE;
6426     const char *xdigit;
6427
6428     if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
6429         /* strip off leading x or 0x.
6430            for compatibility silently suffer "x" and "0x" as valid hex numbers.
6431         */
6432         if (len >= 1) {
6433             if (s[0] == 'x') {
6434                 s++;
6435                 len--;
6436             }
6437             else if (len >= 2 && s[0] == '0' && s[1] == 'x') {
6438                 s+=2;
6439                 len-=2;
6440             }
6441         }
6442     }
6443
6444     for (; len-- && *s; s++) {
6445         xdigit = strchr((char *) PL_hexdigit, *s);
6446         if (xdigit) {
6447             /* Write it in this wonky order with a goto to attempt to get the
6448                compiler to make the common case integer-only loop pretty tight.
6449                With gcc seems to be much straighter code than old scan_hex.  */
6450           redo:
6451             if (!overflowed) {
6452                 if (value <= max_div_16) {
6453                     value = (value << 4) | ((xdigit - PL_hexdigit) & 15);
6454                     continue;
6455                 }
6456                 warn("Integer overflow in hexadecimal number");
6457                 overflowed = TRUE;
6458                 value_nv = (NV) value;
6459             }
6460             value_nv *= 16.0;
6461             /* If an NV has not enough bits in its mantissa to
6462              * represent a UV this summing of small low-order numbers
6463              * is a waste of time (because the NV cannot preserve
6464              * the low-order bits anyway): we could just remember when
6465              * did we overflow and in the end just multiply value_nv by the
6466              * right amount of 16-tuples. */
6467             value_nv += (NV)((xdigit - PL_hexdigit) & 15);
6468             continue;
6469         }
6470         if (*s == '_' && len && allow_underscores && s[1]
6471                 && (xdigit = strchr((char *) PL_hexdigit, s[1])))
6472             {
6473                 --len;
6474                 ++s;
6475                 goto redo;
6476             }
6477         if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
6478             warn("Illegal hexadecimal digit '%c' ignored", *s);
6479         break;
6480     }
6481
6482     if (   ( overflowed && value_nv > 4294967295.0)
6483 #if UVSIZE > 4
6484         || (!overflowed && value > 0xffffffff  )
6485 #endif
6486         ) {
6487         warn("Hexadecimal number > 0xffffffff non-portable");
6488     }
6489     *len_p = s - start;
6490     if (!overflowed) {
6491         *flags = 0;
6492         return value;
6493     }
6494     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
6495     if (result)
6496         *result = value_nv;
6497     return UV_MAX;
6498 }
6499 #endif
6500 #endif
6501
6502 #ifndef grok_oct
6503 #if defined(NEED_grok_oct)
6504 static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6505 static
6506 #else
6507 extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
6508 #endif
6509
6510 #ifdef grok_oct
6511 #  undef grok_oct
6512 #endif
6513 #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
6514 #define Perl_grok_oct DPPP_(my_grok_oct)
6515
6516 #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
6517 UV
6518 DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
6519 {
6520     const char *s = start;
6521     STRLEN len = *len_p;
6522     UV value = 0;
6523     NV value_nv = 0;
6524
6525     const UV max_div_8 = UV_MAX / 8;
6526     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
6527     bool overflowed = FALSE;
6528
6529     for (; len-- && *s; s++) {
6530          /* gcc 2.95 optimiser not smart enough to figure that this subtraction
6531             out front allows slicker code.  */
6532         int digit = *s - '0';
6533         if (digit >= 0 && digit <= 7) {
6534             /* Write it in this wonky order with a goto to attempt to get the
6535                compiler to make the common case integer-only loop pretty tight.
6536             */
6537           redo:
6538             if (!overflowed) {
6539                 if (value <= max_div_8) {
6540                     value = (value << 3) | digit;
6541                     continue;
6542                 }
6543                 /* Bah. We're just overflowed.  */
6544                 warn("Integer overflow in octal number");
6545                 overflowed = TRUE;
6546                 value_nv = (NV) value;
6547             }
6548             value_nv *= 8.0;
6549             /* If an NV has not enough bits in its mantissa to
6550              * represent a UV this summing of small low-order numbers
6551              * is a waste of time (because the NV cannot preserve
6552              * the low-order bits anyway): we could just remember when
6553              * did we overflow and in the end just multiply value_nv by the
6554              * right amount of 8-tuples. */
6555             value_nv += (NV)digit;
6556             continue;
6557         }
6558         if (digit == ('_' - '0') && len && allow_underscores
6559             && (digit = s[1] - '0') && (digit >= 0 && digit <= 7))
6560             {
6561                 --len;
6562                 ++s;
6563                 goto redo;
6564             }
6565         /* Allow \octal to work the DWIM way (that is, stop scanning
6566          * as soon as non-octal characters are seen, complain only iff
6567          * someone seems to want to use the digits eight and nine). */
6568         if (digit == 8 || digit == 9) {
6569             if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
6570                 warn("Illegal octal digit '%c' ignored", *s);
6571         }
6572         break;
6573     }
6574
6575     if (   ( overflowed && value_nv > 4294967295.0)
6576 #if UVSIZE > 4
6577         || (!overflowed && value > 0xffffffff  )
6578 #endif
6579         ) {
6580         warn("Octal number > 037777777777 non-portable");
6581     }
6582     *len_p = s - start;
6583     if (!overflowed) {
6584         *flags = 0;
6585         return value;
6586     }
6587     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
6588     if (result)
6589         *result = value_nv;
6590     return UV_MAX;
6591 }
6592 #endif
6593 #endif
6594
6595 #if !defined(my_snprintf)
6596 #if defined(NEED_my_snprintf)
6597 static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
6598 static
6599 #else
6600 extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
6601 #endif
6602
6603 #define my_snprintf DPPP_(my_my_snprintf)
6604 #define Perl_my_snprintf DPPP_(my_my_snprintf)
6605
6606 #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL)
6607
6608 int
6609 DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...)
6610 {
6611     dTHX;
6612     int retval;
6613     va_list ap;
6614     va_start(ap, format);
6615 #ifdef HAS_VSNPRINTF
6616     retval = vsnprintf(buffer, len, format, ap);
6617 #else
6618     retval = vsprintf(buffer, format, ap);
6619 #endif
6620     va_end(ap);
6621     if (retval < 0 || (len > 0 && (Size_t)retval >= len))
6622         Perl_croak(aTHX_ "panic: my_snprintf buffer overflow");
6623     return retval;
6624 }
6625
6626 #endif
6627 #endif
6628
6629 #if !defined(my_sprintf)
6630 #if defined(NEED_my_sprintf)
6631 static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...);
6632 static
6633 #else
6634 extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...);
6635 #endif
6636
6637 #define my_sprintf DPPP_(my_my_sprintf)
6638 #define Perl_my_sprintf DPPP_(my_my_sprintf)
6639
6640 #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL)
6641
6642 int
6643 DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...)
6644 {
6645     va_list args;
6646     va_start(args, pat);
6647     vsprintf(buffer, pat, args);
6648     va_end(args);
6649     return strlen(buffer);
6650 }
6651
6652 #endif
6653 #endif
6654
6655 #ifdef NO_XSLOCKS
6656 #  ifdef dJMPENV
6657 #    define dXCPT             dJMPENV; int rEtV = 0
6658 #    define XCPT_TRY_START    JMPENV_PUSH(rEtV); if (rEtV == 0)
6659 #    define XCPT_TRY_END      JMPENV_POP;
6660 #    define XCPT_CATCH        if (rEtV != 0)
6661 #    define XCPT_RETHROW      JMPENV_JUMP(rEtV)
6662 #  else
6663 #    define dXCPT             Sigjmp_buf oldTOP; int rEtV = 0
6664 #    define XCPT_TRY_START    Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0)
6665 #    define XCPT_TRY_END      Copy(oldTOP, top_env, 1, Sigjmp_buf);
6666 #    define XCPT_CATCH        if (rEtV != 0)
6667 #    define XCPT_RETHROW      Siglongjmp(top_env, rEtV)
6668 #  endif
6669 #endif
6670
6671 #if !defined(my_strlcat)
6672 #if defined(NEED_my_strlcat)
6673 static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size);
6674 static
6675 #else
6676 extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size);
6677 #endif
6678
6679 #define my_strlcat DPPP_(my_my_strlcat)
6680 #define Perl_my_strlcat DPPP_(my_my_strlcat)
6681
6682 #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL)
6683
6684 Size_t
6685 DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size)
6686 {
6687     Size_t used, length, copy;
6688
6689     used = strlen(dst);
6690     length = strlen(src);
6691     if (size > 0 && used < size - 1) {
6692         copy = (length >= size - used) ? size - used - 1 : length;
6693         memcpy(dst + used, src, copy);
6694         dst[used + copy] = '\0';
6695     }
6696     return used + length;
6697 }
6698 #endif
6699 #endif
6700
6701 #if !defined(my_strlcpy)
6702 #if defined(NEED_my_strlcpy)
6703 static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size);
6704 static
6705 #else
6706 extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size);
6707 #endif
6708
6709 #define my_strlcpy DPPP_(my_my_strlcpy)
6710 #define Perl_my_strlcpy DPPP_(my_my_strlcpy)
6711
6712 #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL)
6713
6714 Size_t
6715 DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size)
6716 {
6717     Size_t length, copy;
6718
6719     length = strlen(src);
6720     if (size > 0) {
6721         copy = (length >= size) ? size - 1 : length;
6722         memcpy(dst, src, copy);
6723         dst[copy] = '\0';
6724     }
6725     return length;
6726 }
6727
6728 #endif
6729 #endif
6730 #ifndef PERL_PV_ESCAPE_QUOTE
6731 #  define PERL_PV_ESCAPE_QUOTE           0x0001
6732 #endif
6733
6734 #ifndef PERL_PV_PRETTY_QUOTE
6735 #  define PERL_PV_PRETTY_QUOTE           PERL_PV_ESCAPE_QUOTE
6736 #endif
6737
6738 #ifndef PERL_PV_PRETTY_ELLIPSES
6739 #  define PERL_PV_PRETTY_ELLIPSES        0x0002
6740 #endif
6741
6742 #ifndef PERL_PV_PRETTY_LTGT
6743 #  define PERL_PV_PRETTY_LTGT            0x0004
6744 #endif
6745
6746 #ifndef PERL_PV_ESCAPE_FIRSTCHAR
6747 #  define PERL_PV_ESCAPE_FIRSTCHAR       0x0008
6748 #endif
6749
6750 #ifndef PERL_PV_ESCAPE_UNI
6751 #  define PERL_PV_ESCAPE_UNI             0x0100
6752 #endif
6753
6754 #ifndef PERL_PV_ESCAPE_UNI_DETECT
6755 #  define PERL_PV_ESCAPE_UNI_DETECT      0x0200
6756 #endif
6757
6758 #ifndef PERL_PV_ESCAPE_ALL
6759 #  define PERL_PV_ESCAPE_ALL             0x1000
6760 #endif
6761
6762 #ifndef PERL_PV_ESCAPE_NOBACKSLASH
6763 #  define PERL_PV_ESCAPE_NOBACKSLASH     0x2000
6764 #endif
6765
6766 #ifndef PERL_PV_ESCAPE_NOCLEAR
6767 #  define PERL_PV_ESCAPE_NOCLEAR         0x4000
6768 #endif
6769
6770 #ifndef PERL_PV_ESCAPE_RE
6771 #  define PERL_PV_ESCAPE_RE              0x8000
6772 #endif
6773
6774 #ifndef PERL_PV_PRETTY_NOCLEAR
6775 #  define PERL_PV_PRETTY_NOCLEAR         PERL_PV_ESCAPE_NOCLEAR
6776 #endif
6777 #ifndef PERL_PV_PRETTY_DUMP
6778 #  define PERL_PV_PRETTY_DUMP            PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE
6779 #endif
6780
6781 #ifndef PERL_PV_PRETTY_REGPROP
6782 #  define PERL_PV_PRETTY_REGPROP         PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE
6783 #endif
6784
6785 /* Hint: pv_escape
6786  * Note that unicode functionality is only backported to
6787  * those perl versions that support it. For older perl
6788  * versions, the implementation will fall back to bytes.
6789  */
6790
6791 #ifndef pv_escape
6792 #if defined(NEED_pv_escape)
6793 static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags);
6794 static
6795 #else
6796 extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags);
6797 #endif
6798
6799 #ifdef pv_escape
6800 #  undef pv_escape
6801 #endif
6802 #define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f)
6803 #define Perl_pv_escape DPPP_(my_pv_escape)
6804
6805 #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL)
6806
6807 char *
6808 DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str,
6809   const STRLEN count, const STRLEN max,
6810   STRLEN * const escaped, const U32 flags)
6811 {
6812     const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\';
6813     const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc;
6814     char octbuf[32] = "%123456789ABCDF";
6815     STRLEN wrote = 0;
6816     STRLEN chsize = 0;
6817     STRLEN readsize = 1;
6818 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6819     bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0;
6820 #endif
6821     const char *pv  = str;
6822     const char * const end = pv + count;
6823     octbuf[0] = esc;
6824
6825     if (!(flags & PERL_PV_ESCAPE_NOCLEAR))
6826         sv_setpvs(dsv, "");
6827
6828 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6829     if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count))
6830         isuni = 1;
6831 #endif
6832
6833     for (; pv < end && (!max || wrote < max) ; pv += readsize) {
6834         const UV u =
6835 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6836                      isuni ? utf8_to_uvchr((U8*)pv, &readsize) :
6837 #endif
6838                              (U8)*pv;
6839         const U8 c = (U8)u & 0xFF;
6840
6841         if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) {
6842             if (flags & PERL_PV_ESCAPE_FIRSTCHAR)
6843                 chsize = my_snprintf(octbuf, sizeof octbuf,
6844                                       "%"UVxf, u);
6845             else
6846                 chsize = my_snprintf(octbuf, sizeof octbuf,
6847                                       "%cx{%"UVxf"}", esc, u);
6848         } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) {
6849             chsize = 1;
6850         } else {
6851             if (c == dq || c == esc || !isPRINT(c)) {
6852                 chsize = 2;
6853                 switch (c) {
6854                 case '\\' : /* fallthrough */
6855                 case '%'  : if (c == esc)
6856                                 octbuf[1] = esc;
6857                             else
6858                                 chsize = 1;
6859                             break;
6860                 case '\v' : octbuf[1] = 'v'; break;
6861                 case '\t' : octbuf[1] = 't'; break;
6862                 case '\r' : octbuf[1] = 'r'; break;
6863                 case '\n' : octbuf[1] = 'n'; break;
6864                 case '\f' : octbuf[1] = 'f'; break;
6865                 case '"'  : if (dq == '"')
6866                                 octbuf[1] = '"';
6867                             else
6868                                 chsize = 1;
6869                             break;
6870                 default:    chsize = my_snprintf(octbuf, sizeof octbuf,
6871                                 pv < end && isDIGIT((U8)*(pv+readsize))
6872                                 ? "%c%03o" : "%c%o", esc, c);
6873                 }
6874             } else {
6875                 chsize = 1;
6876             }
6877         }
6878         if (max && wrote + chsize > max) {
6879             break;
6880         } else if (chsize > 1) {
6881             sv_catpvn(dsv, octbuf, chsize);
6882             wrote += chsize;
6883         } else {
6884             char tmp[2];
6885             my_snprintf(tmp, sizeof tmp, "%c", c);
6886             sv_catpvn(dsv, tmp, 1);
6887             wrote++;
6888         }
6889         if (flags & PERL_PV_ESCAPE_FIRSTCHAR)
6890             break;
6891     }
6892     if (escaped != NULL)
6893         *escaped= pv - str;
6894     return SvPVX(dsv);
6895 }
6896
6897 #endif
6898 #endif
6899
6900 #ifndef pv_pretty
6901 #if defined(NEED_pv_pretty)
6902 static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags);
6903 static
6904 #else
6905 extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags);
6906 #endif
6907
6908 #ifdef pv_pretty
6909 #  undef pv_pretty
6910 #endif
6911 #define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g)
6912 #define Perl_pv_pretty DPPP_(my_pv_pretty)
6913
6914 #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL)
6915
6916 char *
6917 DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count,
6918   const STRLEN max, char const * const start_color, char const * const end_color,
6919   const U32 flags)
6920 {
6921     const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%';
6922     STRLEN escaped;
6923
6924     if (!(flags & PERL_PV_PRETTY_NOCLEAR))
6925         sv_setpvs(dsv, "");
6926
6927     if (dq == '"')
6928         sv_catpvs(dsv, "\"");
6929     else if (flags & PERL_PV_PRETTY_LTGT)
6930         sv_catpvs(dsv, "<");
6931
6932     if (start_color != NULL)
6933         sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color));
6934
6935     pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR);
6936
6937     if (end_color != NULL)
6938         sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color));
6939
6940     if (dq == '"')
6941         sv_catpvs(dsv, "\"");
6942     else if (flags & PERL_PV_PRETTY_LTGT)
6943         sv_catpvs(dsv, ">");
6944
6945     if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count)
6946         sv_catpvs(dsv, "...");
6947
6948     return SvPVX(dsv);
6949 }
6950
6951 #endif
6952 #endif
6953
6954 #ifndef pv_display
6955 #if defined(NEED_pv_display)
6956 static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim);
6957 static
6958 #else
6959 extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim);
6960 #endif
6961
6962 #ifdef pv_display
6963 #  undef pv_display
6964 #endif
6965 #define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e)
6966 #define Perl_pv_display DPPP_(my_pv_display)
6967
6968 #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL)
6969
6970 char *
6971 DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
6972 {
6973     pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP);
6974     if (len > cur && pv[cur] == '\0')
6975         sv_catpvs(dsv, "\\0");
6976     return SvPVX(dsv);
6977 }
6978
6979 #endif
6980 #endif
6981
6982 #endif /* _P_P_PORTABILITY_H_ */
6983
6984 /* End of File ppport.h */