Merge branch 'master' into doxygen

Merge with ~3.0.1 sources from master.
This commit is contained in:
Vadim Zeitlin 2014-04-30 18:37:57 +02:00
commit 1ebd2334b8
1593 changed files with 51732 additions and 28076 deletions

View file

@ -31,18 +31,16 @@
%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... */
zval *z_var;
MAKE_STD_ZVAL(z_var);
SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0);
/* zend_hash_add(&EG(symbol_table), "$1", sizeof("$1"), (void *)&z_var,sizeof(zval *), NULL); */
zend_constant c;
c.value = *z_var;
zval_copy_ctor(&c.value);
size_t len = sizeof("$1") - 1;
c.name = zend_strndup("$1", len);
size_t len = sizeof("$symname") - 1;
c.name = zend_strndup("$symname", len);
c.name_len = len+1;
c.flags = CONST_CS | CONST_PERSISTENT;
c.module_number = module_number;

View file

@ -4,16 +4,15 @@
*
* director.swg
*
* This file contains support for director classes that proxy
* method calls from C++ to PHP extensions.
* This file contains support for director classes so that PHP proxy
* methods can be called from C++.
* ----------------------------------------------------------------------------- */
#ifndef SWIG_DIRECTOR_PHP_HEADER_
#define SWIG_DIRECTOR_PHP_HEADER_
#ifdef __cplusplus
#include <string>
#include <exception>
#include <map>
/*
@ -26,38 +25,33 @@
#endif
namespace Swig {
/* memory handler */
struct GCItem
{
virtual ~GCItem() {}
virtual int get_own() const
{
/* memory handler */
struct GCItem {
virtual ~GCItem() {
}
virtual int get_own() const {
return 0;
}
};
struct GCItem_var
{
GCItem_var(GCItem *item = 0) : _item(item)
{
struct GCItem_var {
GCItem_var(GCItem *item = 0) : _item(item) {
}
GCItem_var& operator=(GCItem *item)
{
GCItem_var& operator=(GCItem *item) {
GCItem *tmp = _item;
_item = item;
delete tmp;
return *this;
}
~GCItem_var()
{
~GCItem_var() {
delete _item;
}
GCItem * operator->() const
{
GCItem * operator->() const {
return _item;
}
@ -65,18 +59,14 @@ namespace Swig {
GCItem *_item;
};
struct GCItem_Object : GCItem
{
GCItem_Object(int own) : _own(own)
{
struct GCItem_Object : GCItem {
GCItem_Object(int own) : _own(own) {
}
virtual ~GCItem_Object()
{
virtual ~GCItem_Object() {
}
int get_own() const
{
int get_own() const {
return _own;
}
@ -85,14 +75,11 @@ namespace Swig {
};
template <typename Type>
struct GCItem_T : GCItem
{
GCItem_T(Type *ptr) : _ptr(ptr)
{
struct GCItem_T : GCItem {
GCItem_T(Type *ptr) : _ptr(ptr) {
}
virtual ~GCItem_T()
{
virtual ~GCItem_T() {
delete _ptr;
}
@ -103,14 +90,14 @@ namespace Swig {
class Director {
protected:
zval *swig_self;
typedef std::map<void*, GCItem_var> swig_ownership_map;
typedef std::map<void *, GCItem_var> swig_ownership_map;
mutable swig_ownership_map swig_owner;
#ifdef ZTS
// Store the ZTS context so it's available when C++ calls back to PHP.
void *** swig_zts_ctx;
#endif
#endif
public:
Director(zval* self TSRMLS_DC) : swig_self(self) {
Director(zval *self TSRMLS_DC) : swig_self(self) {
TSRMLS_SET_CTX(swig_zts_ctx);
}
@ -118,12 +105,11 @@ namespace Swig {
TSRMLS_FETCH_FROM_CTX(swig_zts_ctx);
zend_class_entry **ce;
zend_function *mptr;
int name_len = strlen(lc_fname);
if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) {
return false;
}
if (zend_hash_find(&(*ce)->function_table, lc_fname, name_len + 1, (void**) &mptr) != SUCCESS) {
if (zend_hash_find(&(*ce)->function_table, lc_fname, strlen(lc_fname) + 1, (void **) &mptr) != SUCCESS) {
return false;
}
// common.scope points to the declaring class
@ -131,8 +117,7 @@ namespace Swig {
}
template <typename Type>
void swig_acquire_ownership(Type *vptr) const
{
void swig_acquire_ownership(Type *vptr) const {
if (vptr) {
swig_owner[vptr] = new GCItem_T<Type>(vptr);
}
@ -140,14 +125,12 @@ namespace Swig {
};
/* base class for director exceptions */
class DirectorException {
class DirectorException : public std::exception {
protected:
std::string swig_msg;
public:
DirectorException(int code, const char *hdr, const char* msg TSRMLS_DC)
: swig_msg(hdr)
{
if (strlen(msg)) {
DirectorException(int code, const char *hdr, const char *msg TSRMLS_DC) : swig_msg(hdr) {
if (msg[0]) {
swig_msg += " ";
swig_msg += msg;
}
@ -155,37 +138,39 @@ namespace Swig {
SWIG_ErrorMsg() = swig_msg.c_str();
}
static void raise(int code, const char *hdr, const char* msg TSRMLS_DC)
{
virtual ~DirectorException() throw() {
}
const char *what() const throw() {
return swig_msg.c_str();
}
static void raise(int code, const char *hdr, const char *msg TSRMLS_DC) {
throw DirectorException(code, hdr, msg TSRMLS_CC);
}
};
/* attempt to call a pure virtual method via a director method */
class DirectorPureVirtualException : public Swig::DirectorException
{
class DirectorPureVirtualException : public DirectorException {
public:
DirectorPureVirtualException(const char* msg TSRMLS_DC)
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC)
{
DirectorPureVirtualException(const char *msg TSRMLS_DC)
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC) {
}
static void raise(const char *msg TSRMLS_DC)
{
static void raise(const char *msg TSRMLS_DC) {
throw DirectorPureVirtualException(msg TSRMLS_CC);
}
};
/* any php exception that occurs during a director method call */
class DirectorMethodException : public Swig::DirectorException
class DirectorMethodException : public DirectorException
{
public:
DirectorMethodException(const char* msg TSRMLS_DC)
: DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC)
{
DirectorMethodException(const char *msg TSRMLS_DC)
: DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC) {
}
static void raise(const char *msg TSRMLS_DC)
{
static void raise(const char *msg TSRMLS_DC) {
throw DirectorMethodException(msg TSRMLS_CC);
}
};
@ -195,6 +180,4 @@ namespace Swig {
// so use a macro to insert TSRMLS_CC so any ZTS context gets passed.
#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC)
#endif /* __cplusplus */
#endif

View file

@ -80,7 +80,7 @@
sizeof(zval *), NULL);
}
%typemap(varinit) SWIGTYPE, SWIGTYPE &
%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&
{
zval *z_var;
@ -164,7 +164,7 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
convert_to_string_ex(z_var);
s1 = Z_STRVAL_PP(z_var);
if ((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if (s1)
$1 = estrdup(s1);
else
@ -190,9 +190,9 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
if(s1)
strncpy($1, s1, $1_dim0);
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if (s1)
strncpy($1, s1, $1_dim0);
}
}
@ -210,13 +210,13 @@
}
%typemap(varin) SWIGTYPE *, SWIGTYPE &
%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
{
zval **z_var;
$1_ltype _temp;
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
}
@ -288,12 +288,12 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1) )) {
if((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if(s1)
efree(s1);
if($1) {
(*z_var)->value.str.val = estrdup($1);
(*z_var)->value.str.len = strlen($1) +1;
(*z_var)->value.str.len = strlen($1) + 1;
} else {
(*z_var)->value.str.val = 0;
(*z_var)->value.str.len = 0;
@ -314,7 +314,7 @@
zval **z_var;
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
if($1)
if($1)
SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0);
}
@ -325,10 +325,10 @@
deliberate error cos this code looks bogus to me
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
if((s1 == NULL) || strcmp(s1, $1)) {
if($1) {
(*z_var)->value.str.val = estrdup($1);
(*z_var)->value.str.len = strlen($1)+1;
(*z_var)->value.str.len = strlen($1) + 1;
} else {
(*z_var)->value.str.val = 0;
(*z_var)->value.str.len = 0;
@ -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;

View file

@ -93,7 +93,7 @@
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
{
if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
if(SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
}
$result = *tmp;
@ -114,6 +114,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) {
@ -131,7 +138,8 @@
%typemap(argout) SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE&;
SWIGTYPE &,
SWIGTYPE &&;
%typemap(in) void *
{
@ -188,12 +196,16 @@
signed char,
unsigned char,
bool,
size_t,
enum SWIGTYPE
size_t
{
ZVAL_LONG(return_value,$1);
}
%typemap(out) enum SWIGTYPE
{
ZVAL_LONG(return_value, (long)$1);
}
%typemap(out) long long
%{
if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) {
@ -226,12 +238,21 @@
const signed char &,
const unsigned char &,
const bool &,
const size_t &,
const enum SWIGTYPE &
const size_t &
{
ZVAL_LONG(return_value,*$1);
}
%typemap(out) const enum SWIGTYPE &
{
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) {
@ -269,6 +290,20 @@
ZVAL_LONG($input,$1);
}
%typemap(directorin) enum SWIGTYPE
{
ZVAL_LONG($input, (long)$1_name);
}
%typemap(directorin) char *, char []
{
if(!$1) {
ZVAL_NULL($input);
} else {
ZVAL_STRING($input, (char *)$1, 1);
}
}
%typemap(out) bool
{
ZVAL_BOOL(return_value,($1)?1:0);
@ -333,7 +368,8 @@
%typemap(out) SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &
SWIGTYPE &,
SWIGTYPE &&
%{
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
%}
@ -345,7 +381,8 @@
%typemap(directorin) SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &
SWIGTYPE &,
SWIGTYPE &&
%{
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
%}
@ -440,6 +477,7 @@
SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &,
SWIGTYPE &&,
SWIGTYPE *const&
{
void *tmp;
@ -470,7 +508,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;
@ -483,6 +521,7 @@
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -2,37 +2,41 @@
* phpkw.swg
* ----------------------------------------------------------------------------- */
#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
/* Keyword (case insensitive) */
#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, class renamed as 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
/* Class (case insensitive) */
#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP",sourcefmt="%(lower)s") `x`
#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP") "::" `x`
#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
/* Constant (case insensitive) */
#define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x`
#define PHPBN1b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant,sourcefmt="%(lower)s") `x`
%define PHPBN1(X)
PHPBN1a(X); PHPBN1b(X)
%enddef
/*
From
/* Constant (case sensitive) */
#define PHPBN2a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem) `x`
#define PHPBN2b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant) `x`
%define PHPBN2(X)
PHPBN2a(X); PHPBN2b(X)
%enddef
http://aspn.activestate.com/ASPN/docs/PHP/reserved.html
http://php.net/manual/en/reserved.keywords.php
#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
and reviewed by Olly Betts.
Further updates from the PHP manual on php.net.
*/
/* We classify these as kw since PHP will not run if used globally. */
/* "You cannot use any of the following words as constants, class names,
/* From: http://php.net/manual/en/reserved.keywords.php
* "You cannot use any of the following words as constants, class names,
* function or method names. Using them as variable names is generally OK, but
* could lead to confusion."
*/
/* case insensitive */
/* Check is case insensitive - these *MUST* be listed in lower case here */
PHPKW(__halt_compiler);
PHPKW(abstract);
PHPKW(and);
PHPKW(array);
PHPKW(as);
PHPKW(break);
PHPKW(callable); // As of PHP 5.4
PHPKW(case);
PHPKW(catch);
PHPKW(class);
@ -57,20 +61,22 @@ PHPKW(eval); // "Language construct"
PHPKW(exit); // "Language construct"
PHPKW(extends);
PHPKW(final);
PHPKW(finally); // As of PHP 5.5
PHPKW(for);
PHPKW(foreach);
PHPKW(function);
PHPKW(global);
PHPKW(goto); // As of PHP5.3
PHPKW(goto); // As of PHP 5.3
PHPKW(if);
PHPKW(implements);
PHPKW(include); // "Language construct"
PHPKW(include_once); // "Language construct"
PHPKW(instanceof);
PHPKW(insteadof); // As of PHP 5.4
PHPKW(interface);
PHPKW(isset); // "Language construct"
PHPKW(list); // "Language construct"
PHPKW(namespace); // As of PHP5.3
PHPKW(namespace); // As of PHP 5.3
PHPKW(new);
PHPKW(or);
PHPKW(print); // "Language construct"
@ -83,39 +89,70 @@ PHPKW(return); // "Language construct"
PHPKW(static);
PHPKW(switch);
PHPKW(throw);
PHPKW(trait); // As of PHP 5.4
PHPKW(try);
PHPKW(unset); // "Language construct"
PHPKW(use);
PHPKW(var);
PHPKW(while);
PHPKW(xor);
// Compile-time constants
PHPKW(__CLASS__);
PHPKW(__DIR__); // As of PHP5.3
PHPKW(__FILE__);
PHPKW(__FUNCTION__);
PHPKW(__METHOD__);
PHPKW(__NAMESPACE__); // As of PHP5.3
PHPKW(__LINE__);
PHPKW(yield); // As of PHP 5.5
// Compile-time "magic" constants
// From: http://php.net/manual/en/reserved.keywords.php
// also at: http://php.net/manual/en/language.constants.predefined.php
/* These *MUST* be listed in lower case here */
PHPKW(__class__);
PHPKW(__dir__); // As of PHP 5.3
PHPKW(__file__);
PHPKW(__function__);
PHPKW(__line__);
PHPKW(__method__);
PHPKW(__namespace__); // As of PHP 5.3
PHPKW(__trait__); // As of PHP 5.4
/* We classify these as built-in names since they conflict, but PHP still runs */
/* Type 1: case insensitive */
PHPBN1(__sleep);
PHPBN1(__wakeup);
PHPBN1(not);
PHPBN1(parent);
PHPBN1(virtual);
PHPBN1(NULL);
PHPBN1(TRUE);
PHPBN1(FALSE);
/* Predefined case-insensitive constants */
/* These *MUST* be listed in lower case here */
PHPBN1(null);
PHPBN1(true);
PHPBN1(false);
/* Type 2: case sensitive */
/* "Core Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
PHPBN2(E_ALL);
/* "Core Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
/* These are case sensitive */
PHPBN2(PHP_VERSION);
PHPBN2(PHP_MAJOR_VERSION); // As of PHP 5.2.7
PHPBN2(PHP_MINOR_VERSION); // As of PHP 5.2.7
PHPBN2(PHP_RELEASE_VERSION); // As of PHP 5.2.7
PHPBN2(PHP_VERSION_ID); // As of PHP 5.2.7
PHPBN2(PHP_EXTRA_VERSION); // As of PHP 5.2.7
PHPBN2(PHP_ZTS); // As of PHP 5.2.7
PHPBN2(PHP_DEBUG); // As of PHP 5.2.7
PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3.0
PHPBN2(PHP_OS);
PHPBN2(PHP_SAPI);
PHPBN2(PHP_EOL); // As of PHP 5.0.2
PHPBN2(PHP_INT_MAX); // As of PHP 5.0.5
PHPBN2(PHP_INT_SIZE); // As of PHP 5.0.5
PHPBN2(DEFAULT_INCLUDE_PATH);
PHPBN2(PEAR_INSTALL_DIR);
PHPBN2(PEAR_EXTENSION_DIR);
PHPBN2(PHP_EXTENSION_DIR);
PHPBN2(PHP_PREFIX);
PHPBN2(PHP_BINDIR);
PHPBN2(PHP_BINARY); // As of PHP 5.4
PHPBN2(PHP_MANDIR); // As of PHP 5.3.7
PHPBN2(PHP_LIBDIR);
PHPBN2(PHP_DATADIR);
PHPBN2(PHP_SYSCONFDIR);
PHPBN2(PHP_LOCALSTATEDIR);
PHPBN2(PHP_CONFIG_FILE_PATH);
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
PHPBN2(PHP_SHLIB_SUFFIX);
PHPBN2(E_ERROR);
PHPBN2(E_PARSE);
PHPBN2(E_WARNING);
PHPBN2(E_PARSE);
PHPBN2(E_NOTICE);
PHPBN2(E_CORE_ERROR);
PHPBN2(E_CORE_WARNING);
@ -124,31 +161,17 @@ PHPBN2(E_COMPILE_WARNING);
PHPBN2(E_USER_ERROR);
PHPBN2(E_USER_WARNING);
PHPBN2(E_USER_NOTICE);
PHPBN2(E_DEPRECATED); // As of PHP 5.3
PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3
PHPBN2(PHP_OS);
PHPBN2(PHP_VERSION);
PHPBN2(PHP_SAPI);
PHPBN2(PHP_EOL);
PHPBN2(PHP_INT_MAX);
PHPBN2(PHP_INT_SIZE);
PHPBN2(DEFAULT_INCLUDE_PATH);
PHPBN2(PEAR_INSTALL_DIR);
PHPBN2(PEAR_EXTENSION_DIR);
PHPBN2(PHP_EXTENSION_DIR);
PHPBN2(PHP_PREFIX);
PHPBN2(PHP_BINDIR);
PHPBN2(PHP_LIBDIR);
PHPBN2(PHP_DATADIR);
PHPBN2(PHP_SYSCONFDIR);
PHPBN2(PHP_LOCALSTATEDIR);
PHPBN2(PHP_CONFIG_FILE_PATH);
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
PHPBN2(PHP_SHLIB_SUFFIX);
PHPBN2(E_DEPRECATED); // As of PHP 5.3.0
PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3.0
PHPBN2(E_ALL);
PHPBN2(E_STRICT);
PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0
// TRUE, FALSE, NULL are listed on the same page, but are actually
// case-insensitive, whereas all the other constants listed there seem to be
// case-sensitive, so we handle TRUE, FALSE, NULL in PHPBN1.
PHPBN2(PHP_OUTPUT_HANDLER_START);
PHPBN2(PHP_OUTPUT_HANDLER_CONT);
PHPBN2(PHP_OUTPUT_HANDLER_END);
PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3
/* These don't actually seem to be set (tested on Linux, I guess they're
* Windows only?) */
PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3
@ -162,7 +185,7 @@ PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3
/* "Standard Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
PHPBN2(EXTR_OVERWRITE);
PHPBN2(EXTR_SKIP);
PHPBN2(EXTR_PREFIX_SAME);
@ -370,10 +393,6 @@ PHPBN2(LOG_NDELAY);
PHPBN2(LOG_NOWAIT);
PHPBN2(LOG_PERROR);
/* Added in PHP5 */
PHPBN2(E_STRICT);
PHPBN2(__COMPILER_HALT_OFFSET__);
/* Added in PHP 5.2 */
PHPBN2(PREG_BACKTRACK_LIMIT_ERROR);
PHPBN2(PREG_BAD_UTF8_ERROR);
@ -485,17 +504,143 @@ PHPBN2(SIG_UNBLOCK);
PHPBN2(TRAP_BRKPT);
PHPBN2(TRAP_TRACE);
/* Class names reserved by PHP */
/* case insensitive */
/* Added in PHP 5.4 */
PHPBN2(ENT_DISALLOWED);
PHPBN2(ENT_HTML401);
PHPBN2(ENT_HTML5);
PHPBN2(ENT_SUBSTITUTE);
PHPBN2(ENT_XML1);
PHPBN2(ENT_XHTML);
PHPBN2(IPPROTO_IP);
PHPBN2(IPPROTO_IPV6);
PHPBN2(IPV6_MULTICAST_HOPS);
PHPBN2(IPV6_MULTICAST_IF);
PHPBN2(IPV6_MULTICAST_LOOP);
PHPBN2(IP_MULTICAST_IF);
PHPBN2(IP_MULTICAST_LOOP);
PHPBN2(IP_MULTICAST_TTL);
PHPBN2(MCAST_JOIN_GROUP);
PHPBN2(MCAST_LEAVE_GROUP);
PHPBN2(MCAST_BLOCK_SOURCE);
PHPBN2(MCAST_UNBLOCK_SOURCE);
PHPBN2(MCAST_JOIN_SOURCE_GROUP);
PHPBN2(MCAST_LEAVE_SOURCE_GROUP);
PHPBN2(CURLOPT_MAX_RECV_SPEED_LARGE);
PHPBN2(CURLOPT_MAX_SEND_SPEED_LARGE);
PHPBN2(LIBXML_HTML_NODEFDTD);
PHPBN2(LIBXML_HTML_NOIMPLIED);
PHPBN2(LIBXML_PEDANTIC);
PHPBN2(OPENSSL_CIPHER_AES_128_CBC);
PHPBN2(OPENSSL_CIPHER_AES_192_CBC);
PHPBN2(OPENSSL_CIPHER_AES_256_CBC);
PHPBN2(OPENSSL_RAW_DATA);
PHPBN2(OPENSSL_ZERO_PADDING);
PHPBN2(PHP_OUTPUT_HANDLER_CLEAN);
PHPBN2(PHP_OUTPUT_HANDLER_CLEANABLE);
PHPBN2(PHP_OUTPUT_HANDLER_DISABLED);
PHPBN2(PHP_OUTPUT_HANDLER_FINAL);
PHPBN2(PHP_OUTPUT_HANDLER_FLUSH);
PHPBN2(PHP_OUTPUT_HANDLER_FLUSHABLE);
PHPBN2(PHP_OUTPUT_HANDLER_REMOVABLE);
PHPBN2(PHP_OUTPUT_HANDLER_STARTED);
PHPBN2(PHP_OUTPUT_HANDLER_STDFLAGS);
PHPBN2(PHP_OUTPUT_HANDLER_WRITE);
PHPBN2(PHP_SESSION_ACTIVE);
PHPBN2(PHP_SESSION_DISABLED);
PHPBN2(PHP_SESSION_NONE);
PHPBN2(STREAM_META_ACCESS);
PHPBN2(STREAM_META_GROUP);
PHPBN2(STREAM_META_GROUP_NAME);
PHPBN2(STREAM_META_OWNER);
PHPBN2(STREAM_META_OWNER_NAME);
PHPBN2(STREAM_META_TOUCH);
PHPBN2(ZLIB_ENCODING_DEFLATE);
PHPBN2(ZLIB_ENCODING_GZIP);
PHPBN2(ZLIB_ENCODING_RAW);
PHPBN2(U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR);
PHPBN2(IDNA_CHECK_BIDI);
PHPBN2(IDNA_CHECK_CONTEXTJ);
PHPBN2(IDNA_NONTRANSITIONAL_TO_ASCII);
PHPBN2(IDNA_NONTRANSITIONAL_TO_UNICODE);
PHPBN2(INTL_IDNA_VARIANT_2003);
PHPBN2(INTL_IDNA_VARIANT_UTS46);
PHPBN2(IDNA_ERROR_EMPTY_LABEL);
PHPBN2(IDNA_ERROR_LABEL_TOO_LONG);
PHPBN2(IDNA_ERROR_DOMAIN_NAME_TOO_LONG);
PHPBN2(IDNA_ERROR_LEADING_HYPHEN);
PHPBN2(IDNA_ERROR_TRAILING_HYPHEN);
PHPBN2(IDNA_ERROR_HYPHEN_3_4);
PHPBN2(IDNA_ERROR_LEADING_COMBINING_MARK);
PHPBN2(IDNA_ERROR_DISALLOWED);
PHPBN2(IDNA_ERROR_PUNYCODE);
PHPBN2(IDNA_ERROR_LABEL_HAS_DOT);
PHPBN2(IDNA_ERROR_INVALID_ACE_LABEL);
PHPBN2(IDNA_ERROR_BIDI);
PHPBN2(IDNA_ERROR_CONTEXTJ);
PHPBN2(JSON_PRETTY_PRINT);
PHPBN2(JSON_UNESCAPED_SLASHES);
PHPBN2(JSON_NUMERIC_CHECK);
PHPBN2(JSON_UNESCAPED_UNICODE);
PHPBN2(JSON_BIGINT_AS_STRING);
/* Added in PHP 5.5 */
PHPBN2(IMG_AFFINE_TRANSLATE);
PHPBN2(IMG_AFFINE_SCALE);
PHPBN2(IMG_AFFINE_ROTATE);
PHPBN2(IMG_AFFINE_SHEAR_HORIZONTAL);
PHPBN2(IMG_AFFINE_SHEAR_VERTICAL);
PHPBN2(IMG_CROP_DEFAULT);
PHPBN2(IMG_CROP_TRANSPARENT);
PHPBN2(IMG_CROP_BLACK);
PHPBN2(IMG_CROP_WHITE);
PHPBN2(IMG_CROP_SIDES);
PHPBN2(IMG_FLIP_BOTH);
PHPBN2(IMG_FLIP_HORIZONTAL);
PHPBN2(IMG_FLIP_VERTICAL);
PHPBN2(IMG_BELL);
PHPBN2(IMG_BESSEL);
PHPBN2(IMG_BICUBIC);
PHPBN2(IMG_BICUBIC_FIXED);
PHPBN2(IMG_BLACKMAN);
PHPBN2(IMG_BOX);
PHPBN2(IMG_BSPLINE);
PHPBN2(IMG_CATMULLROM);
PHPBN2(IMG_GAUSSIAN);
PHPBN2(IMG_GENERALIZED_CUBIC);
PHPBN2(IMG_HERMITE);
PHPBN2(IMG_HAMMING);
PHPBN2(IMG_HANNING);
PHPBN2(IMG_MITCHELL);
PHPBN2(IMG_POWER);
PHPBN2(IMG_QUADRATIC);
PHPBN2(IMG_SINC);
PHPBN2(IMG_NEAREST_NEIGHBOUR);
PHPBN2(IMG_WEIGHTED4);
PHPBN2(IMG_TRIANGLE);
PHPBN2(JSON_ERROR_RECURSION);
PHPBN2(JSON_ERROR_INF_OR_NAN);
PHPBN2(JSON_ERROR_UNSUPPORTED_TYPE);
PHPBN2(MYSQLI_SERVER_PUBLIC_KEY);
/* Added in PHP 5.6 */
PHPBN2(LDAP_ESCAPE_DN);
PHPBN2(LDAP_ESCAPE_FILTER);
/* Class names reserved by PHP (case insensitive) */
PHPCN(directory);
PHPCN(stdclass);
PHPCN(__php_incomplete_class);
PHPCN(directory);
/* Added in PHP5 (this list apparently depends which extensions you load by default). */
PHPCN(parent);
PHPCN(self);
/* Added in PHP5. */
PHPCN(exception);
PHPCN(errorexception); // As of PHP 5.1
PHPCN(php_user_filter);
PHPCN(errorexception);
PHPCN(closure); // As of PHP 5.3
PHPCN(generator); // As of PHP 5.5
PHPCN(self);
PHPCN(static);
PHPCN(parent);
/* From extensions (which of these are actually predefined depends which
* extensions are loaded by default). */
PHPCN(xmlwriter);
PHPCN(libxmlerror);
PHPCN(simplexmlelement);
@ -588,29 +733,112 @@ PHPCN(sqliteexception);
PHPCN(datetime);
/* Built-in PHP functions (incomplete). */
PHPFN(cos);
PHPFN(sin);
PHPFN(tan);
/* Includes Array Functions - http://php.net/manual/en/ref.array.php */
/* Check is case insensitive - these *MUST* be listed in lower case here */
PHPFN(acos);
PHPFN(array_change_key_case);
PHPFN(array_chunk);
PHPFN(array_column);
PHPFN(array_combine);
PHPFN(array_count_values);
PHPFN(array_diff);
PHPFN(array_diff_assoc);
PHPFN(array_diff_key);
PHPFN(array_diff_uassoc);
PHPFN(array_diff_ukey);
PHPFN(array_fill);
PHPFN(array_fill_keys);
PHPFN(array_filter);
PHPFN(array_flip);
PHPFN(array_intersect);
PHPFN(array_intersect_assoc);
PHPFN(array_intersect_key);
PHPFN(array_intersect_uassoc);
PHPFN(array_intersect_ukey);
PHPFN(array_key_exists);
PHPFN(array_keys);
PHPFN(array_map);
PHPFN(array_merge);
PHPFN(array_merge_recursive);
PHPFN(array_multisort);
PHPFN(array_pad);
PHPFN(array_pop);
PHPFN(array_product);
PHPFN(array_push);
PHPFN(array_rand);
PHPFN(array_reduce);
PHPFN(array_replace);
PHPFN(array_replace_recursive);
PHPFN(array_reverse);
PHPFN(array_search);
PHPFN(array_shift);
PHPFN(array_slice);
PHPFN(array_splice);
PHPFN(array_sum);
PHPFN(array_udiff);
PHPFN(array_udiff_assoc);
PHPFN(array_udiff_uassoc);
PHPFN(array_uintersect);
PHPFN(array_uintersect_assoc);
PHPFN(array_uintersect_uassoc);
PHPFN(array_unique);
PHPFN(array_unshift);
PHPFN(array_values);
PHPFN(array_walk);
PHPFN(array_walk_recursive);
PHPFN(arsort);
PHPFN(asin);
PHPFN(asort);
PHPFN(atan);
PHPFN(atan2);
PHPFN(cosh);
PHPFN(sinh);
PHPFN(tanh);
PHPFN(exp);
PHPFN(log);
PHPFN(log10);
PHPFN(pow);
PHPFN(sqrt);
PHPFN(ceil);
PHPFN(compact);
PHPFN(cos);
PHPFN(cosh);
PHPFN(count);
PHPFN(current);
PHPFN(each);
PHPFN(end);
PHPFN(exp);
PHPFN(extract);
PHPFN(floor);
PHPFN(fmod);
PHPFN(min);
PHPFN(in_array);
PHPFN(key);
PHPFN(key_exists);
PHPFN(krsort);
PHPFN(ksort);
PHPFN(log);
PHPFN(log10);
PHPFN(max);
PHPFN(min);
PHPFN(natcasesort);
PHPFN(natsort);
PHPFN(next);
PHPFN(pos);
PHPFN(pow);
PHPFN(prev);
PHPFN(range);
PHPFN(reset);
PHPFN(rsort);
PHPFN(shuffle);
PHPFN(sin);
PHPFN(sinh);
PHPFN(sizeof);
PHPFN(sort);
PHPFN(sqrt);
PHPFN(tan);
PHPFN(tanh);
PHPFN(uasort);
PHPFN(uksort);
PHPFN(usort);
#undef PHPKW
#undef PHPBN1a
#undef PHPBN1b
#undef PHPBN1
#undef PHPBN2a
#undef PHPBN2b
#undef PHPBN2
#undef PHPCN
#undef PHPFN

View file

@ -1,5 +1,5 @@
%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
%typemap(in) TYPE *REF ($*1_ltype tmp),
%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp),
TYPE &REF ($*1_ltype tmp)
%{
/* First Check for SWIG wrapped type */

View file

@ -12,6 +12,7 @@ extern "C" {
#include "zend_exceptions.h"
#include "php.h"
#include "ext/standard/php_string.h"
#include <stdlib.h> /* for abort(), used in generated code. */
#ifdef ZEND_RAW_FENTRY
/* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */
@ -208,11 +209,11 @@ SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) {
const char *type_name;
value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type);
if ( flags & SWIG_POINTER_DISOWN ) {
if (type==-1) return NULL;
if (flags & SWIG_POINTER_DISOWN) {
value->newobject = 0;
}
p = value->ptr;
if (type==-1) return NULL;
type_name=zend_rsrc_list_get_rsrc_type(z->value.lval TSRMLS_CC);
@ -254,11 +255,10 @@ static char const_name[] = "swig_runtime_data_type_pointer";
static swig_module_info *SWIG_Php_GetModule() {
zval *pointer;
swig_module_info *ret = 0;
TSRMLS_FETCH();
MAKE_STD_ZVAL(pointer);
TSRMLS_FETCH();
if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) {
if (pointer->type == IS_LONG) {
ret = (swig_module_info *) pointer->value.lval;

View file

@ -23,6 +23,10 @@ namespace std {
template<class K, class T> class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
map();
map(const map<K,T> &);

View file

@ -33,8 +33,8 @@ namespace std {
%}
%typemap(directorout) string %{
convert_to_string_ex($input);
$result.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
convert_to_string_ex(&$input);
$result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input));
%}
%typemap(out) string %{
@ -56,15 +56,15 @@ namespace std {
/* These next two handle a function which takes a non-const reference to
* a std::string and modifies the string. */
%typemap(in) string & (std::string temp) %{
%typemap(in) string & ($*1_ltype temp) %{
convert_to_string_ex($input);
temp.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
$1 = &temp;
%}
%typemap(directorout) string & (std::string *temp) %{
convert_to_string_ex($input);
temp = new std::string(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
%typemap(directorout) string & ($*1_ltype *temp) %{
convert_to_string_ex(&$input);
temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input));
swig_acquire_ownership(temp);
$result = temp;
%}

View file

@ -77,7 +77,7 @@ namespace std {
self->pop_back();
return x;
}
const_reference get(int i) throw (std::out_of_range) {
bool get(int i) throw (std::out_of_range) {
int size = int(self->size());
if (i>=0 && i<size)
return (*self)[i];

View file

@ -38,7 +38,7 @@
zval *o;
MAKE_STD_ZVAL(o);
ZVAL_BOOL(o,temp$argnum);
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
%{
@ -67,7 +67,7 @@
zval *o;
MAKE_STD_ZVAL(o);
ZVAL_DOUBLE(o,temp$argnum);
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue)
%{
@ -96,7 +96,7 @@
zval *o;
MAKE_STD_ZVAL(o);
ZVAL_LONG(o,temp$argnum);
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
%{
@ -137,7 +137,7 @@ INT_TYPEMAP(long long);
sprintf(temp, "%lld", (long long)temp$argnum);
ZVAL_STRING(o, temp, 1);
}
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in) TYPE *REFERENCE (long long lvalue)
%{
@ -178,7 +178,7 @@ INT_TYPEMAP(unsigned long long);
sprintf(temp, "%llu", (unsigned long long)temp$argnum);
ZVAL_STRING(o, temp, 1);
}
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in) TYPE *REFERENCE (unsigned long long lvalue)
%{
@ -276,12 +276,12 @@ INT_TYPEMAP(unsigned long long);
%}
%typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] )
"$1 = temp;";
%typemap(argout) char OUTPUT[ANY]
%typemap(argout,fragment="t_output_helper") char OUTPUT[ANY]
{
zval *o;
MAKE_STD_ZVAL(o);
ZVAL_STRINGL(o,temp$argnum,$1_dim0);
t_output_helper( &$result, o );
t_output_helper( &$result, o TSRMLS_CC );
}
%typemap(in,numinputs=0) void **OUTPUT (int force),

View file

@ -80,18 +80,18 @@
%}
%typemap(directorout) TYPE
%{
CONVERT_IN($result,$1_ltype,$input);
CONVERT_IN($result,$1_ltype,&$input);
%}
%typemap(directorout) const TYPE & ($*1_ltype temp)
%{
CONVERT_IN(temp,$*1_ltype,$input);
CONVERT_IN(temp,$*1_ltype,&$input);
$result = &temp;
%}
%enddef
%fragment("t_output_helper","header") %{
static void
t_output_helper( zval **target, zval *o) {
t_output_helper(zval **target, zval *o TSRMLS_DC) {
if ( (*target)->type == IS_ARRAY ) {
/* it's already an array, just append */
add_next_index_zval( *target, o );