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