This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
get ext/Win32/Win32.xs to compile on cygwin
[perl5.git] / op.h
diff --git a/op.h b/op.h
index 7ae65d7..e3596b5 100644 (file)
--- a/op.h
+++ b/op.h
@@ -121,6 +121,8 @@ Deprecated.  Use C<GIMME_V> instead.
                                /*  On OP_ENTERWHEN, there's no condition */
                                /*  On OP_BREAK, an implicit break */
                                /*  On OP_SMARTMATCH, an implicit smartmatch */
+                               /*  On OP_ANONHASH and OP_ANONLIST, create a
+                                   reference to the new anon hash or array */
 
 /* old names; don't use in new code, but don't break them, either */
 #define OPf_LIST       OPf_WANT_LIST
@@ -149,6 +151,9 @@ Deprecated.  Use C<GIMME_V> instead.
 #define OPpASSIGN_BACKWARDS    64      /* Left & right switched. */
 #define OPpASSIGN_CV_TO_GV     128     /* Possible optimisation for constants. */
 
+/* Private for OP_[AS]ASSIGN */
+#define OPpASSIGN_STATE                32      /* Assign to a "state" variable */
+
 /* Private for OP_MATCH and OP_SUBST{,CONST} */
 #define OPpRUNTIME             64      /* Pattern coming in on the stack */
 
@@ -187,6 +192,8 @@ Deprecated.  Use C<GIMME_V> instead.
 #define OPpOUR_INTRO           16      /* Variable was in an our() */
   /* OP_RV2[AH]V, OP_PAD[AH]V, OP_[AH]ELEM */
 #define OPpMAYBE_LVSUB         8       /* We might be an lvalue to return */
+  /* OP_PADSV only */
+#define OPpPAD_STATE           16      /* is a "state" pad */
   /* for OP_RV2?V, lower bits carry hints (currently only HINT_STRICT_REFS) */
 
   /* OP_RV2GV only */
@@ -353,7 +360,9 @@ struct pmop {
 #define PMf_FOLD       0x4000          /* case insensitivity */
 #define PMf_EXTENDED   0x8000          /* chuck embedded whitespace */
 
-/* mask of bits stored in regexp->reganch */
+/* mask of bits stored in regexp->extflags
+   these all are also called RXf_PMf_xyz
+ */
 #define PMf_COMPILETIME        (PMf_MULTILINE|PMf_SINGLELINE|PMf_LOCALE|PMf_FOLD|PMf_EXTENDED)
 
 #ifdef USE_ITHREADS
@@ -511,6 +520,15 @@ struct loop {
 #define OA_SCALARREF 7
 #define OA_OPTIONAL 8
 
+/* Op_REFCNT is a reference count at the head of each op tree: needed
+ * since the tree is shared between threads, and between cloned closure
+ * copies in the same thread. OP_REFCNT_LOCK/UNLOCK is used when modifying
+ * this count.
+ * The same mutex is used to protect the refcounts of the reg_trie_data
+ * and reg_ac_data structures, which are shared between duplicated
+ * regexes.
+ */
+
 #ifdef USE_ITHREADS
 #  define OP_REFCNT_INIT               MUTEX_INIT(&PL_op_mutex)
 #  ifdef PERL_CORE
@@ -537,8 +555,14 @@ struct loop {
 #define PERL_LOADMOD_NOIMPORT          0x2
 #define PERL_LOADMOD_IMPORT_OPS                0x4
 
-/* used in perly.y */
+#if defined(PERL_IN_PERLY_C) || defined(PERL_IN_OP_C)
 #define ref(o, type) doref(o, type, TRUE)
+#endif
+
+/* no longer used anywhere in core */
+#ifndef PERL_CORE
+#define cv_ckproto(cv, gv, p) cv_ckproto_len(cv, gv, p, p ? strlen(p) : 0)
+#endif
 
 #ifdef USE_REENTRANT_API
 #include "reentr.h"
@@ -580,3 +604,78 @@ struct token {
     MADPROP* tk_mad;
 };
 #endif
+
+/*
+ * Values that can be hold by mad_key :
+ * ^       unfilled head spot
+ * ,       literal ,
+ * ;       literal ; (blank if implicit ; at end of block)
+ * :       literal : from ?: or attr list
+ * +       unary +
+ * ?       literal ? from ?:
+ * (       literal (
+ * )       literal )
+ * [       literal [
+ * ]       literal ]
+ * {       literal {
+ * }       literal }
+ * @       literal @ sigil
+ * $       literal $ sigil
+ * *       literal * sigil
+ * !       use is source filtered
+ * &       & or sub
+ * #       whitespace/comment following ; or }
+ * #       $# sigil
+ * 1       1st ; from for(;;)
+ * 1       retired protasis
+ * 2       2nd ; from for(;;)
+ * 2       retired apodosis
+ * 3       C-style for list
+ * a       sub or var attributes
+ * a       non-method arrow operator
+ * A       method arrow operator
+ * A       use import args
+ * b       format block
+ * B       retired stub block
+ * C       constant conditional op
+ * d       declarator
+ * D       do block
+ * e       unreached "else" (see C)
+ * e       expression producing E
+ * E       tr/E/R/, /E/
+ * f       folded constant op
+ * F       peg op for format
+ * i       if/unless modifier
+ * I       if/elsif/unless statement
+ * K       retired kid op
+ * l       last index of array ($#foo)
+ * L       label
+ * m       modifier on regex
+ * M       my assignment slurped into some other operator's target
+ * n       sub or format name
+ * o       current operator/declarator name
+ * o       else/continue
+ * O       generic optimized op
+ * p       peg to hold extra whitespace at statement level
+ * P       peg op for package declaration
+ * q       opening quote
+ * =       quoted material
+ * Q       closing quote
+ * Q       optimized qw//
+ * r       expression producing R
+ * R       tr/E/R/ s/E/R/
+ * R       assign slurped by split
+ * s       sub signature
+ * S       use import stub (no import)
+ * S       retired sort block
+ * t       unreached "then" (see C)
+ * U       use import op
+ * v       private sv of for loop
+ * V       use version
+ * w       while/until modifier
+ * W       while/for statement
+ * x       optimized qw
+ * X       random thing
+ * _       whitespace/comments preceding anything else
+ * ~       =~ operator
+ */