diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2013-01-24 20:18:18 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-01-24 20:27:28 +0000 |
commit | d3769a1fd42c8a54f178ed7a712fa1a513f57733 (patch) | |
tree | 1761ae5262e9e7ba68d61a7045cfde5633f50970 | |
parent | 8bdfcda66ee58727097a9ff98d2f946e4da9a105 (diff) | |
download | swig-d3769a1fd42c8a54f178ed7a712fa1a513f57733.tar.gz |
Add rvalue reference typemaps
-rw-r--r-- | Lib/php/const.i | 1 | ||||
-rw-r--r-- | Lib/php/globalvar.i | 6 | ||||
-rw-r--r-- | Lib/php/php.swg | 25 |
3 files changed, 25 insertions, 7 deletions
diff --git a/Lib/php/const.i b/Lib/php/const.i index afd7d02b9..375c7df71 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -31,6 +31,7 @@ %typemap(consttab) SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [] { /* This actually registers it as a global variable and constant. I don't * like it, but I can't figure out the zend_constant code... */ diff --git a/Lib/php/globalvar.i b/Lib/php/globalvar.i index 45fb0223b..1378ae60b 100644 --- a/Lib/php/globalvar.i +++ b/Lib/php/globalvar.i @@ -80,7 +80,7 @@ sizeof(zval *), NULL); } -%typemap(varinit) SWIGTYPE, SWIGTYPE & +%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE && { zval *z_var; @@ -210,7 +210,7 @@ } -%typemap(varin) SWIGTYPE *, SWIGTYPE & +%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && { zval **z_var; $1_ltype _temp; @@ -336,7 +336,7 @@ deliberate error cos this code looks bogus to me } } -%typemap(varout) SWIGTYPE *, SWIGTYPE & +%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && { zval **z_var; diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 99edcddf5..de38060ca 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -115,6 +115,13 @@ } } +%typemap(in) SWIGTYPE && +{ + if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); + } +} + %typemap(in) SWIGTYPE *const& ($*ltype temp) { if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) { @@ -132,7 +139,8 @@ %typemap(argout) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE&; + SWIGTYPE &, + SWIGTYPE &&; %typemap(in) void * { @@ -241,6 +249,11 @@ ZVAL_LONG(return_value, (long)*$1); } +%typemap(out) const enum SWIGTYPE && +{ + ZVAL_LONG(return_value, (long)*$1); +} + %typemap(out) const long long & %{ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { @@ -347,7 +360,8 @@ %typemap(out) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner); %} @@ -359,7 +373,8 @@ %typemap(directorin) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval($input, (void *)&$1_name, $1_descriptor, $owner); %} @@ -454,6 +469,7 @@ SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const& { void *tmp; @@ -478,7 +494,7 @@ return; } -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ (void)$1; zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), 0 TSRMLS_CC); return; @@ -491,6 +507,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } |