diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-05-14 09:38:43 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-05-14 09:38:43 +0000 |
commit | 88037a85d6a4b105a485a30b7ae673eff41a9098 (patch) | |
tree | c2c89faaa65003520ecc71336430ad11558a3696 /XSUB.h | |
parent | 7aa207d6d833e60be59e41514013c4c54b091533 (diff) | |
download | perl-88037a85d6a4b105a485a30b7ae673eff41a9098.tar.gz |
Add new dUNDERBAR and UNDERBAR macros, to help XS writers to
access the $_ variable, even when there is a lexical one in scope.
p4raw-id: //depot/perl@22819
Diffstat (limited to 'XSUB.h')
-rw-r--r-- | XSUB.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -67,6 +67,14 @@ This is usually handled automatically by C<xsubpp>. Sets up the C<ix> variable for an XSUB which has aliases. This is usually handled automatically by C<xsubpp>. +=for apidoc Ams||dUNDERBAR +Sets up the C<padoff_du> variable for an XSUB that wishes to use +C<UNDERBAR>. + +=for apidoc AmU||UNDERBAR +The SV* corresponding to the $_ variable. Works even if there +is a lexical $_ in scope. + =cut */ @@ -106,6 +114,11 @@ handled automatically by C<xsubpp>. #define XSINTERFACE_FUNC_SET(cv,f) \ CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f) +#define dUNDERBAR I32 padoff_du = pad_findmy("$_") +#define UNDERBAR ((padoff_du == NOT_IN_PAD \ + || PAD_COMPNAME_FLAGS(padoff_du) & SVpad_OUR) \ + ? DEFSV : PAD_SVl(padoff_du)) + /* Simple macros to put new mortal values onto the stack. */ /* Typically used to return values from XS functions. */ |