Fix another concatenated filepath in a test for Digest::SHA.
[p5sagit/p5-mst-13.2.git] / ext / Digest / SHA / ppport.h
1 #if 0
2 <<'SKIP';
3 #endif
4 /*
5 ----------------------------------------------------------------------
6
7     ppport.h -- Perl/Pollution/Portability Version 3.07
8
9     Automatically created by Devel::PPPort running under
10     perl 5.008006 on Wed Jan 18 07:00:54 2006.
11
12     Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
13     includes in parts/inc/ instead.
14
15     Use 'perldoc ppport.h' to view the documentation below.
16
17 ----------------------------------------------------------------------
18
19 SKIP
20
21 =pod
22
23 =head1 NAME
24
25 ppport.h - Perl/Pollution/Portability version 3.07
26
27 =head1 SYNOPSIS
28
29   perl ppport.h [options] [source files]
30
31   Searches current directory for files if no [source files] are given
32
33   --help                      show short help
34
35   --patch=file                write one patch file with changes
36   --copy=suffix               write changed copies with suffix
37   --diff=program              use diff program and options
38
39   --compat-version=version    provide compatibility with Perl version
40   --cplusplus                 accept C++ comments
41
42   --quiet                     don't output anything except fatal errors
43   --nodiag                    don't show diagnostics
44   --nohints                   don't show hints
45   --nochanges                 don't suggest changes
46   --nofilter                  don't filter input files
47
48   --strip                     strip all script and doc functionality from
49                               ppport.h (this, obviously, cannot be undone)
50
51   --list-provided             list provided API
52   --list-unsupported          list unsupported API
53   --api-info=name             show Perl API portability information
54
55 =head1 COMPATIBILITY
56
57 This version of F<ppport.h> is designed to support operation with Perl
58 installations back to 5.003, and has been tested up to 5.9.3.
59
60 =head1 OPTIONS
61
62 =head2 --help
63
64 Display a brief usage summary.
65
66 =head2 --patch=I<file>
67
68 If this option is given, a single patch file will be created if
69 any changes are suggested. This requires a working diff program
70 to be installed on your system.
71
72 =head2 --copy=I<suffix>
73
74 If this option is given, a copy of each file will be saved with
75 the given suffix that contains the suggested changes. This does
76 not require any external programs.
77
78 If neither C<--patch> or C<--copy> are given, the default is to
79 simply print the diffs for each file. This requires either
80 C<Text::Diff> or a C<diff> program to be installed.
81
82 =head2 --diff=I<program>
83
84 Manually set the diff program and options to use. The default
85 is to use C<Text::Diff>, when installed, and output unified
86 context diffs.
87
88 =head2 --compat-version=I<version>
89
90 Tell F<ppport.h> to check for compatibility with the given
91 Perl version. The default is to check for compatibility with Perl
92 version 5.003. You can use this option to reduce the output
93 of F<ppport.h> if you intend to be backward compatible only
94 down to a certain Perl version.
95
96 =head2 --cplusplus
97
98 Usually, F<ppport.h> will detect C++ style comments and
99 replace them with C style comments for portability reasons.
100 Using this option instructs F<ppport.h> to leave C++
101 comments untouched.
102
103 =head2 --quiet
104
105 Be quiet. Don't print anything except fatal errors.
106
107 =head2 --nodiag
108
109 Don't output any diagnostic messages. Only portability
110 alerts will be printed.
111
112 =head2 --nohints
113
114 Don't output any hints. Hints often contain useful portability
115 notes.
116
117 =head2 --nochanges
118
119 Don't suggest any changes. Only give diagnostic output and hints
120 unless these are also deactivated.
121
122 =head2 --nofilter
123
124 Don't filter the list of input files. By default, files not looking
125 like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
126
127 =head2 --strip
128
129 Strip all script and documentation functionality from F<ppport.h>.
130 This reduces the size of F<ppport.h> dramatically and may be useful
131 if you want to include F<ppport.h> in smaller modules without
132 increasing their distribution size too much.
133
134 =head2 --list-provided
135
136 Lists the API elements for which compatibility is provided by
137 F<ppport.h>. Also lists if it must be explicitly requested,
138 if it has dependencies, and if there are hints for it.
139
140 =head2 --list-unsupported
141
142 Lists the API elements that are known not to be supported by
143 F<ppport.h> and below which version of Perl they probably
144 won't be available or work.
145
146 =head2 --api-info=I<name>
147
148 Show portability information for API elements matching I<name>.
149 If I<name> is surrounded by slashes, it is interpreted as a regular
150 expression.
151
152 =head1 DESCRIPTION
153
154 In order for a Perl extension (XS) module to be as portable as possible
155 across differing versions of Perl itself, certain steps need to be taken.
156
157 =over 4
158
159 =item *
160
161 Including this header is the first major one. This alone will give you
162 access to a large part of the Perl API that hasn't been available in
163 earlier Perl releases. Use
164
165     perl ppport.h --list-provided
166
167 to see which API elements are provided by ppport.h.
168
169 =item *
170
171 You should avoid using deprecated parts of the API. For example, using
172 global Perl variables without the C<PL_> prefix is deprecated. Also,
173 some API functions used to have a C<perl_> prefix. Using this form is
174 also deprecated. You can safely use the supported API, as F<ppport.h>
175 will provide wrappers for older Perl versions.
176
177 =item *
178
179 If you use one of a few functions or variables that were not present in
180 earlier versions of Perl, and that can't be provided using a macro, you
181 have to explicitly request support for these functions by adding one or
182 more C<#define>s in your source code before the inclusion of F<ppport.h>.
183
184 These functions or variables will be marked C<explicit> in the list shown
185 by C<--list-provided>.
186
187 Depending on whether you module has a single or multiple files that
188 use such functions or variables, you want either C<static> or global
189 variants.
190
191 For a C<static> function or variable (used only in a single source
192 file), use:
193
194     #define NEED_function
195     #define NEED_variable
196
197 For a global function or variable (used in multiple source files),
198 use:
199
200     #define NEED_function_GLOBAL
201     #define NEED_variable_GLOBAL
202
203 Note that you mustn't have more than one global request for the
204 same function or variable in your project.
205
206     Function / Variable       Static Request               Global Request
207     -----------------------------------------------------------------------------------------
208     PL_signals                NEED_PL_signals              NEED_PL_signals_GLOBAL
209     eval_pv()                 NEED_eval_pv                 NEED_eval_pv_GLOBAL
210     grok_bin()                NEED_grok_bin                NEED_grok_bin_GLOBAL
211     grok_hex()                NEED_grok_hex                NEED_grok_hex_GLOBAL
212     grok_number()             NEED_grok_number             NEED_grok_number_GLOBAL
213     grok_numeric_radix()      NEED_grok_numeric_radix      NEED_grok_numeric_radix_GLOBAL
214     grok_oct()                NEED_grok_oct                NEED_grok_oct_GLOBAL
215     newCONSTSUB()             NEED_newCONSTSUB             NEED_newCONSTSUB_GLOBAL
216     newRV_noinc()             NEED_newRV_noinc             NEED_newRV_noinc_GLOBAL
217     sv_2pv_nolen()            NEED_sv_2pv_nolen            NEED_sv_2pv_nolen_GLOBAL
218     sv_2pvbyte()              NEED_sv_2pvbyte              NEED_sv_2pvbyte_GLOBAL
219     sv_catpvf_mg()            NEED_sv_catpvf_mg            NEED_sv_catpvf_mg_GLOBAL
220     sv_catpvf_mg_nocontext()  NEED_sv_catpvf_mg_nocontext  NEED_sv_catpvf_mg_nocontext_GLOBAL
221     sv_setpvf_mg()            NEED_sv_setpvf_mg            NEED_sv_setpvf_mg_GLOBAL
222     sv_setpvf_mg_nocontext()  NEED_sv_setpvf_mg_nocontext  NEED_sv_setpvf_mg_nocontext_GLOBAL
223     vnewSVpvf()               NEED_vnewSVpvf               NEED_vnewSVpvf_GLOBAL
224
225 To avoid namespace conflicts, you can change the namespace of the
226 explicitly exported functions / variables using the C<DPPP_NAMESPACE>
227 macro. Just C<#define> the macro before including C<ppport.h>:
228
229     #define DPPP_NAMESPACE MyOwnNamespace_
230     #include "ppport.h"
231
232 The default namespace is C<DPPP_>.
233
234 =back
235
236 The good thing is that most of the above can be checked by running
237 F<ppport.h> on your source code. See the next section for
238 details.
239
240 =head1 EXAMPLES
241
242 To verify whether F<ppport.h> is needed for your module, whether you
243 should make any changes to your code, and whether any special defines
244 should be used, F<ppport.h> can be run as a Perl script to check your
245 source code. Simply say:
246
247     perl ppport.h
248
249 The result will usually be a list of patches suggesting changes
250 that should at least be acceptable, if not necessarily the most
251 efficient solution, or a fix for all possible problems.
252
253 If you know that your XS module uses features only available in
254 newer Perl releases, if you're aware that it uses C++ comments,
255 and if you want all suggestions as a single patch file, you could
256 use something like this:
257
258     perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
259
260 If you only want your code to be scanned without any suggestions
261 for changes, use:
262
263     perl ppport.h --nochanges
264
265 You can specify a different C<diff> program or options, using
266 the C<--diff> option:
267
268     perl ppport.h --diff='diff -C 10'
269
270 This would output context diffs with 10 lines of context.
271
272 To display portability information for the C<newSVpvn> function,
273 use:
274
275     perl ppport.h --api-info=newSVpvn
276
277 Since the argument to C<--api-info> can be a regular expression,
278 you can use
279
280     perl ppport.h --api-info=/_nomg$/
281
282 to display portability information for all C<_nomg> functions or
283
284     perl ppport.h --api-info=/./
285
286 to display information for all known API elements.
287
288 =head1 BUGS
289
290 If this version of F<ppport.h> is causing failure during
291 the compilation of this module, please check if newer versions
292 of either this module or C<Devel::PPPort> are available on CPAN
293 before sending a bug report.
294
295 If F<ppport.h> was generated using the latest version of
296 C<Devel::PPPort> and is causing failure of this module, please
297 file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
298
299 Please include the following information:
300
301 =over 4
302
303 =item 1.
304
305 The complete output from running "perl -V"
306
307 =item 2.
308
309 This file.
310
311 =item 3.
312
313 The name and version of the module you were trying to build.
314
315 =item 4.
316
317 A full log of the build that failed.
318
319 =item 5.
320
321 Any other information that you think could be relevant.
322
323 =back
324
325 For the latest version of this code, please get the C<Devel::PPPort>
326 module from CPAN.
327
328 =head1 COPYRIGHT
329
330 Version 3.x, Copyright (c) 2004-2006, Marcus Holland-Moritz.
331
332 Version 2.x, Copyright (C) 2001, Paul Marquess.
333
334 Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
335
336 This program is free software; you can redistribute it and/or
337 modify it under the same terms as Perl itself.
338
339 =head1 SEE ALSO
340
341 See L<Devel::PPPort>.
342
343 =cut
344
345 use strict;
346
347 my %opt = (
348   quiet     => 0,
349   diag      => 1,
350   hints     => 1,
351   changes   => 1,
352   cplusplus => 0,
353   filter    => 1,
354   strip     => 0,
355 );
356
357 my($ppport) = $0 =~ /([\w.]+)$/;
358 my $LF = '(?:\r\n|[\r\n])';   # line feed
359 my $HS = "[ \t]";             # horizontal whitespace
360
361 eval {
362   require Getopt::Long;
363   Getopt::Long::GetOptions(\%opt, qw(
364     help quiet diag! filter! hints! changes! cplusplus strip
365     patch=s copy=s diff=s compat-version=s
366     list-provided list-unsupported api-info=s
367   )) or usage();
368 };
369
370 if ($@ and grep /^-/, @ARGV) {
371   usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
372   die "Getopt::Long not found. Please don't use any options.\n";
373 }
374
375 usage() if $opt{help};
376 strip() if $opt{strip};
377
378 if (exists $opt{'compat-version'}) {
379   my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) };
380   if ($@) {
381     die "Invalid version number format: '$opt{'compat-version'}'\n";
382   }
383   die "Only Perl 5 is supported\n" if $r != 5;
384   die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000;
385   $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s;
386 }
387 else {
388   $opt{'compat-version'} = 5;
389 }
390
391 # Never use C comments in this file!!!!!
392 my $ccs  = '/'.'*';
393 my $cce  = '*'.'/';
394 my $rccs = quotemeta $ccs;
395 my $rcce = quotemeta $cce;
396
397 my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/
398                 ? ( $1 => {
399                       ($2                  ? ( base     => $2 ) : ()),
400                       ($3                  ? ( todo     => $3 ) : ()),
401                       (index($4, 'v') >= 0 ? ( varargs  => 1  ) : ()),
402                       (index($4, 'p') >= 0 ? ( provided => 1  ) : ()),
403                       (index($4, 'n') >= 0 ? ( nothxarg => 1  ) : ()),
404                     } )
405                 : die "invalid spec: $_" } qw(
406 AvFILLp|5.004050||p
407 AvFILL|||
408 CLASS|||n
409 CX_CURPAD_SAVE|||
410 CX_CURPAD_SV|||
411 CopFILEAV|5.006000||p
412 CopFILEGV_set|5.006000||p
413 CopFILEGV|5.006000||p
414 CopFILESV|5.006000||p
415 CopFILE_set|5.006000||p
416 CopFILE|5.006000||p
417 CopSTASHPV_set|5.006000||p
418 CopSTASHPV|5.006000||p
419 CopSTASH_eq|5.006000||p
420 CopSTASH_set|5.006000||p
421 CopSTASH|5.006000||p
422 CopyD|5.009002||p
423 Copy|||
424 CvPADLIST|||
425 CvSTASH|||
426 CvWEAKOUTSIDE|||
427 DEFSV|5.004050||p
428 END_EXTERN_C|5.005000||p
429 ENTER|||
430 ERRSV|5.004050||p
431 EXTEND|||
432 EXTERN_C|5.005000||p
433 F0convert|||n
434 FREETMPS|||
435 GIMME_V||5.004000|n
436 GIMME|||n
437 GROK_NUMERIC_RADIX|5.007002||p
438 G_ARRAY|||
439 G_DISCARD|||
440 G_EVAL|||
441 G_NOARGS|||
442 G_SCALAR|||
443 G_VOID||5.004000|
444 GetVars|||
445 GvSV|||
446 Gv_AMupdate|||
447 HEf_SVKEY||5.004000|
448 HeHASH||5.004000|
449 HeKEY||5.004000|
450 HeKLEN||5.004000|
451 HePV||5.004000|
452 HeSVKEY_force||5.004000|
453 HeSVKEY_set||5.004000|
454 HeSVKEY||5.004000|
455 HeVAL||5.004000|
456 HvNAME|||
457 INT2PTR|5.006000||p
458 IN_LOCALE_COMPILETIME|5.007002||p
459 IN_LOCALE_RUNTIME|5.007002||p
460 IN_LOCALE|5.007002||p
461 IN_PERL_COMPILETIME|5.008001||p
462 IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p
463 IS_NUMBER_INFINITY|5.007002||p
464 IS_NUMBER_IN_UV|5.007002||p
465 IS_NUMBER_NAN|5.007003||p
466 IS_NUMBER_NEG|5.007002||p
467 IS_NUMBER_NOT_INT|5.007002||p
468 IVSIZE|5.006000||p
469 IVTYPE|5.006000||p
470 IVdf|5.006000||p
471 LEAVE|||
472 LVRET|||
473 MARK|||
474 MULTICALL||5.009003|
475 MY_CXT_CLONE|5.009002||p
476 MY_CXT_INIT|5.007003||p
477 MY_CXT|5.007003||p
478 MoveD|5.009002||p
479 Move|||
480 NEWSV|||
481 NOOP|5.005000||p
482 NUM2PTR|5.006000||p
483 NVTYPE|5.006000||p
484 NVef|5.006001||p
485 NVff|5.006001||p
486 NVgf|5.006001||p
487 Newxc|5.009003||p
488 Newxz|5.009003||p
489 Newx|5.009003||p
490 Nullav|||
491 Nullch|||
492 Nullcv|||
493 Nullhv|||
494 Nullsv|||
495 ORIGMARK|||
496 PAD_BASE_SV|||
497 PAD_CLONE_VARS|||
498 PAD_COMPNAME_FLAGS|||
499 PAD_COMPNAME_GEN_set|||
500 PAD_COMPNAME_GEN|||
501 PAD_COMPNAME_OURSTASH|||
502 PAD_COMPNAME_PV|||
503 PAD_COMPNAME_TYPE|||
504 PAD_RESTORE_LOCAL|||
505 PAD_SAVE_LOCAL|||
506 PAD_SAVE_SETNULLPAD|||
507 PAD_SETSV|||
508 PAD_SET_CUR_NOSAVE|||
509 PAD_SET_CUR|||
510 PAD_SVl|||
511 PAD_SV|||
512 PERL_BCDVERSION|5.009003||p
513 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
514 PERL_INT_MAX|5.004000||p
515 PERL_INT_MIN|5.004000||p
516 PERL_LONG_MAX|5.004000||p
517 PERL_LONG_MIN|5.004000||p
518 PERL_MAGIC_arylen|5.007002||p
519 PERL_MAGIC_backref|5.007002||p
520 PERL_MAGIC_bm|5.007002||p
521 PERL_MAGIC_collxfrm|5.007002||p
522 PERL_MAGIC_dbfile|5.007002||p
523 PERL_MAGIC_dbline|5.007002||p
524 PERL_MAGIC_defelem|5.007002||p
525 PERL_MAGIC_envelem|5.007002||p
526 PERL_MAGIC_env|5.007002||p
527 PERL_MAGIC_ext|5.007002||p
528 PERL_MAGIC_fm|5.007002||p
529 PERL_MAGIC_glob|5.007002||p
530 PERL_MAGIC_isaelem|5.007002||p
531 PERL_MAGIC_isa|5.007002||p
532 PERL_MAGIC_mutex|5.007002||p
533 PERL_MAGIC_nkeys|5.007002||p
534 PERL_MAGIC_overload_elem|5.007002||p
535 PERL_MAGIC_overload_table|5.007002||p
536 PERL_MAGIC_overload|5.007002||p
537 PERL_MAGIC_pos|5.007002||p
538 PERL_MAGIC_qr|5.007002||p
539 PERL_MAGIC_regdata|5.007002||p
540 PERL_MAGIC_regdatum|5.007002||p
541 PERL_MAGIC_regex_global|5.007002||p
542 PERL_MAGIC_shared_scalar|5.007003||p
543 PERL_MAGIC_shared|5.007003||p
544 PERL_MAGIC_sigelem|5.007002||p
545 PERL_MAGIC_sig|5.007002||p
546 PERL_MAGIC_substr|5.007002||p
547 PERL_MAGIC_sv|5.007002||p
548 PERL_MAGIC_taint|5.007002||p
549 PERL_MAGIC_tiedelem|5.007002||p
550 PERL_MAGIC_tiedscalar|5.007002||p
551 PERL_MAGIC_tied|5.007002||p
552 PERL_MAGIC_utf8|5.008001||p
553 PERL_MAGIC_uvar_elem|5.007003||p
554 PERL_MAGIC_uvar|5.007002||p
555 PERL_MAGIC_vec|5.007002||p
556 PERL_MAGIC_vstring|5.008001||p
557 PERL_QUAD_MAX|5.004000||p
558 PERL_QUAD_MIN|5.004000||p
559 PERL_REVISION|5.006000||p
560 PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p
561 PERL_SCAN_DISALLOW_PREFIX|5.007003||p
562 PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p
563 PERL_SCAN_SILENT_ILLDIGIT|5.008001||p
564 PERL_SHORT_MAX|5.004000||p
565 PERL_SHORT_MIN|5.004000||p
566 PERL_SIGNALS_UNSAFE_FLAG|5.008001||p
567 PERL_SUBVERSION|5.006000||p
568 PERL_UCHAR_MAX|5.004000||p
569 PERL_UCHAR_MIN|5.004000||p
570 PERL_UINT_MAX|5.004000||p
571 PERL_UINT_MIN|5.004000||p
572 PERL_ULONG_MAX|5.004000||p
573 PERL_ULONG_MIN|5.004000||p
574 PERL_UNUSED_DECL|5.007002||p
575 PERL_UQUAD_MAX|5.004000||p
576 PERL_UQUAD_MIN|5.004000||p
577 PERL_USHORT_MAX|5.004000||p
578 PERL_USHORT_MIN|5.004000||p
579 PERL_VERSION|5.006000||p
580 PL_DBsingle|||pn
581 PL_DBsub|||pn
582 PL_DBtrace|||n
583 PL_Sv|5.005000||p
584 PL_compiling|5.004050||p
585 PL_copline|5.005000||p
586 PL_curcop|5.004050||p
587 PL_curstash|5.004050||p
588 PL_debstash|5.004050||p
589 PL_defgv|5.004050||p
590 PL_diehook|5.004050||p
591 PL_dirty|5.004050||p
592 PL_dowarn|||pn
593 PL_errgv|5.004050||p
594 PL_hexdigit|5.005000||p
595 PL_hints|5.005000||p
596 PL_last_in_gv|||n
597 PL_modglobal||5.005000|n
598 PL_na|5.004050||pn
599 PL_no_modify|5.006000||p
600 PL_ofs_sv|||n
601 PL_perl_destruct_level|5.004050||p
602 PL_perldb|5.004050||p
603 PL_ppaddr|5.006000||p
604 PL_rsfp_filters|5.004050||p
605 PL_rsfp|5.004050||p
606 PL_rs|||n
607 PL_signals|5.008001||p
608 PL_stack_base|5.004050||p
609 PL_stack_sp|5.004050||p
610 PL_stdingv|5.004050||p
611 PL_sv_arenaroot|5.004050||p
612 PL_sv_no|5.004050||pn
613 PL_sv_undef|5.004050||pn
614 PL_sv_yes|5.004050||pn
615 PL_tainted|5.004050||p
616 PL_tainting|5.004050||p
617 POP_MULTICALL||5.009003|
618 POPi|||n
619 POPl|||n
620 POPn|||n
621 POPpbytex||5.007001|n
622 POPpx||5.005030|n
623 POPp|||n
624 POPs|||n
625 PTR2IV|5.006000||p
626 PTR2NV|5.006000||p
627 PTR2UV|5.006000||p
628 PTR2ul|5.007001||p
629 PTRV|5.006000||p
630 PUSHMARK|||
631 PUSH_MULTICALL||5.009003|
632 PUSHi|||
633 PUSHmortal|5.009002||p
634 PUSHn|||
635 PUSHp|||
636 PUSHs|||
637 PUSHu|5.004000||p
638 PUTBACK|||
639 PerlIO_clearerr||5.007003|
640 PerlIO_close||5.007003|
641 PerlIO_eof||5.007003|
642 PerlIO_error||5.007003|
643 PerlIO_fileno||5.007003|
644 PerlIO_fill||5.007003|
645 PerlIO_flush||5.007003|
646 PerlIO_get_base||5.007003|
647 PerlIO_get_bufsiz||5.007003|
648 PerlIO_get_cnt||5.007003|
649 PerlIO_get_ptr||5.007003|
650 PerlIO_read||5.007003|
651 PerlIO_seek||5.007003|
652 PerlIO_set_cnt||5.007003|
653 PerlIO_set_ptrcnt||5.007003|
654 PerlIO_setlinebuf||5.007003|
655 PerlIO_stderr||5.007003|
656 PerlIO_stdin||5.007003|
657 PerlIO_stdout||5.007003|
658 PerlIO_tell||5.007003|
659 PerlIO_unread||5.007003|
660 PerlIO_write||5.007003|
661 Poison|5.008000||p
662 RETVAL|||n
663 Renewc|||
664 Renew|||
665 SAVECLEARSV|||
666 SAVECOMPPAD|||
667 SAVEPADSV|||
668 SAVETMPS|||
669 SAVE_DEFSV|5.004050||p
670 SPAGAIN|||
671 SP|||
672 START_EXTERN_C|5.005000||p
673 START_MY_CXT|5.007003||p
674 STMT_END|||p
675 STMT_START|||p
676 ST|||
677 SVt_IV|||
678 SVt_NV|||
679 SVt_PVAV|||
680 SVt_PVCV|||
681 SVt_PVHV|||
682 SVt_PVMG|||
683 SVt_PV|||
684 Safefree|||
685 Slab_Alloc|||
686 Slab_Free|||
687 StructCopy|||
688 SvCUR_set|||
689 SvCUR|||
690 SvEND|||
691 SvGETMAGIC|5.004050||p
692 SvGROW|||
693 SvIOK_UV||5.006000|
694 SvIOK_notUV||5.006000|
695 SvIOK_off|||
696 SvIOK_only_UV||5.006000|
697 SvIOK_only|||
698 SvIOK_on|||
699 SvIOKp|||
700 SvIOK|||
701 SvIVX|||
702 SvIV_nomg|5.009001||p
703 SvIV_set|||
704 SvIVx|||
705 SvIV|||
706 SvIsCOW_shared_hash||5.008003|
707 SvIsCOW||5.008003|
708 SvLEN_set|||
709 SvLEN|||
710 SvLOCK||5.007003|
711 SvMAGIC_set|5.009003||p
712 SvNIOK_off|||
713 SvNIOKp|||
714 SvNIOK|||
715 SvNOK_off|||
716 SvNOK_only|||
717 SvNOK_on|||
718 SvNOKp|||
719 SvNOK|||
720 SvNVX|||
721 SvNV_set|||
722 SvNVx|||
723 SvNV|||
724 SvOK|||
725 SvOOK|||
726 SvPOK_off|||
727 SvPOK_only_UTF8||5.006000|
728 SvPOK_only|||
729 SvPOK_on|||
730 SvPOKp|||
731 SvPOK|||
732 SvPVX_const|5.009003||p
733 SvPVX_mutable|5.009003||p
734 SvPVX|||
735 SvPV_force_nomg|5.007002||p
736 SvPV_force|||
737 SvPV_nolen|5.006000||p
738 SvPV_nomg|5.007002||p
739 SvPV_set|||
740 SvPVbyte_force||5.009002|
741 SvPVbyte_nolen||5.006000|
742 SvPVbytex_force||5.006000|
743 SvPVbytex||5.006000|
744 SvPVbyte|5.006000||p
745 SvPVutf8_force||5.006000|
746 SvPVutf8_nolen||5.006000|
747 SvPVutf8x_force||5.006000|
748 SvPVutf8x||5.006000|
749 SvPVutf8||5.006000|
750 SvPVx|||
751 SvPV|||
752 SvREFCNT_dec|||
753 SvREFCNT_inc|||
754 SvREFCNT|||
755 SvROK_off|||
756 SvROK_on|||
757 SvROK|||
758 SvRV_set|5.009003||p
759 SvRV|||
760 SvSETMAGIC|||
761 SvSHARE||5.007003|
762 SvSTASH_set|5.009003|5.009003|p
763 SvSTASH|||
764 SvSetMagicSV_nosteal||5.004000|
765 SvSetMagicSV||5.004000|
766 SvSetSV_nosteal||5.004000|
767 SvSetSV|||
768 SvTAINTED_off||5.004000|
769 SvTAINTED_on||5.004000|
770 SvTAINTED||5.004000|
771 SvTAINT|||
772 SvTRUE|||
773 SvTYPE|||
774 SvUNLOCK||5.007003|
775 SvUOK||5.007001|
776 SvUPGRADE|||
777 SvUTF8_off||5.006000|
778 SvUTF8_on||5.006000|
779 SvUTF8||5.006000|
780 SvUVXx|5.004000||p
781 SvUVX|5.004000||p
782 SvUV_nomg|5.009001||p
783 SvUV_set|5.009003||p
784 SvUVx|5.004000||p
785 SvUV|5.004000||p
786 SvVOK||5.008001|
787 THIS|||n
788 UNDERBAR|5.009002||p
789 UVSIZE|5.006000||p
790 UVTYPE|5.006000||p
791 UVXf|5.007001||p
792 UVof|5.006000||p
793 UVuf|5.006000||p
794 UVxf|5.006000||p
795 XCPT_CATCH|5.009002||p
796 XCPT_RETHROW|5.009002||p
797 XCPT_TRY_END|5.009002||p
798 XCPT_TRY_START|5.009002||p
799 XPUSHi|||
800 XPUSHmortal|5.009002||p
801 XPUSHn|||
802 XPUSHp|||
803 XPUSHs|||
804 XPUSHu|5.004000||p
805 XSRETURN_EMPTY|||
806 XSRETURN_IV|||
807 XSRETURN_NO|||
808 XSRETURN_NV|||
809 XSRETURN_PV|||
810 XSRETURN_UNDEF|||
811 XSRETURN_UV|5.008001||p
812 XSRETURN_YES|||
813 XSRETURN|||p
814 XST_mIV|||
815 XST_mNO|||
816 XST_mNV|||
817 XST_mPV|||
818 XST_mUNDEF|||
819 XST_mUV|5.008001||p
820 XST_mYES|||
821 XS_VERSION_BOOTCHECK|||
822 XS_VERSION|||
823 XSprePUSH|5.006000||p
824 XS|||
825 ZeroD|5.009002||p
826 Zero|||
827 _aMY_CXT|5.007003||p
828 _pMY_CXT|5.007003||p
829 aMY_CXT_|5.007003||p
830 aMY_CXT|5.007003||p
831 aTHX_|5.006000||p
832 aTHX|5.006000||p
833 add_data|||
834 allocmy|||
835 amagic_call|||
836 amagic_cmp_locale|||
837 amagic_cmp|||
838 amagic_i_ncmp|||
839 amagic_ncmp|||
840 any_dup|||
841 ao|||
842 append_elem|||
843 append_list|||
844 apply_attrs_my|||
845 apply_attrs_string||5.006001|
846 apply_attrs|||
847 apply|||
848 atfork_lock||5.007003|n
849 atfork_unlock||5.007003|n
850 av_arylen_p||5.009003|
851 av_clear|||
852 av_delete||5.006000|
853 av_exists||5.006000|
854 av_extend|||
855 av_fake|||
856 av_fetch|||
857 av_fill|||
858 av_len|||
859 av_make|||
860 av_pop|||
861 av_push|||
862 av_reify|||
863 av_shift|||
864 av_store|||
865 av_undef|||
866 av_unshift|||
867 ax|||n
868 bad_type|||
869 bind_match|||
870 block_end|||
871 block_gimme||5.004000|
872 block_start|||
873 boolSV|5.004000||p
874 boot_core_PerlIO|||
875 boot_core_UNIVERSAL|||
876 boot_core_xsutils|||
877 bytes_from_utf8||5.007001|
878 bytes_to_utf8||5.006001|
879 cache_re|||
880 call_argv|5.006000||p
881 call_atexit||5.006000|
882 call_body|||
883 call_list_body|||
884 call_list||5.004000|
885 call_method|5.006000||p
886 call_pv|5.006000||p
887 call_sv|5.006000||p
888 calloc||5.007002|n
889 cando|||
890 cast_i32||5.006000|
891 cast_iv||5.006000|
892 cast_ulong||5.006000|
893 cast_uv||5.006000|
894 check_type_and_open|||
895 check_uni|||
896 checkcomma|||
897 checkposixcc|||
898 ck_anoncode|||
899 ck_bitop|||
900 ck_concat|||
901 ck_defined|||
902 ck_delete|||
903 ck_die|||
904 ck_eof|||
905 ck_eval|||
906 ck_exec|||
907 ck_exists|||
908 ck_exit|||
909 ck_ftst|||
910 ck_fun|||
911 ck_glob|||
912 ck_grep|||
913 ck_index|||
914 ck_join|||
915 ck_lengthconst|||
916 ck_lfun|||
917 ck_listiob|||
918 ck_match|||
919 ck_method|||
920 ck_null|||
921 ck_open|||
922 ck_repeat|||
923 ck_require|||
924 ck_retarget|||
925 ck_return|||
926 ck_rfun|||
927 ck_rvconst|||
928 ck_sassign|||
929 ck_say|||
930 ck_select|||
931 ck_shift|||
932 ck_sort|||
933 ck_spair|||
934 ck_split|||
935 ck_subr|||
936 ck_substr|||
937 ck_svconst|||
938 ck_trunc|||
939 ck_unpack|||
940 ckwarn_d||5.009003|
941 ckwarn||5.009003|
942 cl_and|||
943 cl_anything|||
944 cl_init_zero|||
945 cl_init|||
946 cl_is_anything|||
947 cl_or|||
948 closest_cop|||
949 convert|||
950 cop_free|||
951 cr_textfilter|||
952 croak_nocontext|||vn
953 croak|||v
954 csighandler||5.009003|n
955 custom_op_desc||5.007003|
956 custom_op_name||5.007003|
957 cv_ckproto|||
958 cv_clone|||
959 cv_const_sv||5.004000|
960 cv_dump|||
961 cv_undef|||
962 cx_dump||5.005000|
963 cx_dup|||
964 cxinc|||
965 dAXMARK|5.009003||p
966 dAX|5.007002||p
967 dITEMS|5.007002||p
968 dMARK|||
969 dMULTICALL||5.009003|
970 dMY_CXT_SV|5.007003||p
971 dMY_CXT|5.007003||p
972 dNOOP|5.006000||p
973 dORIGMARK|||
974 dSP|||
975 dTHR|5.004050||p
976 dTHXa|5.006000||p
977 dTHXoa|5.006000||p
978 dTHX|5.006000||p
979 dUNDERBAR|5.009002||p
980 dXCPT|5.009002||p
981 dXSARGS|||
982 dXSI32|||
983 dXSTARG|5.006000||p
984 deb_curcv|||
985 deb_nocontext|||vn
986 deb_stack_all|||
987 deb_stack_n|||
988 debop||5.005000|
989 debprofdump||5.005000|
990 debprof|||
991 debstackptrs||5.007003|
992 debstack||5.007003|
993 deb||5.007003|v
994 del_sv|||
995 delimcpy||5.004000|
996 deprecate_old|||
997 deprecate|||
998 despatch_signals||5.007001|
999 destroy_matcher|||
1000 die_nocontext|||vn
1001 die_where|||
1002 die|||v
1003 dirp_dup|||
1004 div128|||
1005 djSP|||
1006 do_aexec5|||
1007 do_aexec|||
1008 do_aspawn|||
1009 do_binmode||5.004050|
1010 do_chomp|||
1011 do_chop|||
1012 do_close|||
1013 do_dump_pad|||
1014 do_eof|||
1015 do_exec3|||
1016 do_execfree|||
1017 do_exec|||
1018 do_gv_dump||5.006000|
1019 do_gvgv_dump||5.006000|
1020 do_hv_dump||5.006000|
1021 do_ipcctl|||
1022 do_ipcget|||
1023 do_join|||
1024 do_kv|||
1025 do_magic_dump||5.006000|
1026 do_msgrcv|||
1027 do_msgsnd|||
1028 do_oddball|||
1029 do_op_dump||5.006000|
1030 do_open9||5.006000|
1031 do_openn||5.007001|
1032 do_open||5.004000|
1033 do_pipe|||
1034 do_pmop_dump||5.006000|
1035 do_print|||
1036 do_readline|||
1037 do_seek|||
1038 do_semop|||
1039 do_shmio|||
1040 do_smartmatch|||
1041 do_spawn_nowait|||
1042 do_spawn|||
1043 do_sprintf|||
1044 do_sv_dump||5.006000|
1045 do_sysseek|||
1046 do_tell|||
1047 do_trans_complex_utf8|||
1048 do_trans_complex|||
1049 do_trans_count_utf8|||
1050 do_trans_count|||
1051 do_trans_simple_utf8|||
1052 do_trans_simple|||
1053 do_trans|||
1054 do_vecget|||
1055 do_vecset|||
1056 do_vop|||
1057 docatch_body|||
1058 docatch|||
1059 doeval|||
1060 dofile|||
1061 dofindlabel|||
1062 doform|||
1063 doing_taint||5.008001|n
1064 dooneliner|||
1065 doopen_pm|||
1066 doparseform|||
1067 dopoptoeval|||
1068 dopoptogiven|||
1069 dopoptolabel|||
1070 dopoptoloop|||
1071 dopoptosub_at|||
1072 dopoptosub|||
1073 dopoptowhen|||
1074 doref||5.009003|
1075 dounwind|||
1076 dowantarray|||
1077 dump_all||5.006000|
1078 dump_eval||5.006000|
1079 dump_fds|||
1080 dump_form||5.006000|
1081 dump_indent||5.006000|v
1082 dump_mstats|||
1083 dump_packsubs||5.006000|
1084 dump_sub||5.006000|
1085 dump_sv_child|||
1086 dump_vindent||5.006000|
1087 dumpuntil|||
1088 dup_attrlist|||
1089 emulate_eaccess|||
1090 eval_pv|5.006000||p
1091 eval_sv|5.006000||p
1092 expect_number|||
1093 fbm_compile||5.005000|
1094 fbm_instr||5.005000|
1095 fd_on_nosuid_fs|||
1096 feature_is_enabled|||
1097 filter_add|||
1098 filter_del|||
1099 filter_gets|||
1100 filter_read|||
1101 find_beginning|||
1102 find_byclass|||
1103 find_in_my_stash|||
1104 find_runcv|||
1105 find_rundefsvoffset||5.009002|
1106 find_script|||
1107 find_uninit_var|||
1108 first_symbol|||n
1109 fold_constants|||
1110 forbid_setid|||
1111 force_ident|||
1112 force_list|||
1113 force_next|||
1114 force_version|||
1115 force_word|||
1116 form_nocontext|||vn
1117 form||5.004000|v
1118 fp_dup|||
1119 fprintf_nocontext|||vn
1120 free_global_struct|||
1121 free_tied_hv_pool|||
1122 free_tmps|||
1123 gen_constant_list|||
1124 get_av|5.006000||p
1125 get_context||5.006000|n
1126 get_cv|5.006000||p
1127 get_db_sub|||
1128 get_debug_opts|||
1129 get_hash_seed|||
1130 get_hv|5.006000||p
1131 get_mstats|||
1132 get_no_modify|||
1133 get_num|||
1134 get_op_descs||5.005000|
1135 get_op_names||5.005000|
1136 get_opargs|||
1137 get_ppaddr||5.006000|
1138 get_sv|5.006000||p
1139 get_vtbl||5.005030|
1140 getcwd_sv||5.007002|
1141 getenv_len|||
1142 gp_dup|||
1143 gp_free|||
1144 gp_ref|||
1145 grok_bin|5.007003||p
1146 grok_hex|5.007003||p
1147 grok_number|5.007002||p
1148 grok_numeric_radix|5.007002||p
1149 grok_oct|5.007003||p
1150 group_end|||
1151 gv_AVadd|||
1152 gv_HVadd|||
1153 gv_IOadd|||
1154 gv_SVadd|||
1155 gv_autoload4||5.004000|
1156 gv_check|||
1157 gv_const_sv||5.009003|
1158 gv_dump||5.006000|
1159 gv_efullname3||5.004000|
1160 gv_efullname4||5.006001|
1161 gv_efullname|||
1162 gv_ename|||
1163 gv_fetchfile|||
1164 gv_fetchmeth_autoload||5.007003|
1165 gv_fetchmethod_autoload||5.004000|
1166 gv_fetchmethod|||
1167 gv_fetchmeth|||
1168 gv_fetchpvn_flags||5.009002|
1169 gv_fetchpv|||
1170 gv_fetchsv||5.009002|
1171 gv_fullname3||5.004000|
1172 gv_fullname4||5.006001|
1173 gv_fullname|||
1174 gv_handler||5.007001|
1175 gv_init_sv|||
1176 gv_init|||
1177 gv_stashpvn|5.006000||p
1178 gv_stashpv|||
1179 gv_stashsv|||
1180 he_dup|||
1181 hek_dup|||
1182 hfreeentries|||
1183 hsplit|||
1184 hv_assert||5.009001|
1185 hv_auxinit|||
1186 hv_backreferences_p|||
1187 hv_clear_placeholders||5.009001|
1188 hv_clear|||
1189 hv_delayfree_ent||5.004000|
1190 hv_delete_common|||
1191 hv_delete_ent||5.004000|
1192 hv_delete|||
1193 hv_eiter_p||5.009003|
1194 hv_eiter_set||5.009003|
1195 hv_exists_ent||5.004000|
1196 hv_exists|||
1197 hv_fetch_common|||
1198 hv_fetch_ent||5.004000|
1199 hv_fetch|||
1200 hv_free_ent||5.004000|
1201 hv_iterinit|||
1202 hv_iterkeysv||5.004000|
1203 hv_iterkey|||
1204 hv_iternext_flags||5.008000|
1205 hv_iternextsv|||
1206 hv_iternext|||
1207 hv_iterval|||
1208 hv_kill_backrefs|||
1209 hv_ksplit||5.004000|
1210 hv_magic_check|||
1211 hv_magic|||
1212 hv_name_set||5.009003|
1213 hv_notallowed|||
1214 hv_placeholders_get||5.009003|
1215 hv_placeholders_p||5.009003|
1216 hv_placeholders_set||5.009003|
1217 hv_riter_p||5.009003|
1218 hv_riter_set||5.009003|
1219 hv_scalar||5.009001|
1220 hv_store_ent||5.004000|
1221 hv_store_flags||5.008000|
1222 hv_store|||
1223 hv_undef|||
1224 ibcmp_locale||5.004000|
1225 ibcmp_utf8||5.007003|
1226 ibcmp|||
1227 incl_perldb|||
1228 incline|||
1229 incpush_if_exists|||
1230 incpush|||
1231 ingroup|||
1232 init_argv_symbols|||
1233 init_debugger|||
1234 init_global_struct|||
1235 init_i18nl10n||5.006000|
1236 init_i18nl14n||5.006000|
1237 init_ids|||
1238 init_interp|||
1239 init_lexer|||
1240 init_main_stash|||
1241 init_perllib|||
1242 init_postdump_symbols|||
1243 init_predump_symbols|||
1244 init_stacks||5.005000|
1245 init_tm||5.007002|
1246 instr|||
1247 intro_my|||
1248 intuit_method|||
1249 intuit_more|||
1250 invert|||
1251 io_close|||
1252 isALNUM|||
1253 isALPHA|||
1254 isDIGIT|||
1255 isLOWER|||
1256 isSPACE|||
1257 isUPPER|||
1258 is_an_int|||
1259 is_gv_magical_sv|||
1260 is_gv_magical|||
1261 is_handle_constructor|||
1262 is_list_assignment|||
1263 is_lvalue_sub||5.007001|
1264 is_uni_alnum_lc||5.006000|
1265 is_uni_alnumc_lc||5.006000|
1266 is_uni_alnumc||5.006000|
1267 is_uni_alnum||5.006000|
1268 is_uni_alpha_lc||5.006000|
1269 is_uni_alpha||5.006000|
1270 is_uni_ascii_lc||5.006000|
1271 is_uni_ascii||5.006000|
1272 is_uni_cntrl_lc||5.006000|
1273 is_uni_cntrl||5.006000|
1274 is_uni_digit_lc||5.006000|
1275 is_uni_digit||5.006000|
1276 is_uni_graph_lc||5.006000|
1277 is_uni_graph||5.006000|
1278 is_uni_idfirst_lc||5.006000|
1279 is_uni_idfirst||5.006000|
1280 is_uni_lower_lc||5.006000|
1281 is_uni_lower||5.006000|
1282 is_uni_print_lc||5.006000|
1283 is_uni_print||5.006000|
1284 is_uni_punct_lc||5.006000|
1285 is_uni_punct||5.006000|
1286 is_uni_space_lc||5.006000|
1287 is_uni_space||5.006000|
1288 is_uni_upper_lc||5.006000|
1289 is_uni_upper||5.006000|
1290 is_uni_xdigit_lc||5.006000|
1291 is_uni_xdigit||5.006000|
1292 is_utf8_alnumc||5.006000|
1293 is_utf8_alnum||5.006000|
1294 is_utf8_alpha||5.006000|
1295 is_utf8_ascii||5.006000|
1296 is_utf8_char_slow|||
1297 is_utf8_char||5.006000|
1298 is_utf8_cntrl||5.006000|
1299 is_utf8_common|||
1300 is_utf8_digit||5.006000|
1301 is_utf8_graph||5.006000|
1302 is_utf8_idcont||5.008000|
1303 is_utf8_idfirst||5.006000|
1304 is_utf8_lower||5.006000|
1305 is_utf8_mark||5.006000|
1306 is_utf8_print||5.006000|
1307 is_utf8_punct||5.006000|
1308 is_utf8_space||5.006000|
1309 is_utf8_string_loclen||5.009003|
1310 is_utf8_string_loc||5.008001|
1311 is_utf8_string||5.006001|
1312 is_utf8_upper||5.006000|
1313 is_utf8_xdigit||5.006000|
1314 isa_lookup|||
1315 items|||n
1316 ix|||n
1317 jmaybe|||
1318 keyword|||
1319 leave_scope|||
1320 lex_end|||
1321 lex_start|||
1322 linklist|||
1323 listkids|||
1324 list|||
1325 load_module_nocontext|||vn
1326 load_module||5.006000|v
1327 localize|||
1328 looks_like_bool|||
1329 looks_like_number|||
1330 lop|||
1331 mPUSHi|5.009002||p
1332 mPUSHn|5.009002||p
1333 mPUSHp|5.009002||p
1334 mPUSHu|5.009002||p
1335 mXPUSHi|5.009002||p
1336 mXPUSHn|5.009002||p
1337 mXPUSHp|5.009002||p
1338 mXPUSHu|5.009002||p
1339 magic_clear_all_env|||
1340 magic_clearenv|||
1341 magic_clearpack|||
1342 magic_clearsig|||
1343 magic_dump||5.006000|
1344 magic_existspack|||
1345 magic_freearylen_p|||
1346 magic_freeovrld|||
1347 magic_freeregexp|||
1348 magic_getarylen|||
1349 magic_getdefelem|||
1350 magic_getglob|||
1351 magic_getnkeys|||
1352 magic_getpack|||
1353 magic_getpos|||
1354 magic_getsig|||
1355 magic_getsubstr|||
1356 magic_gettaint|||
1357 magic_getuvar|||
1358 magic_getvec|||
1359 magic_get|||
1360 magic_killbackrefs|||
1361 magic_len|||
1362 magic_methcall|||
1363 magic_methpack|||
1364 magic_nextpack|||
1365 magic_regdata_cnt|||
1366 magic_regdatum_get|||
1367 magic_regdatum_set|||
1368 magic_scalarpack|||
1369 magic_set_all_env|||
1370 magic_setamagic|||
1371 magic_setarylen|||
1372 magic_setbm|||
1373 magic_setcollxfrm|||
1374 magic_setdbline|||
1375 magic_setdefelem|||
1376 magic_setenv|||
1377 magic_setfm|||
1378 magic_setglob|||
1379 magic_setisa|||
1380 magic_setmglob|||
1381 magic_setnkeys|||
1382 magic_setpack|||
1383 magic_setpos|||
1384 magic_setregexp|||
1385 magic_setsig|||
1386 magic_setsubstr|||
1387 magic_settaint|||
1388 magic_setutf8|||
1389 magic_setuvar|||
1390 magic_setvec|||
1391 magic_set|||
1392 magic_sizepack|||
1393 magic_wipepack|||
1394 magicname|||
1395 make_matcher|||
1396 make_trie|||
1397 malloced_size|||n
1398 malloc||5.007002|n
1399 markstack_grow|||
1400 matcher_matches_sv|||
1401 measure_struct|||
1402 memEQ|5.004000||p
1403 memNE|5.004000||p
1404 mem_collxfrm|||
1405 mess_alloc|||
1406 mess_nocontext|||vn
1407 mess||5.006000|v
1408 method_common|||
1409 mfree||5.007002|n
1410 mg_clear|||
1411 mg_copy|||
1412 mg_dup|||
1413 mg_find|||
1414 mg_free|||
1415 mg_get|||
1416 mg_length||5.005000|
1417 mg_localize|||
1418 mg_magical|||
1419 mg_set|||
1420 mg_size||5.005000|
1421 mini_mktime||5.007002|
1422 missingterm|||
1423 mode_from_discipline|||
1424 modkids|||
1425 mod|||
1426 moreswitches|||
1427 mul128|||
1428 mulexp10|||n
1429 my_atof2||5.007002|
1430 my_atof||5.006000|
1431 my_attrs|||
1432 my_bcopy|||n
1433 my_betoh16|||n
1434 my_betoh32|||n
1435 my_betoh64|||n
1436 my_betohi|||n
1437 my_betohl|||n
1438 my_betohs|||n
1439 my_bzero|||n
1440 my_chsize|||
1441 my_clearenv|||
1442 my_cxt_init|||
1443 my_exit_jump|||
1444 my_exit|||
1445 my_failure_exit||5.004000|
1446 my_fflush_all||5.006000|
1447 my_fork||5.007003|n
1448 my_htobe16|||n
1449 my_htobe32|||n
1450 my_htobe64|||n
1451 my_htobei|||n
1452 my_htobel|||n
1453 my_htobes|||n
1454 my_htole16|||n
1455 my_htole32|||n
1456 my_htole64|||n
1457 my_htolei|||n
1458 my_htolel|||n
1459 my_htoles|||n
1460 my_htonl|||
1461 my_kid|||
1462 my_letoh16|||n
1463 my_letoh32|||n
1464 my_letoh64|||n
1465 my_letohi|||n
1466 my_letohl|||n
1467 my_letohs|||n
1468 my_lstat|||
1469 my_memcmp||5.004000|n
1470 my_memset|||n
1471 my_ntohl|||
1472 my_pclose||5.004000|
1473 my_popen_list||5.007001|
1474 my_popen||5.004000|
1475 my_setenv|||
1476 my_socketpair||5.007003|n
1477 my_sprintf||5.009003|vn
1478 my_stat|||
1479 my_strftime||5.007002|
1480 my_swabn|||n
1481 my_swap|||
1482 my_unexec|||
1483 my|||
1484 need_utf8|||n
1485 newANONATTRSUB||5.006000|
1486 newANONHASH|||
1487 newANONLIST|||
1488 newANONSUB|||
1489 newASSIGNOP|||
1490 newATTRSUB||5.006000|
1491 newAVREF|||
1492 newAV|||
1493 newBINOP|||
1494 newCONDOP|||
1495 newCONSTSUB|5.006000||p
1496 newCVREF|||
1497 newDEFSVOP|||
1498 newFORM|||
1499 newFOROP|||
1500 newGIVENOP||5.009003|
1501 newGIVWHENOP|||
1502 newGVOP|||
1503 newGVREF|||
1504 newGVgen|||
1505 newHVREF|||
1506 newHVhv||5.005000|
1507 newHV|||
1508 newIO|||
1509 newLISTOP|||
1510 newLOGOP|||
1511 newLOOPEX|||
1512 newLOOPOP|||
1513 newMYSUB||5.006000|
1514 newNULLLIST|||
1515 newOP|||
1516 newPADOP||5.006000|
1517 newPMOP|||
1518 newPROG|||
1519 newPVOP|||
1520 newRANGE|||
1521 newRV_inc|5.004000||p
1522 newRV_noinc|5.006000||p
1523 newRV|||
1524 newSLICEOP|||
1525 newSTATEOP|||
1526 newSUB|||
1527 newSVOP|||
1528 newSVREF|||
1529 newSVhek||5.009003|
1530 newSViv|||
1531 newSVnv|||
1532 newSVpvf_nocontext|||vn
1533 newSVpvf||5.004000|v
1534 newSVpvn_share||5.007001|
1535 newSVpvn|5.006000||p
1536 newSVpv|||
1537 newSVrv|||
1538 newSVsv|||
1539 newSVuv|5.006000||p
1540 newSV|||
1541 newUNOP|||
1542 newWHENOP||5.009003|
1543 newWHILEOP||5.009003|
1544 newXSproto||5.006000|
1545 newXS||5.006000|
1546 new_collate||5.006000|
1547 new_constant|||
1548 new_ctype||5.006000|
1549 new_he|||
1550 new_logop|||
1551 new_numeric||5.006000|
1552 new_stackinfo||5.005000|
1553 new_version||5.009000|
1554 next_symbol|||
1555 nextargv|||
1556 nextchar|||
1557 ninstr|||
1558 no_bareword_allowed|||
1559 no_fh_allowed|||
1560 no_op|||
1561 not_a_number|||
1562 nothreadhook||5.008000|
1563 nuke_stacks|||
1564 num_overflow|||n
1565 offer_nice_chunk|||
1566 oopsAV|||
1567 oopsCV|||
1568 oopsHV|||
1569 op_clear|||
1570 op_const_sv|||
1571 op_dump||5.006000|
1572 op_free|||
1573 op_null||5.007002|
1574 op_refcnt_lock||5.009002|
1575 op_refcnt_unlock||5.009002|
1576 open_script|||
1577 pMY_CXT_|5.007003||p
1578 pMY_CXT|5.007003||p
1579 pTHX_|5.006000||p
1580 pTHX|5.006000||p
1581 pack_cat||5.007003|
1582 pack_rec|||
1583 package|||
1584 packlist||5.008001|
1585 pad_add_anon|||
1586 pad_add_name|||
1587 pad_alloc|||
1588 pad_block_start|||
1589 pad_check_dup|||
1590 pad_compname_type|||
1591 pad_findlex|||
1592 pad_findmy|||
1593 pad_fixup_inner_anons|||
1594 pad_free|||
1595 pad_leavemy|||
1596 pad_new|||
1597 pad_push|||
1598 pad_reset|||
1599 pad_setsv|||
1600 pad_sv|||
1601 pad_swipe|||
1602 pad_tidy|||
1603 pad_undef|||
1604 parse_body|||
1605 parse_unicode_opts|||
1606 path_is_absolute|||
1607 peep|||
1608 pending_ident|||
1609 perl_alloc_using|||n
1610 perl_alloc|||n
1611 perl_clone_using|||n
1612 perl_clone|||n
1613 perl_construct|||n
1614 perl_destruct||5.007003|n
1615 perl_free|||n
1616 perl_parse||5.006000|n
1617 perl_run|||n
1618 pidgone|||
1619 pmflag|||
1620 pmop_dump||5.006000|
1621 pmruntime|||
1622 pmtrans|||
1623 pop_scope|||
1624 pregcomp|||
1625 pregexec|||
1626 pregfree|||
1627 prepend_elem|||
1628 printf_nocontext|||vn
1629 ptr_table_clear|||
1630 ptr_table_fetch|||
1631 ptr_table_free|||
1632 ptr_table_new|||
1633 ptr_table_split|||
1634 ptr_table_store|||
1635 push_scope|||
1636 put_byte|||
1637 pv_display||5.006000|
1638 pv_uni_display||5.007003|
1639 qerror|||
1640 re_croak2|||
1641 re_dup|||
1642 re_intuit_start||5.006000|
1643 re_intuit_string||5.006000|
1644 realloc||5.007002|n
1645 reentrant_free|||
1646 reentrant_init|||
1647 reentrant_retry|||vn
1648 reentrant_size|||
1649 ref_array_or_hash|||
1650 refkids|||
1651 refto|||
1652 ref||5.009003|
1653 reg_node|||
1654 reganode|||
1655 regatom|||
1656 regbranch|||
1657 regclass_swash||5.007003|
1658 regclass|||
1659 regcppop|||
1660 regcppush|||
1661 regcurly|||
1662 regdump||5.005000|
1663 regexec_flags||5.005000|
1664 reghop3|||
1665 reghopmaybe3|||
1666 reghopmaybe|||
1667 reghop|||
1668 reginclass|||
1669 reginitcolors||5.006000|
1670 reginsert|||
1671 regmatch|||
1672 regnext||5.005000|
1673 regoptail|||
1674 regpiece|||
1675 regpposixcc|||
1676 regprop|||
1677 regrepeat_hard|||
1678 regrepeat|||
1679 regtail|||
1680 regtry|||
1681 reguni|||
1682 regwhite|||
1683 reg|||
1684 repeatcpy|||
1685 report_evil_fh|||
1686 report_uninit|||
1687 require_errno|||
1688 require_pv||5.006000|
1689 restore_magic|||
1690 rninstr|||
1691 rsignal_restore|||
1692 rsignal_save|||
1693 rsignal_state||5.004000|
1694 rsignal||5.004000|
1695 run_body|||
1696 run_user_filter|||
1697 runops_debug||5.005000|
1698 runops_standard||5.005000|
1699 rvpv_dup|||
1700 rxres_free|||
1701 rxres_restore|||
1702 rxres_save|||
1703 safesyscalloc||5.006000|n
1704 safesysfree||5.006000|n
1705 safesysmalloc||5.006000|n
1706 safesysrealloc||5.006000|n
1707 same_dirent|||
1708 save_I16||5.004000|
1709 save_I32|||
1710 save_I8||5.006000|
1711 save_aelem||5.004050|
1712 save_alloc||5.006000|
1713 save_aptr|||
1714 save_ary|||
1715 save_bool||5.008001|
1716 save_clearsv|||
1717 save_delete|||
1718 save_destructor_x||5.006000|
1719 save_destructor||5.006000|
1720 save_freeop|||
1721 save_freepv|||
1722 save_freesv|||
1723 save_generic_pvref||5.006001|
1724 save_generic_svref||5.005030|
1725 save_gp||5.004000|
1726 save_hash|||
1727 save_hek_flags|||
1728 save_helem||5.004050|
1729 save_hints||5.005000|
1730 save_hptr|||
1731 save_int|||
1732 save_item|||
1733 save_iv||5.005000|
1734 save_lines|||
1735 save_list|||
1736 save_long|||
1737 save_magic|||
1738 save_mortalizesv||5.007001|
1739 save_nogv|||
1740 save_op|||
1741 save_padsv||5.007001|
1742 save_pptr|||
1743 save_re_context||5.006000|
1744 save_scalar_at|||
1745 save_scalar|||
1746 save_set_svflags||5.009000|
1747 save_shared_pvref||5.007003|
1748 save_sptr|||
1749 save_svref|||
1750 save_threadsv||5.005000|
1751 save_vptr||5.006000|
1752 savepvn|||
1753 savepv|||
1754 savesharedpv||5.007003|
1755 savestack_grow_cnt||5.008001|
1756 savestack_grow|||
1757 savesvpv||5.009002|
1758 sawparens|||
1759 scalar_mod_type|||
1760 scalarboolean|||
1761 scalarkids|||
1762 scalarseq|||
1763 scalarvoid|||
1764 scalar|||
1765 scan_bin||5.006000|
1766 scan_commit|||
1767 scan_const|||
1768 scan_formline|||
1769 scan_heredoc|||
1770 scan_hex|||
1771 scan_ident|||
1772 scan_inputsymbol|||
1773 scan_num||5.007001|
1774 scan_oct|||
1775 scan_pat|||
1776 scan_str|||
1777 scan_subst|||
1778 scan_trans|||
1779 scan_version||5.009001|
1780 scan_vstring||5.008001|
1781 scan_word|||
1782 scope|||
1783 screaminstr||5.005000|
1784 seed||5.008001|
1785 sequence_num|||
1786 sequence|||
1787 set_context||5.006000|n
1788 set_csh|||
1789 set_numeric_local||5.006000|
1790 set_numeric_radix||5.006000|
1791 set_numeric_standard||5.006000|
1792 setdefout|||
1793 setenv_getix|||
1794 share_hek_flags|||
1795 share_hek||5.004000|
1796 si_dup|||
1797 sighandler|||n
1798 simplify_sort|||
1799 skipspace|||
1800 sortcv_stacked|||
1801 sortcv_xsub|||
1802 sortcv|||
1803 sortsv_flags||5.009003|
1804 sortsv||5.007003|
1805 ss_dup|||
1806 stack_grow|||
1807 start_glob|||
1808 start_subparse||5.004000|
1809 stashpv_hvname_match||5.009003|
1810 stdize_locale|||
1811 strEQ|||
1812 strGE|||
1813 strGT|||
1814 strLE|||
1815 strLT|||
1816 strNE|||
1817 str_to_version||5.006000|
1818 stringify_regexp|||
1819 strip_return|||
1820 strnEQ|||
1821 strnNE|||
1822 study_chunk|||
1823 sub_crush_depth|||
1824 sublex_done|||
1825 sublex_push|||
1826 sublex_start|||
1827 sv_2bool|||
1828 sv_2cv|||
1829 sv_2io|||
1830 sv_2iuv_non_preserve|||
1831 sv_2iv_flags||5.009001|
1832 sv_2iv|||
1833 sv_2mortal|||
1834 sv_2nv|||
1835 sv_2pv_flags||5.007002|
1836 sv_2pv_nolen|5.006000||p
1837 sv_2pvbyte_nolen|||
1838 sv_2pvbyte|5.006000||p
1839 sv_2pvutf8_nolen||5.006000|
1840 sv_2pvutf8||5.006000|
1841 sv_2pv|||
1842 sv_2uv_flags||5.009001|
1843 sv_2uv|5.004000||p
1844 sv_add_arena|||
1845 sv_add_backref|||
1846 sv_backoff|||
1847 sv_bless|||
1848 sv_cat_decode||5.008001|
1849 sv_catpv_mg|5.006000||p
1850 sv_catpvf_mg_nocontext|||pvn
1851 sv_catpvf_mg|5.006000|5.004000|pv
1852 sv_catpvf_nocontext|||vn
1853 sv_catpvf||5.004000|v
1854 sv_catpvn_flags||5.007002|
1855 sv_catpvn_mg|5.004050||p
1856 sv_catpvn_nomg|5.007002||p
1857 sv_catpvn|||
1858 sv_catpv|||
1859 sv_catsv_flags||5.007002|
1860 sv_catsv_mg|5.004050||p
1861 sv_catsv_nomg|5.007002||p
1862 sv_catsv|||
1863 sv_chop|||
1864 sv_clean_all|||
1865 sv_clean_objs|||
1866 sv_clear|||
1867 sv_cmp_locale||5.004000|
1868 sv_cmp|||
1869 sv_collxfrm|||
1870 sv_compile_2op||5.008001|
1871 sv_copypv||5.007003|
1872 sv_dec|||
1873 sv_del_backref|||
1874 sv_derived_from||5.004000|
1875 sv_dump|||
1876 sv_dup|||
1877 sv_eq|||
1878 sv_exp_grow|||
1879 sv_force_normal_flags||5.007001|
1880 sv_force_normal||5.006000|
1881 sv_free2|||
1882 sv_free_arenas|||
1883 sv_free|||
1884 sv_gets||5.004000|
1885 sv_grow|||
1886 sv_i_ncmp|||
1887 sv_inc|||
1888 sv_insert|||
1889 sv_isa|||
1890 sv_isobject|||
1891 sv_iv||5.005000|
1892 sv_kill_backrefs|||
1893 sv_len_utf8||5.006000|
1894 sv_len|||
1895 sv_magicext||5.007003|
1896 sv_magic|||
1897 sv_mortalcopy|||
1898 sv_ncmp|||
1899 sv_newmortal|||
1900 sv_newref|||
1901 sv_nolocking||5.007003|
1902 sv_nosharing||5.007003|
1903 sv_nounlocking||5.007003|
1904 sv_nv||5.005000|
1905 sv_peek||5.005000|
1906 sv_pos_b2u||5.006000|
1907 sv_pos_u2b||5.006000|
1908 sv_pvbyten_force||5.006000|
1909 sv_pvbyten||5.006000|
1910 sv_pvbyte||5.006000|
1911 sv_pvn_force_flags||5.007002|
1912 sv_pvn_force|||p
1913 sv_pvn_nomg|5.007003||p
1914 sv_pvn|5.006000||p
1915 sv_pvutf8n_force||5.006000|
1916 sv_pvutf8n||5.006000|
1917 sv_pvutf8||5.006000|
1918 sv_pv||5.006000|
1919 sv_recode_to_utf8||5.007003|
1920 sv_reftype|||
1921 sv_release_COW|||
1922 sv_release_IVX|||
1923 sv_replace|||
1924 sv_report_used|||
1925 sv_reset|||
1926 sv_rvweaken||5.006000|
1927 sv_setiv_mg|5.006000||p
1928 sv_setiv|||
1929 sv_setnv_mg|5.006000||p
1930 sv_setnv|||
1931 sv_setpv_mg|5.006000||p
1932 sv_setpvf_mg_nocontext|||pvn
1933 sv_setpvf_mg|5.006000|5.004000|pv
1934 sv_setpvf_nocontext|||vn
1935 sv_setpvf||5.004000|v
1936 sv_setpviv_mg||5.008001|
1937 sv_setpviv||5.008001|
1938 sv_setpvn_mg|5.006000||p
1939 sv_setpvn|||
1940 sv_setpv|||
1941 sv_setref_iv|||
1942 sv_setref_nv|||
1943 sv_setref_pvn|||
1944 sv_setref_pv|||
1945 sv_setref_uv||5.007001|
1946 sv_setsv_cow|||
1947 sv_setsv_flags||5.007002|
1948 sv_setsv_mg|5.006000||p
1949 sv_setsv_nomg|5.007002||p
1950 sv_setsv|||
1951 sv_setuv_mg|5.006000||p
1952 sv_setuv|5.006000||p
1953 sv_tainted||5.004000|
1954 sv_taint||5.004000|
1955 sv_true||5.005000|
1956 sv_unglob|||
1957 sv_uni_display||5.007003|
1958 sv_unmagic|||
1959 sv_unref_flags||5.007001|
1960 sv_unref|||
1961 sv_untaint||5.004000|
1962 sv_upgrade|||
1963 sv_usepvn_mg|5.006000||p
1964 sv_usepvn|||
1965 sv_utf8_decode||5.006000|
1966 sv_utf8_downgrade||5.006000|
1967 sv_utf8_encode||5.006000|
1968 sv_utf8_upgrade_flags||5.007002|
1969 sv_utf8_upgrade||5.007001|
1970 sv_uv|5.006000||p
1971 sv_vcatpvf_mg|5.006000|5.004000|p
1972 sv_vcatpvfn||5.004000|
1973 sv_vcatpvf|5.006000|5.004000|p
1974 sv_vsetpvf_mg|5.006000|5.004000|p
1975 sv_vsetpvfn||5.004000|
1976 sv_vsetpvf|5.006000|5.004000|p
1977 svtype|||
1978 swallow_bom|||
1979 swash_fetch||5.007002|
1980 swash_get|||
1981 swash_init||5.006000|
1982 sys_intern_clear|||
1983 sys_intern_dup|||
1984 sys_intern_init|||
1985 taint_env|||
1986 taint_proper|||
1987 tmps_grow||5.006000|
1988 toLOWER|||
1989 toUPPER|||
1990 to_byte_substr|||
1991 to_uni_fold||5.007003|
1992 to_uni_lower_lc||5.006000|
1993 to_uni_lower||5.007003|
1994 to_uni_title_lc||5.006000|
1995 to_uni_title||5.007003|
1996 to_uni_upper_lc||5.006000|
1997 to_uni_upper||5.007003|
1998 to_utf8_case||5.007003|
1999 to_utf8_fold||5.007003|
2000 to_utf8_lower||5.007003|
2001 to_utf8_substr|||
2002 to_utf8_title||5.007003|
2003 to_utf8_upper||5.007003|
2004 tokenize_use|||
2005 tokeq|||
2006 tokereport|||
2007 too_few_arguments|||
2008 too_many_arguments|||
2009 uiv_2buf|||n
2010 unlnk|||
2011 unpack_rec|||
2012 unpack_str||5.007003|
2013 unpackstring||5.008001|
2014 unshare_hek_or_pvn|||
2015 unshare_hek|||
2016 unsharepvn||5.004000|
2017 unwind_handler_stack|||
2018 upg_version||5.009000|
2019 usage|||
2020 utf16_to_utf8_reversed||5.006001|
2021 utf16_to_utf8||5.006001|
2022 utf8_distance||5.006000|
2023 utf8_hop||5.006000|
2024 utf8_length||5.007001|
2025 utf8_mg_pos_init|||
2026 utf8_mg_pos|||
2027 utf8_to_bytes||5.006001|
2028 utf8_to_uvchr||5.007001|
2029 utf8_to_uvuni||5.007001|
2030 utf8n_to_uvchr|||
2031 utf8n_to_uvuni||5.007001|
2032 utilize|||
2033 uvchr_to_utf8_flags||5.007003|
2034 uvchr_to_utf8|||
2035 uvuni_to_utf8_flags||5.007003|
2036 uvuni_to_utf8||5.007001|
2037 validate_suid|||
2038 varname|||
2039 vcmp||5.009000|
2040 vcroak||5.006000|
2041 vdeb||5.007003|
2042 vdie_common|||
2043 vdie_croak_common|||
2044 vdie|||
2045 vform||5.006000|
2046 visit|||
2047 vivify_defelem|||
2048 vivify_ref|||
2049 vload_module||5.006000|
2050 vmess||5.006000|
2051 vnewSVpvf|5.006000|5.004000|p
2052 vnormal||5.009002|
2053 vnumify||5.009000|
2054 vstringify||5.009000|
2055 vverify||5.009003|
2056 vwarner||5.006000|
2057 vwarn||5.006000|
2058 wait4pid|||
2059 warn_nocontext|||vn
2060 warner_nocontext|||vn
2061 warner||5.006000|v
2062 warn|||v
2063 watch|||
2064 whichsig|||
2065 write_no_mem|||
2066 write_to_stderr|||
2067 yyerror|||
2068 yylex|||
2069 yyparse|||
2070 yywarn|||
2071 );
2072
2073 if (exists $opt{'list-unsupported'}) {
2074   my $f;
2075   for $f (sort { lc $a cmp lc $b } keys %API) {
2076     next unless $API{$f}{todo};
2077     print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n";
2078   }
2079   exit 0;
2080 }
2081
2082 # Scan for possible replacement candidates
2083
2084 my(%replace, %need, %hints, %depends);
2085 my $replace = 0;
2086 my $hint = '';
2087
2088 while (<DATA>) {
2089   if ($hint) {
2090     if (m{^\s*\*\s(.*?)\s*$}) {
2091       $hints{$hint} ||= '';  # suppress warning with older perls
2092       $hints{$hint} .= "$1\n";
2093     }
2094     else {
2095       $hint = '';
2096     }
2097   }
2098   $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$};
2099
2100   $replace     = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$};
2101   $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)};
2102   $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce};
2103   $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$};
2104
2105   if (m{^\s*$rccs\s+(\w+)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) {
2106     push @{$depends{$1}}, map { s/\s+//g; $_ } split /,/, $2;
2107   }
2108
2109   $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)};
2110 }
2111
2112 if (exists $opt{'api-info'}) {
2113   my $f;
2114   my $count = 0;
2115   my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$";
2116   for $f (sort { lc $a cmp lc $b } keys %API) {
2117     next unless $f =~ /$match/;
2118     print "\n=== $f ===\n\n";
2119     my $info = 0;
2120     if ($API{$f}{base} || $API{$f}{todo}) {
2121       my $base = format_version($API{$f}{base} || $API{$f}{todo});
2122       print "Supported at least starting from perl-$base.\n";
2123       $info++;
2124     }
2125     if ($API{$f}{provided}) {
2126       my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003";
2127       print "Support by $ppport provided back to perl-$todo.\n";
2128       print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f};
2129       print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f};
2130       print "$hints{$f}" if exists $hints{$f};
2131       $info++;
2132     }
2133     unless ($info) {
2134       print "No portability information available.\n";
2135     }
2136     $count++;
2137   }
2138   if ($count > 0) {
2139     print "\n";
2140   }
2141   else {
2142     print "Found no API matching '$opt{'api-info'}'.\n";
2143   }
2144   exit 0;
2145 }
2146
2147 if (exists $opt{'list-provided'}) {
2148   my $f;
2149   for $f (sort { lc $a cmp lc $b } keys %API) {
2150     next unless $API{$f}{provided};
2151     my @flags;
2152     push @flags, 'explicit' if exists $need{$f};
2153     push @flags, 'depend'   if exists $depends{$f};
2154     push @flags, 'hint'     if exists $hints{$f};
2155     my $flags = @flags ? '  ['.join(', ', @flags).']' : '';
2156     print "$f$flags\n";
2157   }
2158   exit 0;
2159 }
2160
2161 my @files;
2162 my @srcext = qw( xs c h cc cpp );
2163 my $srcext = join '|', @srcext;
2164
2165 if (@ARGV) {
2166   my %seen;
2167   @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV;
2168 }
2169 else {
2170   eval {
2171     require File::Find;
2172     File::Find::find(sub {
2173       $File::Find::name =~ /\.($srcext)$/i
2174           and push @files, $File::Find::name;
2175     }, '.');
2176   };
2177   if ($@) {
2178     @files = map { glob "*.$_" } @srcext;
2179   }
2180 }
2181
2182 if (!@ARGV || $opt{filter}) {
2183   my(@in, @out);
2184   my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files;
2185   for (@files) {
2186     my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/\.($srcext)$/i;
2187     push @{ $out ? \@out : \@in }, $_;
2188   }
2189   if (@ARGV && @out) {
2190     warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out);
2191   }
2192   @files = @in;
2193 }
2194
2195 unless (@files) {
2196   die "No input files given!\n";
2197 }
2198
2199 my(%files, %global, %revreplace);
2200 %revreplace = reverse %replace;
2201 my $filename;
2202 my $patch_opened = 0;
2203
2204 for $filename (@files) {
2205   unless (open IN, "<$filename") {
2206     warn "Unable to read from $filename: $!\n";
2207     next;
2208   }
2209
2210   info("Scanning $filename ...");
2211
2212   my $c = do { local $/; <IN> };
2213   close IN;
2214
2215   my %file = (orig => $c, changes => 0);
2216
2217   # temporarily remove C comments from the code
2218   my @ccom;
2219   $c =~ s{
2220     (
2221         [^"'/]+
2222       |
2223         (?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+
2224       |
2225         (?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+
2226     )
2227   |
2228     (/ (?:
2229         \*[^*]*\*+(?:[^$ccs][^*]*\*+)* /
2230         |
2231         /[^\r\n]*
2232       ))
2233   }{
2234     defined $2 and push @ccom, $2;
2235     defined $1 ? $1 : "$ccs$#ccom$cce";
2236   }egsx;
2237
2238   $file{ccom} = \@ccom;
2239   $file{code} = $c;
2240   $file{has_inc_ppport} = ($c =~ /#.*include.*\Q$ppport\E/);
2241
2242   my $func;
2243
2244   for $func (keys %API) {
2245     my $match = $func;
2246     $match .= "|$revreplace{$func}" if exists $revreplace{$func};
2247     if ($c =~ /\b(?:Perl_)?($match)\b/) {
2248       $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func};
2249       $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/;
2250       if (exists $API{$func}{provided}) {
2251         if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) {
2252           $file{uses}{$func}++;
2253           my @deps = rec_depend($func);
2254           if (@deps) {
2255             $file{uses_deps}{$func} = \@deps;
2256             for (@deps) {
2257               $file{uses}{$_} = 0 unless exists $file{uses}{$_};
2258             }
2259           }
2260           for ($func, @deps) {
2261             if (exists $need{$_}) {
2262               $file{needs}{$_} = 'static';
2263             }
2264           }
2265         }
2266       }
2267       if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) {
2268         if ($c =~ /\b$func\b/) {
2269           $file{uses_todo}{$func}++;
2270         }
2271       }
2272     }
2273   }
2274
2275   while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) {
2276     if (exists $need{$2}) {
2277       $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++;
2278     }
2279     else {
2280       warning("Possibly wrong #define $1 in $filename");
2281     }
2282   }
2283
2284   for (qw(uses needs uses_todo needed_global needed_static)) {
2285     for $func (keys %{$file{$_}}) {
2286       push @{$global{$_}{$func}}, $filename;
2287     }
2288   }
2289
2290   $files{$filename} = \%file;
2291 }
2292
2293 # Globally resolve NEED_'s
2294 my $need;
2295 for $need (keys %{$global{needs}}) {
2296   if (@{$global{needs}{$need}} > 1) {
2297     my @targets = @{$global{needs}{$need}};
2298     my @t = grep $files{$_}{needed_global}{$need}, @targets;
2299     @targets = @t if @t;
2300     @t = grep /\.xs$/i, @targets;
2301     @targets = @t if @t;
2302     my $target = shift @targets;
2303     $files{$target}{needs}{$need} = 'global';
2304     for (@{$global{needs}{$need}}) {
2305       $files{$_}{needs}{$need} = 'extern' if $_ ne $target;
2306     }
2307   }
2308 }
2309
2310 for $filename (@files) {
2311   exists $files{$filename} or next;
2312
2313   info("=== Analyzing $filename ===");
2314
2315   my %file = %{$files{$filename}};
2316   my $func;
2317   my $c = $file{code};
2318
2319   for $func (sort keys %{$file{uses_Perl}}) {
2320     if ($API{$func}{varargs}) {
2321       my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))}
2322                             { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge);
2323       if ($changes) {
2324         warning("Doesn't pass interpreter argument aTHX to Perl_$func");
2325         $file{changes} += $changes;
2326       }
2327     }
2328     else {
2329       warning("Uses Perl_$func instead of $func");
2330       $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*}
2331                                 {$func$1(}g);
2332     }
2333   }
2334
2335   for $func (sort keys %{$file{uses_replace}}) {
2336     warning("Uses $func instead of $replace{$func}");
2337     $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
2338   }
2339
2340   for $func (sort keys %{$file{uses}}) {
2341     next unless $file{uses}{$func};   # if it's only a dependency
2342     if (exists $file{uses_deps}{$func}) {
2343       diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}}));
2344     }
2345     elsif (exists $replace{$func}) {
2346       warning("Uses $func instead of $replace{$func}");
2347       $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
2348     }
2349     else {
2350       diag("Uses $func");
2351     }
2352     hint($func);
2353   }
2354
2355   for $func (sort keys %{$file{uses_todo}}) {
2356     warning("Uses $func, which may not be portable below perl ",
2357             format_version($API{$func}{todo}));
2358   }
2359
2360   for $func (sort keys %{$file{needed_static}}) {
2361     my $message = '';
2362     if (not exists $file{uses}{$func}) {
2363       $message = "No need to define NEED_$func if $func is never used";
2364     }
2365     elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
2366       $message = "No need to define NEED_$func when already needed globally";
2367     }
2368     if ($message) {
2369       diag($message);
2370       $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
2371     }
2372   }
2373
2374   for $func (sort keys %{$file{needed_global}}) {
2375     my $message = '';
2376     if (not exists $global{uses}{$func}) {
2377       $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
2378     }
2379     elsif (exists $file{needs}{$func}) {
2380       if ($file{needs}{$func} eq 'extern') {
2381         $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
2382       }
2383       elsif ($file{needs}{$func} eq 'static') {
2384         $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
2385       }
2386     }
2387     if ($message) {
2388       diag($message);
2389       $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
2390     }
2391   }
2392
2393   $file{needs_inc_ppport} = keys %{$file{uses}};
2394
2395   if ($file{needs_inc_ppport}) {
2396     my $pp = '';
2397
2398     for $func (sort keys %{$file{needs}}) {
2399       my $type = $file{needs}{$func};
2400       next if $type eq 'extern';
2401       my $suffix = $type eq 'global' ? '_GLOBAL' : '';
2402       unless (exists $file{"needed_$type"}{$func}) {
2403         if ($type eq 'global') {
2404           diag("Files [@{$global{needs}{$func}}] need $func, adding global request");
2405         }
2406         else {
2407           diag("File needs $func, adding static request");
2408         }
2409         $pp .= "#define NEED_$func$suffix\n";
2410       }
2411     }
2412
2413     if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
2414       $pp = '';
2415       $file{changes}++;
2416     }
2417
2418     unless ($file{has_inc_ppport}) {
2419       diag("Needs to include '$ppport'");
2420       $pp .= qq(#include "$ppport"\n)
2421     }
2422
2423     if ($pp) {
2424       $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms)
2425                      || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m)
2426                      || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m)
2427                      || ($c =~ s/^/$pp/);
2428     }
2429   }
2430   else {
2431     if ($file{has_inc_ppport}) {
2432       diag("No need to include '$ppport'");
2433       $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m);
2434     }
2435   }
2436
2437   # put back in our C comments
2438   my $ix;
2439   my $cppc = 0;
2440   my @ccom = @{$file{ccom}};
2441   for $ix (0 .. $#ccom) {
2442     if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) {
2443       $cppc++;
2444       $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/;
2445     }
2446     else {
2447       $c =~ s/$rccs$ix$rcce/$ccom[$ix]/;
2448     }
2449   }
2450
2451   if ($cppc) {
2452     my $s = $cppc != 1 ? 's' : '';
2453     warning("Uses $cppc C++ style comment$s, which is not portable");
2454   }
2455
2456   if ($file{changes}) {
2457     if (exists $opt{copy}) {
2458       my $newfile = "$filename$opt{copy}";
2459       if (-e $newfile) {
2460         error("'$newfile' already exists, refusing to write copy of '$filename'");
2461       }
2462       else {
2463         local *F;
2464         if (open F, ">$newfile") {
2465           info("Writing copy of '$filename' with changes to '$newfile'");
2466           print F $c;
2467           close F;
2468         }
2469         else {
2470           error("Cannot open '$newfile' for writing: $!");
2471         }
2472       }
2473     }
2474     elsif (exists $opt{patch} || $opt{changes}) {
2475       if (exists $opt{patch}) {
2476         unless ($patch_opened) {
2477           if (open PATCH, ">$opt{patch}") {
2478             $patch_opened = 1;
2479           }
2480           else {
2481             error("Cannot open '$opt{patch}' for writing: $!");
2482             delete $opt{patch};
2483             $opt{changes} = 1;
2484             goto fallback;
2485           }
2486         }
2487         mydiff(\*PATCH, $filename, $c);
2488       }
2489       else {
2490 fallback:
2491         info("Suggested changes:");
2492         mydiff(\*STDOUT, $filename, $c);
2493       }
2494     }
2495     else {
2496       my $s = $file{changes} == 1 ? '' : 's';
2497       info("$file{changes} potentially required change$s detected");
2498     }
2499   }
2500   else {
2501     info("Looks good");
2502   }
2503 }
2504
2505 close PATCH if $patch_opened;
2506
2507 exit 0;
2508
2509
2510 sub mydiff
2511 {
2512   local *F = shift;
2513   my($file, $str) = @_;
2514   my $diff;
2515
2516   if (exists $opt{diff}) {
2517     $diff = run_diff($opt{diff}, $file, $str);
2518   }
2519
2520   if (!defined $diff and can_use('Text::Diff')) {
2521     $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' });
2522     $diff = <<HEADER . $diff;
2523 --- $file
2524 +++ $file.patched
2525 HEADER
2526   }
2527
2528   if (!defined $diff) {
2529     $diff = run_diff('diff -u', $file, $str);
2530   }
2531
2532   if (!defined $diff) {
2533     $diff = run_diff('diff', $file, $str);
2534   }
2535
2536   if (!defined $diff) {
2537     error("Cannot generate a diff. Please install Text::Diff or use --copy.");
2538     return;
2539   }
2540
2541   print F $diff;
2542
2543 }
2544
2545 sub run_diff
2546 {
2547   my($prog, $file, $str) = @_;
2548   my $tmp = 'dppptemp';
2549   my $suf = 'aaa';
2550   my $diff = '';
2551   local *F;
2552
2553   while (-e "$tmp.$suf") { $suf++ }
2554   $tmp = "$tmp.$suf";
2555
2556   if (open F, ">$tmp") {
2557     print F $str;
2558     close F;
2559
2560     if (open F, "$prog $file $tmp |") {
2561       while (<F>) {
2562         s/\Q$tmp\E/$file.patched/;
2563         $diff .= $_;
2564       }
2565       close F;
2566       unlink $tmp;
2567       return $diff;
2568     }
2569
2570     unlink $tmp;
2571   }
2572   else {
2573     error("Cannot open '$tmp' for writing: $!");
2574   }
2575
2576   return undef;
2577 }
2578
2579 sub can_use
2580 {
2581   eval "use @_;";
2582   return $@ eq '';
2583 }
2584
2585 sub rec_depend
2586 {
2587   my $func = shift;
2588   my %seen;
2589   return () unless exists $depends{$func};
2590   grep !$seen{$_}++, map { ($_, rec_depend($_)) } @{$depends{$func}};
2591 }
2592
2593 sub parse_version
2594 {
2595   my $ver = shift;
2596
2597   if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) {
2598     return ($1, $2, $3);
2599   }
2600   elsif ($ver !~ /^\d+\.[\d_]+$/) {
2601     die "cannot parse version '$ver'\n";
2602   }
2603
2604   $ver =~ s/_//g;
2605   $ver =~ s/$/000000/;
2606
2607   my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
2608
2609   $v = int $v;
2610   $s = int $s;
2611
2612   if ($r < 5 || ($r == 5 && $v < 6)) {
2613     if ($s % 10) {
2614       die "cannot parse version '$ver'\n";
2615     }
2616   }
2617
2618   return ($r, $v, $s);
2619 }
2620
2621 sub format_version
2622 {
2623   my $ver = shift;
2624
2625   $ver =~ s/$/000000/;
2626   my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
2627
2628   $v = int $v;
2629   $s = int $s;
2630
2631   if ($r < 5 || ($r == 5 && $v < 6)) {
2632     if ($s % 10) {
2633       die "invalid version '$ver'\n";
2634     }
2635     $s /= 10;
2636
2637     $ver = sprintf "%d.%03d", $r, $v;
2638     $s > 0 and $ver .= sprintf "_%02d", $s;
2639
2640     return $ver;
2641   }
2642
2643   return sprintf "%d.%d.%d", $r, $v, $s;
2644 }
2645
2646 sub info
2647 {
2648   $opt{quiet} and return;
2649   print @_, "\n";
2650 }
2651
2652 sub diag
2653 {
2654   $opt{quiet} and return;
2655   $opt{diag} and print @_, "\n";
2656 }
2657
2658 sub warning
2659 {
2660   $opt{quiet} and return;
2661   print "*** ", @_, "\n";
2662 }
2663
2664 sub error
2665 {
2666   print "*** ERROR: ", @_, "\n";
2667 }
2668
2669 my %given_hints;
2670 sub hint
2671 {
2672   $opt{quiet} and return;
2673   $opt{hints} or return;
2674   my $func = shift;
2675   exists $hints{$func} or return;
2676   $given_hints{$func}++ and return;
2677   my $hint = $hints{$func};
2678   $hint =~ s/^/   /mg;
2679   print "   --- hint for $func ---\n", $hint;
2680 }
2681
2682 sub usage
2683 {
2684   my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
2685   my %M = ( 'I' => '*' );
2686   $usage =~ s/^\s*perl\s+\S+/$^X $0/;
2687   $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
2688
2689   print <<ENDUSAGE;
2690
2691 Usage: $usage
2692
2693 See perldoc $0 for details.
2694
2695 ENDUSAGE
2696
2697   exit 2;
2698 }
2699
2700 sub strip
2701 {
2702   my $self = do { local(@ARGV,$/)=($0); <> };
2703   $self =~ s/^$HS+Do NOT edit.*?(?=^-)//ms;
2704   $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
2705 if (\@ARGV && \$ARGV[0] eq '--unstrip') {
2706   eval { require Devel::PPPort };
2707   \$@ and die "Cannot require Devel::PPPort, please install.\\n";
2708   Devel::PPPort::WriteFile(\$0);
2709   exit 0;
2710 }
2711 print <<END;
2712
2713 Sorry, but this is a stripped version of \$0.
2714
2715 To be able to use its original script and doc functionality,
2716 please try to regenerate this file using:
2717
2718   \$^X \$0 --unstrip
2719
2720 END
2721 /ms;
2722
2723   open OUT, ">$0" or die "cannot strip $0: $!\n";
2724   print OUT $self;
2725
2726   exit 0;
2727 }
2728
2729 __DATA__
2730 */
2731
2732 #ifndef _P_P_PORTABILITY_H_
2733 #define _P_P_PORTABILITY_H_
2734
2735 #ifndef DPPP_NAMESPACE
2736 #  define DPPP_NAMESPACE DPPP_
2737 #endif
2738
2739 #define DPPP_CAT2(x,y) CAT2(x,y)
2740 #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
2741
2742 #ifndef PERL_REVISION
2743 #  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
2744 #    define PERL_PATCHLEVEL_H_IMPLICIT
2745 #    include <patchlevel.h>
2746 #  endif
2747 #  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
2748 #    include <could_not_find_Perl_patchlevel.h>
2749 #  endif
2750 #  ifndef PERL_REVISION
2751 #    define PERL_REVISION       (5)
2752      /* Replace: 1 */
2753 #    define PERL_VERSION        PATCHLEVEL
2754 #    define PERL_SUBVERSION     SUBVERSION
2755      /* Replace PERL_PATCHLEVEL with PERL_VERSION */
2756      /* Replace: 0 */
2757 #  endif
2758 #endif
2759
2760 #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
2761
2762 /* It is very unlikely that anyone will try to use this with Perl 6
2763    (or greater), but who knows.
2764  */
2765 #if PERL_REVISION != 5
2766 #  error ppport.h only works with Perl version 5
2767 #endif /* PERL_REVISION != 5 */
2768
2769 #ifdef I_LIMITS
2770 #  include <limits.h>
2771 #endif
2772
2773 #ifndef PERL_UCHAR_MIN
2774 #  define PERL_UCHAR_MIN ((unsigned char)0)
2775 #endif
2776
2777 #ifndef PERL_UCHAR_MAX
2778 #  ifdef UCHAR_MAX
2779 #    define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
2780 #  else
2781 #    ifdef MAXUCHAR
2782 #      define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
2783 #    else
2784 #      define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
2785 #    endif
2786 #  endif
2787 #endif
2788
2789 #ifndef PERL_USHORT_MIN
2790 #  define PERL_USHORT_MIN ((unsigned short)0)
2791 #endif
2792
2793 #ifndef PERL_USHORT_MAX
2794 #  ifdef USHORT_MAX
2795 #    define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
2796 #  else
2797 #    ifdef MAXUSHORT
2798 #      define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
2799 #    else
2800 #      ifdef USHRT_MAX
2801 #        define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
2802 #      else
2803 #        define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
2804 #      endif
2805 #    endif
2806 #  endif
2807 #endif
2808
2809 #ifndef PERL_SHORT_MAX
2810 #  ifdef SHORT_MAX
2811 #    define PERL_SHORT_MAX ((short)SHORT_MAX)
2812 #  else
2813 #    ifdef MAXSHORT    /* Often used in <values.h> */
2814 #      define PERL_SHORT_MAX ((short)MAXSHORT)
2815 #    else
2816 #      ifdef SHRT_MAX
2817 #        define PERL_SHORT_MAX ((short)SHRT_MAX)
2818 #      else
2819 #        define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
2820 #      endif
2821 #    endif
2822 #  endif
2823 #endif
2824
2825 #ifndef PERL_SHORT_MIN
2826 #  ifdef SHORT_MIN
2827 #    define PERL_SHORT_MIN ((short)SHORT_MIN)
2828 #  else
2829 #    ifdef MINSHORT
2830 #      define PERL_SHORT_MIN ((short)MINSHORT)
2831 #    else
2832 #      ifdef SHRT_MIN
2833 #        define PERL_SHORT_MIN ((short)SHRT_MIN)
2834 #      else
2835 #        define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
2836 #      endif
2837 #    endif
2838 #  endif
2839 #endif
2840
2841 #ifndef PERL_UINT_MAX
2842 #  ifdef UINT_MAX
2843 #    define PERL_UINT_MAX ((unsigned int)UINT_MAX)
2844 #  else
2845 #    ifdef MAXUINT
2846 #      define PERL_UINT_MAX ((unsigned int)MAXUINT)
2847 #    else
2848 #      define PERL_UINT_MAX (~(unsigned int)0)
2849 #    endif
2850 #  endif
2851 #endif
2852
2853 #ifndef PERL_UINT_MIN
2854 #  define PERL_UINT_MIN ((unsigned int)0)
2855 #endif
2856
2857 #ifndef PERL_INT_MAX
2858 #  ifdef INT_MAX
2859 #    define PERL_INT_MAX ((int)INT_MAX)
2860 #  else
2861 #    ifdef MAXINT    /* Often used in <values.h> */
2862 #      define PERL_INT_MAX ((int)MAXINT)
2863 #    else
2864 #      define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
2865 #    endif
2866 #  endif
2867 #endif
2868
2869 #ifndef PERL_INT_MIN
2870 #  ifdef INT_MIN
2871 #    define PERL_INT_MIN ((int)INT_MIN)
2872 #  else
2873 #    ifdef MININT
2874 #      define PERL_INT_MIN ((int)MININT)
2875 #    else
2876 #      define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
2877 #    endif
2878 #  endif
2879 #endif
2880
2881 #ifndef PERL_ULONG_MAX
2882 #  ifdef ULONG_MAX
2883 #    define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
2884 #  else
2885 #    ifdef MAXULONG
2886 #      define PERL_ULONG_MAX ((unsigned long)MAXULONG)
2887 #    else
2888 #      define PERL_ULONG_MAX (~(unsigned long)0)
2889 #    endif
2890 #  endif
2891 #endif
2892
2893 #ifndef PERL_ULONG_MIN
2894 #  define PERL_ULONG_MIN ((unsigned long)0L)
2895 #endif
2896
2897 #ifndef PERL_LONG_MAX
2898 #  ifdef LONG_MAX
2899 #    define PERL_LONG_MAX ((long)LONG_MAX)
2900 #  else
2901 #    ifdef MAXLONG
2902 #      define PERL_LONG_MAX ((long)MAXLONG)
2903 #    else
2904 #      define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
2905 #    endif
2906 #  endif
2907 #endif
2908
2909 #ifndef PERL_LONG_MIN
2910 #  ifdef LONG_MIN
2911 #    define PERL_LONG_MIN ((long)LONG_MIN)
2912 #  else
2913 #    ifdef MINLONG
2914 #      define PERL_LONG_MIN ((long)MINLONG)
2915 #    else
2916 #      define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
2917 #    endif
2918 #  endif
2919 #endif
2920
2921 #if defined(HAS_QUAD) && (defined(convex) || defined(uts))
2922 #  ifndef PERL_UQUAD_MAX
2923 #    ifdef ULONGLONG_MAX
2924 #      define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX)
2925 #    else
2926 #      ifdef MAXULONGLONG
2927 #        define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG)
2928 #      else
2929 #        define PERL_UQUAD_MAX (~(unsigned long long)0)
2930 #      endif
2931 #    endif
2932 #  endif
2933
2934 #  ifndef PERL_UQUAD_MIN
2935 #    define PERL_UQUAD_MIN ((unsigned long long)0L)
2936 #  endif
2937
2938 #  ifndef PERL_QUAD_MAX
2939 #    ifdef LONGLONG_MAX
2940 #      define PERL_QUAD_MAX ((long long)LONGLONG_MAX)
2941 #    else
2942 #      ifdef MAXLONGLONG
2943 #        define PERL_QUAD_MAX ((long long)MAXLONGLONG)
2944 #      else
2945 #        define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1))
2946 #      endif
2947 #    endif
2948 #  endif
2949
2950 #  ifndef PERL_QUAD_MIN
2951 #    ifdef LONGLONG_MIN
2952 #      define PERL_QUAD_MIN ((long long)LONGLONG_MIN)
2953 #    else
2954 #      ifdef MINLONGLONG
2955 #        define PERL_QUAD_MIN ((long long)MINLONGLONG)
2956 #      else
2957 #        define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
2958 #      endif
2959 #    endif
2960 #  endif
2961 #endif
2962
2963 /* This is based on code from 5.003 perl.h */
2964 #ifdef HAS_QUAD
2965 #  ifdef cray
2966 #ifndef IVTYPE
2967 #  define IVTYPE                         int
2968 #endif
2969
2970 #ifndef IV_MIN
2971 #  define IV_MIN                         PERL_INT_MIN
2972 #endif
2973
2974 #ifndef IV_MAX
2975 #  define IV_MAX                         PERL_INT_MAX
2976 #endif
2977
2978 #ifndef UV_MIN
2979 #  define UV_MIN                         PERL_UINT_MIN
2980 #endif
2981
2982 #ifndef UV_MAX
2983 #  define UV_MAX                         PERL_UINT_MAX
2984 #endif
2985
2986 #    ifdef INTSIZE
2987 #ifndef IVSIZE
2988 #  define IVSIZE                         INTSIZE
2989 #endif
2990
2991 #    endif
2992 #  else
2993 #    if defined(convex) || defined(uts)
2994 #ifndef IVTYPE
2995 #  define IVTYPE                         long long
2996 #endif
2997
2998 #ifndef IV_MIN
2999 #  define IV_MIN                         PERL_QUAD_MIN
3000 #endif
3001
3002 #ifndef IV_MAX
3003 #  define IV_MAX                         PERL_QUAD_MAX
3004 #endif
3005
3006 #ifndef UV_MIN
3007 #  define UV_MIN                         PERL_UQUAD_MIN
3008 #endif
3009
3010 #ifndef UV_MAX
3011 #  define UV_MAX                         PERL_UQUAD_MAX
3012 #endif
3013
3014 #      ifdef LONGLONGSIZE
3015 #ifndef IVSIZE
3016 #  define IVSIZE                         LONGLONGSIZE
3017 #endif
3018
3019 #      endif
3020 #    else
3021 #ifndef IVTYPE
3022 #  define IVTYPE                         long
3023 #endif
3024
3025 #ifndef IV_MIN
3026 #  define IV_MIN                         PERL_LONG_MIN
3027 #endif
3028
3029 #ifndef IV_MAX
3030 #  define IV_MAX                         PERL_LONG_MAX
3031 #endif
3032
3033 #ifndef UV_MIN
3034 #  define UV_MIN                         PERL_ULONG_MIN
3035 #endif
3036
3037 #ifndef UV_MAX
3038 #  define UV_MAX                         PERL_ULONG_MAX
3039 #endif
3040
3041 #      ifdef LONGSIZE
3042 #ifndef IVSIZE
3043 #  define IVSIZE                         LONGSIZE
3044 #endif
3045
3046 #      endif
3047 #    endif
3048 #  endif
3049 #ifndef IVSIZE
3050 #  define IVSIZE                         8
3051 #endif
3052
3053 #ifndef PERL_QUAD_MIN
3054 #  define PERL_QUAD_MIN                  IV_MIN
3055 #endif
3056
3057 #ifndef PERL_QUAD_MAX
3058 #  define PERL_QUAD_MAX                  IV_MAX
3059 #endif
3060
3061 #ifndef PERL_UQUAD_MIN
3062 #  define PERL_UQUAD_MIN                 UV_MIN
3063 #endif
3064
3065 #ifndef PERL_UQUAD_MAX
3066 #  define PERL_UQUAD_MAX                 UV_MAX
3067 #endif
3068
3069 #else
3070 #ifndef IVTYPE
3071 #  define IVTYPE                         long
3072 #endif
3073
3074 #ifndef IV_MIN
3075 #  define IV_MIN                         PERL_LONG_MIN
3076 #endif
3077
3078 #ifndef IV_MAX
3079 #  define IV_MAX                         PERL_LONG_MAX
3080 #endif
3081
3082 #ifndef UV_MIN
3083 #  define UV_MIN                         PERL_ULONG_MIN
3084 #endif
3085
3086 #ifndef UV_MAX
3087 #  define UV_MAX                         PERL_ULONG_MAX
3088 #endif
3089
3090 #endif
3091
3092 #ifndef IVSIZE
3093 #  ifdef LONGSIZE
3094 #    define IVSIZE LONGSIZE
3095 #  else
3096 #    define IVSIZE 4 /* A bold guess, but the best we can make. */
3097 #  endif
3098 #endif
3099 #ifndef UVTYPE
3100 #  define UVTYPE                         unsigned IVTYPE
3101 #endif
3102
3103 #ifndef UVSIZE
3104 #  define UVSIZE                         IVSIZE
3105 #endif
3106 #ifndef sv_setuv
3107 #  define sv_setuv(sv, uv)               \
3108                STMT_START {                         \
3109                  UV TeMpUv = uv;                    \
3110                  if (TeMpUv <= IV_MAX)              \
3111                    sv_setiv(sv, TeMpUv);            \
3112                  else                               \
3113                    sv_setnv(sv, (double)TeMpUv);    \
3114                } STMT_END
3115 #endif
3116 #ifndef newSVuv
3117 #  define newSVuv(uv)                    ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
3118 #endif
3119 #ifndef sv_2uv
3120 #  define sv_2uv(sv)                     ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
3121 #endif
3122
3123 #ifndef SvUVX
3124 #  define SvUVX(sv)                      ((UV)SvIVX(sv))
3125 #endif
3126
3127 #ifndef SvUVXx
3128 #  define SvUVXx(sv)                     SvUVX(sv)
3129 #endif
3130
3131 #ifndef SvUV
3132 #  define SvUV(sv)                       (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
3133 #endif
3134
3135 #ifndef SvUVx
3136 #  define SvUVx(sv)                      ((PL_Sv = (sv)), SvUV(PL_Sv))
3137 #endif
3138
3139 /* Hint: sv_uv
3140  * Always use the SvUVx() macro instead of sv_uv().
3141  */
3142 #ifndef sv_uv
3143 #  define sv_uv(sv)                      SvUVx(sv)
3144 #endif
3145 #ifndef XST_mUV
3146 #  define XST_mUV(i,v)                   (ST(i) = sv_2mortal(newSVuv(v))  )
3147 #endif
3148
3149 #ifndef XSRETURN_UV
3150 #  define XSRETURN_UV(v)                 STMT_START { XST_mUV(0,v);  XSRETURN(1); } STMT_END
3151 #endif
3152 #ifndef PUSHu
3153 #  define PUSHu(u)                       STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG;  } STMT_END
3154 #endif
3155
3156 #ifndef XPUSHu
3157 #  define XPUSHu(u)                      STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
3158 #endif
3159
3160 #ifdef HAS_MEMCMP
3161 #ifndef memNE
3162 #  define memNE(s1,s2,l)                 (memcmp(s1,s2,l))
3163 #endif
3164
3165 #ifndef memEQ
3166 #  define memEQ(s1,s2,l)                 (!memcmp(s1,s2,l))
3167 #endif
3168
3169 #else
3170 #ifndef memNE
3171 #  define memNE(s1,s2,l)                 (bcmp(s1,s2,l))
3172 #endif
3173
3174 #ifndef memEQ
3175 #  define memEQ(s1,s2,l)                 (!bcmp(s1,s2,l))
3176 #endif
3177
3178 #endif
3179 #ifndef MoveD
3180 #  define MoveD(s,d,n,t)                 memmove((char*)(d),(char*)(s), (n) * sizeof(t))
3181 #endif
3182
3183 #ifndef CopyD
3184 #  define CopyD(s,d,n,t)                 memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
3185 #endif
3186
3187 #ifdef HAS_MEMSET
3188 #ifndef ZeroD
3189 #  define ZeroD(d,n,t)                   memzero((char*)(d), (n) * sizeof(t))
3190 #endif
3191
3192 #else
3193 #ifndef ZeroD
3194 #  define ZeroD(d,n,t)                   ((void)memzero((char*)(d), (n) * sizeof(t)), d)
3195 #endif
3196
3197 #endif
3198 #ifndef Poison
3199 #  define Poison(d,n,t)                  (void)memset((char*)(d), 0xAB, (n) * sizeof(t))
3200 #endif
3201 #ifndef Newx
3202 #  define Newx(v,n,t)                    New(0,v,n,t)
3203 #endif
3204
3205 #ifndef Newxc
3206 #  define Newxc(v,n,t,c)                 Newc(0,v,n,t,c)
3207 #endif
3208
3209 #ifndef Newxz
3210 #  define Newxz(v,n,t)                   Newz(0,v,n,t)
3211 #endif
3212
3213 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
3214 /* Replace: 1 */
3215 #  define PL_DBsingle               DBsingle
3216 #  define PL_DBsub                  DBsub
3217 #  define PL_Sv                     Sv
3218 #  define PL_compiling              compiling
3219 #  define PL_copline                copline
3220 #  define PL_curcop                 curcop
3221 #  define PL_curstash               curstash
3222 #  define PL_debstash               debstash
3223 #  define PL_defgv                  defgv
3224 #  define PL_diehook                diehook
3225 #  define PL_dirty                  dirty
3226 #  define PL_dowarn                 dowarn
3227 #  define PL_errgv                  errgv
3228 #  define PL_hexdigit               hexdigit
3229 #  define PL_hints                  hints
3230 #  define PL_na                     na
3231 #  define PL_no_modify              no_modify
3232 #  define PL_perl_destruct_level    perl_destruct_level
3233 #  define PL_perldb                 perldb
3234 #  define PL_ppaddr                 ppaddr
3235 #  define PL_rsfp_filters           rsfp_filters
3236 #  define PL_rsfp                   rsfp
3237 #  define PL_stack_base             stack_base
3238 #  define PL_stack_sp               stack_sp
3239 #  define PL_stdingv                stdingv
3240 #  define PL_sv_arenaroot           sv_arenaroot
3241 #  define PL_sv_no                  sv_no
3242 #  define PL_sv_undef               sv_undef
3243 #  define PL_sv_yes                 sv_yes
3244 #  define PL_tainted                tainted
3245 #  define PL_tainting               tainting
3246 /* Replace: 0 */
3247 #endif
3248
3249 #ifndef PERL_UNUSED_DECL
3250 #  ifdef HASATTRIBUTE
3251 #    if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
3252 #      define PERL_UNUSED_DECL
3253 #    else
3254 #      define PERL_UNUSED_DECL __attribute__((unused))
3255 #    endif
3256 #  else
3257 #    define PERL_UNUSED_DECL
3258 #  endif
3259 #endif
3260 #ifndef NOOP
3261 #  define NOOP                           (void)0
3262 #endif
3263
3264 #ifndef dNOOP
3265 #  define dNOOP                          extern int Perl___notused PERL_UNUSED_DECL
3266 #endif
3267
3268 #ifndef NVTYPE
3269 #  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
3270 #    define NVTYPE long double
3271 #  else
3272 #    define NVTYPE double
3273 #  endif
3274 typedef NVTYPE NV;
3275 #endif
3276
3277 #ifndef INT2PTR
3278
3279 #  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
3280 #    define PTRV                  UV
3281 #    define INT2PTR(any,d)        (any)(d)
3282 #  else
3283 #    if PTRSIZE == LONGSIZE
3284 #      define PTRV                unsigned long
3285 #    else
3286 #      define PTRV                unsigned
3287 #    endif
3288 #    define INT2PTR(any,d)        (any)(PTRV)(d)
3289 #  endif
3290
3291 #  define NUM2PTR(any,d)  (any)(PTRV)(d)
3292 #  define PTR2IV(p)       INT2PTR(IV,p)
3293 #  define PTR2UV(p)       INT2PTR(UV,p)
3294 #  define PTR2NV(p)       NUM2PTR(NV,p)
3295
3296 #  if PTRSIZE == LONGSIZE
3297 #    define PTR2ul(p)     (unsigned long)(p)
3298 #  else
3299 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
3300 #  endif
3301
3302 #endif /* !INT2PTR */
3303
3304 #undef START_EXTERN_C
3305 #undef END_EXTERN_C
3306 #undef EXTERN_C
3307 #ifdef __cplusplus
3308 #  define START_EXTERN_C extern "C" {
3309 #  define END_EXTERN_C }
3310 #  define EXTERN_C extern "C"
3311 #else
3312 #  define START_EXTERN_C
3313 #  define END_EXTERN_C
3314 #  define EXTERN_C extern
3315 #endif
3316
3317 #ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
3318 #  if defined(__STRICT_ANSI__) && defined(PERL_GCC_PEDANTIC)
3319 #    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
3320 #  endif
3321 #endif
3322
3323 #undef STMT_START
3324 #undef STMT_END
3325 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
3326 #  define STMT_START    (void)( /* gcc supports ``({ STATEMENTS; })'' */
3327 #  define STMT_END      )
3328 #else
3329 #  if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
3330 #    define STMT_START  if (1)
3331 #    define STMT_END    else (void)0
3332 #  else
3333 #    define STMT_START  do
3334 #    define STMT_END    while (0)
3335 #  endif
3336 #endif
3337 #ifndef boolSV
3338 #  define boolSV(b)                      ((b) ? &PL_sv_yes : &PL_sv_no)
3339 #endif
3340
3341 /* DEFSV appears first in 5.004_56 */
3342 #ifndef DEFSV
3343 #  define DEFSV                          GvSV(PL_defgv)
3344 #endif
3345
3346 #ifndef SAVE_DEFSV
3347 #  define SAVE_DEFSV                     SAVESPTR(GvSV(PL_defgv))
3348 #endif
3349
3350 /* Older perls (<=5.003) lack AvFILLp */
3351 #ifndef AvFILLp
3352 #  define AvFILLp                        AvFILL
3353 #endif
3354 #ifndef ERRSV
3355 #  define ERRSV                          get_sv("@",FALSE)
3356 #endif
3357 #ifndef newSVpvn
3358 #  define newSVpvn(data,len)             ((data)                                              \
3359                                     ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \
3360                                     : newSV(0))
3361 #endif
3362
3363 /* Hint: gv_stashpvn
3364  * This function's backport doesn't support the length parameter, but
3365  * rather ignores it. Portability can only be ensured if the length
3366  * parameter is used for speed reasons, but the length can always be
3367  * correctly computed from the string argument.
3368  */
3369 #ifndef gv_stashpvn
3370 #  define gv_stashpvn(str,len,create)    gv_stashpv(str,create)
3371 #endif
3372
3373 /* Replace: 1 */
3374 #ifndef get_cv
3375 #  define get_cv                         perl_get_cv
3376 #endif
3377
3378 #ifndef get_sv
3379 #  define get_sv                         perl_get_sv
3380 #endif
3381
3382 #ifndef get_av
3383 #  define get_av                         perl_get_av
3384 #endif
3385
3386 #ifndef get_hv
3387 #  define get_hv                         perl_get_hv
3388 #endif
3389
3390 /* Replace: 0 */
3391 #ifndef dUNDERBAR
3392 #  define dUNDERBAR                      dNOOP
3393 #endif
3394
3395 #ifndef UNDERBAR
3396 #  define UNDERBAR                       DEFSV
3397 #endif
3398 #ifndef dAX
3399 #  define dAX                            I32 ax = MARK - PL_stack_base + 1
3400 #endif
3401
3402 #ifndef dITEMS
3403 #  define dITEMS                         I32 items = SP - MARK
3404 #endif
3405 #ifndef dXSTARG
3406 #  define dXSTARG                        SV * targ = sv_newmortal()
3407 #endif
3408 #ifndef dAXMARK
3409 #  define dAXMARK                        I32 ax = POPMARK; \
3410                                register SV ** const mark = PL_stack_base + ax++
3411 #endif
3412 #ifndef XSprePUSH
3413 #  define XSprePUSH                      (sp = PL_stack_base + ax - 1)
3414 #endif
3415
3416 #if ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 0)))
3417 #  undef XSRETURN
3418 #  define XSRETURN(off)                                   \
3419       STMT_START {                                        \
3420           PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
3421           return;                                         \
3422       } STMT_END
3423 #endif
3424
3425 #ifndef PERL_SIGNALS_UNSAFE_FLAG
3426
3427 #define PERL_SIGNALS_UNSAFE_FLAG 0x0001
3428
3429 #if defined(NEED_PL_signals)
3430 static U32 DPPP_(my_PL_signals) = PERL_SIGNALS_UNSAFE_FLAG;
3431 #elif defined(NEED_PL_signals_GLOBAL)
3432 U32 DPPP_(my_PL_signals) = PERL_SIGNALS_UNSAFE_FLAG;
3433 #else
3434 extern U32 DPPP_(my_PL_signals);
3435 #endif
3436 #define PL_signals DPPP_(my_PL_signals)
3437
3438 #endif
3439 #ifndef dTHR
3440 #  define dTHR                           dNOOP
3441 #endif
3442 #ifndef dTHX
3443 #  define dTHX                           dNOOP
3444 #endif
3445
3446 #ifndef dTHXa
3447 #  define dTHXa(x)                       dNOOP
3448 #endif
3449 #ifndef pTHX
3450 #  define pTHX                           void
3451 #endif
3452
3453 #ifndef pTHX_
3454 #  define pTHX_
3455 #endif
3456
3457 #ifndef aTHX
3458 #  define aTHX
3459 #endif
3460
3461 #ifndef aTHX_
3462 #  define aTHX_
3463 #endif
3464 #ifndef dTHXoa
3465 #  define dTHXoa(x)                      dTHXa(x)
3466 #endif
3467 #ifndef PUSHmortal
3468 #  define PUSHmortal                     PUSHs(sv_newmortal())
3469 #endif
3470
3471 #ifndef mPUSHp
3472 #  define mPUSHp(p,l)                    sv_setpvn_mg(PUSHmortal, (p), (l))
3473 #endif
3474
3475 #ifndef mPUSHn
3476 #  define mPUSHn(n)                      sv_setnv_mg(PUSHmortal, (NV)(n))
3477 #endif
3478
3479 #ifndef mPUSHi
3480 #  define mPUSHi(i)                      sv_setiv_mg(PUSHmortal, (IV)(i))
3481 #endif
3482
3483 #ifndef mPUSHu
3484 #  define mPUSHu(u)                      sv_setuv_mg(PUSHmortal, (UV)(u))
3485 #endif
3486 #ifndef XPUSHmortal
3487 #  define XPUSHmortal                    XPUSHs(sv_newmortal())
3488 #endif
3489
3490 #ifndef mXPUSHp
3491 #  define mXPUSHp(p,l)                   STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
3492 #endif
3493
3494 #ifndef mXPUSHn
3495 #  define mXPUSHn(n)                     STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END
3496 #endif
3497
3498 #ifndef mXPUSHi
3499 #  define mXPUSHi(i)                     STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END
3500 #endif
3501
3502 #ifndef mXPUSHu
3503 #  define mXPUSHu(u)                     STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END
3504 #endif
3505
3506 /* Replace: 1 */
3507 #ifndef call_sv
3508 #  define call_sv                        perl_call_sv
3509 #endif
3510
3511 #ifndef call_pv
3512 #  define call_pv                        perl_call_pv
3513 #endif
3514
3515 #ifndef call_argv
3516 #  define call_argv                      perl_call_argv
3517 #endif
3518
3519 #ifndef call_method
3520 #  define call_method                    perl_call_method
3521 #endif
3522 #ifndef eval_sv
3523 #  define eval_sv                        perl_eval_sv
3524 #endif
3525
3526 /* Replace: 0 */
3527
3528 /* Replace perl_eval_pv with eval_pv */
3529 /* eval_pv depends on eval_sv */
3530
3531 #ifndef eval_pv
3532 #if defined(NEED_eval_pv)
3533 static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
3534 static
3535 #else
3536 extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
3537 #endif
3538
3539 #ifdef eval_pv
3540 #  undef eval_pv
3541 #endif
3542 #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
3543 #define Perl_eval_pv DPPP_(my_eval_pv)
3544
3545 #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
3546
3547 SV*
3548 DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
3549 {
3550     dSP;
3551     SV* sv = newSVpv(p, 0);
3552
3553     PUSHMARK(sp);
3554     eval_sv(sv, G_SCALAR);
3555     SvREFCNT_dec(sv);
3556
3557     SPAGAIN;
3558     sv = POPs;
3559     PUTBACK;
3560
3561     if (croak_on_error && SvTRUE(GvSV(errgv)))
3562         croak(SvPVx(GvSV(errgv), na));
3563
3564     return sv;
3565 }
3566
3567 #endif
3568 #endif
3569 #ifndef newRV_inc
3570 #  define newRV_inc(sv)                  newRV(sv)   /* Replace */
3571 #endif
3572
3573 #ifndef newRV_noinc
3574 #if defined(NEED_newRV_noinc)
3575 static SV * DPPP_(my_newRV_noinc)(SV *sv);
3576 static
3577 #else
3578 extern SV * DPPP_(my_newRV_noinc)(SV *sv);
3579 #endif
3580
3581 #ifdef newRV_noinc
3582 #  undef newRV_noinc
3583 #endif
3584 #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a)
3585 #define Perl_newRV_noinc DPPP_(my_newRV_noinc)
3586
3587 #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
3588 SV *
3589 DPPP_(my_newRV_noinc)(SV *sv)
3590 {
3591   SV *rv = (SV *)newRV(sv);
3592   SvREFCNT_dec(sv);
3593   return rv;
3594 }
3595 #endif
3596 #endif
3597
3598 /* Hint: newCONSTSUB
3599  * Returns a CV* as of perl-5.7.1. This return value is not supported
3600  * by Devel::PPPort.
3601  */
3602
3603 /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
3604 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))) && ((PERL_VERSION != 4) || (PERL_SUBVERSION != 5))
3605 #if defined(NEED_newCONSTSUB)
3606 static void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv);
3607 static
3608 #else
3609 extern void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv);
3610 #endif
3611
3612 #ifdef newCONSTSUB
3613 #  undef newCONSTSUB
3614 #endif
3615 #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c)
3616 #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB)
3617
3618 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
3619
3620 void
3621 DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv)
3622 {
3623         U32 oldhints = PL_hints;
3624         HV *old_cop_stash = PL_curcop->cop_stash;
3625         HV *old_curstash = PL_curstash;
3626         line_t oldline = PL_curcop->cop_line;
3627         PL_curcop->cop_line = PL_copline;
3628
3629         PL_hints &= ~HINT_BLOCK_SCOPE;
3630         if (stash)
3631                 PL_curstash = PL_curcop->cop_stash = stash;
3632
3633         newSUB(
3634
3635 #if   ((PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22)))
3636                 start_subparse(),
3637 #elif ((PERL_VERSION == 3) && (PERL_SUBVERSION == 22))
3638                 start_subparse(0),
3639 #else  /* 5.003_23  onwards */
3640                 start_subparse(FALSE, 0),
3641 #endif
3642
3643                 newSVOP(OP_CONST, 0, newSVpv(name,0)),
3644                 newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
3645                 newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
3646         );
3647
3648         PL_hints = oldhints;
3649         PL_curcop->cop_stash = old_cop_stash;
3650         PL_curstash = old_curstash;
3651         PL_curcop->cop_line = oldline;
3652 }
3653 #endif
3654 #endif
3655
3656 /*
3657  * Boilerplate macros for initializing and accessing interpreter-local
3658  * data from C.  All statics in extensions should be reworked to use
3659  * this, if you want to make the extension thread-safe.  See ext/re/re.xs
3660  * for an example of the use of these macros.
3661  *
3662  * Code that uses these macros is responsible for the following:
3663  * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
3664  * 2. Declare a typedef named my_cxt_t that is a structure that contains
3665  *    all the data that needs to be interpreter-local.
3666  * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
3667  * 4. Use the MY_CXT_INIT macro such that it is called exactly once
3668  *    (typically put in the BOOT: section).
3669  * 5. Use the members of the my_cxt_t structure everywhere as
3670  *    MY_CXT.member.
3671  * 6. Use the dMY_CXT macro (a declaration) in all the functions that
3672  *    access MY_CXT.
3673  */
3674
3675 #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
3676     defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)
3677
3678 #ifndef START_MY_CXT
3679
3680 /* This must appear in all extensions that define a my_cxt_t structure,
3681  * right after the definition (i.e. at file scope).  The non-threads
3682  * case below uses it to declare the data as static. */
3683 #define START_MY_CXT
3684
3685 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 68)))
3686 /* Fetches the SV that keeps the per-interpreter data. */
3687 #define dMY_CXT_SV \
3688         SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
3689 #else /* >= perl5.004_68 */
3690 #define dMY_CXT_SV \
3691         SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,             \
3692                                   sizeof(MY_CXT_KEY)-1, TRUE)
3693 #endif /* < perl5.004_68 */
3694
3695 /* This declaration should be used within all functions that use the
3696  * interpreter-local data. */
3697 #define dMY_CXT \
3698         dMY_CXT_SV;                                                     \
3699         my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
3700
3701 /* Creates and zeroes the per-interpreter data.
3702  * (We allocate my_cxtp in a Perl SV so that it will be released when
3703  * the interpreter goes away.) */
3704 #define MY_CXT_INIT \
3705         dMY_CXT_SV;                                                     \
3706         /* newSV() allocates one more than needed */                    \
3707         my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
3708         Zero(my_cxtp, 1, my_cxt_t);                                     \
3709         sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
3710
3711 /* This macro must be used to access members of the my_cxt_t structure.
3712  * e.g. MYCXT.some_data */
3713 #define MY_CXT          (*my_cxtp)
3714
3715 /* Judicious use of these macros can reduce the number of times dMY_CXT
3716  * is used.  Use is similar to pTHX, aTHX etc. */
3717 #define pMY_CXT         my_cxt_t *my_cxtp
3718 #define pMY_CXT_        pMY_CXT,
3719 #define _pMY_CXT        ,pMY_CXT
3720 #define aMY_CXT         my_cxtp
3721 #define aMY_CXT_        aMY_CXT,
3722 #define _aMY_CXT        ,aMY_CXT
3723
3724 #endif /* START_MY_CXT */
3725
3726 #ifndef MY_CXT_CLONE
3727 /* Clones the per-interpreter data. */
3728 #define MY_CXT_CLONE \
3729         dMY_CXT_SV;                                                     \
3730         my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
3731         Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
3732         sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
3733 #endif
3734
3735 #else /* single interpreter */
3736
3737 #ifndef START_MY_CXT
3738
3739 #define START_MY_CXT    static my_cxt_t my_cxt;
3740 #define dMY_CXT_SV      dNOOP
3741 #define dMY_CXT         dNOOP
3742 #define MY_CXT_INIT     NOOP
3743 #define MY_CXT          my_cxt
3744
3745 #define pMY_CXT         void
3746 #define pMY_CXT_
3747 #define _pMY_CXT
3748 #define aMY_CXT
3749 #define aMY_CXT_
3750 #define _aMY_CXT
3751
3752 #endif /* START_MY_CXT */
3753
3754 #ifndef MY_CXT_CLONE
3755 #define MY_CXT_CLONE    NOOP
3756 #endif
3757
3758 #endif
3759
3760 #ifndef IVdf
3761 #  if IVSIZE == LONGSIZE
3762 #    define     IVdf      "ld"
3763 #    define     UVuf      "lu"
3764 #    define     UVof      "lo"
3765 #    define     UVxf      "lx"
3766 #    define     UVXf      "lX"
3767 #  else
3768 #    if IVSIZE == INTSIZE
3769 #      define   IVdf      "d"
3770 #      define   UVuf      "u"
3771 #      define   UVof      "o"
3772 #      define   UVxf      "x"
3773 #      define   UVXf      "X"
3774 #    endif
3775 #  endif
3776 #endif
3777
3778 #ifndef NVef
3779 #  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
3780       defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */
3781 #    define NVef          PERL_PRIeldbl
3782 #    define NVff          PERL_PRIfldbl
3783 #    define NVgf          PERL_PRIgldbl
3784 #  else
3785 #    define NVef          "e"
3786 #    define NVff          "f"
3787 #    define NVgf          "g"
3788 #  endif
3789 #endif
3790
3791 #ifndef SvPV_nolen
3792
3793 #if defined(NEED_sv_2pv_nolen)
3794 static char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv);
3795 static
3796 #else
3797 extern char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv);
3798 #endif
3799
3800 #ifdef sv_2pv_nolen
3801 #  undef sv_2pv_nolen
3802 #endif
3803 #define sv_2pv_nolen(a) DPPP_(my_sv_2pv_nolen)(aTHX_ a)
3804 #define Perl_sv_2pv_nolen DPPP_(my_sv_2pv_nolen)
3805
3806 #if defined(NEED_sv_2pv_nolen) || defined(NEED_sv_2pv_nolen_GLOBAL)
3807
3808 char *
3809 DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv)
3810 {
3811   STRLEN n_a;
3812   return sv_2pv(sv, &n_a);
3813 }
3814
3815 #endif
3816
3817 /* Hint: sv_2pv_nolen
3818  * Use the SvPV_nolen() macro instead of sv_2pv_nolen().
3819  */
3820
3821 /* SvPV_nolen depends on sv_2pv_nolen */
3822 #define SvPV_nolen(sv) \
3823           ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
3824            ? SvPVX(sv) : sv_2pv_nolen(sv))
3825
3826 #endif
3827
3828 #ifdef SvPVbyte
3829
3830 /* Hint: SvPVbyte
3831  * Does not work in perl-5.6.1, ppport.h implements a version
3832  * borrowed from perl-5.7.3.
3833  */
3834
3835 #if ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 0)))
3836
3837 #if defined(NEED_sv_2pvbyte)
3838 static char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp);
3839 static
3840 #else
3841 extern char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp);
3842 #endif
3843
3844 #ifdef sv_2pvbyte
3845 #  undef sv_2pvbyte
3846 #endif
3847 #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b)
3848 #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte)
3849
3850 #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
3851
3852 char *
3853 DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp)
3854 {
3855   sv_utf8_downgrade(sv,0);
3856   return SvPV(sv,*lp);
3857 }
3858
3859 #endif
3860
3861 /* Hint: sv_2pvbyte
3862  * Use the SvPVbyte() macro instead of sv_2pvbyte().
3863  */
3864
3865 #undef SvPVbyte
3866
3867 /* SvPVbyte depends on sv_2pvbyte */
3868 #define SvPVbyte(sv, lp)                                                \
3869         ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK)                \
3870          ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp))
3871
3872 #endif
3873
3874 #else
3875
3876 #  define SvPVbyte          SvPV
3877 #  define sv_2pvbyte        sv_2pv
3878
3879 #endif
3880
3881 /* sv_2pvbyte_nolen depends on sv_2pv_nolen */
3882 #ifndef sv_2pvbyte_nolen
3883 #  define sv_2pvbyte_nolen               sv_2pv_nolen
3884 #endif
3885
3886 /* Hint: sv_pvn
3887  * Always use the SvPV() macro instead of sv_pvn().
3888  */
3889 #ifndef sv_pvn
3890 #  define sv_pvn(sv, len)                SvPV(sv, len)
3891 #endif
3892
3893 /* Hint: sv_pvn_force
3894  * Always use the SvPV_force() macro instead of sv_pvn_force().
3895  */
3896 #ifndef sv_pvn_force
3897 #  define sv_pvn_force(sv, len)          SvPV_force(sv, len)
3898 #endif
3899 #ifndef SvMAGIC_set
3900 #  define SvMAGIC_set(sv, val)           \
3901                 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
3902                 (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END
3903 #endif
3904
3905 #if ((PERL_VERSION < 9) || ((PERL_VERSION == 9) && (PERL_SUBVERSION < 3)))
3906 #ifndef SvPVX_const
3907 #  define SvPVX_const(sv)                ((const char*) (0 + SvPVX(sv)))
3908 #endif
3909
3910 #ifndef SvPVX_mutable
3911 #  define SvPVX_mutable(sv)              (0 + SvPVX(sv))
3912 #endif
3913 #ifndef SvRV_set
3914 #  define SvRV_set(sv, val)              \
3915                 STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
3916                 (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END
3917 #endif
3918
3919 #else
3920 #ifndef SvPVX_const
3921 #  define SvPVX_const(sv)                ((const char*)((sv)->sv_u.svu_pv))
3922 #endif
3923
3924 #ifndef SvPVX_mutable
3925 #  define SvPVX_mutable(sv)              ((sv)->sv_u.svu_pv)
3926 #endif
3927 #ifndef SvRV_set
3928 #  define SvRV_set(sv, val)              \
3929                 STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
3930                 ((sv)->sv_u.svu_rv = (val)); } STMT_END
3931 #endif
3932
3933 #endif
3934 #ifndef SvSTASH_set
3935 #  define SvSTASH_set(sv, val)           \
3936                 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
3937                 (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END
3938 #endif
3939
3940 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 0)))
3941 #ifndef SvUV_set
3942 #  define SvUV_set(sv, val)              \
3943                 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
3944                 (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END
3945 #endif
3946
3947 #else
3948 #ifndef SvUV_set
3949 #  define SvUV_set(sv, val)              \
3950                 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
3951                 (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END
3952 #endif
3953
3954 #endif
3955
3956 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(vnewSVpvf)
3957 #if defined(NEED_vnewSVpvf)
3958 static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
3959 static
3960 #else
3961 extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
3962 #endif
3963
3964 #ifdef vnewSVpvf
3965 #  undef vnewSVpvf
3966 #endif
3967 #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b)
3968 #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf)
3969
3970 #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
3971
3972 SV *
3973 DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args)
3974 {
3975   register SV *sv = newSV(0);
3976   sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
3977   return sv;
3978 }
3979
3980 #endif
3981 #endif
3982
3983 /* sv_vcatpvf depends on sv_vcatpvfn */
3984 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf)
3985 #  define sv_vcatpvf(sv, pat, args)  sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
3986 #endif
3987
3988 /* sv_vsetpvf depends on sv_vsetpvfn */
3989 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf)
3990 #  define sv_vsetpvf(sv, pat, args)  sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
3991 #endif
3992
3993 /* sv_catpvf_mg depends on sv_vcatpvfn, sv_catpvf_mg_nocontext */
3994 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg)
3995 #if defined(NEED_sv_catpvf_mg)
3996 static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
3997 static
3998 #else
3999 extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
4000 #endif
4001
4002 #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
4003
4004 #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
4005
4006 void
4007 DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
4008 {
4009   va_list args;
4010   va_start(args, pat);
4011   sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
4012   SvSETMAGIC(sv);
4013   va_end(args);
4014 }
4015
4016 #endif
4017 #endif
4018
4019 /* sv_catpvf_mg_nocontext depends on sv_vcatpvfn */
4020 #ifdef PERL_IMPLICIT_CONTEXT
4021 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg_nocontext)
4022 #if defined(NEED_sv_catpvf_mg_nocontext)
4023 static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4024 static
4025 #else
4026 extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4027 #endif
4028
4029 #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
4030 #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
4031
4032 #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
4033
4034 void
4035 DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...)
4036 {
4037   dTHX;
4038   va_list args;
4039   va_start(args, pat);
4040   sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
4041   SvSETMAGIC(sv);
4042   va_end(args);
4043 }
4044
4045 #endif
4046 #endif
4047 #endif
4048
4049 #ifndef sv_catpvf_mg
4050 #  ifdef PERL_IMPLICIT_CONTEXT
4051 #    define sv_catpvf_mg   Perl_sv_catpvf_mg_nocontext
4052 #  else
4053 #    define sv_catpvf_mg   Perl_sv_catpvf_mg
4054 #  endif
4055 #endif
4056
4057 /* sv_vcatpvf_mg depends on sv_vcatpvfn */
4058 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf_mg)
4059 #  define sv_vcatpvf_mg(sv, pat, args)                                     \
4060    STMT_START {                                                            \
4061      sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
4062      SvSETMAGIC(sv);                                                       \
4063    } STMT_END
4064 #endif
4065
4066 /* sv_setpvf_mg depends on sv_vsetpvfn, sv_setpvf_mg_nocontext */
4067 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg)
4068 #if defined(NEED_sv_setpvf_mg)
4069 static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
4070 static
4071 #else
4072 extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
4073 #endif
4074
4075 #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
4076
4077 #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
4078
4079 void
4080 DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
4081 {
4082   va_list args;
4083   va_start(args, pat);
4084   sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
4085   SvSETMAGIC(sv);
4086   va_end(args);
4087 }
4088
4089 #endif
4090 #endif
4091
4092 /* sv_setpvf_mg_nocontext depends on sv_vsetpvfn */
4093 #ifdef PERL_IMPLICIT_CONTEXT
4094 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg_nocontext)
4095 #if defined(NEED_sv_setpvf_mg_nocontext)
4096 static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4097 static
4098 #else
4099 extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4100 #endif
4101
4102 #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
4103 #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
4104
4105 #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
4106
4107 void
4108 DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...)
4109 {
4110   dTHX;
4111   va_list args;
4112   va_start(args, pat);
4113   sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
4114   SvSETMAGIC(sv);
4115   va_end(args);
4116 }
4117
4118 #endif
4119 #endif
4120 #endif
4121
4122 #ifndef sv_setpvf_mg
4123 #  ifdef PERL_IMPLICIT_CONTEXT
4124 #    define sv_setpvf_mg   Perl_sv_setpvf_mg_nocontext
4125 #  else
4126 #    define sv_setpvf_mg   Perl_sv_setpvf_mg
4127 #  endif
4128 #endif
4129
4130 /* sv_vsetpvf_mg depends on sv_vsetpvfn */
4131 #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf_mg)
4132 #  define sv_vsetpvf_mg(sv, pat, args)                                     \
4133    STMT_START {                                                            \
4134      sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
4135      SvSETMAGIC(sv);                                                       \
4136    } STMT_END
4137 #endif
4138 #ifndef SvGETMAGIC
4139 #  define SvGETMAGIC(x)                  STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
4140 #endif
4141 #ifndef PERL_MAGIC_sv
4142 #  define PERL_MAGIC_sv                  '\0'
4143 #endif
4144
4145 #ifndef PERL_MAGIC_overload
4146 #  define PERL_MAGIC_overload            'A'
4147 #endif
4148
4149 #ifndef PERL_MAGIC_overload_elem
4150 #  define PERL_MAGIC_overload_elem       'a'
4151 #endif
4152
4153 #ifndef PERL_MAGIC_overload_table
4154 #  define PERL_MAGIC_overload_table      'c'
4155 #endif
4156
4157 #ifndef PERL_MAGIC_bm
4158 #  define PERL_MAGIC_bm                  'B'
4159 #endif
4160
4161 #ifndef PERL_MAGIC_regdata
4162 #  define PERL_MAGIC_regdata             'D'
4163 #endif
4164
4165 #ifndef PERL_MAGIC_regdatum
4166 #  define PERL_MAGIC_regdatum            'd'
4167 #endif
4168
4169 #ifndef PERL_MAGIC_env
4170 #  define PERL_MAGIC_env                 'E'
4171 #endif
4172
4173 #ifndef PERL_MAGIC_envelem
4174 #  define PERL_MAGIC_envelem             'e'
4175 #endif
4176
4177 #ifndef PERL_MAGIC_fm
4178 #  define PERL_MAGIC_fm                  'f'
4179 #endif
4180
4181 #ifndef PERL_MAGIC_regex_global
4182 #  define PERL_MAGIC_regex_global        'g'
4183 #endif
4184
4185 #ifndef PERL_MAGIC_isa
4186 #  define PERL_MAGIC_isa                 'I'
4187 #endif
4188
4189 #ifndef PERL_MAGIC_isaelem
4190 #  define PERL_MAGIC_isaelem             'i'
4191 #endif
4192
4193 #ifndef PERL_MAGIC_nkeys
4194 #  define PERL_MAGIC_nkeys               'k'
4195 #endif
4196
4197 #ifndef PERL_MAGIC_dbfile
4198 #  define PERL_MAGIC_dbfile              'L'
4199 #endif
4200
4201 #ifndef PERL_MAGIC_dbline
4202 #  define PERL_MAGIC_dbline              'l'
4203 #endif
4204
4205 #ifndef PERL_MAGIC_mutex
4206 #  define PERL_MAGIC_mutex               'm'
4207 #endif
4208
4209 #ifndef PERL_MAGIC_shared
4210 #  define PERL_MAGIC_shared              'N'
4211 #endif
4212
4213 #ifndef PERL_MAGIC_shared_scalar
4214 #  define PERL_MAGIC_shared_scalar       'n'
4215 #endif
4216
4217 #ifndef PERL_MAGIC_collxfrm
4218 #  define PERL_MAGIC_collxfrm            'o'
4219 #endif
4220
4221 #ifndef PERL_MAGIC_tied
4222 #  define PERL_MAGIC_tied                'P'
4223 #endif
4224
4225 #ifndef PERL_MAGIC_tiedelem
4226 #  define PERL_MAGIC_tiedelem            'p'
4227 #endif
4228
4229 #ifndef PERL_MAGIC_tiedscalar
4230 #  define PERL_MAGIC_tiedscalar          'q'
4231 #endif
4232
4233 #ifndef PERL_MAGIC_qr
4234 #  define PERL_MAGIC_qr                  'r'
4235 #endif
4236
4237 #ifndef PERL_MAGIC_sig
4238 #  define PERL_MAGIC_sig                 'S'
4239 #endif
4240
4241 #ifndef PERL_MAGIC_sigelem
4242 #  define PERL_MAGIC_sigelem             's'
4243 #endif
4244
4245 #ifndef PERL_MAGIC_taint
4246 #  define PERL_MAGIC_taint               't'
4247 #endif
4248
4249 #ifndef PERL_MAGIC_uvar
4250 #  define PERL_MAGIC_uvar                'U'
4251 #endif
4252
4253 #ifndef PERL_MAGIC_uvar_elem
4254 #  define PERL_MAGIC_uvar_elem           'u'
4255 #endif
4256
4257 #ifndef PERL_MAGIC_vstring
4258 #  define PERL_MAGIC_vstring             'V'
4259 #endif
4260
4261 #ifndef PERL_MAGIC_vec
4262 #  define PERL_MAGIC_vec                 'v'
4263 #endif
4264
4265 #ifndef PERL_MAGIC_utf8
4266 #  define PERL_MAGIC_utf8                'w'
4267 #endif
4268
4269 #ifndef PERL_MAGIC_substr
4270 #  define PERL_MAGIC_substr              'x'
4271 #endif
4272
4273 #ifndef PERL_MAGIC_defelem
4274 #  define PERL_MAGIC_defelem             'y'
4275 #endif
4276
4277 #ifndef PERL_MAGIC_glob
4278 #  define PERL_MAGIC_glob                '*'
4279 #endif
4280
4281 #ifndef PERL_MAGIC_arylen
4282 #  define PERL_MAGIC_arylen              '#'
4283 #endif
4284
4285 #ifndef PERL_MAGIC_pos
4286 #  define PERL_MAGIC_pos                 '.'
4287 #endif
4288
4289 #ifndef PERL_MAGIC_backref
4290 #  define PERL_MAGIC_backref             '<'
4291 #endif
4292
4293 #ifndef PERL_MAGIC_ext
4294 #  define PERL_MAGIC_ext                 '~'
4295 #endif
4296
4297 /* That's the best we can do... */
4298 #ifndef SvPV_force_nomg
4299 #  define SvPV_force_nomg                SvPV_force
4300 #endif
4301
4302 #ifndef SvPV_nomg
4303 #  define SvPV_nomg                      SvPV
4304 #endif
4305
4306 #ifndef sv_catpvn_nomg
4307 #  define sv_catpvn_nomg                 sv_catpvn
4308 #endif
4309
4310 #ifndef sv_catsv_nomg
4311 #  define sv_catsv_nomg                  sv_catsv
4312 #endif
4313
4314 #ifndef sv_setsv_nomg
4315 #  define sv_setsv_nomg                  sv_setsv
4316 #endif
4317
4318 #ifndef sv_pvn_nomg
4319 #  define sv_pvn_nomg                    sv_pvn
4320 #endif
4321
4322 #ifndef SvIV_nomg
4323 #  define SvIV_nomg                      SvIV
4324 #endif
4325
4326 #ifndef SvUV_nomg
4327 #  define SvUV_nomg                      SvUV
4328 #endif
4329
4330 #ifndef sv_catpv_mg
4331 #  define sv_catpv_mg(sv, ptr)          \
4332    STMT_START {                         \
4333      SV *TeMpSv = sv;                   \
4334      sv_catpv(TeMpSv,ptr);              \
4335      SvSETMAGIC(TeMpSv);                \
4336    } STMT_END
4337 #endif
4338
4339 #ifndef sv_catpvn_mg
4340 #  define sv_catpvn_mg(sv, ptr, len)    \
4341    STMT_START {                         \
4342      SV *TeMpSv = sv;                   \
4343      sv_catpvn(TeMpSv,ptr,len);         \
4344      SvSETMAGIC(TeMpSv);                \
4345    } STMT_END
4346 #endif
4347
4348 #ifndef sv_catsv_mg
4349 #  define sv_catsv_mg(dsv, ssv)         \
4350    STMT_START {                         \
4351      SV *TeMpSv = dsv;                  \
4352      sv_catsv(TeMpSv,ssv);              \
4353      SvSETMAGIC(TeMpSv);                \
4354    } STMT_END
4355 #endif
4356
4357 #ifndef sv_setiv_mg
4358 #  define sv_setiv_mg(sv, i)            \
4359    STMT_START {                         \
4360      SV *TeMpSv = sv;                   \
4361      sv_setiv(TeMpSv,i);                \
4362      SvSETMAGIC(TeMpSv);                \
4363    } STMT_END
4364 #endif
4365
4366 #ifndef sv_setnv_mg
4367 #  define sv_setnv_mg(sv, num)          \
4368    STMT_START {                         \
4369      SV *TeMpSv = sv;                   \
4370      sv_setnv(TeMpSv,num);              \
4371      SvSETMAGIC(TeMpSv);                \
4372    } STMT_END
4373 #endif
4374
4375 #ifndef sv_setpv_mg
4376 #  define sv_setpv_mg(sv, ptr)          \
4377    STMT_START {                         \
4378      SV *TeMpSv = sv;                   \
4379      sv_setpv(TeMpSv,ptr);              \
4380      SvSETMAGIC(TeMpSv);                \
4381    } STMT_END
4382 #endif
4383
4384 #ifndef sv_setpvn_mg
4385 #  define sv_setpvn_mg(sv, ptr, len)    \
4386    STMT_START {                         \
4387      SV *TeMpSv = sv;                   \
4388      sv_setpvn(TeMpSv,ptr,len);         \
4389      SvSETMAGIC(TeMpSv);                \
4390    } STMT_END
4391 #endif
4392
4393 #ifndef sv_setsv_mg
4394 #  define sv_setsv_mg(dsv, ssv)         \
4395    STMT_START {                         \
4396      SV *TeMpSv = dsv;                  \
4397      sv_setsv(TeMpSv,ssv);              \
4398      SvSETMAGIC(TeMpSv);                \
4399    } STMT_END
4400 #endif
4401
4402 #ifndef sv_setuv_mg
4403 #  define sv_setuv_mg(sv, i)            \
4404    STMT_START {                         \
4405      SV *TeMpSv = sv;                   \
4406      sv_setuv(TeMpSv,i);                \
4407      SvSETMAGIC(TeMpSv);                \
4408    } STMT_END
4409 #endif
4410
4411 #ifndef sv_usepvn_mg
4412 #  define sv_usepvn_mg(sv, ptr, len)    \
4413    STMT_START {                         \
4414      SV *TeMpSv = sv;                   \
4415      sv_usepvn(TeMpSv,ptr,len);         \
4416      SvSETMAGIC(TeMpSv);                \
4417    } STMT_END
4418 #endif
4419
4420 #ifdef USE_ITHREADS
4421 #ifndef CopFILE
4422 #  define CopFILE(c)                     ((c)->cop_file)
4423 #endif
4424
4425 #ifndef CopFILEGV
4426 #  define CopFILEGV(c)                   (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv)
4427 #endif
4428
4429 #ifndef CopFILE_set
4430 #  define CopFILE_set(c,pv)              ((c)->cop_file = savepv(pv))
4431 #endif
4432
4433 #ifndef CopFILESV
4434 #  define CopFILESV(c)                   (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
4435 #endif
4436
4437 #ifndef CopFILEAV
4438 #  define CopFILEAV(c)                   (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
4439 #endif
4440
4441 #ifndef CopSTASHPV
4442 #  define CopSTASHPV(c)                  ((c)->cop_stashpv)
4443 #endif
4444
4445 #ifndef CopSTASHPV_set
4446 #  define CopSTASHPV_set(c,pv)           ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch))
4447 #endif
4448
4449 #ifndef CopSTASH
4450 #  define CopSTASH(c)                    (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
4451 #endif
4452
4453 #ifndef CopSTASH_set
4454 #  define CopSTASH_set(c,hv)             CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch)
4455 #endif
4456
4457 #ifndef CopSTASH_eq
4458 #  define CopSTASH_eq(c,hv)              ((hv) && (CopSTASHPV(c) == HvNAME(hv) \
4459                                         || (CopSTASHPV(c) && HvNAME(hv) \
4460                                         && strEQ(CopSTASHPV(c), HvNAME(hv)))))
4461 #endif
4462
4463 #else
4464 #ifndef CopFILEGV
4465 #  define CopFILEGV(c)                   ((c)->cop_filegv)
4466 #endif
4467
4468 #ifndef CopFILEGV_set
4469 #  define CopFILEGV_set(c,gv)            ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
4470 #endif
4471
4472 #ifndef CopFILE_set
4473 #  define CopFILE_set(c,pv)              CopFILEGV_set((c), gv_fetchfile(pv))
4474 #endif
4475
4476 #ifndef CopFILESV
4477 #  define CopFILESV(c)                   (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
4478 #endif
4479
4480 #ifndef CopFILEAV
4481 #  define CopFILEAV(c)                   (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
4482 #endif
4483
4484 #ifndef CopFILE
4485 #  define CopFILE(c)                     (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
4486 #endif
4487
4488 #ifndef CopSTASH
4489 #  define CopSTASH(c)                    ((c)->cop_stash)
4490 #endif
4491
4492 #ifndef CopSTASH_set
4493 #  define CopSTASH_set(c,hv)             ((c)->cop_stash = (hv))
4494 #endif
4495
4496 #ifndef CopSTASHPV
4497 #  define CopSTASHPV(c)                  (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
4498 #endif
4499
4500 #ifndef CopSTASHPV_set
4501 #  define CopSTASHPV_set(c,pv)           CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
4502 #endif
4503
4504 #ifndef CopSTASH_eq
4505 #  define CopSTASH_eq(c,hv)              (CopSTASH(c) == (hv))
4506 #endif
4507
4508 #endif /* USE_ITHREADS */
4509 #ifndef IN_PERL_COMPILETIME
4510 #  define IN_PERL_COMPILETIME            (PL_curcop == &PL_compiling)
4511 #endif
4512
4513 #ifndef IN_LOCALE_RUNTIME
4514 #  define IN_LOCALE_RUNTIME              (PL_curcop->op_private & HINT_LOCALE)
4515 #endif
4516
4517 #ifndef IN_LOCALE_COMPILETIME
4518 #  define IN_LOCALE_COMPILETIME          (PL_hints & HINT_LOCALE)
4519 #endif
4520
4521 #ifndef IN_LOCALE
4522 #  define IN_LOCALE                      (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
4523 #endif
4524 #ifndef IS_NUMBER_IN_UV
4525 #  define IS_NUMBER_IN_UV                0x01
4526 #endif
4527
4528 #ifndef IS_NUMBER_GREATER_THAN_UV_MAX
4529 #  define IS_NUMBER_GREATER_THAN_UV_MAX  0x02
4530 #endif
4531
4532 #ifndef IS_NUMBER_NOT_INT
4533 #  define IS_NUMBER_NOT_INT              0x04
4534 #endif
4535
4536 #ifndef IS_NUMBER_NEG
4537 #  define IS_NUMBER_NEG                  0x08
4538 #endif
4539
4540 #ifndef IS_NUMBER_INFINITY
4541 #  define IS_NUMBER_INFINITY             0x10
4542 #endif
4543
4544 #ifndef IS_NUMBER_NAN
4545 #  define IS_NUMBER_NAN                  0x20
4546 #endif
4547
4548 /* GROK_NUMERIC_RADIX depends on grok_numeric_radix */
4549 #ifndef GROK_NUMERIC_RADIX
4550 #  define GROK_NUMERIC_RADIX(sp, send)   grok_numeric_radix(sp, send)
4551 #endif
4552 #ifndef PERL_SCAN_GREATER_THAN_UV_MAX
4553 #  define PERL_SCAN_GREATER_THAN_UV_MAX  0x02
4554 #endif
4555
4556 #ifndef PERL_SCAN_SILENT_ILLDIGIT
4557 #  define PERL_SCAN_SILENT_ILLDIGIT      0x04
4558 #endif
4559
4560 #ifndef PERL_SCAN_ALLOW_UNDERSCORES
4561 #  define PERL_SCAN_ALLOW_UNDERSCORES    0x01
4562 #endif
4563
4564 #ifndef PERL_SCAN_DISALLOW_PREFIX
4565 #  define PERL_SCAN_DISALLOW_PREFIX      0x02
4566 #endif
4567
4568 #ifndef grok_numeric_radix
4569 #if defined(NEED_grok_numeric_radix)
4570 static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
4571 static
4572 #else
4573 extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
4574 #endif
4575
4576 #ifdef grok_numeric_radix
4577 #  undef grok_numeric_radix
4578 #endif
4579 #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
4580 #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
4581
4582 #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
4583 bool
4584 DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send)
4585 {
4586 #ifdef USE_LOCALE_NUMERIC
4587 #ifdef PL_numeric_radix_sv
4588     if (PL_numeric_radix_sv && IN_LOCALE) {
4589         STRLEN len;
4590         char* radix = SvPV(PL_numeric_radix_sv, len);
4591         if (*sp + len <= send && memEQ(*sp, radix, len)) {
4592             *sp += len;
4593             return TRUE;
4594         }
4595     }
4596 #else
4597     /* older perls don't have PL_numeric_radix_sv so the radix
4598      * must manually be requested from locale.h
4599      */
4600 #include <locale.h>
4601     dTHR;  /* needed for older threaded perls */
4602     struct lconv *lc = localeconv();
4603     char *radix = lc->decimal_point;
4604     if (radix && IN_LOCALE) {
4605         STRLEN len = strlen(radix);
4606         if (*sp + len <= send && memEQ(*sp, radix, len)) {
4607             *sp += len;
4608             return TRUE;
4609         }
4610     }
4611 #endif
4612 #endif /* USE_LOCALE_NUMERIC */
4613     /* always try "." if numeric radix didn't match because
4614      * we may have data from different locales mixed */
4615     if (*sp < send && **sp == '.') {
4616         ++*sp;
4617         return TRUE;
4618     }
4619     return FALSE;
4620 }
4621 #endif
4622 #endif
4623
4624 /* grok_number depends on grok_numeric_radix */
4625
4626 #ifndef grok_number
4627 #if defined(NEED_grok_number)
4628 static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
4629 static
4630 #else
4631 extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
4632 #endif
4633
4634 #ifdef grok_number
4635 #  undef grok_number
4636 #endif
4637 #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
4638 #define Perl_grok_number DPPP_(my_grok_number)
4639
4640 #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
4641 int
4642 DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep)
4643 {
4644   const char *s = pv;
4645   const char *send = pv + len;
4646   const UV max_div_10 = UV_MAX / 10;
4647   const char max_mod_10 = UV_MAX % 10;
4648   int numtype = 0;
4649   int sawinf = 0;
4650   int sawnan = 0;
4651
4652   while (s < send && isSPACE(*s))
4653     s++;
4654   if (s == send) {
4655     return 0;
4656   } else if (*s == '-') {
4657     s++;
4658     numtype = IS_NUMBER_NEG;
4659   }
4660   else if (*s == '+')
4661   s++;
4662
4663   if (s == send)
4664     return 0;
4665
4666   /* next must be digit or the radix separator or beginning of infinity */
4667   if (isDIGIT(*s)) {
4668     /* UVs are at least 32 bits, so the first 9 decimal digits cannot
4669        overflow.  */
4670     UV value = *s - '0';
4671     /* This construction seems to be more optimiser friendly.
4672        (without it gcc does the isDIGIT test and the *s - '0' separately)
4673        With it gcc on arm is managing 6 instructions (6 cycles) per digit.
4674        In theory the optimiser could deduce how far to unroll the loop
4675        before checking for overflow.  */
4676     if (++s < send) {
4677       int digit = *s - '0';
4678       if (digit >= 0 && digit <= 9) {
4679         value = value * 10 + digit;
4680         if (++s < send) {
4681           digit = *s - '0';
4682           if (digit >= 0 && digit <= 9) {
4683             value = value * 10 + digit;
4684             if (++s < send) {
4685               digit = *s - '0';
4686               if (digit >= 0 && digit <= 9) {
4687                 value = value * 10 + digit;
4688                 if (++s < send) {
4689                   digit = *s - '0';
4690                   if (digit >= 0 && digit <= 9) {
4691                     value = value * 10 + digit;
4692                     if (++s < send) {
4693                       digit = *s - '0';
4694                       if (digit >= 0 && digit <= 9) {
4695                         value = value * 10 + digit;
4696                         if (++s < send) {
4697                           digit = *s - '0';
4698                           if (digit >= 0 && digit <= 9) {
4699                             value = value * 10 + digit;
4700                             if (++s < send) {
4701                               digit = *s - '0';
4702                               if (digit >= 0 && digit <= 9) {
4703                                 value = value * 10 + digit;
4704                                 if (++s < send) {
4705                                   digit = *s - '0';
4706                                   if (digit >= 0 && digit <= 9) {
4707                                     value = value * 10 + digit;
4708                                     if (++s < send) {
4709                                       /* Now got 9 digits, so need to check
4710                                          each time for overflow.  */
4711                                       digit = *s - '0';
4712                                       while (digit >= 0 && digit <= 9
4713                                              && (value < max_div_10
4714                                                  || (value == max_div_10
4715                                                      && digit <= max_mod_10))) {
4716                                         value = value * 10 + digit;
4717                                         if (++s < send)
4718                                           digit = *s - '0';
4719                                         else
4720                                           break;
4721                                       }
4722                                       if (digit >= 0 && digit <= 9
4723                                           && (s < send)) {
4724                                         /* value overflowed.
4725                                            skip the remaining digits, don't
4726                                            worry about setting *valuep.  */
4727                                         do {
4728                                           s++;
4729                                         } while (s < send && isDIGIT(*s));
4730                                         numtype |=
4731                                           IS_NUMBER_GREATER_THAN_UV_MAX;
4732                                         goto skip_value;
4733                                       }
4734                                     }
4735                                   }
4736                                 }
4737                               }
4738                             }
4739                           }
4740                         }
4741                       }
4742                     }
4743                   }
4744                 }
4745               }
4746             }
4747           }
4748         }
4749       }
4750     }
4751     numtype |= IS_NUMBER_IN_UV;
4752     if (valuep)
4753       *valuep = value;
4754
4755   skip_value:
4756     if (GROK_NUMERIC_RADIX(&s, send)) {
4757       numtype |= IS_NUMBER_NOT_INT;
4758       while (s < send && isDIGIT(*s))  /* optional digits after the radix */
4759         s++;
4760     }
4761   }
4762   else if (GROK_NUMERIC_RADIX(&s, send)) {
4763     numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */
4764     /* no digits before the radix means we need digits after it */
4765     if (s < send && isDIGIT(*s)) {
4766       do {
4767         s++;
4768       } while (s < send && isDIGIT(*s));
4769       if (valuep) {
4770         /* integer approximation is valid - it's 0.  */
4771         *valuep = 0;
4772       }
4773     }
4774     else
4775       return 0;
4776   } else if (*s == 'I' || *s == 'i') {
4777     s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
4778     s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
4779     s++; if (s < send && (*s == 'I' || *s == 'i')) {
4780       s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
4781       s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
4782       s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
4783       s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
4784       s++;
4785     }
4786     sawinf = 1;
4787   } else if (*s == 'N' || *s == 'n') {
4788     /* XXX TODO: There are signaling NaNs and quiet NaNs. */
4789     s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
4790     s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
4791     s++;
4792     sawnan = 1;
4793   } else
4794     return 0;
4795
4796   if (sawinf) {
4797     numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
4798     numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
4799   } else if (sawnan) {
4800     numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
4801     numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
4802   } else if (s < send) {
4803     /* we can have an optional exponent part */
4804     if (*s == 'e' || *s == 'E') {
4805       /* The only flag we keep is sign.  Blow away any "it's UV"  */
4806       numtype &= IS_NUMBER_NEG;
4807       numtype |= IS_NUMBER_NOT_INT;
4808       s++;
4809       if (s < send && (*s == '-' || *s == '+'))
4810         s++;
4811       if (s < send && isDIGIT(*s)) {
4812         do {
4813           s++;
4814         } while (s < send && isDIGIT(*s));
4815       }
4816       else
4817       return 0;
4818     }
4819   }
4820   while (s < send && isSPACE(*s))
4821     s++;
4822   if (s >= send)
4823     return numtype;
4824   if (len == 10 && memEQ(pv, "0 but true", 10)) {
4825     if (valuep)
4826       *valuep = 0;
4827     return IS_NUMBER_IN_UV;
4828   }
4829   return 0;
4830 }
4831 #endif
4832 #endif
4833
4834 /*
4835  * The grok_* routines have been modified to use warn() instead of
4836  * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit,
4837  * which is why the stack variable has been renamed to 'xdigit'.
4838  */
4839
4840 #ifndef grok_bin
4841 #if defined(NEED_grok_bin)
4842 static UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
4843 static
4844 #else
4845 extern UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
4846 #endif
4847
4848 #ifdef grok_bin
4849 #  undef grok_bin
4850 #endif
4851 #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
4852 #define Perl_grok_bin DPPP_(my_grok_bin)
4853
4854 #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
4855 UV
4856 DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result)
4857 {
4858     const char *s = start;
4859     STRLEN len = *len_p;
4860     UV value = 0;
4861     NV value_nv = 0;
4862
4863     const UV max_div_2 = UV_MAX / 2;
4864     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
4865     bool overflowed = FALSE;
4866
4867     if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
4868         /* strip off leading b or 0b.
4869            for compatibility silently suffer "b" and "0b" as valid binary
4870            numbers. */
4871         if (len >= 1) {
4872             if (s[0] == 'b') {
4873                 s++;
4874                 len--;
4875             }
4876             else if (len >= 2 && s[0] == '0' && s[1] == 'b') {
4877                 s+=2;
4878                 len-=2;
4879             }
4880         }
4881     }
4882
4883     for (; len-- && *s; s++) {
4884         char bit = *s;
4885         if (bit == '0' || bit == '1') {
4886             /* Write it in this wonky order with a goto to attempt to get the
4887                compiler to make the common case integer-only loop pretty tight.
4888                With gcc seems to be much straighter code than old scan_bin.  */
4889           redo:
4890             if (!overflowed) {
4891                 if (value <= max_div_2) {
4892                     value = (value << 1) | (bit - '0');
4893                     continue;
4894                 }
4895                 /* Bah. We're just overflowed.  */
4896                 warn("Integer overflow in binary number");
4897                 overflowed = TRUE;
4898                 value_nv = (NV) value;
4899             }
4900             value_nv *= 2.0;
4901             /* If an NV has not enough bits in its mantissa to
4902              * represent a UV this summing of small low-order numbers
4903              * is a waste of time (because the NV cannot preserve
4904              * the low-order bits anyway): we could just remember when
4905              * did we overflow and in the end just multiply value_nv by the
4906              * right amount. */
4907             value_nv += (NV)(bit - '0');
4908             continue;
4909         }
4910         if (bit == '_' && len && allow_underscores && (bit = s[1])
4911             && (bit == '0' || bit == '1'))
4912             {
4913                 --len;
4914                 ++s;
4915                 goto redo;
4916             }
4917         if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
4918             warn("Illegal binary digit '%c' ignored", *s);
4919         break;
4920     }
4921
4922     if (   ( overflowed && value_nv > 4294967295.0)
4923 #if UVSIZE > 4
4924         || (!overflowed && value > 0xffffffff  )
4925 #endif
4926         ) {
4927         warn("Binary number > 0b11111111111111111111111111111111 non-portable");
4928     }
4929     *len_p = s - start;
4930     if (!overflowed) {
4931         *flags = 0;
4932         return value;
4933     }
4934     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
4935     if (result)
4936         *result = value_nv;
4937     return UV_MAX;
4938 }
4939 #endif
4940 #endif
4941
4942 #ifndef grok_hex
4943 #if defined(NEED_grok_hex)
4944 static UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
4945 static
4946 #else
4947 extern UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
4948 #endif
4949
4950 #ifdef grok_hex
4951 #  undef grok_hex
4952 #endif
4953 #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
4954 #define Perl_grok_hex DPPP_(my_grok_hex)
4955
4956 #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
4957 UV
4958 DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result)
4959 {
4960     const char *s = start;
4961     STRLEN len = *len_p;
4962     UV value = 0;
4963     NV value_nv = 0;
4964
4965     const UV max_div_16 = UV_MAX / 16;
4966     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
4967     bool overflowed = FALSE;
4968     const char *xdigit;
4969
4970     if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
4971         /* strip off leading x or 0x.
4972            for compatibility silently suffer "x" and "0x" as valid hex numbers.
4973         */
4974         if (len >= 1) {
4975             if (s[0] == 'x') {
4976                 s++;
4977                 len--;
4978             }
4979             else if (len >= 2 && s[0] == '0' && s[1] == 'x') {
4980                 s+=2;
4981                 len-=2;
4982             }
4983         }
4984     }
4985
4986     for (; len-- && *s; s++) {
4987         xdigit = strchr((char *) PL_hexdigit, *s);
4988         if (xdigit) {
4989             /* Write it in this wonky order with a goto to attempt to get the
4990                compiler to make the common case integer-only loop pretty tight.
4991                With gcc seems to be much straighter code than old scan_hex.  */
4992           redo:
4993             if (!overflowed) {
4994                 if (value <= max_div_16) {
4995                     value = (value << 4) | ((xdigit - PL_hexdigit) & 15);
4996                     continue;
4997                 }
4998                 warn("Integer overflow in hexadecimal number");
4999                 overflowed = TRUE;
5000                 value_nv = (NV) value;
5001             }
5002             value_nv *= 16.0;
5003             /* If an NV has not enough bits in its mantissa to
5004              * represent a UV this summing of small low-order numbers
5005              * is a waste of time (because the NV cannot preserve
5006              * the low-order bits anyway): we could just remember when
5007              * did we overflow and in the end just multiply value_nv by the
5008              * right amount of 16-tuples. */
5009             value_nv += (NV)((xdigit - PL_hexdigit) & 15);
5010             continue;
5011         }
5012         if (*s == '_' && len && allow_underscores && s[1]
5013                 && (xdigit = strchr((char *) PL_hexdigit, s[1])))
5014             {
5015                 --len;
5016                 ++s;
5017                 goto redo;
5018             }
5019         if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
5020             warn("Illegal hexadecimal digit '%c' ignored", *s);
5021         break;
5022     }
5023
5024     if (   ( overflowed && value_nv > 4294967295.0)
5025 #if UVSIZE > 4
5026         || (!overflowed && value > 0xffffffff  )
5027 #endif
5028         ) {
5029         warn("Hexadecimal number > 0xffffffff non-portable");
5030     }
5031     *len_p = s - start;
5032     if (!overflowed) {
5033         *flags = 0;
5034         return value;
5035     }
5036     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
5037     if (result)
5038         *result = value_nv;
5039     return UV_MAX;
5040 }
5041 #endif
5042 #endif
5043
5044 #ifndef grok_oct
5045 #if defined(NEED_grok_oct)
5046 static UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
5047 static
5048 #else
5049 extern UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
5050 #endif
5051
5052 #ifdef grok_oct
5053 #  undef grok_oct
5054 #endif
5055 #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
5056 #define Perl_grok_oct DPPP_(my_grok_oct)
5057
5058 #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
5059 UV
5060 DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result)
5061 {
5062     const char *s = start;
5063     STRLEN len = *len_p;
5064     UV value = 0;
5065     NV value_nv = 0;
5066
5067     const UV max_div_8 = UV_MAX / 8;
5068     bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
5069     bool overflowed = FALSE;
5070
5071     for (; len-- && *s; s++) {
5072          /* gcc 2.95 optimiser not smart enough to figure that this subtraction
5073             out front allows slicker code.  */
5074         int digit = *s - '0';
5075         if (digit >= 0 && digit <= 7) {
5076             /* Write it in this wonky order with a goto to attempt to get the
5077                compiler to make the common case integer-only loop pretty tight.
5078             */
5079           redo:
5080             if (!overflowed) {
5081                 if (value <= max_div_8) {
5082                     value = (value << 3) | digit;
5083                     continue;
5084                 }
5085                 /* Bah. We're just overflowed.  */
5086                 warn("Integer overflow in octal number");
5087                 overflowed = TRUE;
5088                 value_nv = (NV) value;
5089             }
5090             value_nv *= 8.0;
5091             /* If an NV has not enough bits in its mantissa to
5092              * represent a UV this summing of small low-order numbers
5093              * is a waste of time (because the NV cannot preserve
5094              * the low-order bits anyway): we could just remember when
5095              * did we overflow and in the end just multiply value_nv by the
5096              * right amount of 8-tuples. */
5097             value_nv += (NV)digit;
5098             continue;
5099         }
5100         if (digit == ('_' - '0') && len && allow_underscores
5101             && (digit = s[1] - '0') && (digit >= 0 && digit <= 7))
5102             {
5103                 --len;
5104                 ++s;
5105                 goto redo;
5106             }
5107         /* Allow \octal to work the DWIM way (that is, stop scanning
5108          * as soon as non-octal characters are seen, complain only iff
5109          * someone seems to want to use the digits eight and nine). */
5110         if (digit == 8 || digit == 9) {
5111             if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
5112                 warn("Illegal octal digit '%c' ignored", *s);
5113         }
5114         break;
5115     }
5116
5117     if (   ( overflowed && value_nv > 4294967295.0)
5118 #if UVSIZE > 4
5119         || (!overflowed && value > 0xffffffff  )
5120 #endif
5121         ) {
5122         warn("Octal number > 037777777777 non-portable");
5123     }
5124     *len_p = s - start;
5125     if (!overflowed) {
5126         *flags = 0;
5127         return value;
5128     }
5129     *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
5130     if (result)
5131         *result = value_nv;
5132     return UV_MAX;
5133 }
5134 #endif
5135 #endif
5136
5137 #ifdef NO_XSLOCKS
5138 #  ifdef dJMPENV
5139 #    define dXCPT             dJMPENV; int rEtV = 0
5140 #    define XCPT_TRY_START    JMPENV_PUSH(rEtV); if (rEtV == 0)
5141 #    define XCPT_TRY_END      JMPENV_POP;
5142 #    define XCPT_CATCH        if (rEtV != 0)
5143 #    define XCPT_RETHROW      JMPENV_JUMP(rEtV)
5144 #  else
5145 #    define dXCPT             Sigjmp_buf oldTOP; int rEtV = 0
5146 #    define XCPT_TRY_START    Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0)
5147 #    define XCPT_TRY_END      Copy(oldTOP, top_env, 1, Sigjmp_buf);
5148 #    define XCPT_CATCH        if (rEtV != 0)
5149 #    define XCPT_RETHROW      Siglongjmp(top_env, rEtV)
5150 #  endif
5151 #endif
5152
5153 #endif /* _P_P_PORTABILITY_H_ */
5154
5155 /* End of File ppport.h */