C<foo I<bar>> hunks from <20011019014551.A35625@not.autrijus.org>.
[p5sagit/p5-mst-13.2.git] / sv.h
diff --git a/sv.h b/sv.h
index 3727da1..4d08a90 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -13,7 +13,7 @@
 
 /*
 =for apidoc AmU||svtype
-An enum of flags for Perl types.  These are found in the file B<sv.h> 
+An enum of flags for Perl types.  These are found in the file B<sv.h>
 in the C<svtype> enum.  Test these flags with the C<SvTYPE> macro.
 
 =for apidoc AmU||SVt_PV
@@ -61,7 +61,7 @@ typedef enum {
 
 /* Using C's structural equivalence to help emulate C++ inheritance here... */
 
-struct STRUCT_SV {
+struct STRUCT_SV {             /* struct sv { */
     void*      sv_any;         /* pointer to something */
     U32                sv_refcnt;      /* how many references to us */
     U32                sv_flags;       /* what we are */
@@ -121,7 +121,7 @@ perform the upgrade if necessary.  See C<svtype>.
 #define SvFLAGS(sv)    (sv)->sv_flags
 #define SvREFCNT(sv)   (sv)->sv_refcnt
 
-#ifdef USE_THREADS
+#ifdef USE_5005THREADS
 
 #  if defined(VMS)
 #    define ATOMIC_INC(count) __ATOMIC_INCREMENT_LONG(&count)
@@ -146,7 +146,7 @@ perform the upgrade if necessary.  See C<svtype>.
 #else
 #  define ATOMIC_INC(count) (++count)
 #  define ATOMIC_DEC_AND_TEST(res, count) (res = (--count == 0))
-#endif /* USE_THREADS */
+#endif /* USE_5005THREADS */
 
 #ifdef __GNUC__
 #  define SvREFCNT_inc(sv)             \
@@ -157,7 +157,7 @@ perform the upgrade if necessary.  See C<svtype>.
        nsv;                            \
     })
 #else
-#  if defined(CRIPPLED_CC) || defined(USE_THREADS)
+#  if defined(CRIPPLED_CC) || defined(USE_5005THREADS)
 #    if defined(VMS) && defined(__ALPHA)
 #      define SvREFCNT_inc(sv) \
           (PL_Sv=(SV*)(sv), (PL_Sv && __ATOMIC_INCREMENT_LONG(&(SvREFCNT(PL_Sv)))), (SV *)PL_Sv)
@@ -338,17 +338,17 @@ struct xpvfm {
     HV *       xcv_stash;
     OP *       xcv_start;
     OP *       xcv_root;
-    void      (*xcv_xsub)(pTHXo_ CV*);
+    void      (*xcv_xsub)(pTHX_ CV*);
     ANY                xcv_xsubany;
     GV *       xcv_gv;
     char *     xcv_file;
     long       xcv_depth;      /* >= 2 indicates recursive call */
     AV *       xcv_padlist;
     CV *       xcv_outside;
-#ifdef USE_THREADS
+#ifdef USE_5005THREADS
     perl_mutex *xcv_mutexp;    /* protects xcv_owner */
     struct perl_thread *xcv_owner;     /* current owner thread */
-#endif /* USE_THREADS */
+#endif /* USE_5005THREADS */
     cv_flags_t xcv_flags;
 
     I32                xfm_lines;
@@ -646,7 +646,7 @@ and leaves the UTF8 status as it was.
 #define SvAMAGIC_on(sv)                (SvFLAGS(sv) |= SVf_AMAGIC)
 #define SvAMAGIC_off(sv)       (SvFLAGS(sv) &= ~SVf_AMAGIC)
 
-#define SvGAMAGIC(sv)           (SvFLAGS(sv) & (SVs_GMG|SVf_AMAGIC)) 
+#define SvGAMAGIC(sv)           (SvFLAGS(sv) & (SVs_GMG|SVf_AMAGIC))
 
 /*
 #define Gv_AMG(stash) \
@@ -703,6 +703,14 @@ and leaves the UTF8 status as it was.
 #define SvVALID_on(sv)         (SvFLAGS(sv) |= SVpbm_VALID)
 #define SvVALID_off(sv)                (SvFLAGS(sv) &= ~SVpbm_VALID)
 
+#ifdef USE_ITHREADS
+/* The following uses the FAKE flag to show that a regex pointer is infact
+   its own offset in the regexpad for ithreads */
+#define SvREPADTMP(sv)         (SvFLAGS(sv) & SVf_FAKE)
+#define SvREPADTMP_on(sv)      (SvFLAGS(sv) |= SVf_FAKE)
+#define SvREPADTMP_off(sv)     (SvFLAGS(sv) &= ~SVf_FAKE)
+#endif
+
 #define SvRV(sv) ((XRV*)  SvANY(sv))->xrv_rv
 #define SvRVx(sv) SvRV(sv)
 
@@ -914,6 +922,8 @@ otherwise.
 #define SvPV_force(sv, lp) sv_pvn_force(sv, &lp)
 #define SvPV(sv, lp) sv_pvn(sv, &lp)
 #define SvPV_nolen(sv) sv_pv(sv)
+#define SvPV_nomg(sv, lp) sv_pvn_nomg(sv, &lp)
+#define SvPV_force_flags(sv, lp, flags) sv_pvn_force_flags(sv, &lp, flags)
 
 #define SvPVutf8_force(sv, lp) sv_pvutf8n_force(sv, &lp)
 #define SvPVutf8(sv, lp) sv_pvutf8n(sv, &lp)
@@ -941,6 +951,14 @@ otherwise.
 #define SvUV(sv) SvUVx(sv)
 #define SvTRUE(sv) SvTRUEx(sv)
 
+/* flag values for sv_*_flags functions */
+#define SV_IMMEDIATE_UNREF     1
+#define SV_GMAGIC              2
+
+#define sv_pvn_force_nomg(sv, lp) sv_pvn_force_flags(sv, lp, 0)
+#define sv_utf8_upgrade_nomg(sv) sv_utf8_upgrade_flags(sv, 0)
+#define sv_catpvn_nomg(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, 0)
+
 #ifndef CRIPPLED_CC
 /* redefine some things to more efficient inlined versions */
 
@@ -954,29 +972,28 @@ otherwise.
 #undef SvNV
 #define SvNV(sv) (SvNOK(sv) ? SvNVX(sv) : sv_2nv(sv))
 
-/* flag values for sv_*_flags functions */
-#define SV_IMMEDIATE_UNREF     1
-#define SV_GMAGIC              2
-
 #define sv_setsv_macro(dsv, ssv) sv_setsv_flags(dsv, ssv, SV_GMAGIC)
 #define sv_setsv_nomg(dsv, ssv) sv_setsv_flags(dsv, ssv, 0)
 #define sv_catsv_macro(dsv, ssv) sv_catsv_flags(dsv, ssv, SV_GMAGIC)
 #define sv_catsv_nomg(dsv, ssv) sv_catsv_flags(dsv, ssv, 0)
 #define sv_catpvn_macro(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC)
-#define sv_catpvn_nomg(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, 0)
 #define sv_2pv_macro(sv, lp) sv_2pv_flags(sv, lp, SV_GMAGIC)
 #define sv_2pv_nomg(sv, lp) sv_2pv_flags(sv, lp, 0)
 #define sv_pvn_force_macro(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC)
-#define sv_pvn_force_nomg(sv, lp) sv_pvn_force_flags(sv, lp, 0)
 #define sv_utf8_upgrade_macro(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
-#define sv_utf8_upgrade_nomg(sv) sv_utf8_upgrade_flags(sv, 0)
 
-/* function style also available for bincompat */
+/* function style also available for sourcecompat */
+#undef sv_setsv
 #define sv_setsv(dsv, ssv) sv_setsv_macro(dsv, ssv)
+#undef sv_catsv
 #define sv_catsv(dsv, ssv) sv_catsv_macro(dsv, ssv)
+#undef sv_catpvn
 #define sv_catpvn(dsv, sstr, slen) sv_catpvn_macro(dsv, sstr, slen)
+#undef sv_2pv
 #define sv_2pv(sv, lp) sv_2pv_macro(sv, lp)
+#undef sv_pvn_force
 #define sv_pvn_force(sv, lp) sv_pvn_force_macro(sv, lp)
+#undef sv_utf8_upgrade
 #define sv_utf8_upgrade(sv) sv_utf8_upgrade_macro(sv)
 
 #undef SvPV
@@ -1084,7 +1101,7 @@ otherwise.
                : sv_2bool(sv) )
 #  define SvTRUEx(sv) ({SV *nsv = (sv); SvTRUE(nsv); })
 #else /* __GNUC__ */
-#ifndef USE_THREADS
+#ifndef USE_5005THREADS
 /* These inlined macros use globals, which will require a thread
  * declaration in user code, so we avoid them under threads */
 
@@ -1118,7 +1135,7 @@ otherwise.
                ? SvNVX(sv) != 0.0                              \
                : sv_2bool(sv) )
 #  define SvTRUEx(sv) ((PL_Sv = (sv)), SvTRUE(PL_Sv))
-#endif /* !USE_THREADS */
+#endif /* !USE_5005THREADS */
 #endif /* !__GNU__ */
 #endif /* !CRIPPLED_CC */
 
@@ -1161,7 +1178,7 @@ Like C<SvSetMagicSV>, but does any set magic required afterwards.
 =for apidoc Am|char *|SvGROW|SV* sv|STRLEN len
 Expands the character buffer in the SV so that it has room for the
 indicated number of bytes (remember to reserve space for an extra trailing
-NUL character).  Calls C<sv_grow> to perform the expansion if necessary. 
+NUL character).  Calls C<sv_grow> to perform the expansion if necessary.
 Returns a pointer to the character buffer.
 
 =cut
@@ -1215,4 +1232,9 @@ Returns a pointer to the character buffer.
 
 #define CLONEf_COPY_STACKS 1
 #define CLONEf_KEEP_PTR_TABLE 2
+#define CLONEf_CLONE_HOST 4
 
+struct clone_params {
+  AV* stashes;
+  UV  flags;
+};