X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=XSUB.h;h=2d95b1e7026b484dbd0e6a8fea1a85848298b847;hb=6abfca009fc00780b1546304f40b7d5b81f3cb76;hp=268a2ffb6f706639890a19f768c06173c97d4ddb;hpb=4ef0c66ee576bfc2e9944029fde5fa533ac892b6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/XSUB.h b/XSUB.h index 268a2ff..2d95b1e 100644 --- a/XSUB.h +++ b/XSUB.h @@ -1,7 +1,7 @@ /* XSUB.h * * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - * 2003, 2004, 2005, 2006, 2007 by Larry Wall and others + * 2003, 2004, 2005, 2006, 2007, 2008 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -96,21 +96,33 @@ is a lexical $_ in scope. #define ST(off) PL_stack_base[ax + (off)] +/* XSPROTO() is also used by SWIG like this: + * + * typedef XSPROTO(SwigPerlWrapper); + * typedef SwigPerlWrapper *SwigPerlWrapperPtr; + * + * This code needs to be compilable under both C and C++. + * + * Don't forget to change the __attribute__unused__ version of XS() + * below too if you change XSPROTO() here. + */ +#define XSPROTO(name) void name(pTHX_ CV* cv) + #undef XS #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) -# define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv) +# define XS(name) __declspec(dllexport) XSPROTO(name) #endif #if defined(__SYMBIAN32__) -# define XS(name) EXPORT_C void name(pTHX_ CV* cv) +# define XS(name) EXPORT_C XSPROTO(name) #endif #ifndef XS # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) # define XS(name) void name(pTHX_ CV* cv __attribute__unused__) # else # ifdef __cplusplus -# define XS(name) extern "C" void name(pTHX_ CV* cv) +# define XS(name) extern "C" XSPROTO(name) # else -# define XS(name) void name(pTHX_ CV* cv) +# define XS(name) XSPROTO(name) # endif # endif #endif @@ -257,7 +269,7 @@ Rethrows a previously caught exception. See L. #define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(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_mPVN(i,v,n) (ST(i) = sv_2mortal(newSVpvn(v,n))) +#define XST_mPVN(i,v,n) (ST(i) = newSVpvn_flags(v,n, SVs_TEMP)) #define XST_mNO(i) (ST(i) = &PL_sv_no ) #define XST_mYES(i) (ST(i) = &PL_sv_yes ) #define XST_mUNDEF(i) (ST(i) = &PL_sv_undef) @@ -352,10 +364,10 @@ Rethrows a previously caught exception. See L. SAVETMPS ; \ SAVEINT(db->filtering) ; \ db->filtering = TRUE ; \ - SAVESPTR(DEFSV) ; \ + SAVE_DEFSV ; \ if (name[7] == 's') \ arg = newSVsv(arg); \ - DEFSV = arg ; \ + DEFSV_set(arg) ; \ SvTEMP_off(arg) ; \ PUSHMARK(SP) ; \ PUTBACK ; \