[PHP7] Wrap bool constants as PHP booleans
Leave PHP5 wrapping them as integers as this change could cause incompatibilities. Fixes issue https://github.com/swig/swig/issues/686 noted by Nishant Gupta.
This commit is contained in:
parent
d6c5f64ec3
commit
c8a5f84cd1
6 changed files with 275 additions and 1 deletions
|
|
@ -12,10 +12,12 @@
|
|||
unsigned long,
|
||||
unsigned char,
|
||||
signed char,
|
||||
bool,
|
||||
enum SWIGTYPE
|
||||
"SWIG_LONG_CONSTANT($symname, ($1_type)$value);";
|
||||
|
||||
%typemap(consttab) bool
|
||||
"SWIG_BOOL_CONSTANT($symname, ($1_type)$value);";
|
||||
|
||||
%typemap(consttab) float,
|
||||
double
|
||||
"SWIG_DOUBLE_CONSTANT($symname, $value);";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ extern "C" {
|
|||
* FIXME: Remove for PHP7? Or might user code be using it? */
|
||||
#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A)
|
||||
|
||||
#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue