This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Extract code into separate function
[perl5.git] / proto.h
diff --git a/proto.h b/proto.h
index 458b073..6f41f4f 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -663,6 +663,11 @@ PERL_CALLCONV void Perl_ck_warner_d(pTHX_ U32 err, const char* pat, ...)
 
 PERL_CALLCONV bool     Perl_ckwarn(pTHX_ U32 w);
 PERL_CALLCONV bool     Perl_ckwarn_d(pTHX_ U32 w);
+PERL_CALLCONV const COP*       Perl_closest_cop(pTHX_ const COP *cop, const OP *o, const OP *curop, bool opnext)
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_CLOSEST_COP   \
+       assert(cop)
+
 PERL_CALLCONV OP*      Perl_convert(pTHX_ I32 optype, I32 flags, OP* o)
                        __attribute__warn_unused_result__;
 
@@ -1019,6 +1024,16 @@ PERL_CALLCONV void       Perl_dounwind(pTHX_ I32 cxix);
 PERL_CALLCONV I32      Perl_dowantarray(pTHX)
                        __attribute__warn_unused_result__;
 
+PERL_CALLCONV void     Perl_drand48_init_r(perl_drand48_t *random_state, U32 seed)
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_DRAND48_INIT_R        \
+       assert(random_state)
+
+PERL_CALLCONV double   Perl_drand48_r(perl_drand48_t *random_state)
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_DRAND48_R     \
+       assert(random_state)
+
 PERL_CALLCONV void     Perl_dump_all(pTHX);
 PERL_CALLCONV void     Perl_dump_all_perl(pTHX_ bool justperl);
 PERL_CALLCONV void     Perl_dump_eval(pTHX);
@@ -1756,11 +1771,11 @@ PERL_CALLCONV bool      Perl_is_ascii_string(const U8 *s, STRLEN len)
 PERL_CALLCONV I32      Perl_is_lvalue_sub(pTHX)
                        __attribute__warn_unused_result__;
 
-PERL_STATIC_INLINE bool        S_is_safe_syscall(pTHX_ SV *pv, const char *what, const char *op_name)
+PERL_STATIC_INLINE bool        S_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2)
-                       __attribute__nonnull__(pTHX_3);
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4);
 #define PERL_ARGS_ASSERT_IS_SAFE_SYSCALL       \
        assert(pv); assert(what); assert(op_name)
 
@@ -2883,6 +2898,13 @@ PERL_CALLCONV SV*        Perl_newSV_type(pTHX_ const svtype type)
                        __attribute__malloc__
                        __attribute__warn_unused_result__;
 
+PERL_CALLCONV SV*      Perl_newSVavdefelem(pTHX_ AV *av, SSize_t ix, bool extendible)
+                       __attribute__malloc__
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_NEWSVAVDEFELEM        \
+       assert(av)
+
 PERL_CALLCONV SV*      Perl_newSVhek(pTHX_ const HEK *const hek)
                        __attribute__malloc__
                        __attribute__warn_unused_result__;
@@ -4748,11 +4770,9 @@ PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
 #define PERL_ARGS_ASSERT_UTF8_TO_UVCHR \
        assert(s)
 
-PERL_CALLCONV UV       Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
+/* PERL_CALLCONV UV    utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
                        __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2);
-#define PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF     \
-       assert(s); assert(send)
+                       __attribute__nonnull__(pTHX_2); */
 
 PERL_CALLCONV UV       Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
                        __attribute__deprecated__
@@ -4761,23 +4781,35 @@ PERL_CALLCONV UV        Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
        assert(s)
 
 PERL_CALLCONV UV       Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
+                       __attribute__deprecated__
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_UTF8_TO_UVUNI_BUF     \
        assert(s); assert(send)
 
+PERL_CALLCONV UV       Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR        \
+       assert(s)
+
 PERL_CALLCONV UV       Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_UTF8N_TO_UVUNI        \
        assert(s)
 
-PERL_CALLCONV U8*      Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
+/* PERL_CALLCONV U8*   uvchr_to_utf8(pTHX_ U8 *d, UV uv)
+                       __attribute__nonnull__(pTHX_1); */
+
+/* PERL_CALLCONV U8*   uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
+                       __attribute__nonnull__(pTHX_1); */
+
+PERL_CALLCONV U8*      Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
                        __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8_FLAGS   \
+#define PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS        \
        assert(d)
 
-/* PERL_CALLCONV U8*   Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
-                       __attribute__nonnull__(pTHX_1); */
+PERL_CALLCONV U8*      Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
+                       __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_UVUNI_TO_UTF8 \
        assert(d)
 
@@ -4792,6 +4824,7 @@ PERL_CALLCONV UV  Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
        assert(s)
 
 PERL_CALLCONV UV       Perl_valid_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
+                       __attribute__deprecated__
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVUNI   \
        assert(s)
@@ -4977,18 +5010,6 @@ STATIC int       S_sv_2iuv_non_preserve(pTHX_ SV *const sv)
 #    endif
 #  endif
 #endif
-#if !(defined(EBCDIC))
-/* PERL_CALLCONV UV    Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
-                       __attribute__nonnull__(pTHX_1); */
-#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR        \
-       assert(s)
-
-/* PERL_CALLCONV U8*   Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv)
-                       __attribute__nonnull__(pTHX_1); */
-#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8 \
-       assert(d)
-
-#endif
 #if !(defined(HAS_SIGACTION) && defined(SA_SIGINFO))
 PERL_CALLCONV Signal_t Perl_csighandler(int sig);
 PERL_CALLCONV Signal_t Perl_sighandler(int sig);
@@ -5308,25 +5329,6 @@ PERL_CALLCONV void       Perl_dump_sv_child(pTHX_ SV *sv)
        assert(sv)
 
 #endif
-#if defined(DUMP_FDS)
-PERL_CALLCONV void     Perl_dump_fds(pTHX_ char* s)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_DUMP_FDS      \
-       assert(s)
-
-#endif
-#if defined(EBCDIC)
-PERL_CALLCONV UV       Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR        \
-       assert(s)
-
-PERL_CALLCONV U8*      Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8 \
-       assert(d)
-
-#endif
 #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
 PERL_CALLCONV I32      Perl_do_ipcctl(pTHX_ I32 optype, SV** mark, SV** sp)
                        __attribute__nonnull__(pTHX_2)
@@ -5719,16 +5721,49 @@ PERL_CALLCONV void      Perl_hv_kill_backrefs(pTHX_ HV *hv)
 
 #endif
 #if defined(PERL_IN_GV_C)
+STATIC bool    S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, const U32 is_utf8, const I32 add, svtype sv_type)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_FIND_DEFAULT_STASH    \
+       assert(stash); assert(name)
+
 STATIC void    S_gv_init_svtype(pTHX_ GV *gv, const svtype sv_type)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_GV_INIT_SVTYPE        \
        assert(gv)
 
+STATIC bool    S_gv_is_in_main(pTHX_ const char *name, STRLEN len, const U32 is_utf8)
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_GV_IS_IN_MAIN \
+       assert(name)
+
+STATIC bool    S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, bool addmg, svtype sv_type)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_GV_MAGICALIZE \
+       assert(gv); assert(stash); assert(name)
+
 STATIC void    S_gv_magicalize_isa(pTHX_ GV *gv)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_GV_MAGICALIZE_ISA     \
        assert(gv)
 
+STATIC void    S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_MAYBE_MULTIMAGIC_GV   \
+       assert(gv); assert(name)
+
+STATIC bool    S_parse_gv_stash_name(pTHX_ HV **stash, GV **gv, const char **name, STRLEN *len, const char *nambeg, STRLEN full_len, const U32 is_utf8, const I32 add)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4)
+                       __attribute__nonnull__(pTHX_5);
+#define PERL_ARGS_ASSERT_PARSE_GV_STASH_NAME   \
+       assert(stash); assert(gv); assert(name); assert(len); assert(nambeg)
+
 STATIC HV*     S_require_tie_mod(pTHX_ GV *gv, const char *varpv, SV* namesv, const char *methpv, const U32 flags)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
@@ -6478,6 +6513,7 @@ STATIC SV *       S_space_join_names_mortal(pTHX_ char *const *array)
 
 #endif
 #if defined(PERL_IN_REGCOMP_C)
+PERL_CALLCONV int is_inf       (pTHX);
 STATIC void    S__append_range_to_invlist(pTHX_ SV* const invlist, const UV start, const UV end)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT__APPEND_RANGE_TO_INVLIST      \
@@ -6512,31 +6548,31 @@ PERL_STATIC_INLINE void S_alloc_maybe_populate_EXACT(pTHX_ struct RExC_state_t *
 #define PERL_ARGS_ASSERT_ALLOC_MAYBE_POPULATE_EXACT    \
        assert(pRExC_state); assert(node); assert(flagp)
 
-STATIC void    S_cl_and(struct regnode_charclass_class *cl, const struct regnode_charclass_class *and_with)
+STATIC void    S_cl_and(regnode_ssc *cl, const regnode_ssc *and_with)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2);
 #define PERL_ARGS_ASSERT_CL_AND        \
        assert(cl); assert(and_with)
 
-STATIC void    S_cl_anything(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
+STATIC void    S_cl_anything(const struct RExC_state_t *pRExC_state, regnode_ssc *cl)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2);
 #define PERL_ARGS_ASSERT_CL_ANYTHING   \
        assert(pRExC_state); assert(cl)
 
-STATIC void    S_cl_init(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
+STATIC void    S_cl_init(const struct RExC_state_t *pRExC_state, regnode_ssc *cl)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2);
 #define PERL_ARGS_ASSERT_CL_INIT       \
        assert(pRExC_state); assert(cl)
 
-STATIC int     S_cl_is_anything(const struct regnode_charclass_class *cl)
+STATIC int     S_cl_is_anything(const regnode_ssc *cl)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(1);
 #define PERL_ARGS_ASSERT_CL_IS_ANYTHING        \
        assert(cl)
 
-STATIC void    S_cl_or(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with)
+STATIC void    S_cl_or(const struct RExC_state_t *pRExC_state, regnode_ssc *cl, const regnode_ssc *or_with)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2)
                        __attribute__nonnull__(3);
@@ -6686,10 +6722,16 @@ STATIC void     S_parse_lparen_question_flags(pTHX_ struct RExC_state_t *pRExC_state
 #define PERL_ARGS_ASSERT_PARSE_LPAREN_QUESTION_FLAGS   \
        assert(pRExC_state)
 
-PERL_STATIC_NO_RET void        S_re_croak2(pTHX_ const char* pat1, const char* pat2, ...)
-                       __attribute__noreturn__
+STATIC void    S_populate_ANYOF_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_POPULATE_ANYOF_FROM_INVLIST   \
+       assert(node); assert(invlist_ptr)
+
+PERL_STATIC_NO_RET void        S_re_croak2(pTHX_ bool utf8, const char* pat1, const char* pat2, ...)
+                       __attribute__noreturn__
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3);
 #define PERL_ARGS_ASSERT_RE_CROAK2     \
        assert(pat1); assert(pat2)
 
@@ -6793,7 +6835,14 @@ STATIC void      S_scan_commit(pTHX_ const struct RExC_state_t *pRExC_state, struct s
 #define PERL_ARGS_ASSERT_SCAN_COMMIT   \
        assert(pRExC_state); assert(data); assert(minlenp)
 
-STATIC SSize_t S_study_chunk(pTHX_ struct RExC_state_t *pRExC_state, regnode **scanp, SSize_t *minlenp, SSize_t *deltap, regnode *last, struct scan_data_t *data, I32 stopparen, U8* recursed, struct regnode_charclass_class *and_withp, U32 flags, U32 depth)
+STATIC void    S_set_ANYOF_arg(pTHX_ struct RExC_state_t* const pRExC_state, regnode* const ret, SV* const cp_list, SV* const listsv, const STRLEN initial_listsv_len, SV* const swash, const bool has_user_defined_property)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_SET_ANYOF_ARG \
+       assert(pRExC_state); assert(ret); assert(listsv)
+
+STATIC SSize_t S_study_chunk(pTHX_ struct RExC_state_t *pRExC_state, regnode **scanp, SSize_t *minlenp, SSize_t *deltap, regnode *last, struct scan_data_t *data, I32 stopparen, U8* recursed, regnode_ssc *and_withp, U32 flags, U32 depth)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3)
@@ -7371,12 +7420,11 @@ STATIC char*    S_scan_heredoc(pTHX_ char *s)
 #define PERL_ARGS_ASSERT_SCAN_HEREDOC  \
        assert(s)
 
-STATIC char*   S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck_uni)
+STATIC char*   S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
                        __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2)
-                       __attribute__nonnull__(pTHX_3);
+                       __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_SCAN_IDENT    \
-       assert(s); assert(send); assert(dest)
+       assert(s); assert(dest)
 
 STATIC char*   S_scan_inputsymbol(pTHX_ char *start)
                        __attribute__warn_unused_result__
@@ -7532,11 +7580,6 @@ PERL_CALLCONV UV Perl__to_fold_latin1(pTHX_ const U8 c, U8 *p, STRLEN *lenp, con
 #endif
 #if defined(PERL_IN_UTIL_C)
 STATIC bool    S_ckwarn_common(pTHX_ U32 w);
-STATIC const COP*      S_closest_cop(pTHX_ const COP *cop, const OP *o)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_CLOSEST_COP   \
-       assert(cop)
-
 STATIC bool    S_invoke_exception_hook(pTHX_ SV *ex, bool warn);
 STATIC SV*     S_mess_alloc(pTHX);
 STATIC SV *    S_with_queued_errors(pTHX_ SV *ex)
@@ -7862,10 +7905,10 @@ PERL_CALLCONV int       Perl_PerlIO_fileno(pTHX_ PerlIO *f);
 PERL_CALLCONV int      Perl_PerlIO_fill(pTHX_ PerlIO *f);
 PERL_CALLCONV int      Perl_PerlIO_flush(pTHX_ PerlIO *f);
 PERL_CALLCONV STDCHAR *        Perl_PerlIO_get_base(pTHX_ PerlIO *f);
-PERL_CALLCONV int      Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f)
+PERL_CALLCONV SSize_t  Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f)
                        __attribute__warn_unused_result__;
 
-PERL_CALLCONV int      Perl_PerlIO_get_cnt(pTHX_ PerlIO *f)
+PERL_CALLCONV SSize_t  Perl_PerlIO_get_cnt(pTHX_ PerlIO *f)
                        __attribute__warn_unused_result__;
 
 PERL_CALLCONV STDCHAR *        Perl_PerlIO_get_ptr(pTHX_ PerlIO *f);
@@ -7875,8 +7918,8 @@ PERL_CALLCONV SSize_t     Perl_PerlIO_read(pTHX_ PerlIO *f, void *vbuf, Size_t count
        assert(vbuf)
 
 PERL_CALLCONV int      Perl_PerlIO_seek(pTHX_ PerlIO *f, Off_t offset, int whence);
-PERL_CALLCONV void     Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, int cnt);
-PERL_CALLCONV void     Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, int cnt);
+PERL_CALLCONV void     Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, SSize_t cnt);
+PERL_CALLCONV void     Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, SSize_t cnt);
 PERL_CALLCONV void     Perl_PerlIO_setlinebuf(pTHX_ PerlIO *f);
 PERL_CALLCONV PerlIO * Perl_PerlIO_stderr(pTHX)
                        __attribute__warn_unused_result__;