summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-01-30 10:44:38 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-01-30 10:44:38 +0000
commit6b6eec5b869ecabb6b96b0d84c01808aecc78d84 (patch)
treebe188f6c9db63d9911541036c2e15a4d6b607b5d /sv.h
parent65c6b2907476177557b1357ec8e2bda83f220e47 (diff)
parent875e910638b0552c0eec0bc83eb2d5b3f85f5df5 (diff)
downloadperl-6b6eec5b869ecabb6b96b0d84c01808aecc78d84.tar.gz
[asperl] initial merge of latest win32 branch into ASPerl
p4raw-id: //depot/asperl@445
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/sv.h b/sv.h
index e51ef6069e..a7042e755c 100644
--- a/sv.h
+++ b/sv.h
@@ -611,23 +611,28 @@ struct xpvio {
# endif
#endif /* __GNUC__ */
-/* the following macro updates any magic values this sv is associated with */
+/* the following macros updates any magic values this sv is associated with */
-#define SvSETMAGIC(x) if (SvSMAGICAL(x)) mg_set(x)
+#define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
+#define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END
#define SvSetSV_and(dst,src,finally) \
+ STMT_START { \
if ((dst) != (src)) { \
sv_setsv(dst, src); \
finally; \
- }
+ } \
+ } STMT_END
#define SvSetSV_nosteal_and(dst,src,finally) \
+ STMT_START { \
if ((dst) != (src)) { \
U32 tMpF = SvFLAGS(src) & SVs_TEMP; \
SvTEMP_off(src); \
sv_setsv(dst, src); \
SvFLAGS(src) |= tMpF; \
finally; \
- }
+ } \
+ } STMT_END
#define SvSetSV(dst,src) \
SvSetSV_and(dst,src,/*nothing*/;)
@@ -639,6 +644,27 @@ struct xpvio {
#define SvSetMagicSV_nosteal(dst,src) \
SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst))
+#define SvSetMagicPV(dst,s) \
+ STMT_START { sv_setpv(dst,s); SvSETMAGIC(dst); } STMT_END
+#define SvSetMagicPVN(dst,s,l) \
+ STMT_START { sv_setpvn(dst,s,l); SvSETMAGIC(dst); } STMT_END
+#define SvSetMagicIV(dst,i) \
+ STMT_START { sv_setiv(dst,i); SvSETMAGIC(dst); } STMT_END
+#define SvSetMagicPVIV(dst,i) \
+ STMT_START { sv_setpviv(dst,i); SvSETMAGIC(dst); } STMT_END
+#define SvSetMagicUV(dst,u) \
+ STMT_START { sv_setuv(dst,u); SvSETMAGIC(dst); } STMT_END
+#define SvSetMagicNV(dst,n) \
+ STMT_START { sv_setnv(dst,n); SvSETMAGIC(dst); } STMT_END
+#define SvCatMagicPV(dst,s) \
+ STMT_START { sv_catpv(dst,s); SvSETMAGIC(dst); } STMT_END
+#define SvCatMagicPVN(dst,s,l) \
+ STMT_START { sv_catpvn(dst,s,l); SvSETMAGIC(dst); } STMT_END
+#define SvCatMagicSV(dst,src) \
+ STMT_START { sv_catsv(dst,src); SvSETMAGIC(dst); } STMT_END
+#define SvUseMagicPVN(dst,s,l) \
+ STMT_START { sv_usepvn(dst,s,l); SvSETMAGIC(dst); } STMT_END
+
#define SvPEEK(sv) sv_peek(sv)
#define SvIMMORTAL(sv) ((sv)==&sv_undef || (sv)==&sv_yes || (sv)==&sv_no)