Algorithm-AM
view release on metacpan or search on metacpan
use:
#define NEED_function_GLOBAL
#define NEED_variable_GLOBAL
Note that you mustn't have more than one global request for the
same function or variable in your project.
Function / Variable Static Request Global Request
-----------------------------------------------------------------------------------------
caller_cx() NEED_caller_cx NEED_caller_cx_GLOBAL
ck_warner() NEED_ck_warner NEED_ck_warner_GLOBAL
ck_warner_d() NEED_ck_warner_d NEED_ck_warner_d_GLOBAL
croak_xs_usage() NEED_croak_xs_usage NEED_croak_xs_usage_GLOBAL
die_sv() NEED_die_sv NEED_die_sv_GLOBAL
eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL
grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL
grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL
grok_number() NEED_grok_number NEED_grok_number_GLOBAL
grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL
grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL
load_module() NEED_load_module NEED_load_module_GLOBAL
mess() NEED_mess NEED_mess_GLOBAL
mess_nocontext() NEED_mess_nocontext NEED_mess_nocontext_GLOBAL
mess_sv() NEED_mess_sv NEED_mess_sv_GLOBAL
mg_findext() NEED_mg_findext NEED_mg_findext_GLOBAL
my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL
my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL
my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL
my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL
my_strnlen() NEED_my_strnlen NEED_my_strnlen_GLOBAL
newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL
PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL
PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL
pv_display() NEED_pv_display NEED_pv_display_GLOBAL
pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL
pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL
sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL
sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL
sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL
sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL
sv_unmagicext() NEED_sv_unmagicext NEED_sv_unmagicext_GLOBAL
utf8_to_uvchr_buf() NEED_utf8_to_uvchr_buf NEED_utf8_to_uvchr_buf_GLOBAL
vload_module() NEED_vload_module NEED_vload_module_GLOBAL
vmess() NEED_vmess NEED_vmess_GLOBAL
warner() NEED_warner NEED_warner_GLOBAL
To avoid namespace conflicts, you can change the namespace of the
explicitly exported functions / variables using the C<DPPP_NAMESPACE>
macro. Just C<#define> the macro before including C<ppport.h>:
#define DPPP_NAMESPACE MyOwnNamespace_
#include "ppport.h"
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
should make any changes to your code, and whether any special defines
should be used, F<ppport.h> can be run as a Perl script to check your
source code. Simply say:
perl ppport.h
The result will usually be a list of patches suggesting changes
that should at least be acceptable, if not necessarily the most
efficient solution, or a fix for all possible problems.
If you know that your XS module uses features only available in
newer Perl releases, if you're aware that it uses C++ comments,
and if you want all suggestions as a single patch file, you could
use something like this:
perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
If you only want your code to be scanned without any suggestions
for changes, use:
perl ppport.h --nochanges
You can specify a different C<diff> program or options, using
the C<--diff> option:
perl ppport.h --diff='diff -C 10'
This would output context diffs with 10 lines of context.
If you want to create patched copies of your files instead, use:
perl ppport.h --copy=.new
To display portability information for the C<newSVpvn> function,
use:
perl ppport.h --api-info=newSVpvn
Since the argument to C<--api-info> can be a regular expression,
you can use
perl ppport.h --api-info=/_nomg$/
to display portability information for all C<_nomg> functions or
perl ppport.h --api-info=/./
to display information for all known API elements.
=head1 BUGS
Some of the suggested edits and/or generated patches may not compile as-is
without tweaking manually. This is generally due to the need for an extra
parameter to be added to the call to prevent buffer overflow.
init_i18nl10n|5.006000||cVu
init_i18nl14n|5.006000||dcVu
initialize_invlist_guts|5.029002||Viu
init_ids|5.005000||Viu
init_interp|5.005000||Viu
init_main_stash|5.005000||Viu
init_named_cv|5.027010||cViu
init_os_extras|5.005000||Viu
init_perllib|5.005000||Viu
init_postdump_symbols|5.005000||Viu
init_predump_symbols|5.005000||Viu
init_stacks|5.005000|5.005000|u
INIT_THREADS|5.005000||Viu
init_tm|5.007002|5.007002|u
INIT_TRACK_MEMPOOL|5.009004||Viu
init_uniprops|5.027011||Viu
IN_LC|5.021001||Viu
IN_LC_ALL_COMPILETIME|5.021001||Viu
IN_LC_ALL_RUNTIME|5.021001||Viu
IN_LC_COMPILETIME|5.021001||Viu
IN_LC_PARTIAL_COMPILETIME|5.021001||Viu
IN_LC_PARTIAL_RUNTIME|5.021001||Viu
IN_LC_RUNTIME|5.021001||Viu
IN_LOCALE|5.007002|5.004000|p
IN_LOCALE_COMPILETIME|5.007002|5.004000|p
IN_LOCALE_RUNTIME|5.007002|5.004000|p
IN_PERL_COMPILETIME|5.008001|5.003007|p
IN_PERL_RUNTIME|5.008001|5.008001|
inplace_aassign|5.015003||Viu
inRANGE|5.029010||Viu
IN_SOME_LOCALE_FORM|5.015008||Viu
IN_SOME_LOCALE_FORM_COMPILETIME|5.015008||Viu
IN_SOME_LOCALE_FORM_RUNTIME|5.015008||Viu
instr|5.003007|5.003007|n
INSUBP|5.009005||Viu
INT2PTR|5.006000|5.003007|p
INT32_MIN|5.007002||Viu
INT64_C|5.007001||Viu
INT64_MIN|5.007002||Viu
INT_64_T|5.011000||Viu
INTMAX_C|5.003007|5.003007|
INT_PAT_MODS|5.009005||Viu
intro_my|5.004000|5.004000|
INTSIZE|5.003007|5.003007|Vn
intuit_method|5.005000||Viu
intuit_more|5.003007||Viu
IN_UNI_8_BIT|5.011002||Viu
IN_UTF8_CTYPE_LOCALE|5.019009||Viu
_inverse_folds|5.027011||cViu
invert|5.003007||Viu
invlist_array|5.013010||Vniu
_invlist_array_init|5.015001||Vniu
invlist_clear|5.023009||Viu
invlist_clone|5.015001||cViu
_invlist_contains_cp|5.017003||Vniu
invlist_contents|5.023008||Viu
_invlist_dump|5.019003||cViu
_invlistEQ|5.023006||cViu
invlist_extend|5.013010||Viu
invlist_highest|5.017002||Vniu
_invlist_intersection|5.015001||Viu
_invlist_intersection_maybe_complement_2nd|5.015008||cViu
_invlist_invert|5.015001||cViu
invlist_is_iterating|5.017008||Vniu
invlist_iterfinish|5.017008||Vniu
invlist_iterinit|5.015001||Vniu
invlist_iternext|5.015001||Vniu
_invlist_len|5.017004||Vniu
invlist_lowest|5.031007||xVniu
invlist_max|5.013010||Vniu
invlist_previous_index|5.017004||Vniu
invlist_replace_list_destroys_src|5.023009||Viu
_invlist_search|5.017003||cVniu
invlist_set_len|5.013010||Viu
invlist_set_previous_index|5.017004||Vniu
_invlist_subtract|5.015001||Viu
invlist_trim|5.013010||Vniu
_invlist_union|5.015001||cVu
_invlist_union_maybe_complement_2nd|5.015008||cViu
invmap_dump|5.031007||Viu
invoke_exception_hook|5.013001||Viu
IoANY|5.006001||Viu
IoBOTTOM_GV|5.003007||Viu
IoBOTTOM_NAME|5.003007||Viu
io_close|5.003007||Viu
IOCPARM_LEN|5.003007||Viu
ioctl|5.005000||Viu
IoDIRP|5.003007||Viu
IOf_ARGV|5.003007||Viu
IOf_DIDTOP|5.003007||Viu
IOf_FAKE_DIRP|5.006000||Viu
IOf_FLUSH|5.003007||Viu
IoFLAGS|5.003007||Viu
IoFMT_GV|5.003007||Viu
IoFMT_NAME|5.003007||Viu
IOf_NOLINE|5.005003||Viu
IOf_START|5.003007||Viu
IOf_UNTAINT|5.003007||Viu
IoIFP|5.003007||Viu
IoLINES|5.003007||Viu
IoLINES_LEFT|5.003007||Viu
IoOFP|5.003007||Viu
IoPAGE|5.003007||Viu
IoPAGE_LEN|5.003007||Viu
IoTOP_GV|5.003007||Viu
IoTOP_NAME|5.003007||Viu
IoTYPE|5.003007||Viu
IoTYPE_APPEND|5.006001||Viu
IoTYPE_CLOSED|5.006001||Viu
IoTYPE_IMPLICIT|5.008001||Viu
IoTYPE_NUMERIC|5.008001||Viu
IoTYPE_PIPE|5.006001||Viu
IoTYPE_RDONLY|5.006001||Viu
IoTYPE_RDWR|5.006001||Viu
IoTYPE_SOCKET|5.006001||Viu
IoTYPE_STD|5.006001||Viu
IoTYPE_WRONLY|5.006001||Viu
I_POLL|5.006000|5.006000|Vn
I_PTHREAD|5.005003|5.005003|Vn
I_PWD|5.003007|5.003007|Vn
isALNUM|5.003007|5.003007|p
isALNUM_A|5.031003|5.003007|p
PL_origalen|5.005000||Viu
PL_origargc|5.005000||Viu
PL_origargv|5.005000||Viu
PL_origenviron|5.005000||Viu
PL_origfilename|5.005000||Viu
PL_ors_sv|5.007001||Viu
PL_osname|5.005000||Viu
PL_padix|5.005000||Viu
PL_padix_floor|5.005000||Viu
PL_padlist_generation|5.021007||Viu
PL_padname_const|5.021007||Viu
PL_padname_undef|5.021007||Viu
PL_pad_reset_pending|5.005000||Viu
PL_parser|5.009005|5.003007|p
PL_patchlevel|5.005000||Viu
PL_peepp|5.007003|5.007003|
PL_perldb|5.005000|5.003007|poVnu
PL_perl_destruct_level|5.004005|5.003007|p
PL_perlio|5.007003||Viu
PL_phase|5.013007|5.013007|
PL_pidstatus|5.005000||Viu
PL_Posix_ptrs|5.029000||Viu
PL_ppaddr||5.003007|ponu
PL_preambleav|5.005000||Viu
PL_Private_Use|5.029009||Viu
PL_Proc|5.006000||Viu
PL_profiledata|5.005000||Viu
PL_psig_name|5.006000||Viu
PL_psig_pend|5.007001||Viu
PL_psig_ptr|5.006000||Viu
PL_ptr_table|5.006000||Viu
PL_random_state|5.019004||Viu
PL_RANDOM_STATE_TYPE|5.019004||Viu
PL_reentrant_buffer|5.007002||Viu
PL_reentrant_retint|5.008001||Viu
PL_reg_curpm|5.006000||Viu
PL_regex_pad|5.007002||Viu
PL_regex_padav|5.007002||Viu
PL_registered_mros|5.010001||Viu
PL_regmatch_slab|5.009004||Viu
PL_regmatch_state|5.009004||Viu
PL_replgv|5.005000||Viu
PL_restartjmpenv|5.013001||Viu
PL_restartop|5.005000||Viu
PL_rpeepp|5.013005|5.013005|
PL_rs|5.005000||Vi
PL_rsfp||5.003007|ponu
PL_rsfp_filters||5.003007|ponu
PL_runops|5.006000|5.006000|
PL_savebegin|5.007003||Viu
PL_savestack|5.005000||Viu
PL_savestack_ix|5.005000||Viu
PL_savestack_max|5.005000||Viu
PL_sawampersand|5.005000||Viu
PL_SB_invlist|5.021009||Viu
PL_scopestack|5.005000||Viu
PL_scopestack_ix|5.005000||Viu
PL_scopestack_max|5.005000||Viu
PL_scopestack_name|5.011002||Viu
PL_SCX_invlist|5.027008||Viu
PL_secondgv|5.005000||Viu
PL_setlocale_buf|5.027009||Viu
PL_setlocale_bufsize|5.027009||Viu
PL_sharehook|5.007003||Viu
PL_sighandler1p|5.031007||Viu
PL_sighandler3p|5.031007||Viu
PL_sighandlerp|5.005000||Viu
PL_signalhook|5.013002||Viu
PL_signals|5.008001|5.003007|poVnu
PL_sig_pending|5.007001||Viu
PL_Sock|5.006000||Viu
PL_sortcop|5.005000||Viu
PL_sortstash|5.005000||Viu
PL_splitstr|5.005000||Viu
PL_srand_called|5.006000||Viu
PL_stack_base|5.005000|5.003007|poVnu
PL_stack_max|5.005000||Viu
PL_stack_sp|5.005000|5.003007|poVnu
PL_start_env|5.005000||Viu
PL_stashcache|5.008001||Viu
PL_stashpad|5.017001||Viu
PL_stashpadix|5.017001||Viu
PL_stashpadmax|5.017001||Viu
PL_statcache|5.005000|5.003007|poVnu
PL_statgv|5.005000||Viu
PL_statname|5.005000||Viu
PL_statusvalue|5.005000||Viu
PL_statusvalue_posix|5.009003||Viu
PL_statusvalue_vms|5.005000||Viu
PL_stderrgv|5.006000||Viu
PL_stdingv|5.005000|5.003007|poVnu
PL_StdIO|5.006000||Viu
PL_strtab|5.005000||Viu
PL_strxfrm_is_behaved|5.025002||Viu
PL_strxfrm_max_cp|5.025002||Viu
PL_strxfrm_NUL_replacement|5.025008||Viu
PL_sub_generation|5.005000||Viu
PL_subline|5.005000||Viu
PL_subname|5.005000||Viu
PL_Sv|5.005000|5.003007|p
PL_sv_arenaroot|5.005000|5.003007|poVnu
PL_sv_consts|5.019002||Viu
PL_sv_count|5.005000||Viu
PL_sv_immortals|5.027003||Viu
PL_sv_no|5.004005|5.003007|p
PL_sv_root|5.005000||Viu
PL_sv_serial|5.010001||Viu
PL_sv_undef|5.004005|5.003007|p
PL_sv_yes|5.004005|5.003007|p
PL_sv_zero|5.027003|5.027003|
PL_sys_intern|5.005000||Viu
PL_tainted|5.005000|5.003007|poVnu
PL_tainting|5.005000|5.003007|poVnu
PL_taint_warn|5.007003||Viu
PL_threadhook|5.008000||Viu
PL_tmps_floor|5.005000||Viu
PL_tmps_ix|5.005000||Viu
PL_tmps_max|5.005000||Viu
PL_tmps_stack|5.005000||Viu
PL_tokenbuf||5.003007|ponu
PL_top_env|5.005000||Viu
S_IWOTH|5.003007||Viu
S_IWRITE|5.006000||Viu
S_IWUSR|5.003007||Viu
S_IXGRP|5.003007||Viu
S_IXOTH|5.003007||Viu
S_IXUSR|5.003007||Viu
SIZE_ALIGN|5.005000||Viu
Size_t|5.003007|5.003007|Vn
Size_t_MAX|5.021003||Viu
Size_t_size|5.006000|5.006000|Vn
SKIP|5.009005||Viu
SKIP_next|5.009005||Viu
SKIP_next_fail|5.009005||Viu
skipspace_flags|5.019002||xcViu
skip_to_be_ignored_text|5.023004||Viu
Slab_Alloc|5.006000||cViu
Slab_Free|5.007003||cViu
Slab_to_ro|5.017002||Viu
Slab_to_rw|5.009005||Viu
sleep|5.005000||Viu
SLOPPYDIVIDE|5.003007||Viu
socket|5.005000||Viu
SOCKET_OPEN_MODE|5.008002||Viu
socketpair|5.005000||Viu
Sock_size_t|5.006000|5.006000|Vn
softref2xv|||iu
sortcv|5.009003||Viu
sortcv_stacked|5.009003||Viu
sortcv_xsub|5.009003||Viu
sortsv|5.007003|5.007003|
sortsv_flags|5.009003|5.009003|
sortsv_flags_impl|5.031010||Viu
SP|5.003007|5.003007|
space_join_names_mortal|5.009004||Viu
SPAGAIN|5.003007|5.003007|
S_PAT_MODS|5.009005||Viu
specialWARN|5.006000||Viu
SRAND48_R_PROTO|5.008000|5.008000|Vn
SRANDOM_R_PROTO|5.008000|5.008000|Vn
SRCLOSE|5.027008||Viu
SROPEN|5.027008||Viu
SS_ACCVIO|5.008001||Viu
SS_ADD_BOOL|5.017007||Viu
SS_ADD_DPTR|5.017007||Viu
SS_ADD_DXPTR|5.017007||Viu
SS_ADD_END|5.017007||Viu
SS_ADD_INT|5.017007||Viu
SS_ADD_IV|5.017007||Viu
SS_ADD_LONG|5.017007||Viu
SS_ADD_PTR|5.017007||Viu
SS_ADD_UV|5.017007||Viu
SS_BUFFEROVF|5.021009||Viu
ssc_add_range|5.019005||Viu
ssc_and|5.019005||Viu
ssc_anything|5.019005||Viu
ssc_clear_locale|5.019005||Vniu
ssc_cp_and|5.019005||Viu
ssc_finalize|5.019005||Viu
SSCHECK|5.003007||Viu
ssc_init|5.019005||Viu
ssc_intersection|5.019005||Viu
ssc_is_anything|5.019005||Vniu
ssc_is_cp_posixl_init|5.019005||Vniu
SSC_MATCHES_EMPTY_STRING|5.021004||Viu
ssc_or|5.019005||Viu
ssc_union|5.019005||Viu
SS_DEVOFFLINE|5.008001||Viu
ss_dup|5.007003|5.007003|u
SSGROW|5.008001||Viu
SS_IVCHAN|5.008001||Viu
SSize_t|5.003007|5.003007|Vn
SSize_t_MAX|5.019004||Viu
SS_MAXPUSH|5.017007||Viu
SSNEW|5.006000||Viu
SSNEWa|5.006000||Viu
SSNEWat|5.007001||Viu
SSNEWt|5.007001||Viu
SS_NOPRIV|5.021001||Viu
SS_NORMAL|5.008001||Viu
SSPOPBOOL|5.008001||Viu
SSPOPDPTR|5.003007||Viu
SSPOPDXPTR|5.006000||Viu
SSPOPINT|5.003007||Viu
SSPOPIV|5.003007||Viu
SSPOPLONG|5.003007||Viu
SSPOPPTR|5.003007||Viu
SSPOPUV|5.013001||Viu
SSPTR|5.006000||Viu
SSPTRt|5.007001||Viu
SSPUSHBOOL|5.008001||Viu
SSPUSHDPTR|5.003007||Viu
SSPUSHDXPTR|5.006000||Viu
SSPUSHINT|5.003007||Viu
SSPUSHIV|5.003007||Viu
SSPUSHLONG|5.003007||Viu
SSPUSHPTR|5.003007||Viu
SSPUSHUV|5.013001||Viu
ST|5.003007|5.003007|
stack_grow|5.003007||cVu
STADTX_HASH_H|5.027001||Viu
STADTX_K0_U64|5.027001||Viu
STADTX_K1_U64|5.027001||Viu
STADTX_K2_U32|5.027001||Viu
STADTX_K2_U64|5.027001||Viu
STADTX_K3_U32|5.027001||Viu
STADTX_K3_U64|5.027001||Viu
STADTX_K4_U32|5.027001||Viu
STADTX_K5_U32|5.027001||Viu
STADTX_SCRAMBLE64|5.027001||Viu
STADTX_STATIC_INLINE|5.027001||Viu
STANDARD_C|5.003007||Viu
STAR|5.003007||Viu
START_EXTERN_C|5.005000|5.003007|pV
start_glob|||xi
START_MY_CXT|5.010000|5.010000|p
STARTPERL|5.003007|5.003007|Vn
start_subparse|5.004000|5.003007|pu
StashHANDLER|5.007001||Viu
Stat|5.003007||Viu
stat|5.005000||Viu
STATIC|5.005000||Viu
# For '#define foo bar' or '#define foo(a,b,c) bar', $define becomes a
# reference to [ foo, bar ]
$define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)};
if ($function) {
if (/^}/) {
if (exists $API{$function->[0]}) {
my @n = find_api($function->[1]);
push @{$depends{$function->[0]}}, @n if @n
}
undef $function;
}
else {
$function->[1] .= $_;
}
}
$function = [$1, ''] if m{^DPPP_\(my_(\w+)\)};
# Set $replace to the number given for lines that look like
# / * Replace: \d+ * /
# Thus setting it to 1 starts a region where replacements are automatically
# done, and setting it to 0 ends that region.
$replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$};
# Add bar => foo to %replace for lines like '#define foo bar in a region
# where $replace is non-zero
$replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)};
# Add bar => foo to %replace for lines like '#define foo bar / * Replace * /
$replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce};
# Add foo => bar to %replace for lines like / * Replace foo with bar * /
$replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+.*?)\s+$rcce\s*$};
# For lines like / * foo, bar depends on baz, bat * /
# create a list of the elements on the rhs, and make that list apply to each
# element in the lhs, which becomes a key in \%depends.
if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) {
my @deps = map { s/\s+//g; $_ } split /,/, $3;
my $d;
for $d (map { s/\s+//g; $_ } split /,/, $1) {
push @{$depends{$d}}, @deps;
}
}
$need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)};
}
for (values %depends) {
my %seen;
$_ = [sort dictionary_order grep !$seen{$_}++, @$_];
}
if (exists $opt{'api-info'}) {
my $f;
my $count = 0;
my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$";
# Sort the names, and split into two classes; one for things that are part of
# the API; a second for things that aren't.
my @ok_to_use;
my @shouldnt_use;
for $f (sort dictionary_order keys %API) {
next unless $f =~ /$match/;
my $base = int_parse_version($API{$f}{base}) if $API{$f}{base};
if ($base && ! $API{$f}{inaccessible} && ! $API{$f}{core_only}) {
push @ok_to_use, $f;
}
else {
push @shouldnt_use, $f;
}
}
# We normally suppress non-API items. But if the search matched no API
# items, output the non-ones. This allows someone to get the info for an
# item if they ask for it specifically enough, but doesn't normally clutter
# the output with irrelevant results.
@ok_to_use = @shouldnt_use unless @ok_to_use;
for $f (@ok_to_use) {
print "\n=== $f ===\n";
my $info = 0;
my $base;
$base = int_parse_version($API{$f}{base}) if $API{$f}{base};
my $todo;
$todo = int_parse_version($API{$f}{todo}) if $API{$f}{todo};
# Output information
if ($base) {
my $with_or= "";
if ( $base <= $int_min_perl
|| ( (! $API{$f}{provided} && ! $todo)
|| ($todo && $todo >= $base)))
{
$with_or= " with or";
}
my $Supported = ($API{$f}{undocumented}) ? 'Available' : 'Supported';
print "\n$Supported at least since perl-",
format_version($base), ",$with_or without $ppport.";
if ($API{$f}{unverified}) {
print "\nThis information is based on inspection of the source code",
" and has not been\n",
"verified by successful compilation.";
}
print "\n";
$info++;
}
if ($API{$f}{provided} || $todo) {
print "\nThis is only supported by $ppport, and NOT by perl versions going forward.\n" unless $base;
if ($todo) {
if (! $base || $todo < $base) {
my $additionally = "";
$additionally .= " additionally" if $base;
print "$ppport$additionally provides support at least back to perl-",
format_version($todo),
".\n";
}
}
elsif (! $base || $base > $int_min_perl) {
PL_copline = ocopline;
PL_curcop = ocurcop;
}
}
#endif
#endif
#ifndef load_module
#if defined(NEED_load_module)
static void DPPP_(my_load_module)(U32 flags, SV * name, SV * ver, ...);
static
#else
extern void DPPP_(my_load_module)(U32 flags, SV * name, SV * ver, ...);
#endif
#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
#ifdef load_module
# undef load_module
#endif
#define load_module DPPP_(my_load_module)
#define Perl_load_module DPPP_(my_load_module)
void
DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...)
{
va_list args;
va_start(args, ver);
vload_module(flags, name, ver, &args);
va_end(args);
}
#endif
#endif
#ifndef newRV_inc
# define newRV_inc(sv) newRV(sv) /* Replace */
#endif
#ifndef newRV_noinc
#if defined(PERL_USE_GCC_BRACE_GROUPS)
# define newRV_noinc(sv) ({ SV *_sv = (SV *)newRV((sv)); SvREFCNT_dec((sv)); _sv; })
#else
# define newRV_noinc(sv) ((PL_Sv = (SV *)newRV((sv))), SvREFCNT_dec((sv)), PL_Sv)
#endif
#endif
/*
* Boilerplate macros for initializing and accessing interpreter-local
* data from C. All statics in extensions should be reworked to use
* this, if you want to make the extension thread-safe. See ext/re/re.xs
* for an example of the use of these macros.
*
* Code that uses these macros is responsible for the following:
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT)
#ifndef START_MY_CXT
/* This must appear in all extensions that define a my_cxt_t structure,
* right after the definition (i.e. at file scope). The non-threads
* case below uses it to declare the data as static. */
#define START_MY_CXT
#if (PERL_BCDVERSION < 0x5004068)
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
#else /* >= perl5.004_68 */
#define dMY_CXT_SV \
SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \
sizeof(MY_CXT_KEY)-1, TRUE)
#endif /* < perl5.004_68 */
/* This declaration should be used within all functions that use the
* interpreter-local data. */
#define dMY_CXT \
dMY_CXT_SV; \
my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
/* Creates and zeroes the per-interpreter data.
* (We allocate my_cxtp in a Perl SV so that it will be released when
* the interpreter goes away.) */
#define MY_CXT_INIT \
dMY_CXT_SV; \
/* newSV() allocates one more than needed */ \
my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
Zero(my_cxtp, 1, my_cxt_t); \
sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
/* This macro must be used to access members of the my_cxt_t structure.
* e.g. MYCXT.some_data */
#define MY_CXT (*my_cxtp)
/* Judicious use of these macros can reduce the number of times dMY_CXT
* is used. Use is similar to pTHX, aTHX etc. */
#define pMY_CXT my_cxt_t *my_cxtp
#define pMY_CXT_ pMY_CXT,
#define _pMY_CXT ,pMY_CXT
#define aMY_CXT my_cxtp
#define aMY_CXT_ aMY_CXT,
#define _aMY_CXT ,aMY_CXT
#endif /* START_MY_CXT */
#ifndef MY_CXT_CLONE
/* Clones the per-interpreter data. */
#define MY_CXT_CLONE \
name is more accurate as to what it does */
#endif
#ifdef ibcmp_utf8
#ifndef foldEQ_utf8
# define foldEQ_utf8(s1,pe1,l1,u1,s2,pe2,l2,u2) \
cBOOL(! ibcmp_utf8(s1,pe1,l1,u1,s2,pe2,l2,u2))
#endif
#endif
#if defined(is_utf8_string) && defined(UTF8SKIP)
#ifndef isUTF8_CHAR
# define isUTF8_CHAR(s, e) ( \
(e) <= (s) || ! is_utf8_string(s, UTF8_SAFE_SKIP(s, e)) \
? 0 \
: UTF8SKIP(s))
#endif
#endif
#if 'A' == 65
#ifndef BOM_UTF8
# define BOM_UTF8 "\xEF\xBB\xBF"
#endif
#ifndef REPLACEMENT_CHARACTER_UTF8
# define REPLACEMENT_CHARACTER_UTF8 "\xEF\xBF\xBD"
#endif
#elif '^' == 95
#ifndef BOM_UTF8
# define BOM_UTF8 "\xDD\x73\x66\x73"
#endif
#ifndef REPLACEMENT_CHARACTER_UTF8
# define REPLACEMENT_CHARACTER_UTF8 "\xDD\x73\x73\x71"
#endif
#elif '^' == 176
#ifndef BOM_UTF8
# define BOM_UTF8 "\xDD\x72\x65\x72"
#endif
#ifndef REPLACEMENT_CHARACTER_UTF8
# define REPLACEMENT_CHARACTER_UTF8 "\xDD\x72\x72\x70"
#endif
#else
# error Unknown character set
#endif
#if (PERL_BCDVERSION < 0x5031004)
/* Versions prior to this accepted things that are now considered
* malformations, and didn't return -1 on error with warnings enabled
* */
# undef utf8_to_uvchr_buf
#endif
/* This implementation brings modern, generally more restricted standards to
* utf8_to_uvchr_buf. Some of these are security related, and clearly must
* be done. But its arguable that the others need not, and hence should not.
* The reason they're here is that a module that intends to play with the
* latest perls should be able to work the same in all releases. An example is
* that perl no longer accepts any UV for a code point, but limits them to
* IV_MAX or below. This is for future internal use of the larger code points.
* If it turns out that some of these changes are breaking code that isn't
* intended to work with modern perls, the tighter restrictions could be
* relaxed. khw thinks this is unlikely, but has been wrong in the past. */
/* 5.6.0 is the first release with UTF-8, and we don't implement this function
* there due to its likely lack of still being in use, and the underlying
* implementation is very different from later ones, without the later
* safeguards, so would require extra work to deal with */
#if (PERL_BCDVERSION >= 0x5006001) && ! defined(utf8_to_uvchr_buf)
/* Choose which underlying implementation to use. At least one must be
* present or the perl is too early to handle this function */
# if defined(utf8n_to_uvchr) || defined(utf8_to_uvchr) || defined(utf8_to_uv)
# if defined(utf8n_to_uvchr) /* This is the preferred implementation */
# define D_PPP_utf8_to_uvchr_buf_callee utf8n_to_uvchr
# elif /* Must be at least 5.6.1 from #if above; \
If have both regular and _simple, regular has all args */ \
defined(utf8_to_uv) && defined(utf8_to_uv_simple)
# define D_PPP_utf8_to_uvchr_buf_callee utf8_to_uv
# elif defined(utf8_to_uvchr) /* The below won't work well on error input */
# define D_PPP_utf8_to_uvchr_buf_callee(s, curlen, retlen, flags) \
utf8_to_uvchr((U8 *)(s), (retlen))
# else
# define D_PPP_utf8_to_uvchr_buf_callee(s, curlen, retlen, flags) \
utf8_to_uv((U8 *)(s), (retlen))
# endif
# endif
# if defined(NEED_utf8_to_uvchr_buf)
static UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen);
static
#else
extern UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen);
#endif
#if defined(NEED_utf8_to_uvchr_buf) || defined(NEED_utf8_to_uvchr_buf_GLOBAL)
#ifdef utf8_to_uvchr_buf
# undef utf8_to_uvchr_buf
#endif
#define utf8_to_uvchr_buf(a,b,c) DPPP_(my_utf8_to_uvchr_buf)(aTHX_ a,b,c)
#define Perl_utf8_to_uvchr_buf DPPP_(my_utf8_to_uvchr_buf)
UV
DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
{
UV ret;
STRLEN curlen;
bool overflows = 0;
const U8 *cur_s = s;
const bool do_warnings = ckWARN_d(WARN_UTF8);
# if (PERL_BCDVERSION < 0x5026000) && ! defined(EBCDIC)
STRLEN overflow_length = 0;
# endif
( run in 0.523 second using v1.01-cache-2.11-cpan-39bf76dae61 )