summaryrefslogtreecommitdiff
path: root/XSUB.h
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1995-03-12 22:32:14 -0800
committerLarry Wall <lwall@netlabs.com>1995-03-12 22:32:14 -0800
commit748a93069b3d16374a9859d1456065dd3ae11394 (patch)
tree308ca14de9933a313dceacce8be77db67d9368c7 /XSUB.h
parentfec02dd38faf8f83471b031857d89cb76fea1ca0 (diff)
downloadperl-748a93069b3d16374a9859d1456065dd3ae11394.tar.gz
Perl 5.001perl-5.001
[See the Changes file for a list of changes]
Diffstat (limited to 'XSUB.h')
-rw-r--r--XSUB.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/XSUB.h b/XSUB.h
index 508ebd72ac..a8c2c26ff7 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -17,6 +17,18 @@
#define XSRETURN(off) stack_sp = stack_base + ax + ((off) - 1); return
-#define XSRETURNNO ST(0)=sv_mortalcopy(&sv_no); XSRETURN(1)
-#define XSRETURNYES ST(0)=sv_mortalcopy(&sv_yes); XSRETURN(1)
-#define XSRETURNUNDEF ST(0)=sv_mortalcopy(&sv_undef); XSRETURN(1)
+/* Simple macros to put new mortal values onto the stack. */
+/* Typically used to return values from XS functions. */
+#define XST_mIV(i,v) ST(i)=sv_2mortal(newSViv(v));
+#define XST_mNV(i,v) ST(i)=sv_2mortal(newSVnv(v));
+#define XST_mPV(i,v) ST(i)=sv_2mortal(newSVpv(v,0));
+#define XST_mNO(i) ST(i)=sv_mortalcopy(&sv_no);
+#define XST_mYES(i) ST(i)=sv_mortalcopy(&sv_yes);
+#define XST_mUNDEF(i) ST(i)=sv_newmortal();
+
+#define XSRETURN_IV(v) XST_mIV(0,v); XSRETURN(1)
+#define XSRETURN_NV(v) XST_mNV(0,v); XSRETURN(1)
+#define XSRETURN_PV(v) XST_mPV(0,v); XSRETURN(1)
+#define XSRETURN_NO XST_mNO(0); XSRETURN(1)
+#define XSRETURN_YES XST_mYES(0); XSRETURN(1)
+#define XSRETURN_UNDEF XST_mUNDEF(0); XSRETURN(1)