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