This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #129000) create a safer utf8_hop()
[perl5.git] / embed.fnc
index 085f2f1..9d40940 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
 :
 :         (currently no effect)
 :
+:   W  Add a _pDEPTH argument to function prototypes, and an _aDEPTH
+:      argument to the function calls. This means that under DEBUGGING
+:      a depth argument is added to the functions, which is used for
+:      example by the regex engine for debugging and trace output.
+:      A non DEBUGGING build will not pass the unused argument.
+:      Currently restricted to functions with at least one argument.
+:
 :   X  Explicitly exported:
 :
 :         add entry to the list of exported symbols, unless x or m
@@ -366,6 +373,10 @@ Ap |I32    |debstackptrs
 pR     |SV *   |defelem_target |NN SV *sv|NULLOK MAGIC *mg
 Anp    |char*  |delimcpy       |NN char* to|NN const char* toend|NN const char* from \
                                |NN const char* fromend|int delim|NN I32* retlen
+np     |char*  |delimcpy_no_escape|NN char* to|NN const char* toend \
+                                  |NN const char* from \
+                                  |NN const char* fromend|int delim \
+                                  |NN I32* retlen
 : Used in op.c, perl.c
 pM     |void   |delete_eval_scope
 Aprd   |OP*    |die_sv         |NN SV *baseex
@@ -678,7 +689,7 @@ ApR |I32    |is_lvalue_sub
 : Used in cop.h
 XopR   |I32    |was_lvalue_sub
 #ifndef PERL_NO_INLINE_FUNCTIONS
-AiMRn  |STRLEN |_is_utf8_char_slow|NN const U8 *s|NN const U8 *e
+ApMRnP |STRLEN |_is_utf8_char_helper|NN const U8 * const s|NN const U8 * e|const U32 flags
 #endif
 ADMpPR |U32    |to_uni_upper_lc|U32 c
 ADMpPR |U32    |to_uni_title_lc|U32 c
@@ -704,6 +715,7 @@ ADMpPR      |bool   |isIDFIRST_lazy |NN const char* p
 ADMpPR |bool   |isALNUM_lazy   |NN const char* p
 #ifdef PERL_IN_UTF8_C
 snR    |U8     |to_lower_latin1|const U8 c|NULLOK U8 *p|NULLOK STRLEN *lenp
+inPR   |bool   |is_utf8_cp_above_31_bits|NN const U8 * const s|NN const U8 * const e
 #endif
 #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
 EXp    |UV        |_to_fold_latin1|const U8 c|NN U8 *p|NN STRLEN *lenp|const unsigned int flags
@@ -736,9 +748,44 @@ AmnpdRP    |bool   |is_ascii_string|NN const U8* const s|const STRLEN len
 AmnpdRP        |bool   |is_invariant_string|NN const U8* const s|const STRLEN len
 AnpdD  |STRLEN |is_utf8_char   |NN const U8 *s
 Abmnpd |STRLEN |is_utf8_char_buf|NN const U8 *buf|NN const U8 *buf_end
-Anpd   |bool   |is_utf8_string |NN const U8 *s|STRLEN len
-Anpdmb |bool   |is_utf8_string_loc|NN const U8 *s|STRLEN len|NN const U8 **ep
-Anpd   |bool   |is_utf8_string_loclen|NN const U8 *s|STRLEN len|NULLOK const U8 **ep|NULLOK STRLEN *el
+AnipdP |bool   |is_utf8_string |NN const U8 *s|const STRLEN len
+AnidP  |bool   |is_utf8_string_flags                                       \
+               |NN const U8 *s|const STRLEN len|const U32 flags
+AnidP  |bool   |is_strict_utf8_string|NN const U8 *s|const STRLEN len
+AnidP  |bool   |is_c9strict_utf8_string|NN const U8 *s|const STRLEN len
+Anpdmb |bool   |is_utf8_string_loc                                         \
+               |NN const U8 *s|const STRLEN len|NN const U8 **ep
+Andm   |bool   |is_utf8_string_loc_flags                                   \
+               |NN const U8 *s|const STRLEN len|NN const U8 **ep           \
+               |const U32 flags
+Andm   |bool   |is_strict_utf8_string_loc                                  \
+               |NN const U8 *s|const STRLEN len|NN const U8 **ep
+Andm   |bool   |is_c9strict_utf8_string_loc                                \
+               |NN const U8 *s|const STRLEN len|NN const U8 **ep
+Anipd  |bool   |is_utf8_string_loclen                                      \
+               |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep       \
+               |NULLOK STRLEN *el
+Anid   |bool   |is_utf8_string_loclen_flags                                \
+               |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep       \
+               |NULLOK STRLEN *el|const U32 flags
+Anid   |bool   |is_strict_utf8_string_loclen                               \
+               |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep       \
+               |NULLOK STRLEN *el
+Anid   |bool   |is_c9strict_utf8_string_loclen                             \
+               |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep       \
+               |NULLOK STRLEN *el
+Amnd   |bool   |is_utf8_fixed_width_buf_flags                              \
+               |NN const U8 * const s|const STRLEN len|const U32 flags
+Amnd   |bool   |is_utf8_fixed_width_buf_loc_flags                          \
+               |NN const U8 * const s|const STRLEN len                     \
+               |NULLOK const U8 **ep|const U32 flags
+Anid   |bool   |is_utf8_fixed_width_buf_loclen_flags                       \
+               |NN const U8 * const s|const STRLEN len                     \
+               |NULLOK const U8 **ep|NULLOK STRLEN *el|const U32 flags
+AmndP  |bool   |is_utf8_valid_partial_char                                 \
+               |NN const U8 * const s|NN const U8 * const e
+AnidP  |bool   |is_utf8_valid_partial_char_flags                           \
+               |NN const U8 * const s|NN const U8 * const e|const U32 flags
 AMpR   |bool   |_is_uni_FOO|const U8 classnum|const UV c
 AMpR   |bool   |_is_utf8_FOO|const U8 classnum|NN const U8 *p
 ADMpR  |bool   |is_utf8_alnum  |NN const U8 *p
@@ -1188,7 +1235,7 @@ s |void   |pidgone        |Pid_t pid|int status
 #endif
 : Used in perly.y
 p      |OP*    |pmruntime      |NN OP *o|NN OP *expr|NULLOK OP *repl \
-                               |bool isreg|I32 floor
+                               |UV flags|I32 floor
 #if defined(PERL_IN_OP_C)
 s      |OP*    |pmtrans        |NN OP* o|NN OP* expr|NN OP* repl
 #endif
@@ -1526,6 +1573,7 @@ Apd       |SV*    |sv_setref_pvn  |NN SV *const rv|NULLOK const char *const classname \
                                |NN const char *const pv|const STRLEN n
 Apd    |void   |sv_setpv       |NN SV *const sv|NULLOK const char *const ptr
 Apd    |void   |sv_setpvn      |NN SV *const sv|NULLOK const char *const ptr|const STRLEN len
+Apd    |char  *|sv_setpv_bufsize|NN SV *const sv|const STRLEN cur|const STRLEN len
 Xp     |void   |sv_sethek      |NN SV *const sv|NULLOK const HEK *const hek
 Apmdb  |void   |sv_setsv       |NN SV *dstr|NULLOK SV *sstr
 Apmdb  |void   |sv_taint       |NN SV* sv
@@ -1633,6 +1681,15 @@ ApdD     |UV     |to_utf8_case   |NN const U8 *p                                 \
                                |NN const char *normal|                         \
                                NULLOK const char *special
 #if defined(PERL_IN_UTF8_C)
+inRP   |bool   |does_utf8_overflow|NN const U8 * const s|NN const U8 * e
+inRP   |bool   |is_utf8_overlong_given_start_byte_ok|NN const U8 * const s|const STRLEN len
+inRP   |bool   |isFF_OVERLONG  |NN const U8 * const s|const STRLEN len
+sMR    |char * |unexpected_non_continuation_text                       \
+               |NN const U8 * const s                                  \
+               |STRLEN print_len                                       \
+               |const STRLEN non_cont_byte_pos                         \
+               |const STRLEN expect_len
+sM     |char * |_byte_dump_string|NN const U8 * s|const STRLEN len
 s      |UV     |_to_utf8_case  |const UV uv1                                   \
                                |NN const U8 *p                                 \
                                |NN U8* ustrp                                   \
@@ -1677,6 +1734,9 @@ Ap        |U8*    |utf16_to_utf8_reversed|NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen
 AdpPR  |STRLEN |utf8_length    |NN const U8* s|NN const U8 *e
 AipdPR |IV     |utf8_distance  |NN const U8 *a|NN const U8 *b
 AipdPRn        |U8*    |utf8_hop       |NN const U8 *s|SSize_t off
+AipdPRn        |U8*    |utf8_hop_back|NN const U8 *s|SSize_t off|NN const U8 *start
+AipdPRn        |U8*    |utf8_hop_forward|NN const U8 *s|SSize_t off|NN const U8 *end
+AipdPRn        |U8*    |utf8_hop_safe  |NN const U8 *s|SSize_t off|NN const U8 *start|NN const U8 *end
 ApMd   |U8*    |utf8_to_bytes  |NN U8 *s|NN STRLEN *len
 Apd    |int    |bytes_cmp_utf8 |NN const U8 *b|STRLEN blen|NN const U8 *u \
                                |STRLEN ulen
@@ -1689,7 +1749,15 @@ Amd      |UV     |utf8_to_uvchr_buf      |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retl
 ApdD   |UV     |utf8_to_uvuni_buf      |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen
 pM     |bool   |check_utf8_print       |NN const U8 *s|const STRLEN len
 
-Adp    |UV     |utf8n_to_uvchr |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags
+Adop   |UV     |utf8n_to_uvchr |NN const U8 *s                             \
+                               |STRLEN curlen                              \
+                               |NULLOK STRLEN *retlen                      \
+                               |const U32 flags
+Adp    |UV     |utf8n_to_uvchr_error|NN const U8 *s                        \
+                               |STRLEN curlen                              \
+                               |NULLOK STRLEN *retlen                      \
+                               |const U32 flags                            \
+                               |NULLOK U32 * errors
 AipnR  |UV     |valid_utf8_to_uvchr    |NN const U8 *s|NULLOK STRLEN *retlen
 Ap     |UV     |utf8n_to_uvuni|NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags
 
@@ -2200,6 +2268,12 @@ Es       |regnode*|handle_regex_sets|NN RExC_state_t *pRExC_state \
                                |NULLOK SV ** return_invlist            \
                                |NN I32 *flagp|U32 depth                \
                                |NN char * const oregcomp_parse
+#if defined(DEBUGGING) && defined(ENABLE_REGEX_SETS_DEBUGGING)
+Es     |void   |dump_regex_sets_structures                                 \
+                               |NN RExC_state_t *pRExC_state               \
+                               |NN AV * stack                              \
+                               |const IV fence|NN AV * fence_stack
+#endif
 Es     |void|parse_lparen_question_flags|NN RExC_state_t *pRExC_state
 Es     |regnode*|reg_node      |NN RExC_state_t *pRExC_state|U8 op
 Es     |regnode*|regpiece      |NN RExC_state_t *pRExC_state \
@@ -2339,21 +2413,20 @@ Es      |U8     |regtail_study  |NN RExC_state_t *pRExC_state \
 ERs    |bool   |isFOO_lc       |const U8 classnum|const U8 character
 ERs    |bool   |isFOO_utf8_lc  |const U8 classnum|NN const U8* character
 ERs    |SSize_t|regmatch       |NN regmatch_info *reginfo|NN char *startpos|NN regnode *prog
-ERs    |I32    |regrepeat      |NN regexp *prog|NN char **startposp \
+WERs   |I32    |regrepeat      |NN regexp *prog|NN char **startposp \
                                |NN const regnode *p \
                                |NN regmatch_info *const reginfo \
-                               |I32 max \
-                               |int depth
+                               |I32 max
 ERs    |bool   |regtry         |NN regmatch_info *reginfo|NN char **startposp
 ERs    |bool   |reginclass     |NULLOK regexp * const prog  \
                                |NN const regnode * const n  \
                                |NN const U8 * const p       \
                                |NN const U8 * const p_end   \
                                |bool const utf8_target
-Es     |CHECKPOINT|regcppush   |NN const regexp *rex|I32 parenfloor\
+WEs    |CHECKPOINT|regcppush   |NN const regexp *rex|I32 parenfloor\
                                |U32 maxopenparen
-Es     |void   |regcppop       |NN regexp *rex\
-                               |NN U32 *maxopenparen_p
+WEs    |void   |regcppop       |NN regexp *rex|NN U32 *maxopenparen_p
+WEs    |void   |regcp_restore  |NN regexp *rex|I32 ix|NN U32 *maxopenparen_p
 ERsn   |U8*    |reghop3        |NN U8 *s|SSize_t off|NN const U8 *lim
 ERsn   |U8*    |reghop4        |NN U8 *s|SSize_t off|NN const U8 *llim \
                                |NN const U8 *rlim
@@ -2537,7 +2610,7 @@ s |void   |force_ident_maybe_lex|char pit
 s      |void   |incline        |NN const char *s
 s      |int    |intuit_method  |NN char *s|NULLOK SV *ioname|NULLOK CV *cv
 s      |int    |intuit_more    |NN char *s
-s      |I32    |lop            |I32 f|int x|NN char *s
+s      |I32    |lop            |I32 f|U8 x|NN char *s
 rs     |void   |missingterm    |NULLOK char *s
 s      |void   |no_op          |NN const char *const what|NULLOK char *s
 s      |int    |pending_ident