X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/597ee3f45b478da1456092f63d3ac698ee812786..64f5c2c41358c299ea0b3c7c9ab04fd866c17ce4:/proto.h diff --git a/proto.h b/proto.h index 61a4db8..3aae77f 100644 --- a/proto.h +++ b/proto.h @@ -49,6 +49,7 @@ PERL_CALLCONV int Perl_PerlLIO_open_cloexec(pTHX_ const char *file, int flag) #define PERL_ARGS_ASSERT_PERLLIO_OPEN_CLOEXEC \ assert(file) +PERL_CALLCONV const char* Perl_setlocale(const int category, const char* locale); PERL_CALLCONV void* Perl_Slab_Alloc(pTHX_ size_t sz) __attribute__warn_unused_result__; @@ -61,6 +62,11 @@ PERL_CALLCONV char * Perl__byte_dump_string(pTHX_ const U8 * const start, const PERL_CALLCONV void Perl__force_out_malformed_utf8_message(pTHX_ const U8 *const p, const U8 * const e, const U32 flags, const bool die_here); #define PERL_ARGS_ASSERT__FORCE_OUT_MALFORMED_UTF8_MESSAGE \ assert(p); assert(e) +PERL_CALLCONV Size_t Perl__inverse_folds(pTHX_ const UV cp, unsigned int * first_folds_to, const unsigned int ** remaining_folds_to) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT__INVERSE_FOLDS \ + assert(first_folds_to); assert(remaining_folds_to) + PERL_CALLCONV bool Perl__is_in_locale_category(pTHX_ const bool compiling, const int category); PERL_CALLCONV bool Perl__is_uni_FOO(pTHX_ const U8 classnum, const UV c) __attribute__warn_unused_result__; @@ -214,6 +220,9 @@ PERL_CALLCONV AV* Perl_av_make(pTHX_ SSize_t size, SV **strp) #define PERL_ARGS_ASSERT_AV_MAKE \ assert(strp) +PERL_CALLCONV SV* Perl_av_nonelem(pTHX_ AV *av, SSize_t ix); +#define PERL_ARGS_ASSERT_AV_NONELEM \ + assert(av) PERL_CALLCONV SV* Perl_av_pop(pTHX_ AV *av); #define PERL_ARGS_ASSERT_AV_POP \ assert(av) @@ -1357,6 +1366,9 @@ PERL_CALLCONV void Perl_init_dbargs(pTHX); PERL_CALLCONV void Perl_init_debugger(pTHX); PERL_CALLCONV int Perl_init_i18nl10n(pTHX_ int printwarn); PERL_CALLCONV int Perl_init_i18nl14n(pTHX_ int printwarn); +PERL_CALLCONV void Perl_init_named_cv(pTHX_ CV *cv, OP *nameop); +#define PERL_ARGS_ASSERT_INIT_NAMED_CV \ + assert(cv); assert(nameop) PERL_CALLCONV void Perl_init_stacks(pTHX); PERL_CALLCONV void Perl_init_tm(pTHX_ struct tm *ptm); #define PERL_ARGS_ASSERT_INIT_TM \ @@ -1388,11 +1400,6 @@ PERL_CALLCONV bool Perl_isIDFIRST_lazy(pTHX_ const char* p) #define PERL_ARGS_ASSERT_ISIDFIRST_LAZY \ assert(p) -PERL_CALLCONV bool Perl_isSCRIPT_RUN(pTHX_ const U8 *s, const U8 *send, const bool utf8_target) - __attribute__warn_unused_result__; -#define PERL_ARGS_ASSERT_ISSCRIPT_RUN \ - assert(s); assert(send) - /* PERL_CALLCONV bool Perl_is_ascii_string(const U8* const s, STRLEN len) __attribute__warn_unused_result__ __attribute__pure__; */ @@ -1705,7 +1712,7 @@ PERL_STATIC_INLINE bool S_is_utf8_string_flags(const U8 *s, STRLEN len, const U3 #endif #ifndef NO_MATHOMS -PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); +PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC \ assert(s); assert(ep) #endif @@ -1942,6 +1949,9 @@ PERL_CALLCONV int Perl_magic_setmglob(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_setnkeys(pTHX_ SV* sv, MAGIC* mg); #define PERL_ARGS_ASSERT_MAGIC_SETNKEYS \ assert(sv); assert(mg) +PERL_CALLCONV int Perl_magic_setnonelem(pTHX_ SV* sv, MAGIC* mg); +#define PERL_ARGS_ASSERT_MAGIC_SETNONELEM \ + assert(sv); assert(mg) PERL_CALLCONV int Perl_magic_setpack(pTHX_ SV* sv, MAGIC* mg); #define PERL_ARGS_ASSERT_MAGIC_SETPACK \ assert(sv); assert(mg) @@ -2386,7 +2396,6 @@ PERL_CALLCONV CV * Perl_newXS_flags(pTHX_ const char *name, XSUBADDR_t subaddr, PERL_CALLCONV CV * Perl_newXS_len_flags(pTHX_ const char *name, STRLEN len, XSUBADDR_t subaddr, const char *const filename, const char *const proto, SV **const_svp, U32 flags); #define PERL_ARGS_ASSERT_NEWXS_LEN_FLAGS \ assert(subaddr) -PERL_CALLCONV void Perl_new_numeric(pTHX_ const char* newcoll); PERL_CALLCONV PERL_SI* Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems) __attribute__warn_unused_result__; @@ -2946,7 +2955,6 @@ PERL_CALLCONV void Perl_setfd_cloexec_for_nonsysfd(pTHX_ int fd); PERL_CALLCONV void Perl_setfd_cloexec_or_inhexec_by_sysfdness(pTHX_ int fd); PERL_CALLCONV void Perl_setfd_inhexec(int fd); PERL_CALLCONV void Perl_setfd_inhexec_for_sysfd(pTHX_ int fd); -PERL_CALLCONV char* Perl_setlocale(int category, const char* locale); PERL_CALLCONV HEK* Perl_share_hek(pTHX_ const char* str, SSize_t len, U32 hash); #define PERL_ARGS_ASSERT_SHARE_HEK \ assert(str) @@ -3514,7 +3522,8 @@ PERL_CALLCONV SV* Perl_swash_init(pTHX_ const char* pkg, const char* name, SV* l #define PERL_ARGS_ASSERT_SWASH_INIT \ assert(pkg); assert(name); assert(listsv) -PERL_CALLCONV void Perl_sync_locale(pTHX); +PERL_CALLCONV void Perl_switch_to_global_locale(void); +PERL_CALLCONV bool Perl_sync_locale(void); PERL_CALLCONV void Perl_sys_init(int* argc, char*** argv); #define PERL_ARGS_ASSERT_SYS_INIT \ assert(argc); assert(argv) @@ -3526,6 +3535,8 @@ PERL_CALLCONV void Perl_taint_env(pTHX); PERL_CALLCONV void Perl_taint_proper(pTHX_ const char* f, const char *const s); #define PERL_ARGS_ASSERT_TAINT_PROPER \ assert(s) +PERL_CALLCONV void Perl_thread_locale_init(void); +PERL_CALLCONV void Perl_thread_locale_term(void); PERL_CALLCONV OP * Perl_tied_method(pTHX_ SV *methname, SV **sp, SV *const sv, const MAGIC *const mg, const U32 flags, U32 argc, ...); #define PERL_ARGS_ASSERT_TIED_METHOD \ assert(methname); assert(sp); assert(sv); assert(mg) @@ -3677,9 +3688,13 @@ PERL_CALLCONV void Perl_utilize(pTHX_ int aver, I32 floor, OP* version, OP* idop assert(idop) /* PERL_CALLCONV U8* uvchr_to_utf8(pTHX_ U8 *d, UV uv); */ /* PERL_CALLCONV U8* uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); */ +/* PERL_CALLCONV U8* uvchr_to_utf8_flags_msgs(pTHX_ U8 *d, UV uv, UV flags, HV ** msgs); */ PERL_CALLCONV U8* Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, const UV flags); #define PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS \ assert(d) +PERL_CALLCONV U8* Perl_uvoffuni_to_utf8_flags_msgs(pTHX_ U8 *d, UV uv, const UV flags, HV** msgs); +#define PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS_MSGS \ + assert(d) PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); #define PERL_ARGS_ASSERT_UVUNI_TO_UTF8 \ assert(d) @@ -4190,7 +4205,7 @@ STATIC const regnode* S_dumpuntil(pTHX_ const regexp *r, const regnode *start, c assert(r); assert(start); assert(node); assert(sv) STATIC bool S_put_charclass_bitmap_innards(pTHX_ SV* sv, char* bitmap, SV* nonbitmap_invlist, SV* only_utf8_locale_invlist, const regnode * const node, const bool force_as_is_display); #define PERL_ARGS_ASSERT_PUT_CHARCLASS_BITMAP_INNARDS \ - assert(sv); assert(bitmap) + assert(sv) STATIC SV* S_put_charclass_bitmap_innards_common(pTHX_ SV* invlist, SV* posixes, SV* only_utf8, SV* not_utf8, SV* only_utf8_locale, const bool invert); #define PERL_ARGS_ASSERT_PUT_CHARCLASS_BITMAP_INNARDS_COMMON \ assert(invlist) @@ -4380,6 +4395,11 @@ PERL_STATIC_INLINE STRLEN S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLE #endif #endif #if defined(PERL_CORE) || defined(PERL_EXT) +PERL_CALLCONV bool Perl_isSCRIPT_RUN(pTHX_ const U8 *s, const U8 *send, const bool utf8_target) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_ISSCRIPT_RUN \ + assert(s); assert(send) + #ifndef PERL_NO_INLINE_FUNCTIONS PERL_STATIC_INLINE Size_t S_variant_under_utf8_count(const U8* const s, const U8* const e) __attribute__warn_unused_result__; @@ -4695,20 +4715,28 @@ PERL_CALLCONV SV* Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp); #endif #if defined(PERL_IN_LOCALE_C) STATIC const char* S_category_name(const int category); +STATIC void S_restore_switched_locale(pTHX_ const int category, const char * const original_locale); #ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_INLINE const char * S_save_to_buffer(const char * string, char **buf, Size_t *buf_size, const Size_t offset); +PERL_STATIC_INLINE const char * S_save_to_buffer(const char * string, char **buf, Size_t *buf_size, const Size_t offset) + __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_SAVE_TO_BUFFER \ - assert(string); assert(buf_size) + assert(buf_size) #endif + +STATIC const char* S_switch_category_locale_to_template(pTHX_ const int switch_category, const int template_category, const char * template_locale); # if defined(USE_LOCALE) STATIC void S_new_collate(pTHX_ const char* newcoll); STATIC void S_new_ctype(pTHX_ const char* newctype); #define PERL_ARGS_ASSERT_NEW_CTYPE \ assert(newctype) +STATIC void S_new_numeric(pTHX_ const char* newnum); STATIC void S_set_numeric_radix(pTHX_ const bool use_locale); STATIC char* S_stdize_locale(pTHX_ char* locs); #define PERL_ARGS_ASSERT_STDIZE_LOCALE \ assert(locs) +# if defined(USE_POSIX_2008_LOCALE) +STATIC const char* S_emulate_setlocale(const int category, const char* locale, unsigned int index, const bool is_index_valid); +# endif # if defined(WIN32) STATIC char* S_win32_setlocale(pTHX_ int category, const char* locale); # endif @@ -5181,6 +5209,11 @@ STATIC int S_edit_distance(const UV *src, const UV *tgt, const STRLEN x, const S #define PERL_ARGS_ASSERT_EDIT_DISTANCE \ assert(src); assert(tgt) +STATIC SV * S_get_ANYOFM_contents(pTHX_ const regnode * n) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_GET_ANYOFM_CONTENTS \ + assert(n) + STATIC SV* S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass* const node); #define PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC \ assert(pRExC_state); assert(node) @@ -5408,7 +5441,6 @@ PERL_CALLCONV SV* Perl__new_invlist_C_array(pTHX_ const UV* const list) PERL_CALLCONV SV* Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp, SV **lonly_utf8_locale, SV **output_invlist); #define PERL_ARGS_ASSERT__GET_REGCLASS_NONBITMAP_DATA \ assert(node) -PERL_CALLCONV void Perl__load_PL_utf8_foldclosures(pTHX); PERL_CALLCONV int Perl_re_printf(pTHX_ const char *fmt, ...); #define PERL_ARGS_ASSERT_RE_PRINTF \ assert(fmt) @@ -5416,7 +5448,7 @@ PERL_CALLCONV void Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* #define PERL_ARGS_ASSERT_REGPROP \ assert(sv); assert(o) #endif -#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UTF8_C) PERL_CALLCONV SV* Perl__get_swash_invlist(pTHX_ SV* const swash) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT__GET_SWASH_INVLIST \ @@ -5441,11 +5473,6 @@ PERL_CALLCONV SSize_t Perl__invlist_search(SV* const invlist, const UV cp) #define PERL_ARGS_ASSERT__INVLIST_SEARCH \ assert(invlist) -PERL_CALLCONV HV* Perl__swash_inversion_hash(pTHX_ SV* const swash) - __attribute__warn_unused_result__; -#define PERL_ARGS_ASSERT__SWASH_INVERSION_HASH \ - assert(swash) - #ifndef PERL_NO_INLINE_FUNCTIONS PERL_STATIC_INLINE bool* S_get_invlist_offset_addr(SV* invlist) __attribute__warn_unused_result__; @@ -5574,15 +5601,30 @@ STATIC char * S_find_next_ascii(char* s, const char * send, const bool is_utf8) #define PERL_ARGS_ASSERT_FIND_NEXT_ASCII \ assert(s); assert(send) +STATIC U8 * S_find_next_masked(U8 * s, const U8 * send, const U8 byte, const U8 mask) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_FIND_NEXT_MASKED \ + assert(s); assert(send) + STATIC char * S_find_next_non_ascii(char* s, const char * send, const bool is_utf8) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_FIND_NEXT_NON_ASCII \ assert(s); assert(send) -STATIC bool S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character) +STATIC U8 * S_find_span_end(U8* s, const U8 * send, const U8 span_byte) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_FIND_SPAN_END \ + assert(s); assert(send) + +STATIC U8 * S_find_span_end_mask(U8 * s, const U8 * send, const U8 span_byte, const U8 mask) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_FIND_SPAN_END_MASK \ + assert(s); assert(send) + +STATIC bool S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character, const U8* e) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_ISFOO_UTF8_LC \ - assert(character) + assert(character); assert(e) STATIC bool S_isGCB(pTHX_ const GCB_enum before, const GCB_enum after, const U8 * const strbeg, const U8 * const curpos, const bool utf8_target) __attribute__warn_unused_result__; @@ -5926,9 +5968,9 @@ STATIC bool S_isa_lookup(pTHX_ HV *stash, const char * const name, STRLEN len, U assert(stash); assert(name) #endif #if defined(PERL_IN_UTF8_C) -STATIC UV S__to_utf8_case(pTHX_ const UV uv1, const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, const char *normal, const char *special); +STATIC UV S__to_utf8_case(pTHX_ const UV uv1, const U8 *p, U8* ustrp, STRLEN *lenp, SV *invlist, const int * const invmap, const unsigned int * const * const aux_tables, const U8 * const aux_table_lengths, const char * const normal); #define PERL_ARGS_ASSERT__TO_UTF8_CASE \ - assert(p); assert(ustrp); assert(swashp); assert(normal) + assert(p); assert(ustrp); assert(invlist); assert(invmap); assert(normal) STATIC U32 S_check_and_deprecate(pTHX_ const U8 * p, const U8 ** e, const unsigned type, const bool use_locale, const char * const file, const unsigned line); #define PERL_ARGS_ASSERT_CHECK_AND_DEPRECATE \ assert(p); assert(e); assert(file) @@ -5955,14 +5997,14 @@ PERL_STATIC_INLINE int S_isFF_OVERLONG(const U8 * const s, const STRLEN len) PERL_STATIC_INLINE bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char * const swashname, SV* const invlist) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_IS_UTF8_COMMON \ - assert(p); assert(swash); assert(swashname) + assert(p); assert(swashname) #endif #ifndef PERL_NO_INLINE_FUNCTIONS PERL_STATIC_INLINE bool S_is_utf8_common_with_len(pTHX_ const U8 *const p, const U8 *const e, SV **swash, const char * const swashname, SV* const invlist) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_IS_UTF8_COMMON_WITH_LEN \ - assert(p); assert(e); assert(swash); assert(swashname) + assert(p); assert(e); assert(swashname) #endif #ifndef PERL_NO_INLINE_FUNCTIONS @@ -5972,6 +6014,11 @@ PERL_STATIC_INLINE int S_is_utf8_overlong_given_start_byte_ok(const U8 * const s assert(s) #endif +STATIC HV * S_new_msg_hv(pTHX_ const char * const message, U32 categories, U32 flag) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_NEW_MSG_HV \ + assert(message) + STATIC U8* S_swash_scan_list_line(pTHX_ U8* l, U8* const lend, UV* min, UV* max, UV* val, const bool wants_value, const U8* const typestr) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_SWASH_SCAN_LIST_LINE \ @@ -6000,7 +6047,7 @@ PERL_CALLCONV UV Perl__to_upper_title_latin1(pTHX_ const U8 c, U8 *p, STRLEN *le assert(p); assert(lenp) #endif #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) -PERL_CALLCONV UV Perl__to_fold_latin1(pTHX_ const U8 c, U8 *p, STRLEN *lenp, const unsigned int flags); +PERL_CALLCONV UV Perl__to_fold_latin1(const U8 c, U8 *p, STRLEN *lenp, const unsigned int flags); #define PERL_ARGS_ASSERT__TO_FOLD_LATIN1 \ assert(p); assert(lenp) #endif @@ -6173,7 +6220,7 @@ PERL_CALLCONV SV* Perl_sv_dup_inc(pTHX_ const SV *const sstr, CLONE_PARAMS *cons assert(param) #endif -#if defined(USE_LOCALE) && ( defined(PERL_IN_LOCALE_C) || defined(PERL_IN_MG_C) || defined (PERL_EXT_POSIX)) +#if defined(USE_LOCALE) && ( defined(PERL_IN_LOCALE_C) || defined(PERL_IN_MG_C) || defined (PERL_EXT_POSIX) || defined (PERL_EXT_LANGINFO)) PERL_CALLCONV bool Perl__is_cur_LC_category_utf8(pTHX_ int category); #endif #if defined(USE_LOCALE_COLLATE)