This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More explicit Solaris instructions
[perl5.git] / sv.h
diff --git a/sv.h b/sv.h
index 06bf356..cf18061 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1,6 +1,6 @@
 /*    sv.h
  *
- *    Copyright (c) 1991-1994, Larry Wall
+ *    Copyright (c) 1991-1997, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -80,8 +80,6 @@ struct io {
                                    (Sv && ++SvREFCNT(Sv)), (SV*)Sv)
 #define SvREFCNT_dec(sv)       sv_free((SV*)sv)
 #endif
-#define newRV_noinc(sv)        ((Sv = newRV(sv)), \
-                                   (--SvREFCNT(sv)), (SV*)Sv)
 
 #define SVTYPEMASK     0xff
 #define SvTYPE(sv)     ((sv)->sv_flags & SVTYPEMASK)
@@ -133,11 +131,6 @@ struct io {
 #define SVphv_SHAREKEYS 0x20000000     /* keys live on shared string table */
 #define SVphv_LAZYDEL  0x40000000      /* entry in xhv_eiter must be deleted */
 
-#ifdef OVERLOAD
-#define SVpgv_AM        0x40000000
-/* #define SVpgv_badAM     0x20000000 */
-#endif /* OVERLOAD */
-
 struct xrv {
     SV *       xrv_rv;         /* pointer to another SV */
 };
@@ -225,6 +218,8 @@ struct xpvbm {
     U8         xbm_rare;       /* rarest character in string */
 };
 
+/* This structure much match XPVCV */
+
 struct xpvfm {
     char *     xpv_pv;         /* pointer to malloced string */
     STRLEN     xpv_cur;        /* length of xpv_pv as a C string */
@@ -244,6 +239,8 @@ struct xpvfm {
     long       xcv_depth;              /* >= 2 indicates recursive call */
     AV *       xcv_padlist;
     CV *       xcv_outside;
+    U8         xcv_flags;
+
     I32                xfm_lines;
 };
 
@@ -549,14 +546,47 @@ I32 SvTRUE _((SV *));
 
 #endif /* CRIPPLED_CC */
 
+#define newRV_inc(sv)  newRV(sv)
+#ifdef CRIPPLED_CC
+SV *newRV_noinc _((SV *));
+#else
+#define newRV_noinc(sv)        ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv)
+#endif
+
 /* the following macro updates any magic values this sv is associated with */
 
 #define SvSETMAGIC(x) if (SvSMAGICAL(x)) mg_set(x)
 
-#define SvSetSV(dst,src) if (dst != src) sv_setsv(dst,src)
+#define SvSetSV_and(dst,src,finally) \
+           if ((dst) != (src)) {                       \
+               sv_setsv(dst, src);                     \
+               finally;                                \
+           }
+#define SvSetSV_nosteal_and(dst,src,finally) \
+           if ((dst) != (src)) {                       \
+               U32 tMpF = SvFLAGS(src) & SVs_TEMP;     \
+               SvTEMP_off(src);                        \
+               sv_setsv(dst, src);                     \
+               SvFLAGS(src) |= tMpF;                   \
+               finally;                                \
+           }
+
+#define SvSetSV(dst,src) \
+               SvSetSV_and(dst,src,/*nothing*/;)
+#define SvSetSV_nosteal(dst,src) \
+               SvSetSV_nosteal_and(dst,src,/*nothing*/;)
+
+#define SvSetMagicSV(dst,src) \
+               SvSetSV_and(dst,src,SvSETMAGIC(dst))
+#define SvSetMagicSV_nosteal(dst,src) \
+               SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst))
 
 #define SvPEEK(sv) sv_peek(sv)
 
+#define SvIMMORTAL(sv) ((sv)==&sv_undef || (sv)==&sv_yes || (sv)==&sv_no)
+
+#define boolSV(b) ((b) ? &sv_yes : &sv_no)
+
 #define isGV(sv) (SvTYPE(sv) == SVt_PVGV)
 
 #ifndef DOSISH