source: for-distributions/trunk/bin/windows/perl/lib/Devel/PPPort.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 132.2 KB
Line 
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
28Devel::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
37Perl's API has changed over time, gaining new features, new functions,
38increasing its flexibility, and reducing the impact on the C namespace
39environment (reduced pollution). The header file written by this module,
40typically F<ppport.h>, attempts to bring some of the newer Perl API
41features to older versions of Perl, so that you can worry less about
42keeping track of old releases, but users can still reap the benefit.
43
44C<Devel::PPPort> contains a single function, called C<WriteFile>. Its
45only purpose is to write the F<ppport.h> C header file. This file
46contains a series of macros and, if explicitly requested, functions that
47allow XS modules to be built using older versions of Perl. Currently,
48Perl versions from 5.003 to 5.9.3 are supported.
49
50This module is used by C<h2xs> to write the file F<ppport.h>.
51
52=head2 Why use ppport.h?
53
54You should use F<ppport.h> in modern code so that your code will work
55with the widest range of Perl interpreters possible, without significant
56additional work.
57
58You should attempt older code to fully use F<ppport.h>, because the
59reduced pollution of newer Perl versions is an important thing. It's so
60important that the old polluting ways of original Perl modules will not be
61supported very far into the future, and your module will almost certainly
62break! By adapting to it now, you'll gain compatibility and a sense of
63having done the electronic ecology some good.
64
65=head2 How to use ppport.h
66
67Don't direct the users of your module to download C<Devel::PPPort>.
68They are most probably no XS writers. Also, don't make F<ppport.h>
69optional. Rather, just take the most recent copy of F<ppport.h> that
70you can find (e.g. by generating it with the latest C<Devel::PPPort>
71release from CPAN), copy it into your project, adjust your project to
72use it, and distribute the header along with your module.
73
74=head2 Running ppport.h
75
76But F<ppport.h> is more than just a C header. It's also a Perl script
77that can check your source code. It will suggest hints and portability
78notes, and can even make suggestions on how to change your code. You
79can run it like any other Perl program:
80
81 perl ppport.h [options] [files]
82
83It also has embedded documentation, so you can use
84
85 perldoc ppport.h
86
87to find out more about how to use it.
88
89=head1 FUNCTIONS
90
91=head2 WriteFile
92
93C<WriteFile> takes one optional argument. When called with one
94argument, it expects to be passed a filename. When called with
95no arguments, it defaults to the filename F<ppport.h>.
96
97The function returns a true value if the file was written successfully.
98Otherwise it returns a false value.
99
100=head1 COMPATIBILITY
101
102F<ppport.h> supports Perl versions from 5.003 to 5.9.3
103in threaded and non-threaded configurations.
104
105=head2 Provided Perl compatibility API
106
107The header file written by this module, typically F<ppport.h>, provides
108access to the following elements of the Perl API that is not available
109in 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
378There is still a big part of the API not supported by F<ppport.h>.
379Either because it doesn't make sense to back-port that part of the API,
380or simply because it hasn't been implemented yet. Patches welcome!
381
382Here's a list of the currently unsupported API, and also the version of
383Perl 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
859If you find any bugs, C<Devel::PPPort> doesn't seem to build on your
860system or any of its tests fail, please use the CPAN Request Tracker
861at L<http://rt.cpan.org/> to create a ticket for the module.
862
863=head1 AUTHORS
864
865=over 2
866
867=item *
868
869Version 1.x of Devel::PPPort was written by Kenneth Albanowski.
870
871=item *
872
873Version 2.x was ported to the Perl core by Paul Marquess.
874
875=item *
876
877Version 3.x was ported back to CPAN by Marcus Holland-Moritz.
878
879=back
880
881=head1 COPYRIGHT
882
883Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
884
885Version 2.x, Copyright (C) 2001, Paul Marquess.
886
887Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
888
889This program is free software; you can redistribute it and/or
890modify it under the same terms as Perl itself.
891
892=head1 SEE ALSO
893
894See L<h2xs>, L<ppport.h>.
895
896=cut
897
898package Devel::PPPort;
899
900require DynaLoader;
901use strict;
902use 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
908bootstrap Devel::PPPort;
909
910sub _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
922sub 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
9361;
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
957SKIP
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
1267use strict;
1268
1269my %opt = (
1270 quiet => 0,
1271 diag => 1,
1272 hints => 1,
1273 changes => 1,
1274 cplusplus => 0,
1275 filter => 1,
1276);
1277
1278my($ppport) = $0 =~ /([\w.]+)$/;
1279my $LF = '(?:\r\n|[\r\n])'; # line feed
1280my $HS = "[ \t]"; # horizontal whitespace
1281
1282eval {
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
1291if ($@ and grep /^-/, @ARGV) {
1292 usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
1293 die "Getopt::Long not found. Please don't use any options.\n";
1294}
1295
1296usage() if $opt{help};
1297
1298if (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}
1307else {
1308 $opt{'compat-version'} = 5;
1309}
1310
1311# Never use C comments in this file!!!!!
1312my $ccs = '/'.'*';
1313my $cce = '*'.'/';
1314my $rccs = quotemeta $ccs;
1315my $rcce = quotemeta $cce;
1316
1317my %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(
1326AvFILLp|5.004050||p
1327AvFILL|||
1328CLASS|||n
1329CX_CURPAD_SAVE|||
1330CX_CURPAD_SV|||
1331CopFILEAV|5.006000||p
1332CopFILEGV_set|5.006000||p
1333CopFILEGV|5.006000||p
1334CopFILESV|5.006000||p
1335CopFILE_set|5.006000||p
1336CopFILE|5.006000||p
1337CopSTASHPV_set|5.006000||p
1338CopSTASHPV|5.006000||p
1339CopSTASH_eq|5.006000||p
1340CopSTASH_set|5.006000||p
1341CopSTASH|5.006000||p
1342CopyD|5.009002||p
1343Copy|||
1344CvPADLIST|||
1345CvSTASH|||
1346CvWEAKOUTSIDE|||
1347DEFSV|5.004050||p
1348END_EXTERN_C|5.005000||p
1349ENTER|||
1350ERRSV|5.004050||p
1351EXTEND|||
1352EXTERN_C|5.005000||p
1353FREETMPS|||
1354GIMME_V||5.004000|n
1355GIMME|||n
1356GROK_NUMERIC_RADIX|5.007002||p
1357G_ARRAY|||
1358G_DISCARD|||
1359G_EVAL|||
1360G_NOARGS|||
1361G_SCALAR|||
1362G_VOID||5.004000|
1363GetVars|||
1364GvSV|||
1365Gv_AMupdate|||
1366HEf_SVKEY||5.004000|
1367HeHASH||5.004000|
1368HeKEY||5.004000|
1369HeKLEN||5.004000|
1370HePV||5.004000|
1371HeSVKEY_force||5.004000|
1372HeSVKEY_set||5.004000|
1373HeSVKEY||5.004000|
1374HeVAL||5.004000|
1375HvNAME|||
1376INT2PTR|5.006000||p
1377IN_LOCALE_COMPILETIME|5.007002||p
1378IN_LOCALE_RUNTIME|5.007002||p
1379IN_LOCALE|5.007002||p
1380IN_PERL_COMPILETIME|5.008001||p
1381IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p
1382IS_NUMBER_INFINITY|5.007002||p
1383IS_NUMBER_IN_UV|5.007002||p
1384IS_NUMBER_NAN|5.007003||p
1385IS_NUMBER_NEG|5.007002||p
1386IS_NUMBER_NOT_INT|5.007002||p
1387IVSIZE|5.006000||p
1388IVTYPE|5.006000||p
1389IVdf|5.006000||p
1390LEAVE|||
1391LVRET|||
1392MARK|||
1393MY_CXT_CLONE|5.009002||p
1394MY_CXT_INIT|5.007003||p
1395MY_CXT|5.007003||p
1396MoveD|5.009002||p
1397Move|||
1398NEWSV|||
1399NOOP|5.005000||p
1400NUM2PTR|5.006000||p
1401NVTYPE|5.006000||p
1402NVef|5.006001||p
1403NVff|5.006001||p
1404NVgf|5.006001||p
1405Newc|||
1406Newz|||
1407New|||
1408Nullav|||
1409Nullch|||
1410Nullcv|||
1411Nullhv|||
1412Nullsv|||
1413ORIGMARK|||
1414PAD_BASE_SV|||
1415PAD_CLONE_VARS|||
1416PAD_COMPNAME_FLAGS|||
1417PAD_COMPNAME_GEN_set|||
1418PAD_COMPNAME_GEN|||
1419PAD_COMPNAME_OURSTASH|||
1420PAD_COMPNAME_PV|||
1421PAD_COMPNAME_TYPE|||
1422PAD_RESTORE_LOCAL|||
1423PAD_SAVE_LOCAL|||
1424PAD_SAVE_SETNULLPAD|||
1425PAD_SETSV|||
1426PAD_SET_CUR_NOSAVE|||
1427PAD_SET_CUR|||
1428PAD_SVl|||
1429PAD_SV|||
1430PERL_BCDVERSION|5.009003||p
1431PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
1432PERL_INT_MAX|5.004000||p
1433PERL_INT_MIN|5.004000||p
1434PERL_LONG_MAX|5.004000||p
1435PERL_LONG_MIN|5.004000||p
1436PERL_MAGIC_arylen|5.007002||p
1437PERL_MAGIC_backref|5.007002||p
1438PERL_MAGIC_bm|5.007002||p
1439PERL_MAGIC_collxfrm|5.007002||p
1440PERL_MAGIC_dbfile|5.007002||p
1441PERL_MAGIC_dbline|5.007002||p
1442PERL_MAGIC_defelem|5.007002||p
1443PERL_MAGIC_envelem|5.007002||p
1444PERL_MAGIC_env|5.007002||p
1445PERL_MAGIC_ext|5.007002||p
1446PERL_MAGIC_fm|5.007002||p
1447PERL_MAGIC_glob|5.007002||p
1448PERL_MAGIC_isaelem|5.007002||p
1449PERL_MAGIC_isa|5.007002||p
1450PERL_MAGIC_mutex|5.007002||p
1451PERL_MAGIC_nkeys|5.007002||p
1452PERL_MAGIC_overload_elem|5.007002||p
1453PERL_MAGIC_overload_table|5.007002||p
1454PERL_MAGIC_overload|5.007002||p
1455PERL_MAGIC_pos|5.007002||p
1456PERL_MAGIC_qr|5.007002||p
1457PERL_MAGIC_regdata|5.007002||p
1458PERL_MAGIC_regdatum|5.007002||p
1459PERL_MAGIC_regex_global|5.007002||p
1460PERL_MAGIC_shared_scalar|5.007003||p
1461PERL_MAGIC_shared|5.007003||p
1462PERL_MAGIC_sigelem|5.007002||p
1463PERL_MAGIC_sig|5.007002||p
1464PERL_MAGIC_substr|5.007002||p
1465PERL_MAGIC_sv|5.007002||p
1466PERL_MAGIC_taint|5.007002||p
1467PERL_MAGIC_tiedelem|5.007002||p
1468PERL_MAGIC_tiedscalar|5.007002||p
1469PERL_MAGIC_tied|5.007002||p
1470PERL_MAGIC_utf8|5.008001||p
1471PERL_MAGIC_uvar_elem|5.007003||p
1472PERL_MAGIC_uvar|5.007002||p
1473PERL_MAGIC_vec|5.007002||p
1474PERL_MAGIC_vstring|5.008001||p
1475PERL_QUAD_MAX|5.004000||p
1476PERL_QUAD_MIN|5.004000||p
1477PERL_REVISION|5.006000||p
1478PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p
1479PERL_SCAN_DISALLOW_PREFIX|5.007003||p
1480PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p
1481PERL_SCAN_SILENT_ILLDIGIT|5.008001||p
1482PERL_SHORT_MAX|5.004000||p
1483PERL_SHORT_MIN|5.004000||p
1484PERL_SUBVERSION|5.006000||p
1485PERL_UCHAR_MAX|5.004000||p
1486PERL_UCHAR_MIN|5.004000||p
1487PERL_UINT_MAX|5.004000||p
1488PERL_UINT_MIN|5.004000||p
1489PERL_ULONG_MAX|5.004000||p
1490PERL_ULONG_MIN|5.004000||p
1491PERL_UNUSED_DECL|5.007002||p
1492PERL_UQUAD_MAX|5.004000||p
1493PERL_UQUAD_MIN|5.004000||p
1494PERL_USHORT_MAX|5.004000||p
1495PERL_USHORT_MIN|5.004000||p
1496PERL_VERSION|5.006000||p
1497PL_DBsingle|||pn
1498PL_DBsub|||pn
1499PL_DBtrace|||n
1500PL_Sv|5.005000||p
1501PL_compiling|5.004050||p
1502PL_copline|5.005000||p
1503PL_curcop|5.004050||p
1504PL_curstash|5.004050||p
1505PL_debstash|5.004050||p
1506PL_defgv|5.004050||p
1507PL_diehook|5.004050||p
1508PL_dirty|5.004050||p
1509PL_dowarn|||pn
1510PL_errgv|5.004050||p
1511PL_hexdigit|5.005000||p
1512PL_hints|5.005000||p
1513PL_last_in_gv|||n
1514PL_modglobal||5.005000|n
1515PL_na|5.004050||pn
1516PL_no_modify|5.006000||p
1517PL_ofs_sv|||n
1518PL_perl_destruct_level|5.004050||p
1519PL_perldb|5.004050||p
1520PL_ppaddr|5.006000||p
1521PL_rsfp_filters|5.004050||p
1522PL_rsfp|5.004050||p
1523PL_rs|||n
1524PL_stack_base|5.004050||p
1525PL_stack_sp|5.004050||p
1526PL_stdingv|5.004050||p
1527PL_sv_arenaroot|5.004050||p
1528PL_sv_no|5.004050||pn
1529PL_sv_undef|5.004050||pn
1530PL_sv_yes|5.004050||pn
1531PL_tainted|5.004050||p
1532PL_tainting|5.004050||p
1533POPi|||n
1534POPl|||n
1535POPn|||n
1536POPpbytex||5.007001|n
1537POPpx||5.005030|n
1538POPp|||n
1539POPs|||n
1540PTR2IV|5.006000||p
1541PTR2NV|5.006000||p
1542PTR2UV|5.006000||p
1543PTR2ul|5.007001||p
1544PTRV|5.006000||p
1545PUSHMARK|||
1546PUSHi|||
1547PUSHmortal|5.009002||p
1548PUSHn|||
1549PUSHp|||
1550PUSHs|||
1551PUSHu|5.004000||p
1552PUTBACK|||
1553PerlIO_clearerr||5.007003|
1554PerlIO_close||5.007003|
1555PerlIO_eof||5.007003|
1556PerlIO_error||5.007003|
1557PerlIO_fileno||5.007003|
1558PerlIO_fill||5.007003|
1559PerlIO_flush||5.007003|
1560PerlIO_get_base||5.007003|
1561PerlIO_get_bufsiz||5.007003|
1562PerlIO_get_cnt||5.007003|
1563PerlIO_get_ptr||5.007003|
1564PerlIO_read||5.007003|
1565PerlIO_seek||5.007003|
1566PerlIO_set_cnt||5.007003|
1567PerlIO_set_ptrcnt||5.007003|
1568PerlIO_setlinebuf||5.007003|
1569PerlIO_stderr||5.007003|
1570PerlIO_stdin||5.007003|
1571PerlIO_stdout||5.007003|
1572PerlIO_tell||5.007003|
1573PerlIO_unread||5.007003|
1574PerlIO_write||5.007003|
1575Poison|5.008000||p
1576RETVAL|||n
1577Renewc|||
1578Renew|||
1579SAVECLEARSV|||
1580SAVECOMPPAD|||
1581SAVEPADSV|||
1582SAVETMPS|||
1583SAVE_DEFSV|5.004050||p
1584SPAGAIN|||
1585SP|||
1586START_EXTERN_C|5.005000||p
1587START_MY_CXT|5.007003||p
1588STMT_END|||p
1589STMT_START|||p
1590ST|||
1591SVt_IV|||
1592SVt_NV|||
1593SVt_PVAV|||
1594SVt_PVCV|||
1595SVt_PVHV|||
1596SVt_PVMG|||
1597SVt_PV|||
1598Safefree|||
1599Slab_Alloc|||
1600Slab_Free|||
1601StructCopy|||
1602SvCUR_set|||
1603SvCUR|||
1604SvEND|||
1605SvGETMAGIC|5.004050||p
1606SvGROW|||
1607SvIOK_UV||5.006000|
1608SvIOK_notUV||5.006000|
1609SvIOK_off|||
1610SvIOK_only_UV||5.006000|
1611SvIOK_only|||
1612SvIOK_on|||
1613SvIOKp|||
1614SvIOK|||
1615SvIVX|||
1616SvIV_nomg|5.009001||p
1617SvIV_set|||
1618SvIVx|||
1619SvIV|||
1620SvIsCOW_shared_hash||5.008003|
1621SvIsCOW||5.008003|
1622SvLEN_set|||
1623SvLEN|||
1624SvLOCK||5.007003|
1625SvMAGIC_set||5.009003|
1626SvNIOK_off|||
1627SvNIOKp|||
1628SvNIOK|||
1629SvNOK_off|||
1630SvNOK_only|||
1631SvNOK_on|||
1632SvNOKp|||
1633SvNOK|||
1634SvNVX|||
1635SvNV_set|||
1636SvNVx|||
1637SvNV|||
1638SvOK|||
1639SvOOK|||
1640SvPOK_off|||
1641SvPOK_only_UTF8||5.006000|
1642SvPOK_only|||
1643SvPOK_on|||
1644SvPOKp|||
1645SvPOK|||
1646SvPVX|||
1647SvPV_force_nomg|5.007002||p
1648SvPV_force|||
1649SvPV_nolen|5.006000||p
1650SvPV_nomg|5.007002||p
1651SvPV_set|||
1652SvPVbyte_force||5.009002|
1653SvPVbyte_nolen||5.006000|
1654SvPVbytex_force||5.006000|
1655SvPVbytex||5.006000|
1656SvPVbyte|5.006000||p
1657SvPVutf8_force||5.006000|
1658SvPVutf8_nolen||5.006000|
1659SvPVutf8x_force||5.006000|
1660SvPVutf8x||5.006000|
1661SvPVutf8||5.006000|
1662SvPVx|||
1663SvPV|||
1664SvREFCNT_dec|||
1665SvREFCNT_inc|||
1666SvREFCNT|||
1667SvROK_off|||
1668SvROK_on|||
1669SvROK|||
1670SvRV_set||5.009003|
1671SvRV|||
1672SvSETMAGIC|||
1673SvSHARE||5.007003|
1674SvSTASH_set||5.009003|
1675SvSTASH|||
1676SvSetMagicSV_nosteal||5.004000|
1677SvSetMagicSV||5.004000|
1678SvSetSV_nosteal||5.004000|
1679SvSetSV|||
1680SvTAINTED_off||5.004000|
1681SvTAINTED_on||5.004000|
1682SvTAINTED||5.004000|
1683SvTAINT|||
1684SvTRUE|||
1685SvTYPE|||
1686SvUNLOCK||5.007003|
1687SvUOK||5.007001|
1688SvUPGRADE|||
1689SvUTF8_off||5.006000|
1690SvUTF8_on||5.006000|
1691SvUTF8||5.006000|
1692SvUVXx|5.004000||p
1693SvUVX|5.004000||p
1694SvUV_nomg|5.009001||p
1695SvUV_set||5.009003|
1696SvUVx|5.004000||p
1697SvUV|5.004000||p
1698SvVOK||5.008001|
1699THIS|||n
1700UNDERBAR|5.009002||p
1701UVSIZE|5.006000||p
1702UVTYPE|5.006000||p
1703UVXf|5.007001||p
1704UVof|5.006000||p
1705UVuf|5.006000||p
1706UVxf|5.006000||p
1707XCPT_CATCH|5.009002||p
1708XCPT_RETHROW|5.009002||p
1709XCPT_TRY_END|5.009002||p
1710XCPT_TRY_START|5.009002||p
1711XPUSHi|||
1712XPUSHmortal|5.009002||p
1713XPUSHn|||
1714XPUSHp|||
1715XPUSHs|||
1716XPUSHu|5.004000||p
1717XSRETURN_EMPTY|||
1718XSRETURN_IV|||
1719XSRETURN_NO|||
1720XSRETURN_NV|||
1721XSRETURN_PV|||
1722XSRETURN_UNDEF|||
1723XSRETURN_UV|5.008001||p
1724XSRETURN_YES|||
1725XSRETURN|||
1726XST_mIV|||
1727XST_mNO|||
1728XST_mNV|||
1729XST_mPV|||
1730XST_mUNDEF|||
1731XST_mUV|5.008001||p
1732XST_mYES|||
1733XS_VERSION_BOOTCHECK|||
1734XS_VERSION|||
1735XS|||
1736ZeroD|5.009002||p
1737Zero|||
1738_aMY_CXT|5.007003||p
1739_pMY_CXT|5.007003||p
1740aMY_CXT_|5.007003||p
1741aMY_CXT|5.007003||p
1742aTHX_|5.006000||p
1743aTHX|5.006000||p
1744add_data|||
1745allocmy|||
1746amagic_call|||
1747any_dup|||
1748ao|||
1749append_elem|||
1750append_list|||
1751apply_attrs_my|||
1752apply_attrs_string||5.006001|
1753apply_attrs|||
1754apply|||
1755asIV|||
1756asUV|||
1757atfork_lock||5.007003|n
1758atfork_unlock||5.007003|n
1759av_arylen_p||5.009003|
1760av_clear|||
1761av_delete||5.006000|
1762av_exists||5.006000|
1763av_extend|||
1764av_fake|||
1765av_fetch|||
1766av_fill|||
1767av_len|||
1768av_make|||
1769av_pop|||
1770av_push|||
1771av_reify|||
1772av_shift|||
1773av_store|||
1774av_undef|||
1775av_unshift|||
1776ax|||n
1777bad_type|||
1778bind_match|||
1779block_end|||
1780block_gimme||5.004000|
1781block_start|||
1782boolSV|5.004000||p
1783boot_core_PerlIO|||
1784boot_core_UNIVERSAL|||
1785boot_core_xsutils|||
1786bytes_from_utf8||5.007001|
1787bytes_to_utf8||5.006001|
1788cache_re|||
1789call_argv|5.006000||p
1790call_atexit||5.006000|
1791call_body|||
1792call_list_body|||
1793call_list||5.004000|
1794call_method|5.006000||p
1795call_pv|5.006000||p
1796call_sv|5.006000||p
1797calloc||5.007002|n
1798cando|||
1799cast_i32||5.006000|
1800cast_iv||5.006000|
1801cast_ulong||5.006000|
1802cast_uv||5.006000|
1803check_uni|||
1804checkcomma|||
1805checkposixcc|||
1806ck_anoncode|||
1807ck_bitop|||
1808ck_concat|||
1809ck_defined|||
1810ck_delete|||
1811ck_die|||
1812ck_eof|||
1813ck_eval|||
1814ck_exec|||
1815ck_exists|||
1816ck_exit|||
1817ck_ftst|||
1818ck_fun|||
1819ck_glob|||
1820ck_grep|||
1821ck_index|||
1822ck_join|||
1823ck_lengthconst|||
1824ck_lfun|||
1825ck_listiob|||
1826ck_match|||
1827ck_method|||
1828ck_null|||
1829ck_open|||
1830ck_repeat|||
1831ck_require|||
1832ck_retarget|||
1833ck_return|||
1834ck_rfun|||
1835ck_rvconst|||
1836ck_sassign|||
1837ck_select|||
1838ck_shift|||
1839ck_sort|||
1840ck_spair|||
1841ck_split|||
1842ck_subr|||
1843ck_substr|||
1844ck_svconst|||
1845ck_trunc|||
1846ck_unpack|||
1847cl_and|||
1848cl_anything|||
1849cl_init_zero|||
1850cl_init|||
1851cl_is_anything|||
1852cl_or|||
1853closest_cop|||
1854convert|||
1855cop_free|||
1856cr_textfilter|||
1857croak_nocontext|||vn
1858croak|||v
1859csighandler||5.007001|n
1860custom_op_desc||5.007003|
1861custom_op_name||5.007003|
1862cv_ckproto|||
1863cv_clone|||
1864cv_const_sv||5.004000|
1865cv_dump|||
1866cv_undef|||
1867cx_dump||5.005000|
1868cx_dup|||
1869cxinc|||
1870dAXMARK||5.009003|
1871dAX|5.007002||p
1872dITEMS|5.007002||p
1873dMARK|||
1874dMY_CXT_SV|5.007003||p
1875dMY_CXT|5.007003||p
1876dNOOP|5.006000||p
1877dORIGMARK|||
1878dSP|||
1879dTHR|5.004050||p
1880dTHXa|5.006000||p
1881dTHXoa|5.006000||p
1882dTHX|5.006000||p
1883dUNDERBAR|5.009002||p
1884dXCPT|5.009002||p
1885dXSARGS|||
1886dXSI32|||
1887dXSTARG|5.006000||p
1888deb_curcv|||
1889deb_nocontext|||vn
1890deb_stack_all|||
1891deb_stack_n|||
1892debop||5.005000|
1893debprofdump||5.005000|
1894debprof|||
1895debstackptrs||5.007003|
1896debstack||5.007003|
1897deb||5.007003|v
1898del_he|||
1899del_sv|||
1900delimcpy||5.004000|
1901depcom|||
1902deprecate_old|||
1903deprecate|||
1904despatch_signals||5.007001|
1905die_nocontext|||vn
1906die_where|||
1907die|||v
1908dirp_dup|||
1909div128|||
1910djSP|||
1911do_aexec5|||
1912do_aexec|||
1913do_aspawn|||
1914do_binmode||5.004050|
1915do_chomp|||
1916do_chop|||
1917do_close|||
1918do_dump_pad|||
1919do_eof|||
1920do_exec3|||
1921do_execfree|||
1922do_exec|||
1923do_gv_dump||5.006000|
1924do_gvgv_dump||5.006000|
1925do_hv_dump||5.006000|
1926do_ipcctl|||
1927do_ipcget|||
1928do_join|||
1929do_kv|||
1930do_magic_dump||5.006000|
1931do_msgrcv|||
1932do_msgsnd|||
1933do_oddball|||
1934do_op_dump||5.006000|
1935do_open9||5.006000|
1936do_openn||5.007001|
1937do_open||5.004000|
1938do_pipe|||
1939do_pmop_dump||5.006000|
1940do_print|||
1941do_readline|||
1942do_seek|||
1943do_semop|||
1944do_shmio|||
1945do_spawn_nowait|||
1946do_spawn|||
1947do_sprintf|||
1948do_sv_dump||5.006000|
1949do_sysseek|||
1950do_tell|||
1951do_trans_complex_utf8|||
1952do_trans_complex|||
1953do_trans_count_utf8|||
1954do_trans_count|||
1955do_trans_simple_utf8|||
1956do_trans_simple|||
1957do_trans|||
1958do_vecget|||
1959do_vecset|||
1960do_vop|||
1961docatch_body|||
1962docatch|||
1963doeval|||
1964dofile|||
1965dofindlabel|||
1966doform|||
1967doing_taint||5.008001|n
1968dooneliner|||
1969doopen_pm|||
1970doparseform|||
1971dopoptoeval|||
1972dopoptolabel|||
1973dopoptoloop|||
1974dopoptosub_at|||
1975dopoptosub|||
1976dounwind|||
1977dowantarray|||
1978dump_all||5.006000|
1979dump_eval||5.006000|
1980dump_fds|||
1981dump_form||5.006000|
1982dump_indent||5.006000|v
1983dump_mstats|||
1984dump_packsubs||5.006000|
1985dump_sub||5.006000|
1986dump_vindent||5.006000|
1987dumpuntil|||
1988dup_attrlist|||
1989emulate_eaccess|||
1990eval_pv|5.006000||p
1991eval_sv|5.006000||p
1992expect_number|||
1993fbm_compile||5.005000|
1994fbm_instr||5.005000|
1995fd_on_nosuid_fs|||
1996filter_add|||
1997filter_del|||
1998filter_gets|||
1999filter_read|||
2000find_beginning|||
2001find_byclass|||
2002find_in_my_stash|||
2003find_runcv|||
2004find_rundefsvoffset||5.009002|
2005find_script|||
2006find_uninit_var|||
2007fold_constants|||
2008forbid_setid|||
2009force_ident|||
2010force_list|||
2011force_next|||
2012force_version|||
2013force_word|||
2014form_nocontext|||vn
2015form||5.004000|v
2016fp_dup|||
2017fprintf_nocontext|||vn
2018free_global_struct|||
2019free_tied_hv_pool|||
2020free_tmps|||
2021gen_constant_list|||
2022get_av|5.006000||p
2023get_context||5.006000|n
2024get_cv|5.006000||p
2025get_db_sub|||
2026get_debug_opts|||
2027get_hash_seed|||
2028get_hv|5.006000||p
2029get_mstats|||
2030get_no_modify|||
2031get_num|||
2032get_op_descs||5.005000|
2033get_op_names||5.005000|
2034get_opargs|||
2035get_ppaddr||5.006000|
2036get_sv|5.006000||p
2037get_vtbl||5.005030|
2038getcwd_sv||5.007002|
2039getenv_len|||
2040gp_dup|||
2041gp_free|||
2042gp_ref|||
2043grok_bin|5.007003||p
2044grok_hex|5.007003||p
2045grok_number|5.007002||p
2046grok_numeric_radix|5.007002||p
2047grok_oct|5.007003||p
2048group_end|||
2049gv_AVadd|||
2050gv_HVadd|||
2051gv_IOadd|||
2052gv_autoload4||5.004000|
2053gv_check|||
2054gv_dump||5.006000|
2055gv_efullname3||5.004000|
2056gv_efullname4||5.006001|
2057gv_efullname|||
2058gv_ename|||
2059gv_fetchfile|||
2060gv_fetchmeth_autoload||5.007003|
2061gv_fetchmethod_autoload||5.004000|
2062gv_fetchmethod|||
2063gv_fetchmeth|||
2064gv_fetchpvn_flags||5.009002|
2065gv_fetchpv|||
2066gv_fetchsv||5.009002|
2067gv_fullname3||5.004000|
2068gv_fullname4||5.006001|
2069gv_fullname|||
2070gv_handler||5.007001|
2071gv_init_sv|||
2072gv_init|||
2073gv_share|||
2074gv_stashpvn|5.006000||p
2075gv_stashpv|||
2076gv_stashsv|||
2077he_dup|||
2078hek_dup|||
2079hfreeentries|||
2080hsplit|||
2081hv_assert||5.009001|
2082hv_auxinit|||
2083hv_clear_placeholders||5.009001|
2084hv_clear|||
2085hv_delayfree_ent||5.004000|
2086hv_delete_common|||
2087hv_delete_ent||5.004000|
2088hv_delete|||
2089hv_eiter_p||5.009003|
2090hv_eiter_set||5.009003|
2091hv_exists_ent||5.004000|
2092hv_exists|||
2093hv_fetch_common|||
2094hv_fetch_ent||5.004000|
2095hv_fetch|||
2096hv_free_ent||5.004000|
2097hv_iterinit|||
2098hv_iterkeysv||5.004000|
2099hv_iterkey|||
2100hv_iternext_flags||5.008000|
2101hv_iternextsv|||
2102hv_iternext|||
2103hv_iterval|||
2104hv_ksplit||5.004000|
2105hv_magic_check|||
2106hv_magic|||
2107hv_name_set||5.009003|
2108hv_notallowed|||
2109hv_placeholders_get||5.009003|
2110hv_placeholders_p||5.009003|
2111hv_placeholders_set||5.009003|
2112hv_riter_p||5.009003|
2113hv_riter_set||5.009003|
2114hv_scalar||5.009001|
2115hv_store_ent||5.004000|
2116hv_store_flags||5.008000|
2117hv_store|||
2118hv_undef|||
2119ibcmp_locale||5.004000|
2120ibcmp_utf8||5.007003|
2121ibcmp|||
2122incl_perldb|||
2123incline|||
2124incpush|||
2125ingroup|||
2126init_argv_symbols|||
2127init_debugger|||
2128init_global_struct|||
2129init_i18nl10n||5.006000|
2130init_i18nl14n||5.006000|
2131init_ids|||
2132init_interp|||
2133init_lexer|||
2134init_main_stash|||
2135init_perllib|||
2136init_postdump_symbols|||
2137init_predump_symbols|||
2138init_stacks||5.005000|
2139init_tm||5.007002|
2140instr|||
2141intro_my|||
2142intuit_method|||
2143intuit_more|||
2144invert|||
2145io_close|||
2146isALNUM|||
2147isALPHA|||
2148isDIGIT|||
2149isLOWER|||
2150isSPACE|||
2151isUPPER|||
2152is_an_int|||
2153is_gv_magical_sv|||
2154is_gv_magical|||
2155is_handle_constructor|||
2156is_list_assignment|||
2157is_lvalue_sub||5.007001|
2158is_uni_alnum_lc||5.006000|
2159is_uni_alnumc_lc||5.006000|
2160is_uni_alnumc||5.006000|
2161is_uni_alnum||5.006000|
2162is_uni_alpha_lc||5.006000|
2163is_uni_alpha||5.006000|
2164is_uni_ascii_lc||5.006000|
2165is_uni_ascii||5.006000|
2166is_uni_cntrl_lc||5.006000|
2167is_uni_cntrl||5.006000|
2168is_uni_digit_lc||5.006000|
2169is_uni_digit||5.006000|
2170is_uni_graph_lc||5.006000|
2171is_uni_graph||5.006000|
2172is_uni_idfirst_lc||5.006000|
2173is_uni_idfirst||5.006000|
2174is_uni_lower_lc||5.006000|
2175is_uni_lower||5.006000|
2176is_uni_print_lc||5.006000|
2177is_uni_print||5.006000|
2178is_uni_punct_lc||5.006000|
2179is_uni_punct||5.006000|
2180is_uni_space_lc||5.006000|
2181is_uni_space||5.006000|
2182is_uni_upper_lc||5.006000|
2183is_uni_upper||5.006000|
2184is_uni_xdigit_lc||5.006000|
2185is_uni_xdigit||5.006000|
2186is_utf8_alnumc||5.006000|
2187is_utf8_alnum||5.006000|
2188is_utf8_alpha||5.006000|
2189is_utf8_ascii||5.006000|
2190is_utf8_char_slow|||
2191is_utf8_char||5.006000|
2192is_utf8_cntrl||5.006000|
2193is_utf8_digit||5.006000|
2194is_utf8_graph||5.006000|
2195is_utf8_idcont||5.008000|
2196is_utf8_idfirst||5.006000|
2197is_utf8_lower||5.006000|
2198is_utf8_mark||5.006000|
2199is_utf8_print||5.006000|
2200is_utf8_punct||5.006000|
2201is_utf8_space||5.006000|
2202is_utf8_string_loclen||5.009003|
2203is_utf8_string_loc||5.008001|
2204is_utf8_string||5.006001|
2205is_utf8_upper||5.006000|
2206is_utf8_xdigit||5.006000|
2207isa_lookup|||
2208items|||n
2209ix|||n
2210jmaybe|||
2211keyword|||
2212leave_scope|||
2213lex_end|||
2214lex_start|||
2215linklist|||
2216listkids|||
2217list|||
2218load_module_nocontext|||vn
2219load_module||5.006000|v
2220localize|||
2221looks_like_number|||
2222lop|||
2223mPUSHi|5.009002||p
2224mPUSHn|5.009002||p
2225mPUSHp|5.009002||p
2226mPUSHu|5.009002||p
2227mXPUSHi|5.009002||p
2228mXPUSHn|5.009002||p
2229mXPUSHp|5.009002||p
2230mXPUSHu|5.009002||p
2231magic_clear_all_env|||
2232magic_clearenv|||
2233magic_clearpack|||
2234magic_clearsig|||
2235magic_dump||5.006000|
2236magic_existspack|||
2237magic_freearylen_p|||
2238magic_freeovrld|||
2239magic_freeregexp|||
2240magic_getarylen|||
2241magic_getdefelem|||
2242magic_getglob|||
2243magic_getnkeys|||
2244magic_getpack|||
2245magic_getpos|||
2246magic_getsig|||
2247magic_getsubstr|||
2248magic_gettaint|||
2249magic_getuvar|||
2250magic_getvec|||
2251magic_get|||
2252magic_killbackrefs|||
2253magic_len|||
2254magic_methcall|||
2255magic_methpack|||
2256magic_nextpack|||
2257magic_regdata_cnt|||
2258magic_regdatum_get|||
2259magic_regdatum_set|||
2260magic_scalarpack|||
2261magic_set_all_env|||
2262magic_setamagic|||
2263magic_setarylen|||
2264magic_setbm|||
2265magic_setcollxfrm|||
2266magic_setdbline|||
2267magic_setdefelem|||
2268magic_setenv|||
2269magic_setfm|||
2270magic_setglob|||
2271magic_setisa|||
2272magic_setmglob|||
2273magic_setnkeys|||
2274magic_setpack|||
2275magic_setpos|||
2276magic_setregexp|||
2277magic_setsig|||
2278magic_setsubstr|||
2279magic_settaint|||
2280magic_setutf8|||
2281magic_setuvar|||
2282magic_setvec|||
2283magic_set|||
2284magic_sizepack|||
2285magic_wipepack|||
2286magicname|||
2287make_trie|||
2288malloced_size|||n
2289malloc||5.007002|n
2290markstack_grow|||
2291measure_struct|||
2292memEQ|5.004000||p
2293memNE|5.004000||p
2294mem_collxfrm|||
2295mess_alloc|||
2296mess_nocontext|||vn
2297mess||5.006000|v
2298method_common|||
2299mfree||5.007002|n
2300mg_clear|||
2301mg_copy|||
2302mg_dup|||
2303mg_find|||
2304mg_free|||
2305mg_get|||
2306mg_length||5.005000|
2307mg_localize|||
2308mg_magical|||
2309mg_set|||
2310mg_size||5.005000|
2311mini_mktime||5.007002|
2312missingterm|||
2313mode_from_discipline|||
2314modkids|||
2315mod|||
2316moreswitches|||
2317mul128|||
2318mulexp10|||n
2319my_atof2||5.007002|
2320my_atof||5.006000|
2321my_attrs|||
2322my_bcopy|||n
2323my_betoh16|||n
2324my_betoh32|||n
2325my_betoh64|||n
2326my_betohi|||n
2327my_betohl|||n
2328my_betohs|||n
2329my_bzero|||n
2330my_chsize|||
2331my_exit_jump|||
2332my_exit|||
2333my_failure_exit||5.004000|
2334my_fflush_all||5.006000|
2335my_fork||5.007003|n
2336my_htobe16|||n
2337my_htobe32|||n
2338my_htobe64|||n
2339my_htobei|||n
2340my_htobel|||n
2341my_htobes|||n
2342my_htole16|||n
2343my_htole32|||n
2344my_htole64|||n
2345my_htolei|||n
2346my_htolel|||n
2347my_htoles|||n
2348my_htonl|||
2349my_kid|||
2350my_letoh16|||n
2351my_letoh32|||n
2352my_letoh64|||n
2353my_letohi|||n
2354my_letohl|||n
2355my_letohs|||n
2356my_lstat|||
2357my_memcmp||5.004000|n
2358my_memset|||n
2359my_ntohl|||
2360my_pclose||5.004000|
2361my_popen_list||5.007001|
2362my_popen||5.004000|
2363my_setenv|||
2364my_socketpair||5.007003|n
2365my_stat|||
2366my_strftime||5.007002|
2367my_swabn|||n
2368my_swap|||
2369my_unexec|||
2370my|||
2371newANONATTRSUB||5.006000|
2372newANONHASH|||
2373newANONLIST|||
2374newANONSUB|||
2375newASSIGNOP|||
2376newATTRSUB||5.006000|
2377newAVREF|||
2378newAV|||
2379newBINOP|||
2380newCONDOP|||
2381newCONSTSUB|5.006000||p
2382newCVREF|||
2383newDEFSVOP|||
2384newFORM|||
2385newFOROP|||
2386newGVOP|||
2387newGVREF|||
2388newGVgen|||
2389newHVREF|||
2390newHVhv||5.005000|
2391newHV|||
2392newIO|||
2393newLISTOP|||
2394newLOGOP|||
2395newLOOPEX|||
2396newLOOPOP|||
2397newMYSUB||5.006000|
2398newNULLLIST|||
2399newOP|||
2400newPADOP||5.006000|
2401newPMOP|||
2402newPROG|||
2403newPVOP|||
2404newRANGE|||
2405newRV_inc|5.004000||p
2406newRV_noinc|5.006000||p
2407newRV|||
2408newSLICEOP|||
2409newSTATEOP|||
2410newSUB|||
2411newSVOP|||
2412newSVREF|||
2413newSVhek||5.009003|
2414newSViv|||
2415newSVnv|||
2416newSVpvf_nocontext|||vn
2417newSVpvf||5.004000|v
2418newSVpvn_share||5.007001|
2419newSVpvn|5.006000||p
2420newSVpv|||
2421newSVrv|||
2422newSVsv|||
2423newSVuv|5.006000||p
2424newSV|||
2425newUNOP|||
2426newWHILEOP||5.009003|
2427newXSproto||5.006000|
2428newXS||5.006000|
2429new_collate||5.006000|
2430new_constant|||
2431new_ctype||5.006000|
2432new_he|||
2433new_logop|||
2434new_numeric||5.006000|
2435new_stackinfo||5.005000|
2436new_version||5.009000|
2437next_symbol|||
2438nextargv|||
2439nextchar|||
2440ninstr|||
2441no_bareword_allowed|||
2442no_fh_allowed|||
2443no_op|||
2444not_a_number|||
2445nothreadhook||5.008000|
2446nuke_stacks|||
2447num_overflow|||n
2448oopsAV|||
2449oopsCV|||
2450oopsHV|||
2451op_clear|||
2452op_const_sv|||
2453op_dump||5.006000|
2454op_free|||
2455op_null||5.007002|
2456op_refcnt_lock||5.009002|
2457op_refcnt_unlock||5.009002|
2458open_script|||
2459pMY_CXT_|5.007003||p
2460pMY_CXT|5.007003||p
2461pTHX_|5.006000||p
2462pTHX|5.006000||p
2463pack_cat||5.007003|
2464pack_rec|||
2465package|||
2466packlist||5.008001|
2467pad_add_anon|||
2468pad_add_name|||
2469pad_alloc|||
2470pad_block_start|||
2471pad_check_dup|||
2472pad_compname_type|||
2473pad_findlex|||
2474pad_findmy|||
2475pad_fixup_inner_anons|||
2476pad_free|||
2477pad_leavemy|||
2478pad_new|||
2479pad_push|||
2480pad_reset|||
2481pad_setsv|||
2482pad_sv|||
2483pad_swipe|||
2484pad_tidy|||
2485pad_undef|||
2486parse_body|||
2487parse_unicode_opts|||
2488path_is_absolute|||
2489peep|||
2490pending_ident|||
2491perl_alloc_using|||n
2492perl_alloc|||n
2493perl_clone_using|||n
2494perl_clone|||n
2495perl_construct|||n
2496perl_destruct||5.007003|n
2497perl_free|||n
2498perl_parse||5.006000|n
2499perl_run|||n
2500pidgone|||
2501pmflag|||
2502pmop_dump||5.006000|
2503pmruntime|||
2504pmtrans|||
2505pop_scope|||
2506pregcomp|||
2507pregexec|||
2508pregfree|||
2509prepend_elem|||
2510printf_nocontext|||vn
2511ptr_table_clear|||
2512ptr_table_fetch|||
2513ptr_table_free|||
2514ptr_table_new|||
2515ptr_table_split|||
2516ptr_table_store|||
2517push_scope|||
2518put_byte|||
2519pv_display||5.006000|
2520pv_uni_display||5.007003|
2521qerror|||
2522re_croak2|||
2523re_dup|||
2524re_intuit_start||5.006000|
2525re_intuit_string||5.006000|
2526realloc||5.007002|n
2527reentrant_free|||
2528reentrant_init|||
2529reentrant_retry|||vn
2530reentrant_size|||
2531refkids|||
2532refto|||
2533ref|||
2534reg_node|||
2535reganode|||
2536regatom|||
2537regbranch|||
2538regclass_swash||5.007003|
2539regclass|||
2540regcp_set_to|||
2541regcppop|||
2542regcppush|||
2543regcurly|||
2544regdump||5.005000|
2545regexec_flags||5.005000|
2546reghop3|||
2547reghopmaybe3|||
2548reghopmaybe|||
2549reghop|||
2550reginclass|||
2551reginitcolors||5.006000|
2552reginsert|||
2553regmatch|||
2554regnext||5.005000|
2555regoptail|||
2556regpiece|||
2557regpposixcc|||
2558regprop|||
2559regrepeat_hard|||
2560regrepeat|||
2561regtail|||
2562regtry|||
2563reguni|||
2564regwhite|||
2565reg|||
2566repeatcpy|||
2567report_evil_fh|||
2568report_uninit|||
2569require_errno|||
2570require_pv||5.006000|
2571rninstr|||
2572rsignal_restore|||
2573rsignal_save|||
2574rsignal_state||5.004000|
2575rsignal||5.004000|
2576run_body|||
2577runops_debug||5.005000|
2578runops_standard||5.005000|
2579rvpv_dup|||
2580rxres_free|||
2581rxres_restore|||
2582rxres_save|||
2583safesyscalloc||5.006000|n
2584safesysfree||5.006000|n
2585safesysmalloc||5.006000|n
2586safesysrealloc||5.006000|n
2587same_dirent|||
2588save_I16||5.004000|
2589save_I32|||
2590save_I8||5.006000|
2591save_aelem||5.004050|
2592save_alloc||5.006000|
2593save_aptr|||
2594save_ary|||
2595save_bool||5.008001|
2596save_clearsv|||
2597save_delete|||
2598save_destructor_x||5.006000|
2599save_destructor||5.006000|
2600save_freeop|||
2601save_freepv|||
2602save_freesv|||
2603save_generic_pvref||5.006001|
2604save_generic_svref||5.005030|
2605save_gp||5.004000|
2606save_hash|||
2607save_hek_flags|||
2608save_helem||5.004050|
2609save_hints||5.005000|
2610save_hptr|||
2611save_int|||
2612save_item|||
2613save_iv||5.005000|
2614save_lines|||
2615save_list|||
2616save_long|||
2617save_magic|||
2618save_mortalizesv||5.007001|
2619save_nogv|||
2620save_op|||
2621save_padsv||5.007001|
2622save_pptr|||
2623save_re_context||5.006000|
2624save_scalar_at|||
2625save_scalar|||
2626save_set_svflags||5.009000|
2627save_shared_pvref||5.007003|
2628save_sptr|||
2629save_svref|||
2630save_threadsv||5.005000|
2631save_vptr||5.006000|
2632savepvn|||
2633savepv|||
2634savesharedpv||5.007003|
2635savestack_grow_cnt||5.008001|
2636savestack_grow|||
2637savesvpv||5.009002|
2638sawparens|||
2639scalar_mod_type|||
2640scalarboolean|||
2641scalarkids|||
2642scalarseq|||
2643scalarvoid|||
2644scalar|||
2645scan_bin||5.006000|
2646scan_commit|||
2647scan_const|||
2648scan_formline|||
2649scan_heredoc|||
2650scan_hex|||
2651scan_ident|||
2652scan_inputsymbol|||
2653scan_num||5.007001|
2654scan_oct|||
2655scan_pat|||
2656scan_str|||
2657scan_subst|||
2658scan_trans|||
2659scan_version||5.009001|
2660scan_vstring||5.008001|
2661scan_word|||
2662scope|||
2663screaminstr||5.005000|
2664seed|||
2665set_context||5.006000|n
2666set_csh|||
2667set_numeric_local||5.006000|
2668set_numeric_radix||5.006000|
2669set_numeric_standard||5.006000|
2670setdefout|||
2671setenv_getix|||
2672share_hek_flags|||
2673share_hek|||
2674si_dup|||
2675sighandler|||n
2676simplify_sort|||
2677skipspace|||
2678sortsv||5.007003|
2679ss_dup|||
2680stack_grow|||
2681start_glob|||
2682start_subparse||5.004000|
2683stashpv_hvname_match||5.009003|
2684stdize_locale|||
2685strEQ|||
2686strGE|||
2687strGT|||
2688strLE|||
2689strLT|||
2690strNE|||
2691str_to_version||5.006000|
2692strnEQ|||
2693strnNE|||
2694study_chunk|||
2695sub_crush_depth|||
2696sublex_done|||
2697sublex_push|||
2698sublex_start|||
2699sv_2bool|||
2700sv_2cv|||
2701sv_2io|||
2702sv_2iuv_non_preserve|||
2703sv_2iv_flags||5.009001|
2704sv_2iv|||
2705sv_2mortal|||
2706sv_2nv|||
2707sv_2pv_flags||5.007002|
2708sv_2pv_nolen|5.006000||p
2709sv_2pvbyte_nolen|||
2710sv_2pvbyte|5.006000||p
2711sv_2pvutf8_nolen||5.006000|
2712sv_2pvutf8||5.006000|
2713sv_2pv|||
2714sv_2uv_flags||5.009001|
2715sv_2uv|5.004000||p
2716sv_add_arena|||
2717sv_add_backref|||
2718sv_backoff|||
2719sv_bless|||
2720sv_cat_decode||5.008001|
2721sv_catpv_mg|5.006000||p
2722sv_catpvf_mg_nocontext|||pvn
2723sv_catpvf_mg|5.006000|5.004000|pv
2724sv_catpvf_nocontext|||vn
2725sv_catpvf||5.004000|v
2726sv_catpvn_flags||5.007002|
2727sv_catpvn_mg|5.006000||p
2728sv_catpvn_nomg|5.007002||p
2729sv_catpvn|||
2730sv_catpv|||
2731sv_catsv_flags||5.007002|
2732sv_catsv_mg|5.006000||p
2733sv_catsv_nomg|5.007002||p
2734sv_catsv|||
2735sv_chop|||
2736sv_clean_all|||
2737sv_clean_objs|||
2738sv_clear|||
2739sv_cmp_locale||5.004000|
2740sv_cmp|||
2741sv_collxfrm|||
2742sv_compile_2op||5.008001|
2743sv_copypv||5.007003|
2744sv_dec|||
2745sv_del_backref|||
2746sv_derived_from||5.004000|
2747sv_dump|||
2748sv_dup|||
2749sv_eq|||
2750sv_force_normal_flags||5.007001|
2751sv_force_normal||5.006000|
2752sv_free2|||
2753sv_free_arenas|||
2754sv_free|||
2755sv_gets||5.004000|
2756sv_grow|||
2757sv_inc|||
2758sv_insert|||
2759sv_isa|||
2760sv_isobject|||
2761sv_iv||5.005000|
2762sv_len_utf8||5.006000|
2763sv_len|||
2764sv_magicext||5.007003|
2765sv_magic|||
2766sv_mortalcopy|||
2767sv_newmortal|||
2768sv_newref|||
2769sv_nolocking||5.007003|
2770sv_nosharing||5.007003|
2771sv_nounlocking||5.007003|
2772sv_nv||5.005000|
2773sv_peek||5.005000|
2774sv_pos_b2u||5.006000|
2775sv_pos_u2b||5.006000|
2776sv_pvbyten_force||5.006000|
2777sv_pvbyten||5.006000|
2778sv_pvbyte||5.006000|
2779sv_pvn_force_flags||5.007002|
2780sv_pvn_force|||p
2781sv_pvn_nomg|5.007003||p
2782sv_pvn|5.006000||p
2783sv_pvutf8n_force||5.006000|
2784sv_pvutf8n||5.006000|
2785sv_pvutf8||5.006000|
2786sv_pv||5.006000|
2787sv_recode_to_utf8||5.007003|
2788sv_reftype|||
2789sv_release_COW|||
2790sv_release_IVX|||
2791sv_replace|||
2792sv_report_used|||
2793sv_reset|||
2794sv_rvweaken||5.006000|
2795sv_setiv_mg|5.006000||p
2796sv_setiv|||
2797sv_setnv_mg|5.006000||p
2798sv_setnv|||
2799sv_setpv_mg|5.006000||p
2800sv_setpvf_mg_nocontext|||pvn
2801sv_setpvf_mg|5.006000|5.004000|pv
2802sv_setpvf_nocontext|||vn
2803sv_setpvf||5.004000|v
2804sv_setpviv_mg||5.008001|
2805sv_setpviv||5.008001|
2806sv_setpvn_mg|5.006000||p
2807sv_setpvn|||
2808sv_setpv|||
2809sv_setref_iv|||
2810sv_setref_nv|||
2811sv_setref_pvn|||
2812sv_setref_pv|||
2813sv_setref_uv||5.007001|
2814sv_setsv_cow|||
2815sv_setsv_flags||5.007002|
2816sv_setsv_mg|5.006000||p
2817sv_setsv_nomg|5.007002||p
2818sv_setsv|||
2819sv_setuv_mg|5.006000||p
2820sv_setuv|5.006000||p
2821sv_tainted||5.004000|
2822sv_taint||5.004000|
2823sv_true||5.005000|
2824sv_unglob|||
2825sv_uni_display||5.007003|
2826sv_unmagic|||
2827sv_unref_flags||5.007001|
2828sv_unref|||
2829sv_untaint||5.004000|
2830sv_upgrade|||
2831sv_usepvn_mg|5.006000||p
2832sv_usepvn|||
2833sv_utf8_decode||5.006000|
2834sv_utf8_downgrade||5.006000|
2835sv_utf8_encode||5.006000|
2836sv_utf8_upgrade_flags||5.007002|
2837sv_utf8_upgrade||5.007001|
2838sv_uv|5.006000||p
2839sv_vcatpvf_mg|5.006000|5.004000|p
2840sv_vcatpvfn||5.004000|
2841sv_vcatpvf|5.006000|5.004000|p
2842sv_vsetpvf_mg|5.006000|5.004000|p
2843sv_vsetpvfn||5.004000|
2844sv_vsetpvf|5.006000|5.004000|p
2845svtype|||
2846swallow_bom|||
2847swash_fetch||5.007002|
2848swash_init||5.006000|
2849sys_intern_clear|||
2850sys_intern_dup|||
2851sys_intern_init|||
2852taint_env|||
2853taint_proper|||
2854tmps_grow||5.006000|
2855toLOWER|||
2856toUPPER|||
2857to_byte_substr|||
2858to_uni_fold||5.007003|
2859to_uni_lower_lc||5.006000|
2860to_uni_lower||5.007003|
2861to_uni_title_lc||5.006000|
2862to_uni_title||5.007003|
2863to_uni_upper_lc||5.006000|
2864to_uni_upper||5.007003|
2865to_utf8_case||5.007003|
2866to_utf8_fold||5.007003|
2867to_utf8_lower||5.007003|
2868to_utf8_substr|||
2869to_utf8_title||5.007003|
2870to_utf8_upper||5.007003|
2871tokeq|||
2872tokereport|||
2873too_few_arguments|||
2874too_many_arguments|||
2875unlnk|||
2876unpack_rec|||
2877unpack_str||5.007003|
2878unpackstring||5.008001|
2879unshare_hek_or_pvn|||
2880unshare_hek|||
2881unsharepvn||5.004000|
2882upg_version||5.009000|
2883usage|||
2884utf16_textfilter|||
2885utf16_to_utf8_reversed||5.006001|
2886utf16_to_utf8||5.006001|
2887utf16rev_textfilter|||
2888utf8_distance||5.006000|
2889utf8_hop||5.006000|
2890utf8_length||5.007001|
2891utf8_mg_pos_init|||
2892utf8_mg_pos|||
2893utf8_to_bytes||5.006001|
2894utf8_to_uvchr||5.007001|
2895utf8_to_uvuni||5.007001|
2896utf8n_to_uvchr||5.007001|
2897utf8n_to_uvuni||5.007001|
2898utilize|||
2899uvchr_to_utf8_flags||5.007003|
2900uvchr_to_utf8||5.007001|
2901uvuni_to_utf8_flags||5.007003|
2902uvuni_to_utf8||5.007001|
2903validate_suid|||
2904varname|||
2905vcmp||5.009000|
2906vcroak||5.006000|
2907vdeb||5.007003|
2908vdie|||
2909vform||5.006000|
2910visit|||
2911vivify_defelem|||
2912vivify_ref|||
2913vload_module||5.006000|
2914vmess||5.006000|
2915vnewSVpvf|5.006000|5.004000|p
2916vnormal||5.009002|
2917vnumify||5.009000|
2918vstringify||5.009000|
2919vwarner||5.006000|
2920vwarn||5.006000|
2921wait4pid|||
2922warn_nocontext|||vn
2923warner_nocontext|||vn
2924warner||5.006000|v
2925warn|||v
2926watch|||
2927whichsig|||
2928write_to_stderr|||
2929yyerror|||
2930yylex|||
2931yyparse|||
2932yywarn|||
2933);
2934
2935if (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
2946my(%replace, %need, %hints, %depends);
2947my $replace = 0;
2948my $hint = '';
2949
2950while (<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
2974if (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
3009if (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
3023my @files;
3024my @srcext = qw( xs c h cc cpp );
3025my $srcext = join '|', @srcext;
3026
3027if (@ARGV) {
3028 my %seen;
3029 @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV;
3030}
3031else {
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
3044if (!@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
3057unless (@files) {
3058 die "No input files given!\n";
3059}
3060
3061my(%files, %global, %revreplace);
3062%revreplace = reverse %replace;
3063my $filename;
3064my $patch_opened = 0;
3065
3066for $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
3156my $need;
3157for $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
3172for $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 {
3352fallback:
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
3367close PATCH if $patch_opened;
3368
3369exit 0;
3370
3371
3372sub 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
3387HEADER
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
3407sub 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
3441sub can_use
3442{
3443 eval "use @_;";
3444 return $@ eq '';
3445}
3446
3447sub 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
3455sub 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
3483sub 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
3508sub info
3509{
3510 $opt{quiet} and return;
3511 print @_, "\n";
3512}
3513
3514sub diag
3515{
3516 $opt{quiet} and return;
3517 $opt{diag} and print @_, "\n";
3518}
3519
3520sub warning
3521{
3522 $opt{quiet} and return;
3523 print "*** ", @_, "\n";
3524}
3525
3526sub error
3527{
3528 print "*** ERROR: ", @_, "\n";
3529}
3530
3531my %given_hints;
3532sub 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
3544sub 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
3553Usage: $usage
3554
3555See perldoc $0 for details.
3556
3557ENDUSAGE
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
4056typedef 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)
4326static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
4327static
4328#else
4329extern 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
4340SV*
4341DPPP_(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)
4368static SV * DPPP_(my_newRV_noinc)(SV *sv);
4369static
4370#else
4371extern 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)
4381SV *
4382DPPP_(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)
4399static void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv);
4400static
4401#else
4402extern 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
4413void
4414DPPP_(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)
4587static char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv);
4588static
4589#else
4590extern 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
4601char *
4602DPPP_(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)
4631static char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp);
4632static
4633#else
4634extern 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
4645char *
4646DPPP_(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)
4695static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
4696static
4697#else
4698extern 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
4709SV *
4710DPPP_(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)
4733static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
4734static
4735#else
4736extern 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
4743void
4744DPPP_(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)
4760static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4761static
4762#else
4763extern 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
4771void
4772DPPP_(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)
4806static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
4807static
4808#else
4809extern 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
4816void
4817DPPP_(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)
4833static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
4834static
4835#else
4836extern 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
4844void
4845DPPP_(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)
5307static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
5308static
5309#else
5310extern 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)
5320bool
5321DPPP_(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)
5365static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
5366static
5367#else
5368extern 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)
5378int
5379DPPP_(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)
5579static UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
5580static
5581#else
5582extern 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)
5592UV
5593DPPP_(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)
5681static UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
5682static
5683#else
5684extern 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)
5694UV
5695DPPP_(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)
5783static UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result);
5784static
5785#else
5786extern 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)
5796UV
5797DPPP_(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 */
Note: See TracBrowser for help on using the repository browser.