Protect against having no such command as 'cc'
[p5sagit/p5-mst-13.2.git] / sv.h
diff --git a/sv.h b/sv.h
index 36fa72d..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.
@@ -131,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 */
 };
@@ -223,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 */
@@ -242,6 +239,8 @@ struct xpvfm {
     long       xcv_depth;              /* >= 2 indicates recursive call */
     AV *       xcv_padlist;
     CV *       xcv_outside;
+    U8         xcv_flags;
+
     I32                xfm_lines;
 };
 
@@ -558,12 +557,36 @@ SV *newRV_noinc _((SV *));
 
 #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