This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #38293] chr(65535) should be allowed in regexes
[perl5.git] / cop.h
diff --git a/cop.h b/cop.h
index 6c26e0e..fc69b91 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -148,10 +148,11 @@ struct cop {
     line_t      cop_line;       /* line # of this command */
     SV *       cop_warnings;   /* lexical warnings bitmask */
     SV *       cop_io;         /* lexical IO defaults */
+    /* compile time state of %^H.  See the comment in op.c for how this is
+       used to recreate a hash to return from caller.  */
+    struct refcounted_he * cop_hints;
 };
 
-#define Nullcop Null(COP*)
-
 #ifdef USE_ITHREADS
 #  define CopFILE(c)           ((c)->cop_file)
 #  define CopFILEGV(c)         (CopFILE(c) \
@@ -228,6 +229,18 @@ struct cop {
 #  define OutCopFILE(c) CopFILE(c)
 #endif
 
+/* CopARYBASE is likely to be removed soon.  */
+#define CopARYBASE(c)          ((c)->cop_arybase)
+#define CopARYBASE_get(c)      ((c)->cop_arybase + 0)
+#define CopARYBASE_set(c, b)   STMT_START { (c)->cop_arybase = (b); } STMT_END
+
+/* FIXME NATIVE_HINTS if this is changed from op_private (see perl.h)  */
+#define CopHINTS_get(c)                ((c)->op_private + 0)
+#define CopHINTS_set(c, h)     STMT_START {                            \
+                                   (c)->op_private                     \
+                                        = (U8)((h) & HINT_PRIVATE_MASK); \
+                               } STMT_END
+
 /*
  * Here we have some enormously heavy (or at least ponderous) wizardry.
  */
@@ -239,7 +252,7 @@ struct block_sub {
     GV *       dfoutgv;
     AV *       savearray;
     AV *       argarray;
-    long       olddepth;
+    I32                olddepth;
     U8         hasargs;
     U8         lval;           /* XXX merge lval and hasargs? */
     PAD                *oldcomppad;
@@ -254,10 +267,10 @@ struct block_sub {
        cx->blk_sub.cv = cv;                                            \
        cx->blk_sub.olddepth = CvDEPTH(cv);                             \
        cx->blk_sub.hasargs = hasargs;                                  \
-       cx->blk_sub.retop = Nullop;                                             \
+       cx->blk_sub.retop = NULL;                                       \
        if (!CvDEPTH(cv)) {                                             \
-           (void)SvREFCNT_inc(cv);                                     \
-           (void)SvREFCNT_inc(cv);                                     \
+           SvREFCNT_inc_void(cv);                                      \
+           SvREFCNT_inc_void(cv);                                      \
            SAVEFREESV(cv);                                             \
        }
 
@@ -276,10 +289,10 @@ struct block_sub {
 #define PUSHFORMAT(cx)                                                 \
        cx->blk_sub.cv = cv;                                            \
        cx->blk_sub.gv = gv;                                            \
-       cx->blk_sub.retop = Nullop;                                     \
+       cx->blk_sub.retop = NULL;                                       \
        cx->blk_sub.hasargs = 0;                                        \
        cx->blk_sub.dfoutgv = PL_defoutgv;                              \
-       (void)SvREFCNT_inc(cx->blk_sub.dfoutgv)
+       SvREFCNT_inc_void(cx->blk_sub.dfoutgv)
 
 #define POP_SAVEARRAY()                                                \
     STMT_START {                                                       \
@@ -348,7 +361,7 @@ struct block_eval {
        cx->blk_eval.old_eval_root = PL_eval_root;                      \
        cx->blk_eval.cur_text = PL_linestr;                             \
        cx->blk_eval.cv = NULL; /* set by doeval(), as applicable */    \
-       cx->blk_eval.retop = Nullop;                                    \
+       cx->blk_eval.retop = NULL;                                      \
        cx->blk_eval.cur_top_env = PL_top_env;                          \
     } STMT_END
 
@@ -419,7 +432,7 @@ struct block_loop {
        SvREFCNT_dec(cx->blk_loop.iterlval);                            \
        if (CxITERVAR(cx)) {                                            \
             if (SvPADMY(cx->blk_loop.itersave)) {                      \
-               SV **s_v_p = CxITERVAR(cx);                             \
+               SV ** const s_v_p = CxITERVAR(cx);                      \
                sv_2mortal(*s_v_p);                                     \
                *s_v_p = cx->blk_loop.itersave;                         \
            }                                                           \
@@ -544,7 +557,7 @@ struct subst {
        cx->sb_s                = s,                                    \
        cx->sb_m                = m,                                    \
        cx->sb_strend           = strend,                               \
-       cx->sb_rxres            = Null(void*),                          \
+       cx->sb_rxres            = NULL,                                 \
        cx->sb_rx               = rx,                                   \
        cx->cx_type             = CXt_SUBST;                            \
        rxres_save(&cx->sb_rxres, rx)
@@ -648,6 +661,8 @@ L<perlcall>.
 #define G_KEEPERR      16      /* Append errors to $@, don't overwrite it */
 #define G_NODEBUG      32      /* Disable debugging at toplevel.  */
 #define G_METHOD       64       /* Calling method. */
+#define G_FAKINGEVAL  256      /* Faking en eval context for call_sv or
+                                  fold_constants. */
 
 /* flag bits for PL_in_eval */
 #define EVAL_NULL      0       /* not in an eval */
@@ -805,3 +820,13 @@ See L<perlcall/Lightweight Callbacks>.
        CATCH_SET(multicall_oldcatch);                                  \
        LEAVE;                                                          \
     } STMT_END
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */