5 ----------------------------------------------------------------------
7 ppport.h -- Perl/Pollution/Portability Version 3.14_05
9 Automatically created by Devel::PPPort running under perl 5.011000.
11 Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
12 includes in parts/inc/ instead.
14 Use 'perldoc ppport.h' to view the documentation below.
16 ----------------------------------------------------------------------
24 ppport.h - Perl/Pollution/Portability version 3.14_05
28 perl ppport.h [options] [source files]
30 Searches current directory for files if no [source files] are given
32 --help show short help
34 --version show version
36 --patch=file write one patch file with changes
37 --copy=suffix write changed copies with suffix
38 --diff=program use diff program and options
40 --compat-version=version provide compatibility with Perl version
41 --cplusplus accept C++ comments
43 --quiet don't output anything except fatal errors
44 --nodiag don't show diagnostics
45 --nohints don't show hints
46 --nochanges don't suggest changes
47 --nofilter don't filter input files
49 --strip strip all script and doc functionality from
52 --list-provided list provided API
53 --list-unsupported list unsupported API
54 --api-info=name show Perl API portability information
58 This version of F<ppport.h> is designed to support operation with Perl
59 installations back to 5.003, and has been tested up to 5.10.0.
65 Display a brief usage summary.
69 Display the version of F<ppport.h>.
71 =head2 --patch=I<file>
73 If this option is given, a single patch file will be created if
74 any changes are suggested. This requires a working diff program
75 to be installed on your system.
77 =head2 --copy=I<suffix>
79 If this option is given, a copy of each file will be saved with
80 the given suffix that contains the suggested changes. This does
81 not require any external programs. Note that this does not
82 automagially add a dot between the original filename and the
83 suffix. If you want the dot, you have to include it in the option
86 If neither C<--patch> or C<--copy> are given, the default is to
87 simply print the diffs for each file. This requires either
88 C<Text::Diff> or a C<diff> program to be installed.
90 =head2 --diff=I<program>
92 Manually set the diff program and options to use. The default
93 is to use C<Text::Diff>, when installed, and output unified
96 =head2 --compat-version=I<version>
98 Tell F<ppport.h> to check for compatibility with the given
99 Perl version. The default is to check for compatibility with Perl
100 version 5.003. You can use this option to reduce the output
101 of F<ppport.h> if you intend to be backward compatible only
102 down to a certain Perl version.
106 Usually, F<ppport.h> will detect C++ style comments and
107 replace them with C style comments for portability reasons.
108 Using this option instructs F<ppport.h> to leave C++
113 Be quiet. Don't print anything except fatal errors.
117 Don't output any diagnostic messages. Only portability
118 alerts will be printed.
122 Don't output any hints. Hints often contain useful portability
123 notes. Warnings will still be displayed.
127 Don't suggest any changes. Only give diagnostic output and hints
128 unless these are also deactivated.
132 Don't filter the list of input files. By default, files not looking
133 like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
137 Strip all script and documentation functionality from F<ppport.h>.
138 This reduces the size of F<ppport.h> dramatically and may be useful
139 if you want to include F<ppport.h> in smaller modules without
140 increasing their distribution size too much.
142 The stripped F<ppport.h> will have a C<--unstrip> option that allows
143 you to undo the stripping, but only if an appropriate C<Devel::PPPort>
146 =head2 --list-provided
148 Lists the API elements for which compatibility is provided by
149 F<ppport.h>. Also lists if it must be explicitly requested,
150 if it has dependencies, and if there are hints or warnings for it.
152 =head2 --list-unsupported
154 Lists the API elements that are known not to be supported by
155 F<ppport.h> and below which version of Perl they probably
156 won't be available or work.
158 =head2 --api-info=I<name>
160 Show portability information for API elements matching I<name>.
161 If I<name> is surrounded by slashes, it is interpreted as a regular
166 In order for a Perl extension (XS) module to be as portable as possible
167 across differing versions of Perl itself, certain steps need to be taken.
173 Including this header is the first major one. This alone will give you
174 access to a large part of the Perl API that hasn't been available in
175 earlier Perl releases. Use
177 perl ppport.h --list-provided
179 to see which API elements are provided by ppport.h.
183 You should avoid using deprecated parts of the API. For example, using
184 global Perl variables without the C<PL_> prefix is deprecated. Also,
185 some API functions used to have a C<perl_> prefix. Using this form is
186 also deprecated. You can safely use the supported API, as F<ppport.h>
187 will provide wrappers for older Perl versions.
191 If you use one of a few functions or variables that were not present in
192 earlier versions of Perl, and that can't be provided using a macro, you
193 have to explicitly request support for these functions by adding one or
194 more C<#define>s in your source code before the inclusion of F<ppport.h>.
196 These functions or variables will be marked C<explicit> in the list shown
197 by C<--list-provided>.
199 Depending on whether you module has a single or multiple files that
200 use such functions or variables, you want either C<static> or global
203 For a C<static> function or variable (used only in a single source
206 #define NEED_function
207 #define NEED_variable
209 For a global function or variable (used in multiple source files),
212 #define NEED_function_GLOBAL
213 #define NEED_variable_GLOBAL
215 Note that you mustn't have more than one global request for the
216 same function or variable in your project.
218 Function / Variable Static Request Global Request
219 -----------------------------------------------------------------------------------------
220 PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL
221 PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL
222 eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL
223 grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL
224 grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL
225 grok_number() NEED_grok_number NEED_grok_number_GLOBAL
226 grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL
227 grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL
228 load_module() NEED_load_module NEED_load_module_GLOBAL
229 my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL
230 my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL
231 my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL
232 my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL
233 newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
234 newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL
235 newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL
236 newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL
237 pv_display() NEED_pv_display NEED_pv_display_GLOBAL
238 pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL
239 pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL
240 sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL
241 sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL
242 sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL
243 sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL
244 sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL
245 sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL
246 sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL
247 vload_module() NEED_vload_module NEED_vload_module_GLOBAL
248 vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL
249 warner() NEED_warner NEED_warner_GLOBAL
251 To avoid namespace conflicts, you can change the namespace of the
252 explicitly exported functions / variables using the C<DPPP_NAMESPACE>
253 macro. Just C<#define> the macro before including C<ppport.h>:
255 #define DPPP_NAMESPACE MyOwnNamespace_
258 The default namespace is C<DPPP_>.
262 The good thing is that most of the above can be checked by running
263 F<ppport.h> on your source code. See the next section for
268 To verify whether F<ppport.h> is needed for your module, whether you
269 should make any changes to your code, and whether any special defines
270 should be used, F<ppport.h> can be run as a Perl script to check your
271 source code. Simply say:
275 The result will usually be a list of patches suggesting changes
276 that should at least be acceptable, if not necessarily the most
277 efficient solution, or a fix for all possible problems.
279 If you know that your XS module uses features only available in
280 newer Perl releases, if you're aware that it uses C++ comments,
281 and if you want all suggestions as a single patch file, you could
282 use something like this:
284 perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
286 If you only want your code to be scanned without any suggestions
289 perl ppport.h --nochanges
291 You can specify a different C<diff> program or options, using
292 the C<--diff> option:
294 perl ppport.h --diff='diff -C 10'
296 This would output context diffs with 10 lines of context.
298 If you want to create patched copies of your files instead, use:
300 perl ppport.h --copy=.new
302 To display portability information for the C<newSVpvn> function,
305 perl ppport.h --api-info=newSVpvn
307 Since the argument to C<--api-info> can be a regular expression,
310 perl ppport.h --api-info=/_nomg$/
312 to display portability information for all C<_nomg> functions or
314 perl ppport.h --api-info=/./
316 to display information for all known API elements.
320 If this version of F<ppport.h> is causing failure during
321 the compilation of this module, please check if newer versions
322 of either this module or C<Devel::PPPort> are available on CPAN
323 before sending a bug report.
325 If F<ppport.h> was generated using the latest version of
326 C<Devel::PPPort> and is causing failure of this module, please
327 file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
329 Please include the following information:
335 The complete output from running "perl -V"
343 The name and version of the module you were trying to build.
347 A full log of the build that failed.
351 Any other information that you think could be relevant.
355 For the latest version of this code, please get the C<Devel::PPPort>
360 Version 3.x, Copyright (c) 2004-2008, Marcus Holland-Moritz.
362 Version 2.x, Copyright (C) 2001, Paul Marquess.
364 Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
366 This program is free software; you can redistribute it and/or
367 modify it under the same terms as Perl itself.
371 See L<Devel::PPPort>.
377 # Disable broken TRIE-optimization
378 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
380 my $VERSION = 3.14_05;
393 my($ppport) = $0 =~ /([\w.]+)$/;
394 my $LF = '(?:\r\n|[\r\n])'; # line feed
395 my $HS = "[ \t]"; # horizontal whitespace
397 # Never use C comments in this file!
400 my $rccs = quotemeta $ccs;
401 my $rcce = quotemeta $cce;
404 require Getopt::Long;
405 Getopt::Long::GetOptions(\%opt, qw(
406 help quiet diag! filter! hints! changes! cplusplus strip version
407 patch=s copy=s diff=s compat-version=s
408 list-provided list-unsupported api-info=s
412 if ($@ and grep /^-/, @ARGV) {
413 usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
414 die "Getopt::Long not found. Please don't use any options.\n";
418 print "This is $0 $VERSION.\n";
422 usage() if $opt{help};
423 strip() if $opt{strip};
425 if (exists $opt{'compat-version'}) {
426 my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) };
428 die "Invalid version number format: '$opt{'compat-version'}'\n";
430 die "Only Perl 5 is supported\n" if $r != 5;
431 die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000;
432 $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s;
435 $opt{'compat-version'} = 5;
438 my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/
440 ($2 ? ( base => $2 ) : ()),
441 ($3 ? ( todo => $3 ) : ()),
442 (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()),
443 (index($4, 'p') >= 0 ? ( provided => 1 ) : ()),
444 (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()),
446 : die "invalid spec: $_" } qw(
453 CopFILEAV|5.006000||p
454 CopFILEGV_set|5.006000||p
455 CopFILEGV|5.006000||p
456 CopFILESV|5.006000||p
457 CopFILE_set|5.006000||p
459 CopSTASHPV_set|5.006000||p
460 CopSTASHPV|5.006000||p
461 CopSTASH_eq|5.006000||p
462 CopSTASH_set|5.006000||p
470 END_EXTERN_C|5.005000||p
479 GROK_NUMERIC_RADIX|5.007002||p
494 HeSVKEY_force||5.004000|
495 HeSVKEY_set||5.004000|
501 IN_LOCALE_COMPILETIME|5.007002||p
502 IN_LOCALE_RUNTIME|5.007002||p
503 IN_LOCALE|5.007002||p
504 IN_PERL_COMPILETIME|5.008001||p
505 IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p
506 IS_NUMBER_INFINITY|5.007002||p
507 IS_NUMBER_IN_UV|5.007002||p
508 IS_NUMBER_NAN|5.007003||p
509 IS_NUMBER_NEG|5.007002||p
510 IS_NUMBER_NOT_INT|5.007002||p
518 MY_CXT_CLONE|5.009002||p
519 MY_CXT_INIT|5.007003||p
540 PAD_COMPNAME_FLAGS|||
541 PAD_COMPNAME_GEN_set|||
543 PAD_COMPNAME_OURSTASH|||
549 PAD_SAVE_SETNULLPAD|||
551 PAD_SET_CUR_NOSAVE|||
555 PERLIO_FUNCS_CAST|5.009003||p
556 PERLIO_FUNCS_DECL|5.009003||p
558 PERL_BCDVERSION|5.011000||p
559 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
560 PERL_HASH|5.004000||p
561 PERL_INT_MAX|5.004000||p
562 PERL_INT_MIN|5.004000||p
563 PERL_LONG_MAX|5.004000||p
564 PERL_LONG_MIN|5.004000||p
565 PERL_MAGIC_arylen|5.007002||p
566 PERL_MAGIC_backref|5.007002||p
567 PERL_MAGIC_bm|5.007002||p
568 PERL_MAGIC_collxfrm|5.007002||p
569 PERL_MAGIC_dbfile|5.007002||p
570 PERL_MAGIC_dbline|5.007002||p
571 PERL_MAGIC_defelem|5.007002||p
572 PERL_MAGIC_envelem|5.007002||p
573 PERL_MAGIC_env|5.007002||p
574 PERL_MAGIC_ext|5.007002||p
575 PERL_MAGIC_fm|5.007002||p
576 PERL_MAGIC_glob|5.011000||p
577 PERL_MAGIC_isaelem|5.007002||p
578 PERL_MAGIC_isa|5.007002||p
579 PERL_MAGIC_mutex|5.011000||p
580 PERL_MAGIC_nkeys|5.007002||p
581 PERL_MAGIC_overload_elem|5.007002||p
582 PERL_MAGIC_overload_table|5.007002||p
583 PERL_MAGIC_overload|5.007002||p
584 PERL_MAGIC_pos|5.007002||p
585 PERL_MAGIC_qr|5.007002||p
586 PERL_MAGIC_regdata|5.007002||p
587 PERL_MAGIC_regdatum|5.007002||p
588 PERL_MAGIC_regex_global|5.007002||p
589 PERL_MAGIC_shared_scalar|5.007003||p
590 PERL_MAGIC_shared|5.007003||p
591 PERL_MAGIC_sigelem|5.007002||p
592 PERL_MAGIC_sig|5.007002||p
593 PERL_MAGIC_substr|5.007002||p
594 PERL_MAGIC_sv|5.007002||p
595 PERL_MAGIC_taint|5.007002||p
596 PERL_MAGIC_tiedelem|5.007002||p
597 PERL_MAGIC_tiedscalar|5.007002||p
598 PERL_MAGIC_tied|5.007002||p
599 PERL_MAGIC_utf8|5.008001||p
600 PERL_MAGIC_uvar_elem|5.007003||p
601 PERL_MAGIC_uvar|5.007002||p
602 PERL_MAGIC_vec|5.007002||p
603 PERL_MAGIC_vstring|5.008001||p
604 PERL_PV_ESCAPE_ALL|||p
605 PERL_PV_ESCAPE_FIRSTCHAR|||p
606 PERL_PV_ESCAPE_NOBACKSLASH|||p
607 PERL_PV_ESCAPE_NOCLEAR|||p
608 PERL_PV_ESCAPE_QUOTE|||p
609 PERL_PV_ESCAPE_RE|||p
610 PERL_PV_ESCAPE_UNI_DETECT|||p
611 PERL_PV_ESCAPE_UNI|||p
612 PERL_PV_PRETTY_DUMP|||p
613 PERL_PV_PRETTY_ELLIPSES|||p
614 PERL_PV_PRETTY_LTGT|||p
615 PERL_PV_PRETTY_NOCLEAR|||p
616 PERL_PV_PRETTY_QUOTE|||p
617 PERL_PV_PRETTY_REGPROP|||p
618 PERL_QUAD_MAX|5.004000||p
619 PERL_QUAD_MIN|5.004000||p
620 PERL_REVISION|5.006000||p
621 PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p
622 PERL_SCAN_DISALLOW_PREFIX|5.007003||p
623 PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p
624 PERL_SCAN_SILENT_ILLDIGIT|5.008001||p
625 PERL_SHORT_MAX|5.004000||p
626 PERL_SHORT_MIN|5.004000||p
627 PERL_SIGNALS_UNSAFE_FLAG|5.008001||p
628 PERL_SUBVERSION|5.006000||p
629 PERL_UCHAR_MAX|5.004000||p
630 PERL_UCHAR_MIN|5.004000||p
631 PERL_UINT_MAX|5.004000||p
632 PERL_UINT_MIN|5.004000||p
633 PERL_ULONG_MAX|5.004000||p
634 PERL_ULONG_MIN|5.004000||p
635 PERL_UNUSED_ARG|5.009003||p
636 PERL_UNUSED_CONTEXT|5.009004||p
637 PERL_UNUSED_DECL|5.007002||p
638 PERL_UNUSED_VAR|5.007002||p
639 PERL_UQUAD_MAX|5.004000||p
640 PERL_UQUAD_MIN|5.004000||p
641 PERL_USE_GCC_BRACE_GROUPS|5.009004||p
642 PERL_USHORT_MAX|5.004000||p
643 PERL_USHORT_MIN|5.004000||p
644 PERL_VERSION|5.006000||p
645 PL_DBsignal|5.005000||p
652 PL_compiling|5.004050||p
653 PL_copline|5.011000||p
654 PL_curcop|5.004050||p
655 PL_curstash|5.004050||p
656 PL_debstash|5.004050||p
658 PL_diehook|5.004050||p
662 PL_expect|5.011000||p
663 PL_hexdigit|5.005000||p
666 PL_laststatval|5.005000||p
670 PL_modglobal||5.005000|n
672 PL_no_modify|5.006000||p
675 PL_perl_destruct_level|5.004050||p
676 PL_perldb|5.004050||p
677 PL_ppaddr|5.006000||p
678 PL_rsfp_filters|5.004050||p
681 PL_signals|5.008001||p
682 PL_stack_base|5.004050||p
683 PL_stack_sp|5.004050||p
684 PL_statcache|5.005000||p
685 PL_stdingv|5.004050||p
686 PL_sv_arenaroot|5.004050||p
687 PL_sv_no|5.004050||pn
688 PL_sv_undef|5.004050||pn
689 PL_sv_yes|5.004050||pn
690 PL_tainted|5.004050||p
691 PL_tainting|5.004050||p
693 POP_MULTICALL||5.011000|
697 POPpbytex||5.007001|n
707 PUSH_MULTICALL||5.011000|
709 PUSHmortal|5.009002||p
715 PerlIO_clearerr||5.007003|
716 PerlIO_close||5.007003|
717 PerlIO_context_layers||5.009004|
718 PerlIO_eof||5.007003|
719 PerlIO_error||5.007003|
720 PerlIO_fileno||5.007003|
721 PerlIO_fill||5.007003|
722 PerlIO_flush||5.007003|
723 PerlIO_get_base||5.007003|
724 PerlIO_get_bufsiz||5.007003|
725 PerlIO_get_cnt||5.007003|
726 PerlIO_get_ptr||5.007003|
727 PerlIO_read||5.007003|
728 PerlIO_seek||5.007003|
729 PerlIO_set_cnt||5.007003|
730 PerlIO_set_ptrcnt||5.007003|
731 PerlIO_setlinebuf||5.007003|
732 PerlIO_stderr||5.007003|
733 PerlIO_stdin||5.007003|
734 PerlIO_stdout||5.007003|
735 PerlIO_tell||5.007003|
736 PerlIO_unread||5.007003|
737 PerlIO_write||5.007003|
738 Perl_signbit||5.009005|n
739 PoisonFree|5.009004||p
740 PoisonNew|5.009004||p
741 PoisonWith|5.009004||p
750 SAVE_DEFSV|5.004050||p
753 START_EXTERN_C|5.005000||p
754 START_MY_CXT|5.007003||p
757 STR_WITH_LEN|5.009003||p
759 SV_CONST_RETURN|5.009003||p
760 SV_COW_DROP_PV|5.008001||p
761 SV_COW_SHARED_HASH_KEYS|5.009005||p
762 SV_GMAGIC|5.007002||p
763 SV_HAS_TRAILING_NUL|5.009004||p
764 SV_IMMEDIATE_UNREF|5.007001||p
765 SV_MUTABLE_RETURN|5.009003||p
766 SV_NOSTEAL|5.009002||p
767 SV_SMAGIC|5.009003||p
768 SV_UTF8_NO_ENCODING|5.008001||p
787 SvGETMAGIC|5.004050||p
790 SvIOK_notUV||5.006000|
792 SvIOK_only_UV||5.006000|
798 SvIV_nomg|5.009001||p
802 SvIsCOW_shared_hash||5.008003|
807 SvMAGIC_set|5.009003||p
821 SvOOK_offset||5.011000|
824 SvPOK_only_UTF8||5.006000|
829 SvPVX_const|5.009003||p
830 SvPVX_mutable|5.009003||p
832 SvPV_const|5.009003||p
833 SvPV_flags_const_nolen|5.009003||p
834 SvPV_flags_const|5.009003||p
835 SvPV_flags_mutable|5.009003||p
836 SvPV_flags|5.007002||p
837 SvPV_force_flags_mutable|5.009003||p
838 SvPV_force_flags_nolen|5.009003||p
839 SvPV_force_flags|5.007002||p
840 SvPV_force_mutable|5.009003||p
841 SvPV_force_nolen|5.009003||p
842 SvPV_force_nomg_nolen|5.009003||p
843 SvPV_force_nomg|5.007002||p
845 SvPV_mutable|5.009003||p
846 SvPV_nolen_const|5.009003||p
847 SvPV_nolen|5.006000||p
848 SvPV_nomg_const_nolen|5.009003||p
849 SvPV_nomg_const|5.009003||p
850 SvPV_nomg|5.007002||p
853 SvPVbyte_force||5.009002|
854 SvPVbyte_nolen||5.006000|
855 SvPVbytex_force||5.006000|
858 SvPVutf8_force||5.006000|
859 SvPVutf8_nolen||5.006000|
860 SvPVutf8x_force||5.006000|
866 SvREFCNT_inc_NN|5.009004||p
867 SvREFCNT_inc_simple_NN|5.009004||p
868 SvREFCNT_inc_simple_void_NN|5.009004||p
869 SvREFCNT_inc_simple_void|5.009004||p
870 SvREFCNT_inc_simple|5.009004||p
871 SvREFCNT_inc_void_NN|5.009004||p
872 SvREFCNT_inc_void|5.009004||p
883 SvSHARED_HASH|5.009003||p
885 SvSTASH_set|5.009003||p
887 SvSetMagicSV_nosteal||5.004000|
888 SvSetMagicSV||5.004000|
889 SvSetSV_nosteal||5.004000|
891 SvTAINTED_off||5.004000|
892 SvTAINTED_on||5.004000|
898 SvUOK|5.007001|5.006000|p
900 SvUTF8_off||5.006000|
905 SvUV_nomg|5.009001||p
910 SvVSTRING_mg|5.009004||p
913 UTF8_MAXBYTES|5.009002||p
921 WARN_AMBIGUOUS|5.006000||p
922 WARN_ASSERTIONS|5.011000||p
923 WARN_BAREWORD|5.006000||p
924 WARN_CLOSED|5.006000||p
925 WARN_CLOSURE|5.006000||p
926 WARN_DEBUGGING|5.006000||p
927 WARN_DEPRECATED|5.006000||p
928 WARN_DIGIT|5.006000||p
929 WARN_EXEC|5.006000||p
930 WARN_EXITING|5.006000||p
931 WARN_GLOB|5.006000||p
932 WARN_INPLACE|5.006000||p
933 WARN_INTERNAL|5.006000||p
935 WARN_LAYER|5.008000||p
936 WARN_MALLOC|5.006000||p
937 WARN_MISC|5.006000||p
938 WARN_NEWLINE|5.006000||p
939 WARN_NUMERIC|5.006000||p
940 WARN_ONCE|5.006000||p
941 WARN_OVERFLOW|5.006000||p
942 WARN_PACK|5.006000||p
943 WARN_PARENTHESIS|5.006000||p
944 WARN_PIPE|5.006000||p
945 WARN_PORTABLE|5.006000||p
946 WARN_PRECEDENCE|5.006000||p
947 WARN_PRINTF|5.006000||p
948 WARN_PROTOTYPE|5.006000||p
950 WARN_RECURSION|5.006000||p
951 WARN_REDEFINE|5.006000||p
952 WARN_REGEXP|5.006000||p
953 WARN_RESERVED|5.006000||p
954 WARN_SEMICOLON|5.006000||p
955 WARN_SEVERE|5.006000||p
956 WARN_SIGNAL|5.006000||p
957 WARN_SUBSTR|5.006000||p
958 WARN_SYNTAX|5.006000||p
959 WARN_TAINT|5.006000||p
960 WARN_THREADS|5.008000||p
961 WARN_UNINITIALIZED|5.006000||p
962 WARN_UNOPENED|5.006000||p
963 WARN_UNPACK|5.006000||p
964 WARN_UNTIE|5.006000||p
965 WARN_UTF8|5.006000||p
966 WARN_VOID|5.006000||p
967 XCPT_CATCH|5.009002||p
968 XCPT_RETHROW|5.009002||p
969 XCPT_TRY_END|5.009002||p
970 XCPT_TRY_START|5.009002||p
972 XPUSHmortal|5.009002||p
983 XSRETURN_UV|5.008001||p
993 XS_VERSION_BOOTCHECK|||
995 XSprePUSH|5.006000||p
1000 _pMY_CXT|5.007003||p
1001 aMY_CXT_|5.007003||p
1011 amagic_cmp_locale|||
1021 apply_attrs_string||5.006001|
1024 atfork_lock||5.007003|n
1025 atfork_unlock||5.007003|n
1026 av_arylen_p||5.009003|
1028 av_create_and_push||5.009005|
1029 av_create_and_unshift_one||5.009005|
1030 av_delete||5.006000|
1031 av_exists||5.006000|
1036 av_iter_p||5.011000|
1050 block_gimme||5.004000|
1054 boot_core_UNIVERSAL|||
1056 boot_core_xsutils|||
1057 bytes_from_utf8||5.007001|
1059 bytes_to_utf8||5.006001|
1060 call_argv|5.006000||p
1061 call_atexit||5.006000|
1062 call_list||5.004000|
1063 call_method|5.006000||p
1070 cast_ulong||5.006000|
1072 check_type_and_open|||
1126 clear_placeholders|||
1131 create_eval_scope|||
1132 croak_nocontext|||vn
1133 croak_xs_usage||5.011000|
1135 csighandler||5.009003|n
1137 custom_op_desc||5.007003|
1138 custom_op_name||5.007003|
1142 cv_const_sv||5.004000|
1152 dMULTICALL||5.009003|
1153 dMY_CXT_SV|5.007003||p
1163 dUNDERBAR|5.009002||p
1174 debprofdump||5.005000|
1176 debstackptrs||5.007003|
1178 debug_start_match|||
1181 delete_eval_scope|||
1185 despatch_signals||5.007001|
1196 do_binmode||5.004050|
1205 do_gv_dump||5.006000|
1206 do_gvgv_dump||5.006000|
1207 do_hv_dump||5.006000|
1212 do_magic_dump||5.006000|
1216 do_op_dump||5.006000|
1221 do_pmop_dump||5.006000|
1232 do_sv_dump||5.006000|
1235 do_trans_complex_utf8|||
1237 do_trans_count_utf8|||
1239 do_trans_simple_utf8|||
1250 doing_taint||5.008001|n
1264 dump_eval||5.006000|
1267 dump_form||5.006000|
1268 dump_indent||5.006000|v
1270 dump_packsubs||5.006000|
1273 dump_trie_interim_list|||
1274 dump_trie_interim_table|||
1276 dump_vindent||5.006000|
1284 fbm_compile||5.005000|
1285 fbm_instr||5.005000|
1287 feature_is_enabled|||
1288 fetch_cop_label||5.011000|
1293 find_and_forget_pmops|||
1294 find_array_subscript|||
1297 find_hash_subscript|||
1299 find_runcv||5.008001|
1300 find_rundefsvoffset||5.009002|
1315 fprintf_nocontext|||vn
1316 free_global_struct|||
1317 free_tied_hv_pool|||
1319 gen_constant_list|||
1323 get_context||5.006000|n
1324 get_cvn_flags||5.009005|
1333 get_op_descs||5.005000|
1334 get_op_names||5.005000|
1336 get_ppaddr||5.006000|
1340 getcwd_sv||5.007002|
1349 grok_bin|5.007003||p
1350 grok_hex|5.007003||p
1351 grok_number|5.007002||p
1352 grok_numeric_radix|5.007002||p
1353 grok_oct|5.007003||p
1359 gv_autoload4||5.004000|
1361 gv_const_sv||5.009003|
1363 gv_efullname3||5.004000|
1364 gv_efullname4||5.006001|
1367 gv_fetchfile_flags||5.009005|
1369 gv_fetchmeth_autoload||5.007003|
1370 gv_fetchmethod_autoload||5.004000|
1371 gv_fetchmethod_flags||5.011000|
1374 gv_fetchpvn_flags||5.009002|
1376 gv_fetchsv||5.009002|
1377 gv_fullname3||5.004000|
1378 gv_fullname4||5.006001|
1381 gv_handler||5.007001|
1384 gv_name_set||5.009004|
1385 gv_stashpvn|5.004000||p
1386 gv_stashpvs||5.009003|
1393 hv_assert||5.011000|
1395 hv_backreferences_p|||
1396 hv_clear_placeholders||5.009001|
1398 hv_common_key_len||5.010000|
1399 hv_common||5.010000|
1401 hv_delayfree_ent||5.004000|
1403 hv_delete_ent||5.004000|
1405 hv_eiter_p||5.009003|
1406 hv_eiter_set||5.009003|
1407 hv_exists_ent||5.004000|
1409 hv_fetch_ent||5.004000|
1410 hv_fetchs|5.009003||p
1412 hv_free_ent||5.004000|
1414 hv_iterkeysv||5.004000|
1416 hv_iternext_flags||5.008000|
1421 hv_ksplit||5.004000|
1424 hv_name_set||5.009003|
1426 hv_placeholders_get||5.009003|
1427 hv_placeholders_p||5.009003|
1428 hv_placeholders_set||5.009003|
1429 hv_riter_p||5.009003|
1430 hv_riter_set||5.009003|
1431 hv_scalar||5.009001|
1432 hv_store_ent||5.004000|
1433 hv_store_flags||5.008000|
1434 hv_stores|5.009004||p
1437 ibcmp_locale||5.004000|
1438 ibcmp_utf8||5.007003|
1441 incpush_if_exists|||
1444 init_argv_symbols|||
1446 init_global_struct|||
1447 init_i18nl10n||5.006000|
1448 init_i18nl14n||5.006000|
1453 init_postdump_symbols|||
1454 init_predump_symbols|||
1455 init_stacks||5.005000|
1481 is_handle_constructor|||n
1482 is_list_assignment|||
1483 is_lvalue_sub||5.007001|
1484 is_uni_alnum_lc||5.006000|
1485 is_uni_alnumc_lc||5.006000|
1486 is_uni_alnumc||5.006000|
1487 is_uni_alnum||5.006000|
1488 is_uni_alpha_lc||5.006000|
1489 is_uni_alpha||5.006000|
1490 is_uni_ascii_lc||5.006000|
1491 is_uni_ascii||5.006000|
1492 is_uni_cntrl_lc||5.006000|
1493 is_uni_cntrl||5.006000|
1494 is_uni_digit_lc||5.006000|
1495 is_uni_digit||5.006000|
1496 is_uni_graph_lc||5.006000|
1497 is_uni_graph||5.006000|
1498 is_uni_idfirst_lc||5.006000|
1499 is_uni_idfirst||5.006000|
1500 is_uni_lower_lc||5.006000|
1501 is_uni_lower||5.006000|
1502 is_uni_print_lc||5.006000|
1503 is_uni_print||5.006000|
1504 is_uni_punct_lc||5.006000|
1505 is_uni_punct||5.006000|
1506 is_uni_space_lc||5.006000|
1507 is_uni_space||5.006000|
1508 is_uni_upper_lc||5.006000|
1509 is_uni_upper||5.006000|
1510 is_uni_xdigit_lc||5.006000|
1511 is_uni_xdigit||5.006000|
1512 is_utf8_alnumc||5.006000|
1513 is_utf8_alnum||5.006000|
1514 is_utf8_alpha||5.006000|
1515 is_utf8_ascii||5.006000|
1516 is_utf8_char_slow|||n
1517 is_utf8_char||5.006000|
1518 is_utf8_cntrl||5.006000|
1520 is_utf8_digit||5.006000|
1521 is_utf8_graph||5.006000|
1522 is_utf8_idcont||5.008000|
1523 is_utf8_idfirst||5.006000|
1524 is_utf8_lower||5.006000|
1525 is_utf8_mark||5.006000|
1526 is_utf8_print||5.006000|
1527 is_utf8_punct||5.006000|
1528 is_utf8_space||5.006000|
1529 is_utf8_string_loclen||5.009003|
1530 is_utf8_string_loc||5.008001|
1531 is_utf8_string||5.006001|
1532 is_utf8_upper||5.006000|
1533 is_utf8_xdigit||5.006000|
1546 load_module_nocontext|||vn
1547 load_module|5.006000||pv
1550 looks_like_number|||
1565 magic_clear_all_env|||
1571 magic_dump||5.006000|
1573 magic_freearylen_p|||
1586 magic_killbackrefs|||
1591 magic_regdata_cnt|||
1592 magic_regdatum_get|||
1593 magic_regdatum_set|||
1595 magic_set_all_env|||
1598 magic_setcollxfrm|||
1620 make_trie_failtable|||
1622 malloc_good_size|||n
1626 matcher_matches_sv|||
1642 mg_length||5.005000|
1647 mini_mktime||5.007002|
1649 mode_from_discipline|||
1655 mro_get_linear_isa_c3|||
1656 mro_get_linear_isa_dfs|||
1657 mro_get_linear_isa||5.009005|
1658 mro_isa_changed_in|||
1661 mro_method_changed_in||5.009005|
1682 my_failure_exit||5.004000|
1683 my_fflush_all||5.006000|
1706 my_memcmp||5.004000|n
1709 my_pclose||5.004000|
1710 my_popen_list||5.007001|
1713 my_snprintf|5.009004||pvn
1714 my_socketpair||5.007003|n
1715 my_sprintf|5.009003||pvn
1717 my_strftime||5.007002|
1718 my_strlcat|5.009004||pn
1719 my_strlcpy|5.009004||pn
1723 my_vsnprintf||5.009004|n
1726 newANONATTRSUB||5.006000|
1731 newATTRSUB||5.006000|
1736 newCONSTSUB|5.004050||p
1741 newGIVENOP||5.009003|
1765 newRV_inc|5.004000||p
1766 newRV_noinc|5.004000||p
1773 newSV_type||5.009005|
1777 newSVpvf_nocontext|||vn
1778 newSVpvf||5.004000|v
1779 newSVpvn_flags|5.011000||p
1780 newSVpvn_share|5.007001||p
1781 newSVpvn_utf8|5.011000||p
1782 newSVpvn|5.004050||p
1783 newSVpvs_flags|5.011000||p
1784 newSVpvs_share||5.009003|
1785 newSVpvs|5.009003||p
1793 newWHENOP||5.009003|
1794 newWHILEOP||5.009003|
1795 newXS_flags||5.009004|
1796 newXSproto||5.006000|
1798 new_collate||5.006000|
1800 new_ctype||5.006000|
1803 new_numeric||5.006000|
1804 new_stackinfo||5.005000|
1805 new_version||5.009000|
1806 new_warnings_bitfield|||
1811 no_bareword_allowed|||
1815 nothreadhook||5.008000|
1831 op_refcnt_lock||5.009002|
1832 op_refcnt_unlock||5.009002|
1835 pMY_CXT_|5.007003||p
1839 packWARN|5.007003||p
1849 pad_compname_type|||
1852 pad_fixup_inner_anons|||
1865 parse_unicode_opts|||
1868 path_is_absolute|||n
1870 pending_Slabs_to_ro|||
1871 perl_alloc_using|||n
1873 perl_clone_using|||n
1876 perl_destruct||5.007003|n
1878 perl_parse||5.006000|n
1883 pmop_dump||5.006000|
1890 pregfree2||5.011000|
1895 printf_nocontext|||vn
1896 process_special_blocks|||
1897 ptr_table_clear||5.009005|
1898 ptr_table_fetch||5.009005|
1900 ptr_table_free||5.009005|
1901 ptr_table_new||5.009005|
1902 ptr_table_split||5.009005|
1903 ptr_table_store||5.009005|
1906 pv_display|5.006000||p
1907 pv_escape|5.009004||p
1908 pv_pretty|5.009004||p
1909 pv_uni_display||5.007003|
1912 re_compile||5.009005|
1915 re_intuit_start||5.009005|
1916 re_intuit_string||5.006000|
1917 readpipe_override|||
1921 reentrant_retry|||vn
1923 ref_array_or_hash|||
1924 refcounted_he_chain_2hv|||
1925 refcounted_he_fetch|||
1926 refcounted_he_free|||
1927 refcounted_he_new_common|||
1928 refcounted_he_new|||
1929 refcounted_he_value|||
1933 reg_check_named_buff_matched|||
1934 reg_named_buff_all||5.009005|
1935 reg_named_buff_exists||5.009005|
1936 reg_named_buff_fetch||5.009005|
1937 reg_named_buff_firstkey||5.009005|
1938 reg_named_buff_iter|||
1939 reg_named_buff_nextkey||5.009005|
1940 reg_named_buff_scalar||5.009005|
1944 reg_numbered_buff_fetch|||
1945 reg_numbered_buff_length|||
1946 reg_numbered_buff_store|||
1955 regclass_swash||5.009004|
1963 regexec_flags||5.005000|
1964 regfree_internal||5.009005|
1969 reginitcolors||5.006000|
1986 require_pv||5.006000|
1992 rsignal_state||5.004000|
1996 runops_debug||5.005000|
1997 runops_standard||5.005000|
2002 safesyscalloc||5.006000|n
2003 safesysfree||5.006000|n
2004 safesysmalloc||5.006000|n
2005 safesysrealloc||5.006000|n
2010 save_aelem||5.004050|
2011 save_alloc||5.006000|
2014 save_bool||5.008001|
2017 save_destructor_x||5.006000|
2018 save_destructor||5.006000|
2022 save_generic_pvref||5.006001|
2023 save_generic_svref||5.005030|
2027 save_helem||5.004050|
2036 save_mortalizesv||5.007001|
2039 save_padsv_and_mortalize||5.011000|
2041 save_re_context||5.006000|
2044 save_set_svflags||5.009000|
2045 save_shared_pvref||5.007003|
2048 save_vptr||5.006000|
2052 savesharedpvn||5.009005|
2053 savesharedpv||5.007003|
2054 savestack_grow_cnt||5.008001|
2078 scan_version||5.009001|
2079 scan_vstring||5.009005|
2082 screaminstr||5.005000|
2087 set_context||5.006000|n
2088 set_numeric_local||5.006000|
2089 set_numeric_radix||5.006000|
2090 set_numeric_standard||5.006000|
2094 share_hek||5.004000|
2106 sortsv_flags||5.009003|
2108 space_join_names_mortal|||
2113 start_subparse||5.004000|
2114 stashpv_hvname_match||5.011000|
2123 str_to_version||5.006000|
2136 sv_2iuv_non_preserve|||
2137 sv_2iv_flags||5.009001|
2142 sv_2pv_flags|5.007002||p
2143 sv_2pv_nolen|5.006000||p
2144 sv_2pvbyte_nolen|5.006000||p
2145 sv_2pvbyte|5.006000||p
2146 sv_2pvutf8_nolen||5.006000|
2147 sv_2pvutf8||5.006000|
2149 sv_2uv_flags||5.009001|
2155 sv_cat_decode||5.008001|
2156 sv_catpv_mg|5.004050||p
2157 sv_catpvf_mg_nocontext|||pvn
2158 sv_catpvf_mg|5.006000|5.004000|pv
2159 sv_catpvf_nocontext|||vn
2160 sv_catpvf||5.004000|v
2161 sv_catpvn_flags||5.007002|
2162 sv_catpvn_mg|5.004050||p
2163 sv_catpvn_nomg|5.007002||p
2165 sv_catpvs|5.009003||p
2167 sv_catsv_flags||5.007002|
2168 sv_catsv_mg|5.004050||p
2169 sv_catsv_nomg|5.007002||p
2177 sv_cmp_locale||5.004000|
2180 sv_compile_2op||5.008001|
2181 sv_copypv||5.007003|
2184 sv_derived_from||5.004000|
2185 sv_destroyable||5.010000|
2191 sv_force_normal_flags||5.007001|
2192 sv_force_normal||5.006000|
2200 sv_insert_flags||5.011000|
2206 sv_len_utf8||5.006000|
2208 sv_magic_portable|5.011000|5.004000|p
2209 sv_magicext||5.007003|
2215 sv_nolocking||5.007003|
2216 sv_nosharing||5.007003|
2220 sv_pos_b2u_midway|||
2221 sv_pos_b2u||5.006000|
2222 sv_pos_u2b_cached|||
2223 sv_pos_u2b_forwards|||n
2224 sv_pos_u2b_midway|||n
2225 sv_pos_u2b||5.006000|
2226 sv_pvbyten_force||5.006000|
2227 sv_pvbyten||5.006000|
2228 sv_pvbyte||5.006000|
2229 sv_pvn_force_flags|5.007002||p
2231 sv_pvn_nomg|5.007003|5.005000|p
2233 sv_pvutf8n_force||5.006000|
2234 sv_pvutf8n||5.006000|
2235 sv_pvutf8||5.006000|
2237 sv_recode_to_utf8||5.007003|
2243 sv_rvweaken||5.006000|
2244 sv_setiv_mg|5.004050||p
2246 sv_setnv_mg|5.006000||p
2248 sv_setpv_mg|5.004050||p
2249 sv_setpvf_mg_nocontext|||pvn
2250 sv_setpvf_mg|5.006000|5.004000|pv
2251 sv_setpvf_nocontext|||vn
2252 sv_setpvf||5.004000|v
2253 sv_setpviv_mg||5.008001|
2254 sv_setpviv||5.008001|
2255 sv_setpvn_mg|5.004050||p
2257 sv_setpvs|5.009004||p
2263 sv_setref_uv||5.007001|
2265 sv_setsv_flags||5.007002|
2266 sv_setsv_mg|5.004050||p
2267 sv_setsv_nomg|5.007002||p
2269 sv_setuv_mg|5.004050||p
2270 sv_setuv|5.004000||p
2271 sv_tainted||5.004000|
2275 sv_uni_display||5.007003|
2277 sv_unref_flags||5.007001|
2279 sv_untaint||5.004000|
2281 sv_usepvn_flags||5.009004|
2282 sv_usepvn_mg|5.004050||p
2284 sv_utf8_decode||5.006000|
2285 sv_utf8_downgrade||5.006000|
2286 sv_utf8_encode||5.006000|
2287 sv_utf8_upgrade_flags||5.007002|
2288 sv_utf8_upgrade||5.007001|
2290 sv_vcatpvf_mg|5.006000|5.004000|p
2291 sv_vcatpvfn||5.004000|
2292 sv_vcatpvf|5.006000|5.004000|p
2293 sv_vsetpvf_mg|5.006000|5.004000|p
2294 sv_vsetpvfn||5.004000|
2295 sv_vsetpvf|5.006000|5.004000|p
2300 swash_fetch||5.007002|
2302 swash_init||5.006000|
2303 sys_init3||5.010000|n
2304 sys_init||5.010000|n
2308 sys_term||5.010000|n
2311 tmps_grow||5.006000|
2315 to_uni_fold||5.007003|
2316 to_uni_lower_lc||5.006000|
2317 to_uni_lower||5.007003|
2318 to_uni_title_lc||5.006000|
2319 to_uni_title||5.007003|
2320 to_uni_upper_lc||5.006000|
2321 to_uni_upper||5.007003|
2322 to_utf8_case||5.007003|
2323 to_utf8_fold||5.007003|
2324 to_utf8_lower||5.007003|
2326 to_utf8_title||5.007003|
2327 to_utf8_upper||5.007003|
2333 too_few_arguments|||
2334 too_many_arguments|||
2338 unpack_str||5.007003|
2339 unpackstring||5.008001|
2340 unshare_hek_or_pvn|||
2342 unsharepvn||5.004000|
2343 unwind_handler_stack|||
2344 update_debugger_info|||
2345 upg_version||5.009005|
2347 utf16_to_utf8_reversed||5.006001|
2348 utf16_to_utf8||5.006001|
2349 utf8_distance||5.006000|
2351 utf8_length||5.007001|
2352 utf8_mg_pos_cache_update|||
2353 utf8_to_bytes||5.006001|
2354 utf8_to_uvchr||5.007001|
2355 utf8_to_uvuni||5.007001|
2357 utf8n_to_uvuni||5.007001|
2359 uvchr_to_utf8_flags||5.007003|
2361 uvuni_to_utf8_flags||5.007003|
2362 uvuni_to_utf8||5.007001|
2369 vdie_croak_common|||
2375 vload_module|5.006000||p
2377 vnewSVpvf|5.006000|5.004000|p
2380 vstringify||5.009000|
2386 warner_nocontext|||vn
2387 warner|5.006000|5.004000|pv
2407 if (exists $opt{'list-unsupported'}) {
2409 for $f (sort { lc $a cmp lc $b } keys %API) {
2410 next unless $API{$f}{todo};
2411 print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n";
2416 # Scan for possible replacement candidates
2418 my(%replace, %need, %hints, %warnings, %depends);
2420 my($hint, $define, $function);
2426 / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
2427 | "[^"\\]*(?:\\.[^"\\]*)*"
2428 | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx;
2429 grep { exists $API{$_} } $code =~ /(\w+)/mg;
2434 my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings;
2435 if (m{^\s*\*\s(.*?)\s*$}) {
2436 for (@{$hint->[1]}) {
2437 $h->{$_} ||= ''; # suppress warning with older perls
2441 else { undef $hint }
2444 $hint = [$1, [split /,?\s+/, $2]]
2445 if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$};
2448 if ($define->[1] =~ /\\$/) {
2452 if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) {
2453 my @n = find_api($define->[1]);
2454 push @{$depends{$define->[0]}}, @n if @n
2460 $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)};
2464 if (exists $API{$function->[0]}) {
2465 my @n = find_api($function->[1]);
2466 push @{$depends{$function->[0]}}, @n if @n
2471 $function->[1] .= $_;
2475 $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)};
2477 $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$};
2478 $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)};
2479 $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce};
2480 $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$};
2482 if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) {
2483 my @deps = map { s/\s+//g; $_ } split /,/, $3;
2485 for $d (map { s/\s+//g; $_ } split /,/, $1) {
2486 push @{$depends{$d}}, @deps;
2490 $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)};
2493 for (values %depends) {
2495 $_ = [sort grep !$s{$_}++, @$_];
2498 if (exists $opt{'api-info'}) {
2501 my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$";
2502 for $f (sort { lc $a cmp lc $b } keys %API) {
2503 next unless $f =~ /$match/;
2504 print "\n=== $f ===\n\n";
2506 if ($API{$f}{base} || $API{$f}{todo}) {
2507 my $base = format_version($API{$f}{base} || $API{$f}{todo});
2508 print "Supported at least starting from perl-$base.\n";
2511 if ($API{$f}{provided}) {
2512 my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003";
2513 print "Support by $ppport provided back to perl-$todo.\n";
2514 print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f};
2515 print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f};
2516 print "\n$hints{$f}" if exists $hints{$f};
2517 print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f};
2520 print "No portability information available.\n" unless $info;
2523 $count or print "Found no API matching '$opt{'api-info'}'.";
2528 if (exists $opt{'list-provided'}) {
2530 for $f (sort { lc $a cmp lc $b } keys %API) {
2531 next unless $API{$f}{provided};
2533 push @flags, 'explicit' if exists $need{$f};
2534 push @flags, 'depend' if exists $depends{$f};
2535 push @flags, 'hint' if exists $hints{$f};
2536 push @flags, 'warning' if exists $warnings{$f};
2537 my $flags = @flags ? ' ['.join(', ', @flags).']' : '';
2544 my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc );
2545 my $srcext = join '|', map { quotemeta $_ } @srcext;
2552 push @files, $_ unless $seen{$_}++;
2554 else { warn "'$_' is not a file.\n" }
2557 my @new = grep { -f } glob $_
2558 or warn "'$_' does not exist.\n";
2559 push @files, grep { !$seen{$_}++ } @new;
2566 File::Find::find(sub {
2567 $File::Find::name =~ /($srcext)$/i
2568 and push @files, $File::Find::name;
2572 @files = map { glob "*$_" } @srcext;
2576 if (!@ARGV || $opt{filter}) {
2578 my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files;
2580 my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i;
2581 push @{ $out ? \@out : \@in }, $_;
2583 if (@ARGV && @out) {
2584 warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out);
2589 die "No input files given!\n" unless @files;
2591 my(%files, %global, %revreplace);
2592 %revreplace = reverse %replace;
2594 my $patch_opened = 0;
2596 for $filename (@files) {
2597 unless (open IN, "<$filename") {
2598 warn "Unable to read from $filename: $!\n";
2602 info("Scanning $filename ...");
2604 my $c = do { local $/; <IN> };
2607 my %file = (orig => $c, changes => 0);
2609 # Temporarily remove C/XS comments and strings from the code
2613 ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]*
2614 | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* )
2616 | "[^"\\]*(?:\\.[^"\\]*)*"
2617 | '[^'\\]*(?:\\.[^'\\]*)*'
2618 | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) )
2619 }{ defined $2 and push @ccom, $2;
2620 defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex;
2622 $file{ccom} = \@ccom;
2624 $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m;
2628 for $func (keys %API) {
2630 $match .= "|$revreplace{$func}" if exists $revreplace{$func};
2631 if ($c =~ /\b(?:Perl_)?($match)\b/) {
2632 $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func};
2633 $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/;
2634 if (exists $API{$func}{provided}) {
2635 $file{uses_provided}{$func}++;
2636 if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) {
2637 $file{uses}{$func}++;
2638 my @deps = rec_depend($func);
2640 $file{uses_deps}{$func} = \@deps;
2642 $file{uses}{$_} = 0 unless exists $file{uses}{$_};
2645 for ($func, @deps) {
2646 $file{needs}{$_} = 'static' if exists $need{$_};
2650 if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) {
2651 if ($c =~ /\b$func\b/) {
2652 $file{uses_todo}{$func}++;
2658 while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) {
2659 if (exists $need{$2}) {
2660 $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++;
2662 else { warning("Possibly wrong #define $1 in $filename") }
2665 for (qw(uses needs uses_todo needed_global needed_static)) {
2666 for $func (keys %{$file{$_}}) {
2667 push @{$global{$_}{$func}}, $filename;
2671 $files{$filename} = \%file;
2674 # Globally resolve NEED_'s
2676 for $need (keys %{$global{needs}}) {
2677 if (@{$global{needs}{$need}} > 1) {
2678 my @targets = @{$global{needs}{$need}};
2679 my @t = grep $files{$_}{needed_global}{$need}, @targets;
2680 @targets = @t if @t;
2681 @t = grep /\.xs$/i, @targets;
2682 @targets = @t if @t;
2683 my $target = shift @targets;
2684 $files{$target}{needs}{$need} = 'global';
2685 for (@{$global{needs}{$need}}) {
2686 $files{$_}{needs}{$need} = 'extern' if $_ ne $target;
2691 for $filename (@files) {
2692 exists $files{$filename} or next;
2694 info("=== Analyzing $filename ===");
2696 my %file = %{$files{$filename}};
2698 my $c = $file{code};
2701 for $func (sort keys %{$file{uses_Perl}}) {
2702 if ($API{$func}{varargs}) {
2703 unless ($API{$func}{nothxarg}) {
2704 my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))}
2705 { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge);
2707 warning("Doesn't pass interpreter argument aTHX to Perl_$func");
2708 $file{changes} += $changes;
2713 warning("Uses Perl_$func instead of $func");
2714 $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*}
2719 for $func (sort keys %{$file{uses_replace}}) {
2720 warning("Uses $func instead of $replace{$func}");
2721 $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
2724 for $func (sort keys %{$file{uses_provided}}) {
2725 if ($file{uses}{$func}) {
2726 if (exists $file{uses_deps}{$func}) {
2727 diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}}));
2733 $warnings += hint($func);
2736 unless ($opt{quiet}) {
2737 for $func (sort keys %{$file{uses_todo}}) {
2738 print "*** WARNING: Uses $func, which may not be portable below perl ",
2739 format_version($API{$func}{todo}), ", even with '$ppport'\n";
2744 for $func (sort keys %{$file{needed_static}}) {
2746 if (not exists $file{uses}{$func}) {
2747 $message = "No need to define NEED_$func if $func is never used";
2749 elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
2750 $message = "No need to define NEED_$func when already needed globally";
2754 $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
2758 for $func (sort keys %{$file{needed_global}}) {
2760 if (not exists $global{uses}{$func}) {
2761 $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
2763 elsif (exists $file{needs}{$func}) {
2764 if ($file{needs}{$func} eq 'extern') {
2765 $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
2767 elsif ($file{needs}{$func} eq 'static') {
2768 $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
2773 $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
2777 $file{needs_inc_ppport} = keys %{$file{uses}};
2779 if ($file{needs_inc_ppport}) {
2782 for $func (sort keys %{$file{needs}}) {
2783 my $type = $file{needs}{$func};
2784 next if $type eq 'extern';
2785 my $suffix = $type eq 'global' ? '_GLOBAL' : '';
2786 unless (exists $file{"needed_$type"}{$func}) {
2787 if ($type eq 'global') {
2788 diag("Files [@{$global{needs}{$func}}] need $func, adding global request");
2791 diag("File needs $func, adding static request");
2793 $pp .= "#define NEED_$func$suffix\n";
2797 if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
2802 unless ($file{has_inc_ppport}) {
2803 diag("Needs to include '$ppport'");
2804 $pp .= qq(#include "$ppport"\n)
2808 $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms)
2809 || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m)
2810 || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m)
2811 || ($c =~ s/^/$pp/);
2815 if ($file{has_inc_ppport}) {
2816 diag("No need to include '$ppport'");
2817 $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m);
2821 # put back in our C comments
2824 my @ccom = @{$file{ccom}};
2825 for $ix (0 .. $#ccom) {
2826 if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) {
2828 $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/;
2831 $c =~ s/$rccs$ix$rcce/$ccom[$ix]/;
2836 my $s = $cppc != 1 ? 's' : '';
2837 warning("Uses $cppc C++ style comment$s, which is not portable");
2840 my $s = $warnings != 1 ? 's' : '';
2841 my $warn = $warnings ? " ($warnings warning$s)" : '';
2842 info("Analysis completed$warn");
2844 if ($file{changes}) {
2845 if (exists $opt{copy}) {
2846 my $newfile = "$filename$opt{copy}";
2848 error("'$newfile' already exists, refusing to write copy of '$filename'");
2852 if (open F, ">$newfile") {
2853 info("Writing copy of '$filename' with changes to '$newfile'");
2858 error("Cannot open '$newfile' for writing: $!");
2862 elsif (exists $opt{patch} || $opt{changes}) {
2863 if (exists $opt{patch}) {
2864 unless ($patch_opened) {
2865 if (open PATCH, ">$opt{patch}") {
2869 error("Cannot open '$opt{patch}' for writing: $!");
2875 mydiff(\*PATCH, $filename, $c);
2879 info("Suggested changes:");
2880 mydiff(\*STDOUT, $filename, $c);
2884 my $s = $file{changes} == 1 ? '' : 's';
2885 info("$file{changes} potentially required change$s detected");
2893 close PATCH if $patch_opened;
2898 sub try_use { eval "use @_;"; return $@ eq '' }
2903 my($file, $str) = @_;
2906 if (exists $opt{diff}) {
2907 $diff = run_diff($opt{diff}, $file, $str);
2910 if (!defined $diff and try_use('Text::Diff')) {
2911 $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' });
2912 $diff = <<HEADER . $diff;
2918 if (!defined $diff) {
2919 $diff = run_diff('diff -u', $file, $str);
2922 if (!defined $diff) {
2923 $diff = run_diff('diff', $file, $str);
2926 if (!defined $diff) {
2927 error("Cannot generate a diff. Please install Text::Diff or use --copy.");
2936 my($prog, $file, $str) = @_;
2937 my $tmp = 'dppptemp';
2942 while (-e "$tmp.$suf") { $suf++ }
2945 if (open F, ">$tmp") {
2949 if (open F, "$prog $file $tmp |") {
2951 s/\Q$tmp\E/$file.patched/;
2962 error("Cannot open '$tmp' for writing: $!");
2970 my($func, $seen) = @_;
2971 return () unless exists $depends{$func};
2972 $seen = {%{$seen||{}}};
2973 return () if $seen->{$func}++;
2975 grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}};
2982 if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) {
2983 return ($1, $2, $3);
2985 elsif ($ver !~ /^\d+\.[\d_]+$/) {
2986 die "cannot parse version '$ver'\n";
2990 $ver =~ s/$/000000/;
2992 my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
2997 if ($r < 5 || ($r == 5 && $v < 6)) {
2999 die "cannot parse version '$ver'\n";
3003 return ($r, $v, $s);
3010 $ver =~ s/$/000000/;
3011 my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
3016 if ($r < 5 || ($r == 5 && $v < 6)) {
3018 die "invalid version '$ver'\n";
3022 $ver = sprintf "%d.%03d", $r, $v;
3023 $s > 0 and $ver .= sprintf "_%02d", $s;
3028 return sprintf "%d.%d.%d", $r, $v, $s;
3033 $opt{quiet} and return;
3039 $opt{quiet} and return;
3040 $opt{diag} and print @_, "\n";
3045 $opt{quiet} and return;
3046 print "*** ", @_, "\n";
3051 print "*** ERROR: ", @_, "\n";
3058 $opt{quiet} and return;
3061 if (exists $warnings{$func} && !$given_warnings{$func}++) {
3062 my $warn = $warnings{$func};
3063 $warn =~ s!^!*** !mg;
3064 print "*** WARNING: $func\n", $warn;
3067 if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) {
3068 my $hint = $hints{$func};
3070 print " --- hint for $func ---\n", $hint;
3077 my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
3078 my %M = ( 'I' => '*' );
3079 $usage =~ s/^\s*perl\s+\S+/$^X $0/;
3080 $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
3086 See perldoc $0 for details.
3095 my $self = do { local(@ARGV,$/)=($0); <> };
3096 my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
3097 $copy =~ s/^(?=\S+)/ /gms;
3098 $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
3099 $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
3100 if (\@ARGV && \$ARGV[0] eq '--unstrip') {
3101 eval { require Devel::PPPort };
3102 \$@ and die "Cannot require Devel::PPPort, please install.\\n";
3103 if (\$Devel::PPPort::VERSION < $VERSION) {
3104 die "$0 was originally generated with Devel::PPPort $VERSION.\\n"
3105 . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n"
3106 . "Please install a newer version, or --unstrip will not work.\\n";
3108 Devel::PPPort::WriteFile(\$0);
3113 Sorry, but this is a stripped version of \$0.
3115 To be able to use its original script and doc functionality,
3116 please try to regenerate this file using:
3122 my($pl, $c) = $self =~ /(.*^__DATA__)(.*)/ms;
3124 / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
3125 | ( "[^"\\]*(?:\\.[^"\\]*)*"
3126 | '[^'\\]*(?:\\.[^'\\]*)*' )
3127 | ($HS+) }{ defined $2 ? ' ' : ($1 || '') }gsex;
3130 $c =~ s!^\s*#\s*!#!mg;
3133 open OUT, ">$0" or die "cannot strip $0: $!\n";
3134 print OUT "$pl$c\n";
3142 #ifndef _P_P_PORTABILITY_H_
3143 #define _P_P_PORTABILITY_H_
3145 #ifndef DPPP_NAMESPACE
3146 # define DPPP_NAMESPACE DPPP_
3149 #define DPPP_CAT2(x,y) CAT2(x,y)
3150 #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
3152 #ifndef PERL_REVISION
3153 # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
3154 # define PERL_PATCHLEVEL_H_IMPLICIT
3155 # include <patchlevel.h>
3157 # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
3158 # include <could_not_find_Perl_patchlevel.h>
3160 # ifndef PERL_REVISION
3161 # define PERL_REVISION (5)
3163 # define PERL_VERSION PATCHLEVEL
3164 # define PERL_SUBVERSION SUBVERSION
3165 /* Replace PERL_PATCHLEVEL with PERL_VERSION */
3170 #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
3171 #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
3173 /* It is very unlikely that anyone will try to use this with Perl 6
3174 (or greater), but who knows.
3176 #if PERL_REVISION != 5
3177 # error ppport.h only works with Perl version 5
3178 #endif /* PERL_REVISION != 5 */
3187 # define dTHXa(x) dNOOP
3205 #if (PERL_BCDVERSION < 0x5006000)
3208 # define aTHXR_ thr,
3216 # define aTHXR_ aTHX_
3220 # define dTHXoa(x) dTHXa(x)
3224 # include <limits.h>
3227 #ifndef PERL_UCHAR_MIN
3228 # define PERL_UCHAR_MIN ((unsigned char)0)
3231 #ifndef PERL_UCHAR_MAX
3233 # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
3236 # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
3238 # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
3243 #ifndef PERL_USHORT_MIN
3244 # define PERL_USHORT_MIN ((unsigned short)0)
3247 #ifndef PERL_USHORT_MAX
3249 # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
3252 # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
3255 # define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
3257 # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
3263 #ifndef PERL_SHORT_MAX
3265 # define PERL_SHORT_MAX ((short)SHORT_MAX)
3267 # ifdef MAXSHORT /* Often used in <values.h> */
3268 # define PERL_SHORT_MAX ((short)MAXSHORT)
3271 # define PERL_SHORT_MAX ((short)SHRT_MAX)
3273 # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
3279 #ifndef PERL_SHORT_MIN
3281 # define PERL_SHORT_MIN ((short)SHORT_MIN)
3284 # define PERL_SHORT_MIN ((short)MINSHORT)
3287 # define PERL_SHORT_MIN ((short)SHRT_MIN)
3289 # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
3295 #ifndef PERL_UINT_MAX
3297 # define PERL_UINT_MAX ((unsigned int)UINT_MAX)
3300 # define PERL_UINT_MAX ((unsigned int)MAXUINT)
3302 # define PERL_UINT_MAX (~(unsigned int)0)
3307 #ifndef PERL_UINT_MIN
3308 # define PERL_UINT_MIN ((unsigned int)0)
3311 #ifndef PERL_INT_MAX
3313 # define PERL_INT_MAX ((int)INT_MAX)
3315 # ifdef MAXINT /* Often used in <values.h> */
3316 # define PERL_INT_MAX ((int)MAXINT)
3318 # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
3323 #ifndef PERL_INT_MIN
3325 # define PERL_INT_MIN ((int)INT_MIN)
3328 # define PERL_INT_MIN ((int)MININT)
3330 # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
3335 #ifndef PERL_ULONG_MAX
3337 # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
3340 # define PERL_ULONG_MAX ((unsigned long)MAXULONG)
3342 # define PERL_ULONG_MAX (~(unsigned long)0)
3347 #ifndef PERL_ULONG_MIN
3348 # define PERL_ULONG_MIN ((unsigned long)0L)
3351 #ifndef PERL_LONG_MAX
3353 # define PERL_LONG_MAX ((long)LONG_MAX)
3356 # define PERL_LONG_MAX ((long)MAXLONG)
3358 # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
3363 #ifndef PERL_LONG_MIN
3365 # define PERL_LONG_MIN ((long)LONG_MIN)
3368 # define PERL_LONG_MIN ((long)MINLONG)
3370 # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
3375 #if defined(HAS_QUAD) && (defined(convex) || defined(uts))
3376 # ifndef PERL_UQUAD_MAX
3377 # ifdef ULONGLONG_MAX
3378 # define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX)
3380 # ifdef MAXULONGLONG
3381 # define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG)
3383 # define PERL_UQUAD_MAX (~(unsigned long long)0)
3388 # ifndef PERL_UQUAD_MIN
3389 # define PERL_UQUAD_MIN ((unsigned long long)0L)
3392 # ifndef PERL_QUAD_MAX
3393 # ifdef LONGLONG_MAX
3394 # define PERL_QUAD_MAX ((long long)LONGLONG_MAX)
3397 # define PERL_QUAD_MAX ((long long)MAXLONGLONG)
3399 # define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1))
3404 # ifndef PERL_QUAD_MIN
3405 # ifdef LONGLONG_MIN
3406 # define PERL_QUAD_MIN ((long long)LONGLONG_MIN)
3409 # define PERL_QUAD_MIN ((long long)MINLONGLONG)
3411 # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
3417 /* This is based on code from 5.003 perl.h */
3425 # define IV_MIN PERL_INT_MIN
3429 # define IV_MAX PERL_INT_MAX
3433 # define UV_MIN PERL_UINT_MIN
3437 # define UV_MAX PERL_UINT_MAX
3442 # define IVSIZE INTSIZE
3447 # if defined(convex) || defined(uts)
3449 # define IVTYPE long long
3453 # define IV_MIN PERL_QUAD_MIN
3457 # define IV_MAX PERL_QUAD_MAX
3461 # define UV_MIN PERL_UQUAD_MIN
3465 # define UV_MAX PERL_UQUAD_MAX
3468 # ifdef LONGLONGSIZE
3470 # define IVSIZE LONGLONGSIZE
3476 # define IVTYPE long
3480 # define IV_MIN PERL_LONG_MIN
3484 # define IV_MAX PERL_LONG_MAX
3488 # define UV_MIN PERL_ULONG_MIN
3492 # define UV_MAX PERL_ULONG_MAX
3497 # define IVSIZE LONGSIZE
3507 #ifndef PERL_QUAD_MIN
3508 # define PERL_QUAD_MIN IV_MIN
3511 #ifndef PERL_QUAD_MAX
3512 # define PERL_QUAD_MAX IV_MAX
3515 #ifndef PERL_UQUAD_MIN
3516 # define PERL_UQUAD_MIN UV_MIN
3519 #ifndef PERL_UQUAD_MAX
3520 # define PERL_UQUAD_MAX UV_MAX
3525 # define IVTYPE long
3529 # define IV_MIN PERL_LONG_MIN
3533 # define IV_MAX PERL_LONG_MAX
3537 # define UV_MIN PERL_ULONG_MIN
3541 # define UV_MAX PERL_ULONG_MAX
3548 # define IVSIZE LONGSIZE
3550 # define IVSIZE 4 /* A bold guess, but the best we can make. */
3554 # define UVTYPE unsigned IVTYPE
3558 # define UVSIZE IVSIZE
3561 # define sv_setuv(sv, uv) \
3564 if (TeMpUv <= IV_MAX) \
3565 sv_setiv(sv, TeMpUv); \
3567 sv_setnv(sv, (double)TeMpUv); \
3571 # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
3574 # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
3578 # define SvUVX(sv) ((UV)SvIVX(sv))
3582 # define SvUVXx(sv) SvUVX(sv)
3586 # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
3590 # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv))
3594 * Always use the SvUVx() macro instead of sv_uv().
3597 # define sv_uv(sv) SvUVx(sv)
3600 #if !defined(SvUOK) && defined(SvIOK_UV)
3601 # define SvUOK(sv) SvIOK_UV(sv)
3604 # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
3608 # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END
3611 # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
3615 # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
3620 # define memNE(s1,s2,l) (memcmp(s1,s2,l))
3624 # define memEQ(s1,s2,l) (!memcmp(s1,s2,l))
3629 # define memNE(s1,s2,l) (bcmp(s1,s2,l))
3633 # define memEQ(s1,s2,l) (!bcmp(s1,s2,l))
3638 # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t))
3642 # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
3647 # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t))
3652 # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d)
3657 # define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t))
3661 # define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB)
3665 # define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF)
3669 # define Poison(d,n,t) PoisonFree(d,n,t)
3672 # define Newx(v,n,t) New(0,v,n,t)
3676 # define Newxc(v,n,t,c) Newc(0,v,n,t,c)
3680 # define Newxz(v,n,t) Newz(0,v,n,t)
3683 #ifndef PERL_UNUSED_DECL
3684 # ifdef HASATTRIBUTE
3685 # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
3686 # define PERL_UNUSED_DECL
3688 # define PERL_UNUSED_DECL __attribute__((unused))
3691 # define PERL_UNUSED_DECL
3695 #ifndef PERL_UNUSED_ARG
3696 # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
3698 # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
3700 # define PERL_UNUSED_ARG(x) ((void)x)
3704 #ifndef PERL_UNUSED_VAR
3705 # define PERL_UNUSED_VAR(x) ((void)x)
3708 #ifndef PERL_UNUSED_CONTEXT
3709 # ifdef USE_ITHREADS
3710 # define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
3712 # define PERL_UNUSED_CONTEXT
3716 # define NOOP /*EMPTY*/(void)0
3720 # define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
3724 # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
3725 # define NVTYPE long double
3727 # define NVTYPE double
3734 # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
3736 # define INT2PTR(any,d) (any)(d)
3738 # if PTRSIZE == LONGSIZE
3739 # define PTRV unsigned long
3741 # define PTRV unsigned
3743 # define INT2PTR(any,d) (any)(PTRV)(d)
3746 # define NUM2PTR(any,d) (any)(PTRV)(d)
3747 # define PTR2IV(p) INT2PTR(IV,p)
3748 # define PTR2UV(p) INT2PTR(UV,p)
3749 # define PTR2NV(p) NUM2PTR(NV,p)
3751 # if PTRSIZE == LONGSIZE
3752 # define PTR2ul(p) (unsigned long)(p)
3754 # define PTR2ul(p) INT2PTR(unsigned long,p)
3757 #endif /* !INT2PTR */
3759 #undef START_EXTERN_C
3763 # define START_EXTERN_C extern "C" {
3764 # define END_EXTERN_C }
3765 # define EXTERN_C extern "C"
3767 # define START_EXTERN_C
3768 # define END_EXTERN_C
3769 # define EXTERN_C extern
3772 #if defined(PERL_GCC_PEDANTIC)
3773 # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
3774 # define PERL_GCC_BRACE_GROUPS_FORBIDDEN
3778 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
3779 # ifndef PERL_USE_GCC_BRACE_GROUPS
3780 # define PERL_USE_GCC_BRACE_GROUPS
3786 #ifdef PERL_USE_GCC_BRACE_GROUPS
3787 # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
3790 # if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
3791 # define STMT_START if (1)
3792 # define STMT_END else (void)0
3794 # define STMT_START do
3795 # define STMT_END while (0)
3799 # define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
3802 /* DEFSV appears first in 5.004_56 */
3804 # define DEFSV GvSV(PL_defgv)
3808 # define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
3811 /* Older perls (<=5.003) lack AvFILLp */
3813 # define AvFILLp AvFILL
3816 # define ERRSV get_sv("@",FALSE)
3819 /* Hint: gv_stashpvn
3820 * This function's backport doesn't support the length parameter, but
3821 * rather ignores it. Portability can only be ensured if the length
3822 * parameter is used for speed reasons, but the length can always be
3823 * correctly computed from the string argument.
3826 # define gv_stashpvn(str,len,create) gv_stashpv(str,create)
3831 # define get_cv perl_get_cv
3835 # define get_sv perl_get_sv
3839 # define get_av perl_get_av
3843 # define get_hv perl_get_hv
3848 # define dUNDERBAR dNOOP
3852 # define UNDERBAR DEFSV
3855 # define dAX I32 ax = MARK - PL_stack_base + 1
3859 # define dITEMS I32 items = SP - MARK
3862 # define dXSTARG SV * targ = sv_newmortal()
3865 # define dAXMARK I32 ax = POPMARK; \
3866 register SV ** const mark = PL_stack_base + ax++
3869 # define XSprePUSH (sp = PL_stack_base + ax - 1)
3872 #if (PERL_BCDVERSION < 0x5005000)
3874 # define XSRETURN(off) \
3876 PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
3881 # define PERL_ABS(x) ((x) < 0 ? -(x) : (x))
3889 #ifndef UTF8_MAXBYTES
3890 # define UTF8_MAXBYTES UTF8_MAXLEN
3893 # define CPERLscope(x) x
3896 # define PERL_HASH(hash,str,len) \
3898 const char *s_PeRlHaSh = str; \
3899 I32 i_PeRlHaSh = len; \
3900 U32 hash_PeRlHaSh = 0; \
3901 while (i_PeRlHaSh--) \
3902 hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
3903 (hash) = hash_PeRlHaSh; \
3907 #ifndef PERLIO_FUNCS_DECL
3908 # ifdef PERLIO_FUNCS_CONST
3909 # define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
3910 # define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
3912 # define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs
3913 # define PERLIO_FUNCS_CAST(funcs) (funcs)
3917 /* provide these typedefs for older perls */
3918 #if (PERL_BCDVERSION < 0x5009003)
3921 typedef OP
* (CPERLscope(*Perl_ppaddr_t
))(ARGSproto
);
3923 typedef OP
* (CPERLscope(*Perl_ppaddr_t
))(pTHX
);
3926 typedef OP
* (CPERLscope(*Perl_check_t
)) (pTHX_ OP
*);
3930 # define isPSXSPC(c) (isSPACE(c) || (c) == '\v')
3934 # define isBLANK(c) ((c) == ' ' || (c) == '\t')
3939 # define isALNUMC(c) isalnum(c)
3943 # define isASCII(c) isascii(c)
3947 # define isCNTRL(c) iscntrl(c)
3951 # define isGRAPH(c) isgraph(c)
3955 # define isPRINT(c) isprint(c)
3959 # define isPUNCT(c) ispunct(c)
3963 # define isXDIGIT(c) isxdigit(c)
3967 # if (PERL_BCDVERSION < 0x5010000)
3969 * The implementation in older perl versions includes all of the
3970 * isSPACE() characters, which is wrong. The version provided by
3971 * Devel::PPPort always overrides a present buggy version.
3976 # define isALNUMC(c) (isALPHA(c) || isDIGIT(c))
3980 # define isASCII(c) ((c) <= 127)
3984 # define isCNTRL(c) ((c) < ' ' || (c) == 127)
3988 # define isGRAPH(c) (isALNUM(c) || isPUNCT(c))
3992 # define isPRINT(c) (((c) >= 32 && (c) < 127))
3996 # define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126))
4000 # define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
4005 #ifndef PERL_SIGNALS_UNSAFE_FLAG
4007 #define PERL_SIGNALS_UNSAFE_FLAG 0x0001
4009 #if (PERL_BCDVERSION < 0x5008000)
4010 # define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG
4012 # define D_PPP_PERL_SIGNALS_INIT 0
4015 #if defined(NEED_PL_signals)
4016 static U32
DPPP_(my_PL_signals
) = D_PPP_PERL_SIGNALS_INIT
;
4017 #elif defined(NEED_PL_signals_GLOBAL)
4018 U32
DPPP_(my_PL_signals
) = D_PPP_PERL_SIGNALS_INIT
;
4020 extern U32
DPPP_(my_PL_signals
);
4022 #define PL_signals DPPP_(my_PL_signals)
4027 * Calling an op via PL_ppaddr requires passing a context argument
4028 * for threaded builds. Since the context argument is different for
4029 * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will
4030 * automatically be defined as the correct argument.
4033 #if (PERL_BCDVERSION <= 0x5005005)
4035 # define PL_ppaddr ppaddr
4036 # define PL_no_modify no_modify
4040 #if (PERL_BCDVERSION <= 0x5004005)
4042 # define PL_DBsignal DBsignal
4043 # define PL_DBsingle DBsingle
4044 # define PL_DBsub DBsub
4045 # define PL_DBtrace DBtrace
4047 # define PL_bufend bufend
4048 # define PL_bufptr bufptr
4049 # define PL_compiling compiling
4050 # define PL_copline copline
4051 # define PL_curcop curcop
4052 # define PL_curstash curstash
4053 # define PL_debstash debstash
4054 # define PL_defgv defgv
4055 # define PL_diehook diehook
4056 # define PL_dirty dirty
4057 # define PL_dowarn dowarn
4058 # define PL_errgv errgv
4059 # define PL_expect expect
4060 # define PL_hexdigit hexdigit
4061 # define PL_hints hints
4062 # define PL_laststatval laststatval
4063 # define PL_lex_state lex_state
4064 # define PL_lex_stuff lex_stuff
4065 # define PL_linestr linestr
4067 # define PL_perl_destruct_level perl_destruct_level
4068 # define PL_perldb perldb
4069 # define PL_rsfp_filters rsfp_filters
4070 # define PL_rsfp rsfp
4071 # define PL_stack_base stack_base
4072 # define PL_stack_sp stack_sp
4073 # define PL_statcache statcache
4074 # define PL_stdingv stdingv
4075 # define PL_sv_arenaroot sv_arenaroot
4076 # define PL_sv_no sv_no
4077 # define PL_sv_undef sv_undef
4078 # define PL_sv_yes sv_yes
4079 # define PL_tainted tainted
4080 # define PL_tainting tainting
4081 # define PL_tokenbuf tokenbuf
4085 /* Warning: PL_parser
4086 * For perl versions earlier than 5.9.5, this is an always
4087 * non-NULL dummy. Also, it cannot be dereferenced. Don't
4088 * use it if you can avoid is and unless you absolutely know
4089 * what you're doing.
4090 * If you always check that PL_parser is non-NULL, you can
4091 * define DPPP_PL_parser_NO_DUMMY to avoid the creation of
4092 * a dummy parser structure.
4095 #if (PERL_BCDVERSION >= 0x5009005)
4096 # ifdef DPPP_PL_parser_NO_DUMMY
4097 # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \
4098 (croak("panic: PL_parser == NULL in %s:%d", \
4099 __FILE__, __LINE__), (yy_parser *) NULL))->var)
4101 # ifdef DPPP_PL_parser_NO_DUMMY_WARNING
4102 # define D_PPP_parser_dummy_warning(var)
4104 # define D_PPP_parser_dummy_warning(var) \
4105 warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__),
4107 # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \
4108 (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var)
4109 #if defined(NEED_PL_parser)
4110 static yy_parser
DPPP_(dummy_PL_parser
);
4111 #elif defined(NEED_PL_parser_GLOBAL)
4112 yy_parser
DPPP_(dummy_PL_parser
);
4114 extern yy_parser
DPPP_(dummy_PL_parser
);
4119 /* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */
4120 /* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf
4121 * Do not use this variable unless you know exactly what you're
4122 * doint. It is internal to the perl parser and may change or even
4123 * be removed in the future. As of perl 5.9.5, you have to check
4124 * for (PL_parser != NULL) for this variable to have any effect.
4125 * An always non-NULL PL_parser dummy is provided for earlier
4127 * If PL_parser is NULL when you try to access this variable, a
4128 * dummy is being accessed instead and a warning is issued unless
4129 * you define DPPP_PL_parser_NO_DUMMY_WARNING.
4130 * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access
4131 * this variable will croak with a panic message.
4134 # define PL_expect D_PPP_my_PL_parser_var(expect)
4135 # define PL_copline D_PPP_my_PL_parser_var(copline)
4136 # define PL_rsfp D_PPP_my_PL_parser_var(rsfp)
4137 # define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters)
4138 # define PL_linestr D_PPP_my_PL_parser_var(linestr)
4139 # define PL_bufptr D_PPP_my_PL_parser_var(bufptr)
4140 # define PL_bufend D_PPP_my_PL_parser_var(bufend)
4141 # define PL_lex_state D_PPP_my_PL_parser_var(lex_state)
4142 # define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff)
4143 # define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf)
4147 /* ensure that PL_parser != NULL and cannot be dereferenced */
4148 # define PL_parser ((void *) 1)
4152 # define mPUSHs(s) PUSHs(sv_2mortal(s))
4156 # define PUSHmortal PUSHs(sv_newmortal())
4160 # define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l))
4164 # define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n))
4168 # define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i))
4172 # define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u))
4175 # define mXPUSHs(s) XPUSHs(sv_2mortal(s))
4179 # define XPUSHmortal XPUSHs(sv_newmortal())
4183 # define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END
4187 # define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END
4191 # define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END
4195 # define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END
4200 # define call_sv perl_call_sv
4204 # define call_pv perl_call_pv
4208 # define call_argv perl_call_argv
4212 # define call_method perl_call_method
4215 # define eval_sv perl_eval_sv
4217 #ifndef PERL_LOADMOD_DENY
4218 # define PERL_LOADMOD_DENY 0x1
4221 #ifndef PERL_LOADMOD_NOIMPORT
4222 # define PERL_LOADMOD_NOIMPORT 0x2
4225 #ifndef PERL_LOADMOD_IMPORT_OPS
4226 # define PERL_LOADMOD_IMPORT_OPS 0x4
4231 /* Replace perl_eval_pv with eval_pv */
4234 #if defined(NEED_eval_pv)
4235 static SV
* DPPP_(my_eval_pv
)(char *p
, I32 croak_on_error
);
4238 extern SV
* DPPP_(my_eval_pv
)(char *p
, I32 croak_on_error
);
4244 #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
4245 #define Perl_eval_pv DPPP_(my_eval_pv)
4247 #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
4250 DPPP_(my_eval_pv
)(char *p
, I32 croak_on_error
)
4253 SV
* sv
= newSVpv(p
, 0);
4256 eval_sv(sv
, G_SCALAR
);
4263 if (croak_on_error
&& SvTRUE(GvSV(errgv
)))
4264 croak(SvPVx(GvSV(errgv
), na
));
4272 #ifndef vload_module
4273 #if defined(NEED_vload_module)
4274 static void DPPP_(my_vload_module
)(U32 flags
, SV
*name
, SV
*ver
, va_list *args
);
4277 extern void DPPP_(my_vload_module
)(U32 flags
, SV
*name
, SV
*ver
, va_list *args
);
4281 # undef vload_module
4283 #define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d)
4284 #define Perl_vload_module DPPP_(my_vload_module)
4286 #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL)
4289 DPPP_(my_vload_module
)(U32 flags
, SV
*name
, SV
*ver
, va_list *args
)
4295 OP
* const modname
= newSVOP(OP_CONST
, 0, name
);
4296 /* 5.005 has a somewhat hacky force_normal that doesn't croak on
4297 SvREADONLY() if PL_compling is true. Current perls take care in
4298 ck_require() to correctly turn off SvREADONLY before calling
4299 force_normal_flags(). This seems a better fix than fudging PL_compling
4301 SvREADONLY_off(((SVOP
*)modname
)->op_sv
);
4302 modname
->op_private
|= OPpCONST_BARE
;
4304 veop
= newSVOP(OP_CONST
, 0, ver
);
4308 if (flags
& PERL_LOADMOD_NOIMPORT
) {
4309 imop
= sawparens(newNULLLIST());
4311 else if (flags
& PERL_LOADMOD_IMPORT_OPS
) {
4312 imop
= va_arg(*args
, OP
*);
4317 sv
= va_arg(*args
, SV
*);
4319 imop
= append_elem(OP_LIST
, imop
, newSVOP(OP_CONST
, 0, sv
));
4320 sv
= va_arg(*args
, SV
*);
4324 const line_t ocopline
= PL_copline
;
4325 COP
* const ocurcop
= PL_curcop
;
4326 const int oexpect
= PL_expect
;
4328 #if (PERL_BCDVERSION >= 0x5004000)
4329 utilize(!(flags
& PERL_LOADMOD_DENY
), start_subparse(FALSE
, 0),
4330 veop
, modname
, imop
);
4332 utilize(!(flags
& PERL_LOADMOD_DENY
), start_subparse(),
4335 PL_expect
= oexpect
;
4336 PL_copline
= ocopline
;
4337 PL_curcop
= ocurcop
;
4345 #if defined(NEED_load_module)
4346 static void DPPP_(my_load_module
)(U32 flags
, SV
*name
, SV
*ver
, ...);
4349 extern void DPPP_(my_load_module
)(U32 flags
, SV
*name
, SV
*ver
, ...);
4355 #define load_module DPPP_(my_load_module)
4356 #define Perl_load_module DPPP_(my_load_module)
4358 #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
4361 DPPP_(my_load_module
)(U32 flags
, SV
*name
, SV
*ver
, ...)
4364 va_start(args
, ver
);
4365 vload_module(flags
, name
, ver
, &args
);
4372 # define newRV_inc(sv) newRV(sv) /* Replace */
4376 #if defined(NEED_newRV_noinc)
4377 static SV
* DPPP_(my_newRV_noinc
)(SV
*sv
);
4380 extern SV
* DPPP_(my_newRV_noinc
)(SV
*sv
);
4386 #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a)
4387 #define Perl_newRV_noinc DPPP_(my_newRV_noinc)
4389 #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
4391 DPPP_(my_newRV_noinc
)(SV
*sv
)
4393 SV
*rv
= (SV
*)newRV(sv
);
4400 /* Hint: newCONSTSUB
4401 * Returns a CV* as of perl-5.7.1. This return value is not supported
4405 /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
4406 #if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005)
4407 #if defined(NEED_newCONSTSUB)
4408 static void DPPP_(my_newCONSTSUB
)(HV
*stash
, const char *name
, SV
*sv
);
4411 extern void DPPP_(my_newCONSTSUB
)(HV
*stash
, const char *name
, SV
*sv
);
4417 #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c)
4418 #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB)
4420 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
4422 /* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */
4423 /* (There's no PL_parser in perl < 5.005, so this is completely safe) */
4424 #define D_PPP_PL_copline PL_copline
4427 DPPP_(my_newCONSTSUB
)(HV
*stash
, const char *name
, SV
*sv
)
4429 U32 oldhints
= PL_hints
;
4430 HV
*old_cop_stash
= PL_curcop
->cop_stash
;
4431 HV
*old_curstash
= PL_curstash
;
4432 line_t oldline
= PL_curcop
->cop_line
;
4433 PL_curcop
->cop_line
= D_PPP_PL_copline
;
4435 PL_hints
&= ~HINT_BLOCK_SCOPE
;
4437 PL_curstash
= PL_curcop
->cop_stash
= stash
;
4441 #if (PERL_BCDVERSION < 0x5003022)
4443 #elif (PERL_BCDVERSION == 0x5003022)
4445 #else /* 5.003_23 onwards */
4446 start_subparse(FALSE
, 0),
4449 newSVOP(OP_CONST
, 0, newSVpv((char *) name
, 0)),
4450 newSVOP(OP_CONST
, 0, &PL_sv_no
), /* SvPV(&PL_sv_no) == "" -- GMB */
4451 newSTATEOP(0, Nullch
, newSVOP(OP_CONST
, 0, sv
))
4454 PL_hints
= oldhints
;
4455 PL_curcop
->cop_stash
= old_cop_stash
;
4456 PL_curstash
= old_curstash
;
4457 PL_curcop
->cop_line
= oldline
;
4463 * Boilerplate macros for initializing and accessing interpreter-local
4464 * data from C. All statics in extensions should be reworked to use
4465 * this, if you want to make the extension thread-safe. See ext/re/re.xs
4466 * for an example of the use of these macros.
4468 * Code that uses these macros is responsible for the following:
4469 * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
4470 * 2. Declare a typedef named my_cxt_t that is a structure that contains
4471 * all the data that needs to be interpreter-local.
4472 * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
4473 * 4. Use the MY_CXT_INIT macro such that it is called exactly once
4474 * (typically put in the BOOT: section).
4475 * 5. Use the members of the my_cxt_t structure everywhere as
4477 * 6. Use the dMY_CXT macro (a declaration) in all the functions that
4481 #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
4482 defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT)
4484 #ifndef START_MY_CXT
4486 /* This must appear in all extensions that define a my_cxt_t structure,
4487 * right after the definition (i.e. at file scope). The non-threads
4488 * case below uses it to declare the data as static. */
4489 #define START_MY_CXT
4491 #if (PERL_BCDVERSION < 0x5004068)
4492 /* Fetches the SV that keeps the per-interpreter data. */
4493 #define dMY_CXT_SV \
4494 SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
4495 #else /* >= perl5.004_68 */
4496 #define dMY_CXT_SV \
4497 SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \
4498 sizeof(MY_CXT_KEY)-1, TRUE)
4499 #endif /* < perl5.004_68 */
4501 /* This declaration should be used within all functions that use the
4502 * interpreter-local data. */
4505 my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
4507 /* Creates and zeroes the per-interpreter data.
4508 * (We allocate my_cxtp in a Perl SV so that it will be released when
4509 * the interpreter goes away.) */
4510 #define MY_CXT_INIT \
4512 /* newSV() allocates one more than needed */ \
4513 my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
4514 Zero(my_cxtp, 1, my_cxt_t); \
4515 sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
4517 /* This macro must be used to access members of the my_cxt_t structure.
4518 * e.g. MYCXT.some_data */
4519 #define MY_CXT (*my_cxtp)
4521 /* Judicious use of these macros can reduce the number of times dMY_CXT
4522 * is used. Use is similar to pTHX, aTHX etc. */
4523 #define pMY_CXT my_cxt_t *my_cxtp
4524 #define pMY_CXT_ pMY_CXT,
4525 #define _pMY_CXT ,pMY_CXT
4526 #define aMY_CXT my_cxtp
4527 #define aMY_CXT_ aMY_CXT,
4528 #define _aMY_CXT ,aMY_CXT
4530 #endif /* START_MY_CXT */
4532 #ifndef MY_CXT_CLONE
4533 /* Clones the per-interpreter data. */
4534 #define MY_CXT_CLONE \
4536 my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
4537 Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
4538 sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
4541 #else /* single interpreter */
4543 #ifndef START_MY_CXT
4545 #define START_MY_CXT static my_cxt_t my_cxt;
4546 #define dMY_CXT_SV dNOOP
4547 #define dMY_CXT dNOOP
4548 #define MY_CXT_INIT NOOP
4549 #define MY_CXT my_cxt
4551 #define pMY_CXT void
4558 #endif /* START_MY_CXT */
4560 #ifndef MY_CXT_CLONE
4561 #define MY_CXT_CLONE NOOP
4567 # if IVSIZE == LONGSIZE
4574 # if IVSIZE == INTSIZE
4585 # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
4586 defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000)
4587 /* Not very likely, but let's try anyway. */
4588 # define NVef PERL_PRIeldbl
4589 # define NVff PERL_PRIfldbl
4590 # define NVgf PERL_PRIgldbl
4598 #ifndef SvREFCNT_inc
4599 # ifdef PERL_USE_GCC_BRACE_GROUPS
4600 # define SvREFCNT_inc(sv) \
4602 SV * const _sv = (SV*)(sv); \
4604 (SvREFCNT(_sv))++; \
4608 # define SvREFCNT_inc(sv) \
4609 ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL)
4613 #ifndef SvREFCNT_inc_simple
4614 # ifdef PERL_USE_GCC_BRACE_GROUPS
4615 # define SvREFCNT_inc_simple(sv) \
4622 # define SvREFCNT_inc_simple(sv) \
4623 ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL)
4627 #ifndef SvREFCNT_inc_NN
4628 # ifdef PERL_USE_GCC_BRACE_GROUPS
4629 # define SvREFCNT_inc_NN(sv) \
4631 SV * const _sv = (SV*)(sv); \
4636 # define SvREFCNT_inc_NN(sv) \
4637 (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv)
4641 #ifndef SvREFCNT_inc_void
4642 # ifdef PERL_USE_GCC_BRACE_GROUPS
4643 # define SvREFCNT_inc_void(sv) \
4645 SV * const _sv = (SV*)(sv); \
4647 (void)(SvREFCNT(_sv)++); \
4650 # define SvREFCNT_inc_void(sv) \
4651 (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0)
4654 #ifndef SvREFCNT_inc_simple_void
4655 # define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END
4658 #ifndef SvREFCNT_inc_simple_NN
4659 # define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv))
4662 #ifndef SvREFCNT_inc_void_NN
4663 # define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
4666 #ifndef SvREFCNT_inc_simple_void_NN
4667 # define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
4670 #if (PERL_BCDVERSION < 0x5006000)
4671 # define D_PPP_CONSTPV_ARG(x) ((char *) (x))
4673 # define D_PPP_CONSTPV_ARG(x) (x)
4676 # define newSVpvn(data,len) ((data) \
4677 ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \
4680 #ifndef newSVpvn_utf8
4681 # define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0)
4687 #ifndef newSVpvn_flags
4689 #if defined(NEED_newSVpvn_flags)
4690 static SV
* DPPP_(my_newSVpvn_flags
)(pTHX_
const char *s
, STRLEN len
, U32 flags
);
4693 extern SV
* DPPP_(my_newSVpvn_flags
)(pTHX_
const char *s
, STRLEN len
, U32 flags
);
4696 #ifdef newSVpvn_flags
4697 # undef newSVpvn_flags
4699 #define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c)
4700 #define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags)
4702 #if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL)
4705 DPPP_(my_newSVpvn_flags
)(pTHX_
const char *s
, STRLEN len
, U32 flags
)
4707 SV
*sv
= newSVpvn(D_PPP_CONSTPV_ARG(s
), len
);
4708 SvFLAGS(sv
) |= (flags
& SVf_UTF8
);
4709 return (flags
& SVs_TEMP
) ? sv_2mortal(sv
) : sv
;
4716 /* Backwards compatibility stuff... :-( */
4717 #if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen)
4718 # define NEED_sv_2pv_flags
4720 #if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL)
4721 # define NEED_sv_2pv_flags_GLOBAL
4724 /* Hint: sv_2pv_nolen
4725 * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen().
4727 #ifndef sv_2pv_nolen
4728 # define sv_2pv_nolen(sv) SvPV_nolen(sv)
4734 * Does not work in perl-5.6.1, ppport.h implements a version
4735 * borrowed from perl-5.7.3.
4738 #if (PERL_BCDVERSION < 0x5007000)
4740 #if defined(NEED_sv_2pvbyte)
4741 static char * DPPP_(my_sv_2pvbyte
)(pTHX_ SV
*sv
, STRLEN
*lp
);
4744 extern char * DPPP_(my_sv_2pvbyte
)(pTHX_ SV
*sv
, STRLEN
*lp
);
4750 #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b)
4751 #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte)
4753 #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
4756 DPPP_(my_sv_2pvbyte
)(pTHX_ SV
*sv
, STRLEN
*lp
)
4758 sv_utf8_downgrade(sv
,0);
4759 return SvPV(sv
,*lp
);
4765 * Use the SvPVbyte() macro instead of sv_2pvbyte().
4770 #define SvPVbyte(sv, lp) \
4771 ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
4772 ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp))
4778 # define SvPVbyte SvPV
4779 # define sv_2pvbyte sv_2pv
4782 #ifndef sv_2pvbyte_nolen
4783 # define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv)
4787 * Always use the SvPV() macro instead of sv_pvn().
4790 /* Hint: sv_pvn_force
4791 * Always use the SvPV_force() macro instead of sv_pvn_force().
4794 /* If these are undefined, they're not handled by the core anyway */
4795 #ifndef SV_IMMEDIATE_UNREF
4796 # define SV_IMMEDIATE_UNREF 0
4800 # define SV_GMAGIC 0
4803 #ifndef SV_COW_DROP_PV
4804 # define SV_COW_DROP_PV 0
4807 #ifndef SV_UTF8_NO_ENCODING
4808 # define SV_UTF8_NO_ENCODING 0
4812 # define SV_NOSTEAL 0
4815 #ifndef SV_CONST_RETURN
4816 # define SV_CONST_RETURN 0
4819 #ifndef SV_MUTABLE_RETURN
4820 # define SV_MUTABLE_RETURN 0
4824 # define SV_SMAGIC 0
4827 #ifndef SV_HAS_TRAILING_NUL
4828 # define SV_HAS_TRAILING_NUL 0
4831 #ifndef SV_COW_SHARED_HASH_KEYS
4832 # define SV_COW_SHARED_HASH_KEYS 0
4835 #if (PERL_BCDVERSION < 0x5007002)
4837 #if defined(NEED_sv_2pv_flags)
4838 static char * DPPP_(my_sv_2pv_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
);
4841 extern char * DPPP_(my_sv_2pv_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
);
4845 # undef sv_2pv_flags
4847 #define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c)
4848 #define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags)
4850 #if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL)
4853 DPPP_(my_sv_2pv_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
)
4855 STRLEN n_a
= (STRLEN
) flags
;
4856 return sv_2pv(sv
, lp
? lp
: &n_a
);
4861 #if defined(NEED_sv_pvn_force_flags)
4862 static char * DPPP_(my_sv_pvn_force_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
);
4865 extern char * DPPP_(my_sv_pvn_force_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
);
4868 #ifdef sv_pvn_force_flags
4869 # undef sv_pvn_force_flags
4871 #define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c)
4872 #define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags)
4874 #if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL)
4877 DPPP_(my_sv_pvn_force_flags
)(pTHX_ SV
*sv
, STRLEN
*lp
, I32 flags
)
4879 STRLEN n_a
= (STRLEN
) flags
;
4880 return sv_pvn_force(sv
, lp
? lp
: &n_a
);
4887 #if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) )
4888 # define DPPP_SVPV_NOLEN_LP_ARG &PL_na
4890 # define DPPP_SVPV_NOLEN_LP_ARG 0
4893 # define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC)
4896 #ifndef SvPV_mutable
4897 # define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC)
4900 # define SvPV_flags(sv, lp, flags) \
4901 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4902 ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags))
4904 #ifndef SvPV_flags_const
4905 # define SvPV_flags_const(sv, lp, flags) \
4906 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4907 ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \
4908 (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN))
4910 #ifndef SvPV_flags_const_nolen
4911 # define SvPV_flags_const_nolen(sv, flags) \
4912 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4913 ? SvPVX_const(sv) : \
4914 (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN))
4916 #ifndef SvPV_flags_mutable
4917 # define SvPV_flags_mutable(sv, lp, flags) \
4918 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4919 ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \
4920 sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
4923 # define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC)
4926 #ifndef SvPV_force_nolen
4927 # define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC)
4930 #ifndef SvPV_force_mutable
4931 # define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC)
4934 #ifndef SvPV_force_nomg
4935 # define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0)
4938 #ifndef SvPV_force_nomg_nolen
4939 # define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0)
4941 #ifndef SvPV_force_flags
4942 # define SvPV_force_flags(sv, lp, flags) \
4943 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4944 ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags))
4946 #ifndef SvPV_force_flags_nolen
4947 # define SvPV_force_flags_nolen(sv, flags) \
4948 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4949 ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags))
4951 #ifndef SvPV_force_flags_mutable
4952 # define SvPV_force_flags_mutable(sv, lp, flags) \
4953 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
4954 ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \
4955 : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
4958 # define SvPV_nolen(sv) \
4959 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4960 ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC))
4962 #ifndef SvPV_nolen_const
4963 # define SvPV_nolen_const(sv) \
4964 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
4965 ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN))
4968 # define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0)
4971 #ifndef SvPV_nomg_const
4972 # define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0)
4975 #ifndef SvPV_nomg_const_nolen
4976 # define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0)
4979 # define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \
4980 SvPV_set((sv), (char *) saferealloc( \
4981 (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \
4985 # define SvMAGIC_set(sv, val) \
4986 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
4987 (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END
4990 #if (PERL_BCDVERSION < 0x5009003)
4992 # define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv)))
4995 #ifndef SvPVX_mutable
4996 # define SvPVX_mutable(sv) (0 + SvPVX(sv))
4999 # define SvRV_set(sv, val) \
5000 STMT_START { assert(SvTYPE(sv) >= SVt_RV); \
5001 (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END
5006 # define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv))
5009 #ifndef SvPVX_mutable
5010 # define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv)
5013 # define SvRV_set(sv, val) \
5014 STMT_START { assert(SvTYPE(sv) >= SVt_RV); \
5015 ((sv)->sv_u.svu_rv = (val)); } STMT_END
5020 # define SvSTASH_set(sv, val) \
5021 STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
5022 (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END
5025 #if (PERL_BCDVERSION < 0x5004000)
5027 # define SvUV_set(sv, val) \
5028 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
5029 (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END
5034 # define SvUV_set(sv, val) \
5035 STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
5036 (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END
5041 #if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf)
5042 #if defined(NEED_vnewSVpvf)
5043 static SV
* DPPP_(my_vnewSVpvf
)(pTHX_
const char *pat
, va_list *args
);
5046 extern SV
* DPPP_(my_vnewSVpvf
)(pTHX_
const char *pat
, va_list *args
);
5052 #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b)
5053 #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf)
5055 #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
5058 DPPP_(my_vnewSVpvf
)(pTHX_
const char *pat
, va_list *args
)
5060 register SV
*sv
= newSV(0);
5061 sv_vsetpvfn(sv
, pat
, strlen(pat
), args
, Null(SV
**), 0, Null(bool*));
5068 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf)
5069 # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
5072 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf)
5073 # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
5076 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg)
5077 #if defined(NEED_sv_catpvf_mg)
5078 static void DPPP_(my_sv_catpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...);
5081 extern void DPPP_(my_sv_catpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...);
5084 #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
5086 #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
5089 DPPP_(my_sv_catpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...)
5092 va_start(args
, pat
);
5093 sv_vcatpvfn(sv
, pat
, strlen(pat
), &args
, Null(SV
**), 0, Null(bool*));
5101 #ifdef PERL_IMPLICIT_CONTEXT
5102 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext)
5103 #if defined(NEED_sv_catpvf_mg_nocontext)
5104 static void DPPP_(my_sv_catpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...);
5107 extern void DPPP_(my_sv_catpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...);
5110 #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
5111 #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
5113 #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
5116 DPPP_(my_sv_catpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...)
5120 va_start(args
, pat
);
5121 sv_vcatpvfn(sv
, pat
, strlen(pat
), &args
, Null(SV
**), 0, Null(bool*));
5130 /* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */
5131 #ifndef sv_catpvf_mg
5132 # ifdef PERL_IMPLICIT_CONTEXT
5133 # define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext
5135 # define sv_catpvf_mg Perl_sv_catpvf_mg
5139 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg)
5140 # define sv_vcatpvf_mg(sv, pat, args) \
5142 sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \
5147 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg)
5148 #if defined(NEED_sv_setpvf_mg)
5149 static void DPPP_(my_sv_setpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...);
5152 extern void DPPP_(my_sv_setpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...);
5155 #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
5157 #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
5160 DPPP_(my_sv_setpvf_mg
)(pTHX_ SV
*sv
, const char *pat
, ...)
5163 va_start(args
, pat
);
5164 sv_vsetpvfn(sv
, pat
, strlen(pat
), &args
, Null(SV
**), 0, Null(bool*));
5172 #ifdef PERL_IMPLICIT_CONTEXT
5173 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext)
5174 #if defined(NEED_sv_setpvf_mg_nocontext)
5175 static void DPPP_(my_sv_setpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...);
5178 extern void DPPP_(my_sv_setpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...);
5181 #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
5182 #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
5184 #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
5187 DPPP_(my_sv_setpvf_mg_nocontext
)(SV
*sv
, const char *pat
, ...)
5191 va_start(args
, pat
);
5192 sv_vsetpvfn(sv
, pat
, strlen(pat
), &args
, Null(SV
**), 0, Null(bool*));
5201 /* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */
5202 #ifndef sv_setpvf_mg
5203 # ifdef PERL_IMPLICIT_CONTEXT
5204 # define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext
5206 # define sv_setpvf_mg Perl_sv_setpvf_mg
5210 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg)
5211 # define sv_vsetpvf_mg(sv, pat, args) \
5213 sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \
5218 #ifndef newSVpvn_share
5220 #if defined(NEED_newSVpvn_share)
5221 static SV
* DPPP_(my_newSVpvn_share
)(pTHX_
const char *src
, I32 len
, U32 hash
);
5224 extern SV
* DPPP_(my_newSVpvn_share
)(pTHX_
const char *src
, I32 len
, U32 hash
);
5227 #ifdef newSVpvn_share
5228 # undef newSVpvn_share
5230 #define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c)
5231 #define Perl_newSVpvn_share DPPP_(my_newSVpvn_share)
5233 #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL)
5236 DPPP_(my_newSVpvn_share
)(pTHX_
const char *src
, I32 len
, U32 hash
)
5242 PERL_HASH(hash
, (char*) src
, len
);
5243 sv
= newSVpvn((char *) src
, len
);
5244 sv_upgrade(sv
, SVt_PVIV
);
5254 #ifndef SvSHARED_HASH
5255 # define SvSHARED_HASH(sv) (0 + SvUVX(sv))
5261 #ifndef WARN_CLOSURE
5262 # define WARN_CLOSURE 1
5265 #ifndef WARN_DEPRECATED
5266 # define WARN_DEPRECATED 2
5269 #ifndef WARN_EXITING
5270 # define WARN_EXITING 3
5274 # define WARN_GLOB 4
5282 # define WARN_CLOSED 6
5286 # define WARN_EXEC 7
5290 # define WARN_LAYER 8
5293 #ifndef WARN_NEWLINE
5294 # define WARN_NEWLINE 9
5298 # define WARN_PIPE 10
5301 #ifndef WARN_UNOPENED
5302 # define WARN_UNOPENED 11
5306 # define WARN_MISC 12
5309 #ifndef WARN_NUMERIC
5310 # define WARN_NUMERIC 13
5314 # define WARN_ONCE 14
5317 #ifndef WARN_OVERFLOW
5318 # define WARN_OVERFLOW 15
5322 # define WARN_PACK 16
5325 #ifndef WARN_PORTABLE
5326 # define WARN_PORTABLE 17
5329 #ifndef WARN_RECURSION
5330 # define WARN_RECURSION 18
5333 #ifndef WARN_REDEFINE
5334 # define WARN_REDEFINE 19
5338 # define WARN_REGEXP 20
5342 # define WARN_SEVERE 21
5345 #ifndef WARN_DEBUGGING
5346 # define WARN_DEBUGGING 22
5349 #ifndef WARN_INPLACE
5350 # define WARN_INPLACE 23
5353 #ifndef WARN_INTERNAL
5354 # define WARN_INTERNAL 24
5358 # define WARN_MALLOC 25
5362 # define WARN_SIGNAL 26
5366 # define WARN_SUBSTR 27
5370 # define WARN_SYNTAX 28
5373 #ifndef WARN_AMBIGUOUS
5374 # define WARN_AMBIGUOUS 29
5377 #ifndef WARN_BAREWORD
5378 # define WARN_BAREWORD 30
5382 # define WARN_DIGIT 31
5385 #ifndef WARN_PARENTHESIS
5386 # define WARN_PARENTHESIS 32
5389 #ifndef WARN_PRECEDENCE
5390 # define WARN_PRECEDENCE 33
5394 # define WARN_PRINTF 34
5397 #ifndef WARN_PROTOTYPE
5398 # define WARN_PROTOTYPE 35
5405 #ifndef WARN_RESERVED
5406 # define WARN_RESERVED 37
5409 #ifndef WARN_SEMICOLON
5410 # define WARN_SEMICOLON 38
5414 # define WARN_TAINT 39
5417 #ifndef WARN_THREADS
5418 # define WARN_THREADS 40
5421 #ifndef WARN_UNINITIALIZED
5422 # define WARN_UNINITIALIZED 41
5426 # define WARN_UNPACK 42
5430 # define WARN_UNTIE 43
5434 # define WARN_UTF8 44
5438 # define WARN_VOID 45
5441 #ifndef WARN_ASSERTIONS
5442 # define WARN_ASSERTIONS 46
5445 # define packWARN(a) (a)
5450 # define ckWARN(a) (PL_dowarn & G_WARN_ON)
5452 # define ckWARN(a) PL_dowarn
5456 #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner)
5457 #if defined(NEED_warner)
5458 static void DPPP_(my_warner
)(U32 err
, const char *pat
, ...);
5461 extern void DPPP_(my_warner
)(U32 err
, const char *pat
, ...);
5464 #define Perl_warner DPPP_(my_warner)
5466 #if defined(NEED_warner) || defined(NEED_warner_GLOBAL)
5469 DPPP_(my_warner
)(U32 err
, const char *pat
, ...)
5474 PERL_UNUSED_ARG(err
);
5476 va_start(args
, pat
);
5477 sv
= vnewSVpvf(pat
, &args
);
5480 warn("%s", SvPV_nolen(sv
));
5483 #define warner Perl_warner
5485 #define Perl_warner_nocontext Perl_warner
5490 /* concatenating with "" ensures that only literal strings are accepted as argument
5491 * note that STR_WITH_LEN() can't be used as argument to macros or functions that
5492 * under some configurations might be macros
5494 #ifndef STR_WITH_LEN
5495 # define STR_WITH_LEN(s) (s ""), (sizeof(s)-1)
5498 # define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1)
5501 #ifndef newSVpvs_flags
5502 # define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags)
5506 # define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1)
5510 # define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1)
5514 # define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval)
5518 # define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0)
5521 # define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
5523 #ifndef PERL_MAGIC_sv
5524 # define PERL_MAGIC_sv '\0'
5527 #ifndef PERL_MAGIC_overload
5528 # define PERL_MAGIC_overload 'A'
5531 #ifndef PERL_MAGIC_overload_elem
5532 # define PERL_MAGIC_overload_elem 'a'
5535 #ifndef PERL_MAGIC_overload_table
5536 # define PERL_MAGIC_overload_table 'c'
5539 #ifndef PERL_MAGIC_bm
5540 # define PERL_MAGIC_bm 'B'
5543 #ifndef PERL_MAGIC_regdata
5544 # define PERL_MAGIC_regdata 'D'
5547 #ifndef PERL_MAGIC_regdatum
5548 # define PERL_MAGIC_regdatum 'd'
5551 #ifndef PERL_MAGIC_env
5552 # define PERL_MAGIC_env 'E'
5555 #ifndef PERL_MAGIC_envelem
5556 # define PERL_MAGIC_envelem 'e'
5559 #ifndef PERL_MAGIC_fm
5560 # define PERL_MAGIC_fm 'f'
5563 #ifndef PERL_MAGIC_regex_global
5564 # define PERL_MAGIC_regex_global 'g'
5567 #ifndef PERL_MAGIC_isa
5568 # define PERL_MAGIC_isa 'I'
5571 #ifndef PERL_MAGIC_isaelem
5572 # define PERL_MAGIC_isaelem 'i'
5575 #ifndef PERL_MAGIC_nkeys
5576 # define PERL_MAGIC_nkeys 'k'
5579 #ifndef PERL_MAGIC_dbfile
5580 # define PERL_MAGIC_dbfile 'L'
5583 #ifndef PERL_MAGIC_dbline
5584 # define PERL_MAGIC_dbline 'l'
5587 #ifndef PERL_MAGIC_mutex
5588 # define PERL_MAGIC_mutex 'm'
5591 #ifndef PERL_MAGIC_shared
5592 # define PERL_MAGIC_shared 'N'
5595 #ifndef PERL_MAGIC_shared_scalar
5596 # define PERL_MAGIC_shared_scalar 'n'
5599 #ifndef PERL_MAGIC_collxfrm
5600 # define PERL_MAGIC_collxfrm 'o'
5603 #ifndef PERL_MAGIC_tied
5604 # define PERL_MAGIC_tied 'P'
5607 #ifndef PERL_MAGIC_tiedelem
5608 # define PERL_MAGIC_tiedelem 'p'
5611 #ifndef PERL_MAGIC_tiedscalar
5612 # define PERL_MAGIC_tiedscalar 'q'
5615 #ifndef PERL_MAGIC_qr
5616 # define PERL_MAGIC_qr 'r'
5619 #ifndef PERL_MAGIC_sig
5620 # define PERL_MAGIC_sig 'S'
5623 #ifndef PERL_MAGIC_sigelem
5624 # define PERL_MAGIC_sigelem 's'
5627 #ifndef PERL_MAGIC_taint
5628 # define PERL_MAGIC_taint 't'
5631 #ifndef PERL_MAGIC_uvar
5632 # define PERL_MAGIC_uvar 'U'
5635 #ifndef PERL_MAGIC_uvar_elem
5636 # define PERL_MAGIC_uvar_elem 'u'
5639 #ifndef PERL_MAGIC_vstring
5640 # define PERL_MAGIC_vstring 'V'
5643 #ifndef PERL_MAGIC_vec
5644 # define PERL_MAGIC_vec 'v'
5647 #ifndef PERL_MAGIC_utf8
5648 # define PERL_MAGIC_utf8 'w'
5651 #ifndef PERL_MAGIC_substr
5652 # define PERL_MAGIC_substr 'x'
5655 #ifndef PERL_MAGIC_defelem
5656 # define PERL_MAGIC_defelem 'y'
5659 #ifndef PERL_MAGIC_glob
5660 # define PERL_MAGIC_glob '*'
5663 #ifndef PERL_MAGIC_arylen
5664 # define PERL_MAGIC_arylen '#'
5667 #ifndef PERL_MAGIC_pos
5668 # define PERL_MAGIC_pos '.'
5671 #ifndef PERL_MAGIC_backref
5672 # define PERL_MAGIC_backref '<'
5675 #ifndef PERL_MAGIC_ext
5676 # define PERL_MAGIC_ext '~'
5679 /* That's the best we can do... */
5680 #ifndef sv_catpvn_nomg
5681 # define sv_catpvn_nomg sv_catpvn
5684 #ifndef sv_catsv_nomg
5685 # define sv_catsv_nomg sv_catsv
5688 #ifndef sv_setsv_nomg
5689 # define sv_setsv_nomg sv_setsv
5693 # define sv_pvn_nomg sv_pvn
5697 # define SvIV_nomg SvIV
5701 # define SvUV_nomg SvUV
5705 # define sv_catpv_mg(sv, ptr) \
5708 sv_catpv(TeMpSv,ptr); \
5709 SvSETMAGIC(TeMpSv); \
5713 #ifndef sv_catpvn_mg
5714 # define sv_catpvn_mg(sv, ptr, len) \
5717 sv_catpvn(TeMpSv,ptr,len); \
5718 SvSETMAGIC(TeMpSv); \
5723 # define sv_catsv_mg(dsv, ssv) \
5726 sv_catsv(TeMpSv,ssv); \
5727 SvSETMAGIC(TeMpSv); \
5732 # define sv_setiv_mg(sv, i) \
5735 sv_setiv(TeMpSv,i); \
5736 SvSETMAGIC(TeMpSv); \
5741 # define sv_setnv_mg(sv, num) \
5744 sv_setnv(TeMpSv,num); \
5745 SvSETMAGIC(TeMpSv); \
5750 # define sv_setpv_mg(sv, ptr) \
5753 sv_setpv(TeMpSv,ptr); \
5754 SvSETMAGIC(TeMpSv); \
5758 #ifndef sv_setpvn_mg
5759 # define sv_setpvn_mg(sv, ptr, len) \
5762 sv_setpvn(TeMpSv,ptr,len); \
5763 SvSETMAGIC(TeMpSv); \
5768 # define sv_setsv_mg(dsv, ssv) \
5771 sv_setsv(TeMpSv,ssv); \
5772 SvSETMAGIC(TeMpSv); \
5777 # define sv_setuv_mg(sv, i) \
5780 sv_setuv(TeMpSv,i); \
5781 SvSETMAGIC(TeMpSv); \
5785 #ifndef sv_usepvn_mg
5786 # define sv_usepvn_mg(sv, ptr, len) \
5789 sv_usepvn(TeMpSv,ptr,len); \
5790 SvSETMAGIC(TeMpSv); \
5793 #ifndef SvVSTRING_mg
5794 # define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL)
5797 /* Hint: sv_magic_portable
5798 * This is a compatibility function that is only available with
5799 * Devel::PPPort. It is NOT in the perl core.
5800 * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when
5801 * it is being passed a name pointer with namlen == 0. In that
5802 * case, perl 5.8.0 and later store the pointer, not a copy of it.
5803 * The compatibility can be provided back to perl 5.004. With
5804 * earlier versions, the code will not compile.
5807 #if (PERL_BCDVERSION < 0x5004000)
5809 /* code that uses sv_magic_portable will not compile */
5811 #elif (PERL_BCDVERSION < 0x5008000)
5813 # define sv_magic_portable(sv, obj, how, name, namlen) \
5815 SV *SvMp_sv = (sv); \
5816 char *SvMp_name = (char *) (name); \
5817 I32 SvMp_namlen = (namlen); \
5818 if (SvMp_name && SvMp_namlen == 0) \
5821 sv_magic(SvMp_sv, obj, how, 0, 0); \
5822 mg = SvMAGIC(SvMp_sv); \
5823 mg->mg_len = -42; /* XXX: this is the tricky part */ \
5824 mg->mg_ptr = SvMp_name; \
5828 sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \
5834 # define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e)
5840 # define CopFILE(c) ((c)->cop_file)
5844 # define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv)
5848 # define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv))
5852 # define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
5856 # define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
5860 # define CopSTASHPV(c) ((c)->cop_stashpv)
5863 #ifndef CopSTASHPV_set
5864 # define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch))
5868 # define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
5871 #ifndef CopSTASH_set
5872 # define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch)
5876 # define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \
5877 || (CopSTASHPV(c) && HvNAME(hv) \
5878 && strEQ(CopSTASHPV(c), HvNAME(hv)))))
5883 # define CopFILEGV(c) ((c)->cop_filegv)
5886 #ifndef CopFILEGV_set
5887 # define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
5891 # define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv))
5895 # define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
5899 # define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
5903 # define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
5907 # define CopSTASH(c) ((c)->cop_stash)
5910 #ifndef CopSTASH_set
5911 # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv))
5915 # define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
5918 #ifndef CopSTASHPV_set
5919 # define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
5923 # define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv))
5926 #endif /* USE_ITHREADS */
5927 #ifndef IN_PERL_COMPILETIME
5928 # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling)
5931 #ifndef IN_LOCALE_RUNTIME
5932 # define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE)
5935 #ifndef IN_LOCALE_COMPILETIME
5936 # define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE)
5940 # define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
5942 #ifndef IS_NUMBER_IN_UV
5943 # define IS_NUMBER_IN_UV 0x01
5946 #ifndef IS_NUMBER_GREATER_THAN_UV_MAX
5947 # define IS_NUMBER_GREATER_THAN_UV_MAX 0x02
5950 #ifndef IS_NUMBER_NOT_INT
5951 # define IS_NUMBER_NOT_INT 0x04
5954 #ifndef IS_NUMBER_NEG
5955 # define IS_NUMBER_NEG 0x08
5958 #ifndef IS_NUMBER_INFINITY
5959 # define IS_NUMBER_INFINITY 0x10
5962 #ifndef IS_NUMBER_NAN
5963 # define IS_NUMBER_NAN 0x20
5965 #ifndef GROK_NUMERIC_RADIX
5966 # define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send)
5968 #ifndef PERL_SCAN_GREATER_THAN_UV_MAX
5969 # define PERL_SCAN_GREATER_THAN_UV_MAX 0x02
5972 #ifndef PERL_SCAN_SILENT_ILLDIGIT
5973 # define PERL_SCAN_SILENT_ILLDIGIT 0x04
5976 #ifndef PERL_SCAN_ALLOW_UNDERSCORES
5977 # define PERL_SCAN_ALLOW_UNDERSCORES 0x01
5980 #ifndef PERL_SCAN_DISALLOW_PREFIX
5981 # define PERL_SCAN_DISALLOW_PREFIX 0x02
5984 #ifndef grok_numeric_radix
5985 #if defined(NEED_grok_numeric_radix)
5986 static bool DPPP_(my_grok_numeric_radix
)(pTHX_
const char ** sp
, const char * send
);
5989 extern bool DPPP_(my_grok_numeric_radix
)(pTHX_
const char ** sp
, const char * send
);
5992 #ifdef grok_numeric_radix
5993 # undef grok_numeric_radix
5995 #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
5996 #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
5998 #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
6000 DPPP_(my_grok_numeric_radix
)(pTHX_
const char **sp
, const char *send
)
6002 #ifdef USE_LOCALE_NUMERIC
6003 #ifdef PL_numeric_radix_sv
6004 if (PL_numeric_radix_sv
&& IN_LOCALE
) {
6006 char* radix
= SvPV(PL_numeric_radix_sv
, len
);
6007 if (*sp
+ len
<= send
&& memEQ(*sp
, radix
, len
)) {
6013 /* older perls don't have PL_numeric_radix_sv so the radix
6014 * must manually be requested from locale.h
6017 dTHR
; /* needed for older threaded perls */
6018 struct lconv
*lc
= localeconv();
6019 char *radix
= lc
->decimal_point
;
6020 if (radix
&& IN_LOCALE
) {
6021 STRLEN len
= strlen(radix
);
6022 if (*sp
+ len
<= send
&& memEQ(*sp
, radix
, len
)) {
6028 #endif /* USE_LOCALE_NUMERIC */
6029 /* always try "." if numeric radix didn't match because
6030 * we may have data from different locales mixed */
6031 if (*sp
< send
&& **sp
== '.') {
6041 #if defined(NEED_grok_number)
6042 static int DPPP_(my_grok_number
)(pTHX_
const char * pv
, STRLEN len
, UV
* valuep
);
6045 extern int DPPP_(my_grok_number
)(pTHX_
const char * pv
, STRLEN len
, UV
* valuep
);
6051 #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
6052 #define Perl_grok_number DPPP_(my_grok_number)
6054 #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
6056 DPPP_(my_grok_number
)(pTHX_
const char *pv
, STRLEN len
, UV
*valuep
)
6059 const char *send
= pv
+ len
;
6060 const UV max_div_10
= UV_MAX
/ 10;
6061 const char max_mod_10
= UV_MAX
% 10;
6066 while (s
< send
&& isSPACE(*s
))
6070 } else if (*s
== '-') {
6072 numtype
= IS_NUMBER_NEG
;
6080 /* next must be digit or the radix separator or beginning of infinity */
6082 /* UVs are at least 32 bits, so the first 9 decimal digits cannot
6084 UV value
= *s
- '0';
6085 /* This construction seems to be more optimiser friendly.
6086 (without it gcc does the isDIGIT test and the *s - '0' separately)
6087 With it gcc on arm is managing 6 instructions (6 cycles) per digit.
6088 In theory the optimiser could deduce how far to unroll the loop
6089 before checking for overflow. */
6091 int digit
= *s
- '0';
6092 if (digit
>= 0 && digit
<= 9) {
6093 value
= value
* 10 + digit
;
6096 if (digit
>= 0 && digit
<= 9) {
6097 value
= value
* 10 + digit
;
6100 if (digit
>= 0 && digit
<= 9) {
6101 value
= value
* 10 + digit
;
6104 if (digit
>= 0 && digit
<= 9) {
6105 value
= value
* 10 + digit
;
6108 if (digit
>= 0 && digit
<= 9) {
6109 value
= value
* 10 + digit
;
6112 if (digit
>= 0 && digit
<= 9) {
6113 value
= value
* 10 + digit
;
6116 if (digit
>= 0 && digit
<= 9) {
6117 value
= value
* 10 + digit
;
6120 if (digit
>= 0 && digit
<= 9) {
6121 value
= value
* 10 + digit
;
6123 /* Now got 9 digits, so need to check
6124 each time for overflow. */
6126 while (digit
>= 0 && digit
<= 9
6127 && (value
< max_div_10
6128 || (value
== max_div_10
6129 && digit
<= max_mod_10
))) {
6130 value
= value
* 10 + digit
;
6136 if (digit
>= 0 && digit
<= 9
6138 /* value overflowed.
6139 skip the remaining digits, don't
6140 worry about setting *valuep. */
6143 } while (s
< send
&& isDIGIT(*s
));
6145 IS_NUMBER_GREATER_THAN_UV_MAX
;
6165 numtype
|= IS_NUMBER_IN_UV
;
6170 if (GROK_NUMERIC_RADIX(&s
, send
)) {
6171 numtype
|= IS_NUMBER_NOT_INT
;
6172 while (s
< send
&& isDIGIT(*s
)) /* optional digits after the radix */
6176 else if (GROK_NUMERIC_RADIX(&s
, send
)) {
6177 numtype
|= IS_NUMBER_NOT_INT
| IS_NUMBER_IN_UV
; /* valuep assigned below */
6178 /* no digits before the radix means we need digits after it */
6179 if (s
< send
&& isDIGIT(*s
)) {
6182 } while (s
< send
&& isDIGIT(*s
));
6184 /* integer approximation is valid - it's 0. */
6190 } else if (*s
== 'I' || *s
== 'i') {
6191 s
++; if (s
== send
|| (*s
!= 'N' && *s
!= 'n')) return 0;
6192 s
++; if (s
== send
|| (*s
!= 'F' && *s
!= 'f')) return 0;
6193 s
++; if (s
< send
&& (*s
== 'I' || *s
== 'i')) {
6194 s
++; if (s
== send
|| (*s
!= 'N' && *s
!= 'n')) return 0;
6195 s
++; if (s
== send
|| (*s
!= 'I' && *s
!= 'i')) return 0;
6196 s
++; if (s
== send
|| (*s
!= 'T' && *s
!= 't')) return 0;
6197 s
++; if (s
== send
|| (*s
!= 'Y' && *s
!= 'y')) return 0;
6201 } else if (*s
== 'N' || *s
== 'n') {
6202 /* XXX TODO: There are signaling NaNs and quiet NaNs. */
6203 s
++; if (s
== send
|| (*s
!= 'A' && *s
!= 'a')) return 0;
6204 s
++; if (s
== send
|| (*s
!= 'N' && *s
!= 'n')) return 0;
6211 numtype
&= IS_NUMBER_NEG
; /* Keep track of sign */
6212 numtype
|= IS_NUMBER_INFINITY
| IS_NUMBER_NOT_INT
;
6213 } else if (sawnan
) {
6214 numtype
&= IS_NUMBER_NEG
; /* Keep track of sign */
6215 numtype
|= IS_NUMBER_NAN
| IS_NUMBER_NOT_INT
;
6216 } else if (s
< send
) {
6217 /* we can have an optional exponent part */
6218 if (*s
== 'e' || *s
== 'E') {
6219 /* The only flag we keep is sign. Blow away any "it's UV" */
6220 numtype
&= IS_NUMBER_NEG
;
6221 numtype
|= IS_NUMBER_NOT_INT
;
6223 if (s
< send
&& (*s
== '-' || *s
== '+'))
6225 if (s
< send
&& isDIGIT(*s
)) {
6228 } while (s
< send
&& isDIGIT(*s
));
6234 while (s
< send
&& isSPACE(*s
))
6238 if (len
== 10 && memEQ(pv
, "0 but true", 10)) {
6241 return IS_NUMBER_IN_UV
;
6249 * The grok_* routines have been modified to use warn() instead of
6250 * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit,
6251 * which is why the stack variable has been renamed to 'xdigit'.
6255 #if defined(NEED_grok_bin)
6256 static UV
DPPP_(my_grok_bin
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6259 extern UV
DPPP_(my_grok_bin
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6265 #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
6266 #define Perl_grok_bin DPPP_(my_grok_bin)
6268 #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
6270 DPPP_(my_grok_bin
)(pTHX_
const char *start
, STRLEN
*len_p
, I32
*flags
, NV
*result
)
6272 const char *s
= start
;
6273 STRLEN len
= *len_p
;
6277 const UV max_div_2
= UV_MAX
/ 2;
6278 bool allow_underscores
= *flags
& PERL_SCAN_ALLOW_UNDERSCORES
;
6279 bool overflowed
= FALSE
;
6281 if (!(*flags
& PERL_SCAN_DISALLOW_PREFIX
)) {
6282 /* strip off leading b or 0b.
6283 for compatibility silently suffer "b" and "0b" as valid binary
6290 else if (len
>= 2 && s
[0] == '0' && s
[1] == 'b') {
6297 for (; len
-- && *s
; s
++) {
6299 if (bit
== '0' || bit
== '1') {
6300 /* Write it in this wonky order with a goto to attempt to get the
6301 compiler to make the common case integer-only loop pretty tight.
6302 With gcc seems to be much straighter code than old scan_bin. */
6305 if (value
<= max_div_2
) {
6306 value
= (value
<< 1) | (bit
- '0');
6309 /* Bah. We're just overflowed. */
6310 warn("Integer overflow in binary number");
6312 value_nv
= (NV
) value
;
6315 /* If an NV has not enough bits in its mantissa to
6316 * represent a UV this summing of small low-order numbers
6317 * is a waste of time (because the NV cannot preserve
6318 * the low-order bits anyway): we could just remember when
6319 * did we overflow and in the end just multiply value_nv by the
6321 value_nv
+= (NV
)(bit
- '0');
6324 if (bit
== '_' && len
&& allow_underscores
&& (bit
= s
[1])
6325 && (bit
== '0' || bit
== '1'))
6331 if (!(*flags
& PERL_SCAN_SILENT_ILLDIGIT
))
6332 warn("Illegal binary digit '%c' ignored", *s
);
6336 if ( ( overflowed
&& value_nv
> 4294967295.0)
6338 || (!overflowed
&& value
> 0xffffffff )
6341 warn("Binary number > 0b11111111111111111111111111111111 non-portable");
6348 *flags
= PERL_SCAN_GREATER_THAN_UV_MAX
;
6357 #if defined(NEED_grok_hex)
6358 static UV
DPPP_(my_grok_hex
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6361 extern UV
DPPP_(my_grok_hex
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6367 #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
6368 #define Perl_grok_hex DPPP_(my_grok_hex)
6370 #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
6372 DPPP_(my_grok_hex
)(pTHX_
const char *start
, STRLEN
*len_p
, I32
*flags
, NV
*result
)
6374 const char *s
= start
;
6375 STRLEN len
= *len_p
;
6379 const UV max_div_16
= UV_MAX
/ 16;
6380 bool allow_underscores
= *flags
& PERL_SCAN_ALLOW_UNDERSCORES
;
6381 bool overflowed
= FALSE
;
6384 if (!(*flags
& PERL_SCAN_DISALLOW_PREFIX
)) {
6385 /* strip off leading x or 0x.
6386 for compatibility silently suffer "x" and "0x" as valid hex numbers.
6393 else if (len
>= 2 && s
[0] == '0' && s
[1] == 'x') {
6400 for (; len
-- && *s
; s
++) {
6401 xdigit
= strchr((char *) PL_hexdigit
, *s
);
6403 /* Write it in this wonky order with a goto to attempt to get the
6404 compiler to make the common case integer-only loop pretty tight.
6405 With gcc seems to be much straighter code than old scan_hex. */
6408 if (value
<= max_div_16
) {
6409 value
= (value
<< 4) | ((xdigit
- PL_hexdigit
) & 15);
6412 warn("Integer overflow in hexadecimal number");
6414 value_nv
= (NV
) value
;
6417 /* If an NV has not enough bits in its mantissa to
6418 * represent a UV this summing of small low-order numbers
6419 * is a waste of time (because the NV cannot preserve
6420 * the low-order bits anyway): we could just remember when
6421 * did we overflow and in the end just multiply value_nv by the
6422 * right amount of 16-tuples. */
6423 value_nv
+= (NV
)((xdigit
- PL_hexdigit
) & 15);
6426 if (*s
== '_' && len
&& allow_underscores
&& s
[1]
6427 && (xdigit
= strchr((char *) PL_hexdigit
, s
[1])))
6433 if (!(*flags
& PERL_SCAN_SILENT_ILLDIGIT
))
6434 warn("Illegal hexadecimal digit '%c' ignored", *s
);
6438 if ( ( overflowed
&& value_nv
> 4294967295.0)
6440 || (!overflowed
&& value
> 0xffffffff )
6443 warn("Hexadecimal number > 0xffffffff non-portable");
6450 *flags
= PERL_SCAN_GREATER_THAN_UV_MAX
;
6459 #if defined(NEED_grok_oct)
6460 static UV
DPPP_(my_grok_oct
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6463 extern UV
DPPP_(my_grok_oct
)(pTHX_
const char * start
, STRLEN
* len_p
, I32
* flags
, NV
* result
);
6469 #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
6470 #define Perl_grok_oct DPPP_(my_grok_oct)
6472 #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
6474 DPPP_(my_grok_oct
)(pTHX_
const char *start
, STRLEN
*len_p
, I32
*flags
, NV
*result
)
6476 const char *s
= start
;
6477 STRLEN len
= *len_p
;
6481 const UV max_div_8
= UV_MAX
/ 8;
6482 bool allow_underscores
= *flags
& PERL_SCAN_ALLOW_UNDERSCORES
;
6483 bool overflowed
= FALSE
;
6485 for (; len
-- && *s
; s
++) {
6486 /* gcc 2.95 optimiser not smart enough to figure that this subtraction
6487 out front allows slicker code. */
6488 int digit
= *s
- '0';
6489 if (digit
>= 0 && digit
<= 7) {
6490 /* Write it in this wonky order with a goto to attempt to get the
6491 compiler to make the common case integer-only loop pretty tight.
6495 if (value
<= max_div_8
) {
6496 value
= (value
<< 3) | digit
;
6499 /* Bah. We're just overflowed. */
6500 warn("Integer overflow in octal number");
6502 value_nv
= (NV
) value
;
6505 /* If an NV has not enough bits in its mantissa to
6506 * represent a UV this summing of small low-order numbers
6507 * is a waste of time (because the NV cannot preserve
6508 * the low-order bits anyway): we could just remember when
6509 * did we overflow and in the end just multiply value_nv by the
6510 * right amount of 8-tuples. */
6511 value_nv
+= (NV
)digit
;
6514 if (digit
== ('_' - '0') && len
&& allow_underscores
6515 && (digit
= s
[1] - '0') && (digit
>= 0 && digit
<= 7))
6521 /* Allow \octal to work the DWIM way (that is, stop scanning
6522 * as soon as non-octal characters are seen, complain only iff
6523 * someone seems to want to use the digits eight and nine). */
6524 if (digit
== 8 || digit
== 9) {
6525 if (!(*flags
& PERL_SCAN_SILENT_ILLDIGIT
))
6526 warn("Illegal octal digit '%c' ignored", *s
);
6531 if ( ( overflowed
&& value_nv
> 4294967295.0)
6533 || (!overflowed
&& value
> 0xffffffff )
6536 warn("Octal number > 037777777777 non-portable");
6543 *flags
= PERL_SCAN_GREATER_THAN_UV_MAX
;
6551 #if !defined(my_snprintf)
6552 #if defined(NEED_my_snprintf)
6553 static int DPPP_(my_my_snprintf
)(char * buffer
, const Size_t len
, const char * format
, ...);
6556 extern int DPPP_(my_my_snprintf
)(char * buffer
, const Size_t len
, const char * format
, ...);
6559 #define my_snprintf DPPP_(my_my_snprintf)
6560 #define Perl_my_snprintf DPPP_(my_my_snprintf)
6562 #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL)
6565 DPPP_(my_my_snprintf
)(char *buffer
, const Size_t len
, const char *format
, ...)
6570 va_start(ap
, format
);
6571 #ifdef HAS_VSNPRINTF
6572 retval
= vsnprintf(buffer
, len
, format
, ap
);
6574 retval
= vsprintf(buffer
, format
, ap
);
6577 if (retval
< 0 || (len
> 0 && (Size_t
)retval
>= len
))
6578 Perl_croak(aTHX_
"panic: my_snprintf buffer overflow");
6585 #if !defined(my_sprintf)
6586 #if defined(NEED_my_sprintf)
6587 static int DPPP_(my_my_sprintf
)(char * buffer
, const char * pat
, ...);
6590 extern int DPPP_(my_my_sprintf
)(char * buffer
, const char * pat
, ...);
6593 #define my_sprintf DPPP_(my_my_sprintf)
6594 #define Perl_my_sprintf DPPP_(my_my_sprintf)
6596 #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL)
6599 DPPP_(my_my_sprintf
)(char *buffer
, const char* pat
, ...)
6602 va_start(args
, pat
);
6603 vsprintf(buffer
, pat
, args
);
6605 return strlen(buffer
);
6613 # define dXCPT dJMPENV; int rEtV = 0
6614 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0)
6615 # define XCPT_TRY_END JMPENV_POP;
6616 # define XCPT_CATCH if (rEtV != 0)
6617 # define XCPT_RETHROW JMPENV_JUMP(rEtV)
6619 # define dXCPT Sigjmp_buf oldTOP; int rEtV = 0
6620 # define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0)
6621 # define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf);
6622 # define XCPT_CATCH if (rEtV != 0)
6623 # define XCPT_RETHROW Siglongjmp(top_env, rEtV)
6627 #if !defined(my_strlcat)
6628 #if defined(NEED_my_strlcat)
6629 static Size_t
DPPP_(my_my_strlcat
)(char * dst
, const char * src
, Size_t size
);
6632 extern Size_t
DPPP_(my_my_strlcat
)(char * dst
, const char * src
, Size_t size
);
6635 #define my_strlcat DPPP_(my_my_strlcat)
6636 #define Perl_my_strlcat DPPP_(my_my_strlcat)
6638 #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL)
6641 DPPP_(my_my_strlcat
)(char *dst
, const char *src
, Size_t size
)
6643 Size_t used
, length
, copy
;
6646 length
= strlen(src
);
6647 if (size
> 0 && used
< size
- 1) {
6648 copy
= (length
>= size
- used
) ? size
- used
- 1 : length
;
6649 memcpy(dst
+ used
, src
, copy
);
6650 dst
[used
+ copy
] = '\0';
6652 return used
+ length
;
6657 #if !defined(my_strlcpy)
6658 #if defined(NEED_my_strlcpy)
6659 static Size_t
DPPP_(my_my_strlcpy
)(char * dst
, const char * src
, Size_t size
);
6662 extern Size_t
DPPP_(my_my_strlcpy
)(char * dst
, const char * src
, Size_t size
);
6665 #define my_strlcpy DPPP_(my_my_strlcpy)
6666 #define Perl_my_strlcpy DPPP_(my_my_strlcpy)
6668 #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL)
6671 DPPP_(my_my_strlcpy
)(char *dst
, const char *src
, Size_t size
)
6673 Size_t length
, copy
;
6675 length
= strlen(src
);
6677 copy
= (length
>= size
) ? size
- 1 : length
;
6678 memcpy(dst
, src
, copy
);
6686 #ifndef PERL_PV_ESCAPE_QUOTE
6687 # define PERL_PV_ESCAPE_QUOTE 0x0001
6690 #ifndef PERL_PV_PRETTY_QUOTE
6691 # define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE
6694 #ifndef PERL_PV_PRETTY_ELLIPSES
6695 # define PERL_PV_PRETTY_ELLIPSES 0x0002
6698 #ifndef PERL_PV_PRETTY_LTGT
6699 # define PERL_PV_PRETTY_LTGT 0x0004
6702 #ifndef PERL_PV_ESCAPE_FIRSTCHAR
6703 # define PERL_PV_ESCAPE_FIRSTCHAR 0x0008
6706 #ifndef PERL_PV_ESCAPE_UNI
6707 # define PERL_PV_ESCAPE_UNI 0x0100
6710 #ifndef PERL_PV_ESCAPE_UNI_DETECT
6711 # define PERL_PV_ESCAPE_UNI_DETECT 0x0200
6714 #ifndef PERL_PV_ESCAPE_ALL
6715 # define PERL_PV_ESCAPE_ALL 0x1000
6718 #ifndef PERL_PV_ESCAPE_NOBACKSLASH
6719 # define PERL_PV_ESCAPE_NOBACKSLASH 0x2000
6722 #ifndef PERL_PV_ESCAPE_NOCLEAR
6723 # define PERL_PV_ESCAPE_NOCLEAR 0x4000
6726 #ifndef PERL_PV_ESCAPE_RE
6727 # define PERL_PV_ESCAPE_RE 0x8000
6730 #ifndef PERL_PV_PRETTY_NOCLEAR
6731 # define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR
6733 #ifndef PERL_PV_PRETTY_DUMP
6734 # define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE
6737 #ifndef PERL_PV_PRETTY_REGPROP
6738 # define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE
6742 * Note that unicode functionality is only backported to
6743 * those perl versions that support it. For older perl
6744 * versions, the implementation will fall back to bytes.
6748 #if defined(NEED_pv_escape)
6749 static char * DPPP_(my_pv_escape
)(pTHX_ SV
* dsv
, char const * const str
, const STRLEN count
, const STRLEN max
, STRLEN
* const escaped
, const U32 flags
);
6752 extern char * DPPP_(my_pv_escape
)(pTHX_ SV
* dsv
, char const * const str
, const STRLEN count
, const STRLEN max
, STRLEN
* const escaped
, const U32 flags
);
6758 #define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f)
6759 #define Perl_pv_escape DPPP_(my_pv_escape)
6761 #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL)
6764 DPPP_(my_pv_escape
)(pTHX_ SV
*dsv
, char const * const str
,
6765 const STRLEN count
, const STRLEN max
,
6766 STRLEN
* const escaped
, const U32 flags
)
6768 const char esc
= flags
& PERL_PV_ESCAPE_RE
? '%' : '\\';
6769 const char dq
= flags
& PERL_PV_ESCAPE_QUOTE
? '"' : esc
;
6770 char octbuf
[32] = "%123456789ABCDF";
6773 STRLEN readsize
= 1;
6774 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6775 bool isuni
= flags
& PERL_PV_ESCAPE_UNI
? 1 : 0;
6777 const char *pv
= str
;
6778 const char * const end
= pv
+ count
;
6781 if (!(flags
& PERL_PV_ESCAPE_NOCLEAR
))
6784 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6785 if ((flags
& PERL_PV_ESCAPE_UNI_DETECT
) && is_utf8_string((U8
*)pv
, count
))
6789 for (; pv
< end
&& (!max
|| wrote
< max
) ; pv
+= readsize
) {
6791 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
6792 isuni
? utf8_to_uvchr((U8
*)pv
, &readsize
) :
6795 const U8 c
= (U8
)u
& 0xFF;
6797 if (u
> 255 || (flags
& PERL_PV_ESCAPE_ALL
)) {
6798 if (flags
& PERL_PV_ESCAPE_FIRSTCHAR
)
6799 chsize
= my_snprintf(octbuf
, sizeof octbuf
,
6802 chsize
= my_snprintf(octbuf
, sizeof octbuf
,
6803 "%cx{%"UVxf
"}", esc
, u
);
6804 } else if (flags
& PERL_PV_ESCAPE_NOBACKSLASH
) {
6807 if (c
== dq
|| c
== esc
|| !isPRINT(c
)) {
6810 case '\\' : /* fallthrough */
6811 case '%' : if (c
== esc
)
6816 case '\v' : octbuf
[1] = 'v'; break;
6817 case '\t' : octbuf
[1] = 't'; break;
6818 case '\r' : octbuf
[1] = 'r'; break;
6819 case '\n' : octbuf
[1] = 'n'; break;
6820 case '\f' : octbuf
[1] = 'f'; break;
6821 case '"' : if (dq
== '"')
6826 default: chsize
= my_snprintf(octbuf
, sizeof octbuf
,
6827 pv
< end
&& isDIGIT((U8
)*(pv
+readsize
))
6828 ? "%c%03o" : "%c%o", esc
, c
);
6834 if (max
&& wrote
+ chsize
> max
) {
6836 } else if (chsize
> 1) {
6837 sv_catpvn(dsv
, octbuf
, chsize
);
6841 my_snprintf(tmp
, sizeof tmp
, "%c", c
);
6842 sv_catpvn(dsv
, tmp
, 1);
6845 if (flags
& PERL_PV_ESCAPE_FIRSTCHAR
)
6848 if (escaped
!= NULL
)
6857 #if defined(NEED_pv_pretty)
6858 static char * DPPP_(my_pv_pretty
)(pTHX_ SV
* dsv
, char const * const str
, const STRLEN count
, const STRLEN max
, char const * const start_color
, char const * const end_color
, const U32 flags
);
6861 extern char * DPPP_(my_pv_pretty
)(pTHX_ SV
* dsv
, char const * const str
, const STRLEN count
, const STRLEN max
, char const * const start_color
, char const * const end_color
, const U32 flags
);
6867 #define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g)
6868 #define Perl_pv_pretty DPPP_(my_pv_pretty)
6870 #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL)
6873 DPPP_(my_pv_pretty
)(pTHX_ SV
*dsv
, char const * const str
, const STRLEN count
,
6874 const STRLEN max
, char const * const start_color
, char const * const end_color
,
6877 const U8 dq
= (flags
& PERL_PV_PRETTY_QUOTE
) ? '"' : '%';
6880 if (!(flags
& PERL_PV_PRETTY_NOCLEAR
))
6884 sv_catpvs(dsv
, "\"");
6885 else if (flags
& PERL_PV_PRETTY_LTGT
)
6886 sv_catpvs(dsv
, "<");
6888 if (start_color
!= NULL
)
6889 sv_catpv(dsv
, D_PPP_CONSTPV_ARG(start_color
));
6891 pv_escape(dsv
, str
, count
, max
, &escaped
, flags
| PERL_PV_ESCAPE_NOCLEAR
);
6893 if (end_color
!= NULL
)
6894 sv_catpv(dsv
, D_PPP_CONSTPV_ARG(end_color
));
6897 sv_catpvs(dsv
, "\"");
6898 else if (flags
& PERL_PV_PRETTY_LTGT
)
6899 sv_catpvs(dsv
, ">");
6901 if ((flags
& PERL_PV_PRETTY_ELLIPSES
) && escaped
< count
)
6902 sv_catpvs(dsv
, "...");
6911 #if defined(NEED_pv_display)
6912 static char * DPPP_(my_pv_display
)(pTHX_ SV
* dsv
, const char * pv
, STRLEN cur
, STRLEN len
, STRLEN pvlim
);
6915 extern char * DPPP_(my_pv_display
)(pTHX_ SV
* dsv
, const char * pv
, STRLEN cur
, STRLEN len
, STRLEN pvlim
);
6921 #define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e)
6922 #define Perl_pv_display DPPP_(my_pv_display)
6924 #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL)
6927 DPPP_(my_pv_display
)(pTHX_ SV
*dsv
, const char *pv
, STRLEN cur
, STRLEN len
, STRLEN pvlim
)
6929 pv_pretty(dsv
, pv
, cur
, pvlim
, NULL
, NULL
, PERL_PV_PRETTY_DUMP
);
6930 if (len
> cur
&& pv
[cur
] == '\0')
6931 sv_catpvs(dsv
, "\\0");
6938 #endif /* _P_P_PORTABILITY_H_ */
6940 /* End of File ppport.h */