Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up Conflicts: Doc/Devel/engineering.html Examples/Makefile.in Lib/allegrocl/allegrocl.swg Lib/csharp/csharp.swg Lib/csharp/enums.swg Lib/csharp/enumsimple.swg Lib/csharp/enumtypesafe.swg Lib/java/java.swg Lib/python/pydocs.swg Lib/r/rtype.swg Source/Include/swigwarn.h Source/Modules/octave.cxx Source/Modules/python.cxx Source/Modules/ruby.cxx Source/Swig/scanner.c Source/Swig/stype.c Source/Swig/swig.h configure.ac
This commit is contained in:
commit
e805d5f925
1074 changed files with 54339 additions and 20134 deletions
|
|
@ -33,17 +33,14 @@
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -105,24 +105,22 @@ namespace Swig {
|
|||
zval *swig_self;
|
||||
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
|
||||
public:
|
||||
Director(zval* self) : swig_self(self) {
|
||||
}
|
||||
|
||||
~Director() {
|
||||
for (swig_ownership_map::iterator i = swig_owner.begin(); i != swig_owner.end(); i++) {
|
||||
swig_owner.erase(i);
|
||||
}
|
||||
Director(zval* self TSRMLS_DC) : swig_self(self) {
|
||||
TSRMLS_SET_CTX(swig_zts_ctx);
|
||||
}
|
||||
|
||||
bool swig_is_overridden_method(char *cname, char *lc_fname) {
|
||||
zval classname;
|
||||
TSRMLS_FETCH_FROM_CTX(swig_zts_ctx);
|
||||
zend_class_entry **ce;
|
||||
zend_function *mptr;
|
||||
int name_len = strlen(lc_fname);
|
||||
|
||||
ZVAL_STRING(&classname, cname, 0);
|
||||
if (zend_lookup_class(Z_STRVAL_P(&classname), Z_STRLEN_P(&classname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
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) {
|
||||
|
|
@ -146,7 +144,7 @@ namespace Swig {
|
|||
protected:
|
||||
std::string swig_msg;
|
||||
public:
|
||||
DirectorException(int code, const char *hdr, const char* msg)
|
||||
DirectorException(int code, const char *hdr, const char* msg TSRMLS_DC)
|
||||
: swig_msg(hdr)
|
||||
{
|
||||
if (strlen(msg)) {
|
||||
|
|
@ -157,9 +155,9 @@ namespace Swig {
|
|||
SWIG_ErrorMsg() = swig_msg.c_str();
|
||||
}
|
||||
|
||||
static void raise(int code, const char *hdr, const char* msg)
|
||||
static void raise(int code, const char *hdr, const char* msg TSRMLS_DC)
|
||||
{
|
||||
throw DirectorException(code, hdr, msg);
|
||||
throw DirectorException(code, hdr, msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -167,32 +165,36 @@ namespace Swig {
|
|||
class DirectorPureVirtualException : public Swig::DirectorException
|
||||
{
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg)
|
||||
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg)
|
||||
{
|
||||
DirectorPureVirtualException(const char* msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
static void raise(const char *msg TSRMLS_DC)
|
||||
{
|
||||
throw DirectorPureVirtualException(msg);
|
||||
throw DirectorPureVirtualException(msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
/* any php exception that occurs during a director method call */
|
||||
class DirectorMethodException : public Swig::DirectorException
|
||||
{
|
||||
public:
|
||||
DirectorMethodException(const char* msg = "")
|
||||
: DirectorException(E_ERROR, "SWIG director method error", msg)
|
||||
{
|
||||
DirectorMethodException(const char* msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
static void raise(const char *msg TSRMLS_DC)
|
||||
{
|
||||
throw DirectorMethodException(msg);
|
||||
throw DirectorMethodException(msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// DirectorMethodException() is documented to be callable with no parameters
|
||||
// so use a macro to insert TSRMLS_CC so any ZTS context gets passed.
|
||||
#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@
|
|||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
}
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH)
|
||||
{
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
convert_to_string_ex($input);
|
||||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
$2 = ($2_ltype) Z_STRLEN_PP($input);
|
||||
|
|
@ -214,7 +213,7 @@
|
|||
return_value->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", $1);
|
||||
sprintf(temp, "%lld", (long long)$1);
|
||||
ZVAL_STRING(return_value, temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -225,7 +224,7 @@
|
|||
return_value->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", $1);
|
||||
sprintf(temp, "%llu", (unsigned long long)$1);
|
||||
ZVAL_STRING(return_value, temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -261,7 +260,7 @@
|
|||
return_value->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", *$1);
|
||||
sprintf(temp, "%lld", (long long)(*$1));
|
||||
ZVAL_STRING(return_value, temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -272,7 +271,7 @@
|
|||
return_value->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", *$1);
|
||||
sprintf(temp, "%llu", (unsigned long long)(*$1));
|
||||
ZVAL_STRING(return_value, temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -288,7 +287,7 @@
|
|||
size_t,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
ZVAL_LONG($input,$1_name);
|
||||
ZVAL_LONG($input,$1);
|
||||
}
|
||||
|
||||
%typemap(directorin) enum SWIGTYPE
|
||||
|
|
@ -308,7 +307,7 @@
|
|||
|
||||
%typemap(directorin) bool
|
||||
{
|
||||
ZVAL_BOOL($input,($1_name)?1:0);
|
||||
ZVAL_BOOL($input,($1)?1:0);
|
||||
}
|
||||
|
||||
%typemap(out) float,
|
||||
|
|
@ -326,7 +325,7 @@
|
|||
%typemap(directorin) float,
|
||||
double
|
||||
{
|
||||
ZVAL_DOUBLE($input,$1_name);
|
||||
ZVAL_DOUBLE($input,$1);
|
||||
}
|
||||
|
||||
%typemap(out) char
|
||||
|
|
@ -376,7 +375,7 @@
|
|||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval($input, (void *)&$1_name, $1_descriptor, $owner);
|
||||
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
|
|
@ -419,7 +418,7 @@
|
|||
|
||||
%typemap(directorin) SWIGTYPE
|
||||
{
|
||||
SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1_name), $&1_descriptor, 2);
|
||||
SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1), $&1_descriptor, 2);
|
||||
}
|
||||
|
||||
%typemap(out) void "";
|
||||
|
|
@ -443,17 +442,17 @@
|
|||
%php_typecheck(unsigned int,SWIG_TYPECHECK_UINT32,IS_LONG)
|
||||
%php_typecheck(short,SWIG_TYPECHECK_INT16,IS_LONG)
|
||||
%php_typecheck(unsigned short,SWIG_TYPECHECK_UINT16,IS_LONG)
|
||||
%php_typecheck(long,SWIG_TYPECHECK_INT64,IS_LONG)
|
||||
%php_typecheck(unsigned long,SWIG_TYPECHECK_UINT64,IS_LONG)
|
||||
%php_typecheck(long,SWIG_TYPECHECK_INT32,IS_LONG)
|
||||
%php_typecheck(unsigned long,SWIG_TYPECHECK_UINT32,IS_LONG)
|
||||
%php_typecheck(long long,SWIG_TYPECHECK_INT64,IS_LONG)
|
||||
%php_typecheck(unsigned long long,SWIG_TYPECHECK_UINT64,IS_LONG)
|
||||
%php_typecheck(signed char,SWIG_TYPECHECK_INT8,IS_LONG)
|
||||
%php_typecheck(unsigned char,SWIG_TYPECHECK_UINT8,IS_LONG)
|
||||
%php_typecheck(size_t,SWIG_TYPECHECK_INT16,IS_LONG)
|
||||
%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INT8,IS_LONG)
|
||||
%php_typecheck(size_t,SWIG_TYPECHECK_SIZE,IS_LONG)
|
||||
%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG)
|
||||
%php_typecheck(bool,SWIG_TYPECHECK_BOOL,IS_BOOL)
|
||||
%php_typecheck(float,SWIG_TYPECHECK_FLOAT,IS_DOUBLE)
|
||||
%php_typecheck(double,SWIG_TYPECHECK_BOOL,IS_DOUBLE)
|
||||
%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE)
|
||||
%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING)
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char []
|
||||
|
|
@ -476,6 +475,12 @@
|
|||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $*1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||
{
|
||||
void *tmp;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,8 @@ 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);
|
||||
|
|
@ -146,6 +148,20 @@ PHPBN2(PHP_SHLIB_SUFFIX);
|
|||
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
|
||||
PHPBN2(PHP_WINDOWS_NT_SERVER); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_NT_WORKSTATION); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_BUILD); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_MAJOR); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_MINOR); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_PLATFORM); // As of PHP 5.3
|
||||
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 */
|
||||
PHPBN2(EXTR_OVERWRITE);
|
||||
PHPBN2(EXTR_SKIP);
|
||||
|
|
@ -175,6 +191,8 @@ PHPBN2(INI_USER);
|
|||
PHPBN2(INI_PERDIR);
|
||||
PHPBN2(INI_SYSTEM);
|
||||
PHPBN2(INI_ALL);
|
||||
PHPBN2(INI_SCANNER_NORMAL); // As of PHP 5.3
|
||||
PHPBN2(INI_SCANNER_RAW); // As of PHP 5.3
|
||||
PHPBN2(M_E);
|
||||
PHPBN2(M_LOG2E);
|
||||
PHPBN2(M_LOG10E);
|
||||
|
|
@ -188,6 +206,10 @@ PHPBN2(M_2_PI);
|
|||
PHPBN2(M_2_SQRTPI);
|
||||
PHPBN2(M_SQRT2);
|
||||
PHPBN2(M_SQRT1_2);
|
||||
PHPBN2(M_EULER); // As of PHP 5.2
|
||||
PHPBN2(M_LNPI); // As of PHP 5.2
|
||||
PHPBN2(M_SQRT3); // As of PHP 5.2
|
||||
PHPBN2(M_SQRTPI); // As of PHP 5.2
|
||||
PHPBN2(CRYPT_SALT_LENGTH);
|
||||
PHPBN2(CRYPT_STD_DES);
|
||||
PHPBN2(CRYPT_EXT_DES);
|
||||
|
|
@ -228,6 +250,7 @@ PHPBN2(STR_PAD_BOTH);
|
|||
PHPBN2(PATHINFO_DIRNAME);
|
||||
PHPBN2(PATHINFO_BASENAME);
|
||||
PHPBN2(PATHINFO_EXTENSION);
|
||||
PHPBN2(PATHINFO_FILENAME); // As of PHP 5.2
|
||||
PHPBN2(PATH_SEPARATOR);
|
||||
PHPBN2(CHAR_MAX);
|
||||
PHPBN2(LC_CTYPE);
|
||||
|
|
@ -351,6 +374,117 @@ PHPBN2(LOG_PERROR);
|
|||
PHPBN2(E_STRICT);
|
||||
PHPBN2(__COMPILER_HALT_OFFSET__);
|
||||
|
||||
/* Added in PHP 5.2 */
|
||||
PHPBN2(PREG_BACKTRACK_LIMIT_ERROR);
|
||||
PHPBN2(PREG_BAD_UTF8_ERROR);
|
||||
PHPBN2(PREG_INTERNAL_ERROR);
|
||||
PHPBN2(PREG_NO_ERROR);
|
||||
PHPBN2(PREG_RECURSION_LIMIT_ERROR);
|
||||
PHPBN2(UPLOAD_ERR_EXTENSION);
|
||||
PHPBN2(STREAM_SHUT_RD);
|
||||
PHPBN2(STREAM_SHUT_WR);
|
||||
PHPBN2(STREAM_SHUT_RDWR);
|
||||
PHPBN2(CURLE_FILESIZE_EXCEEDED);
|
||||
PHPBN2(CURLE_FTP_SSL_FAILED);
|
||||
PHPBN2(CURLE_LDAP_INVALID_URL);
|
||||
PHPBN2(CURLFTPAUTH_DEFAULT);
|
||||
PHPBN2(CURLFTPAUTH_SSL);
|
||||
PHPBN2(CURLFTPAUTH_TLS);
|
||||
PHPBN2(CURLFTPSSL_ALL);
|
||||
PHPBN2(CURLFTPSSL_CONTROL);
|
||||
PHPBN2(CURLFTPSSL_NONE);
|
||||
PHPBN2(CURLFTPSSL_TRY);
|
||||
PHPBN2(CURLOPT_FTP_SSL);
|
||||
PHPBN2(CURLOPT_FTPSSLAUTH);
|
||||
PHPBN2(CURLOPT_TCP_NODELAY); // Added in PHP 5.2.1
|
||||
PHPBN2(CURLOPT_TIMEOUT_MS); // Added in PHP 5.2.3
|
||||
PHPBN2(CURLOPT_CONNECTTIMEOUT_MS); // Added in PHP 5.2.3
|
||||
PHPBN2(GMP_VERSION); // Added in PHP 5.2.2
|
||||
PHPBN2(SWFTEXTFIELD_USEFONT);
|
||||
PHPBN2(SWFTEXTFIELD_AUTOSIZE);
|
||||
PHPBN2(SWF_SOUND_NOT_COMPRESSED);
|
||||
PHPBN2(SWF_SOUND_ADPCM_COMPRESSED);
|
||||
PHPBN2(SWF_SOUND_MP3_COMPRESSED);
|
||||
PHPBN2(SWF_SOUND_NOT_COMPRESSED_LE);
|
||||
PHPBN2(SWF_SOUND_NELLY_COMPRESSED);
|
||||
PHPBN2(SWF_SOUND_5KHZ);
|
||||
PHPBN2(SWF_SOUND_11KHZ);
|
||||
PHPBN2(SWF_SOUND_22KHZ);
|
||||
PHPBN2(SWF_SOUND_44KHZ);
|
||||
PHPBN2(SWF_SOUND_8BITS);
|
||||
PHPBN2(SWF_SOUND_16BITS);
|
||||
PHPBN2(SWF_SOUND_MONO);
|
||||
PHPBN2(SWF_SOUND_STEREO);
|
||||
PHPBN2(OPENSSL_VERSION_NUMBER);
|
||||
PHPBN2(SNMP_OID_OUTPUT_FULL);
|
||||
PHPBN2(SNMP_OID_OUTPUT_NUMERIC);
|
||||
PHPBN2(MSG_EAGAIN);
|
||||
PHPBN2(MSG_ENOMSG);
|
||||
|
||||
/* Added in PHP 5.3 */
|
||||
PHPBN2(CURLOPT_PROGRESSFUNCTION);
|
||||
PHPBN2(IMG_FILTER_PIXELATE);
|
||||
PHPBN2(JSON_ERROR_CTRL_CHAR);
|
||||
PHPBN2(JSON_ERROR_DEPTH);
|
||||
PHPBN2(JSON_ERROR_NONE);
|
||||
PHPBN2(JSON_ERROR_STATE_MISMATCH);
|
||||
PHPBN2(JSON_ERROR_SYNTAX);
|
||||
PHPBN2(JSON_FORCE_OBJECT);
|
||||
PHPBN2(JSON_HEX_TAG);
|
||||
PHPBN2(JSON_HEX_AMP);
|
||||
PHPBN2(JSON_HEX_APOS);
|
||||
PHPBN2(JSON_HEX_QUOT);
|
||||
PHPBN2(LDAP_OPT_NETWORK_TIMEOUT);
|
||||
PHPBN2(LIBXML_LOADED_VERSION);
|
||||
PHPBN2(PREG_BAD_UTF8_OFFSET_ERROR);
|
||||
PHPBN2(BUS_ADRALN);
|
||||
PHPBN2(BUS_ADRERR);
|
||||
PHPBN2(BUS_OBJERR);
|
||||
PHPBN2(CLD_CONTIUNED);
|
||||
PHPBN2(CLD_DUMPED);
|
||||
PHPBN2(CLD_EXITED);
|
||||
PHPBN2(CLD_KILLED);
|
||||
PHPBN2(CLD_STOPPED);
|
||||
PHPBN2(CLD_TRAPPED);
|
||||
PHPBN2(FPE_FLTDIV);
|
||||
PHPBN2(FPE_FLTINV);
|
||||
PHPBN2(FPE_FLTOVF);
|
||||
PHPBN2(FPE_FLTRES);
|
||||
PHPBN2(FPE_FLTSUB);
|
||||
PHPBN2(FPE_FLTUND);
|
||||
PHPBN2(FPE_INTDIV);
|
||||
PHPBN2(FPE_INTOVF);
|
||||
PHPBN2(ILL_BADSTK);
|
||||
PHPBN2(ILL_COPROC);
|
||||
PHPBN2(ILL_ILLADR);
|
||||
PHPBN2(ILL_ILLOPC);
|
||||
PHPBN2(ILL_ILLOPN);
|
||||
PHPBN2(ILL_ILLTRP);
|
||||
PHPBN2(ILL_PRVOPC);
|
||||
PHPBN2(ILL_PRVREG);
|
||||
PHPBN2(POLL_ERR);
|
||||
PHPBN2(POLL_HUP);
|
||||
PHPBN2(POLL_IN);
|
||||
PHPBN2(POLL_MSG);
|
||||
PHPBN2(POLL_OUT);
|
||||
PHPBN2(POLL_PRI);
|
||||
PHPBN2(SEGV_ACCERR);
|
||||
PHPBN2(SEGV_MAPERR);
|
||||
PHPBN2(SI_ASYNCIO);
|
||||
PHPBN2(SI_KERNEL);
|
||||
PHPBN2(SI_MESGQ);
|
||||
PHPBN2(SI_NOINFO);
|
||||
PHPBN2(SI_QUEUE);
|
||||
PHPBN2(SI_SIGIO);
|
||||
PHPBN2(SI_TIMER);
|
||||
PHPBN2(SI_TKILL);
|
||||
PHPBN2(SI_USER);
|
||||
PHPBN2(SIG_BLOCK);
|
||||
PHPBN2(SIG_SETMASK);
|
||||
PHPBN2(SIG_UNBLOCK);
|
||||
PHPBN2(TRAP_BRKPT);
|
||||
PHPBN2(TRAP_TRACE);
|
||||
|
||||
/* Class names reserved by PHP */
|
||||
/* case insensitive */
|
||||
PHPCN(stdclass);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -78,7 +79,7 @@ static int default_error_code = E_ERROR;
|
|||
if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
|
||||
|
||||
/* Standard SWIG API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Php_GetModule()
|
||||
#define SWIG_GetModule(clientdata) SWIG_Php_GetModule(clientdata)
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer)
|
||||
|
||||
/* used to wrap returned objects in so we know whether they are newobject
|
||||
|
|
@ -96,7 +97,6 @@ static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
|
|||
|
||||
static void
|
||||
SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) {
|
||||
swig_object_wrapper *value=NULL;
|
||||
/*
|
||||
* First test for Null pointers. Return those as PHP native NULL
|
||||
*/
|
||||
|
|
@ -105,12 +105,13 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
return;
|
||||
}
|
||||
if (type->clientdata) {
|
||||
swig_object_wrapper *value;
|
||||
if (! (*(int *)(type->clientdata)))
|
||||
zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
|
||||
value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
|
||||
value->ptr=ptr;
|
||||
value->newobject=newobject;
|
||||
if (newobject <= 1) {
|
||||
value->newobject=(newobject & 1);
|
||||
if ((newobject & 2) == 0) {
|
||||
/* Just register the pointer as a resource. */
|
||||
ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata));
|
||||
} else {
|
||||
|
|
@ -119,18 +120,32 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
* via the "_cPtr" member. This is currently only used by
|
||||
* directorin typemaps.
|
||||
*/
|
||||
value->newobject = 0;
|
||||
zval *resource;
|
||||
zend_class_entry **ce = NULL;
|
||||
const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */
|
||||
size_t type_name_len;
|
||||
int result;
|
||||
const char * p;
|
||||
|
||||
/* Namespace__Foo -> Foo */
|
||||
/* FIXME: ugly and goes wrong for classes with __ in their names. */
|
||||
while ((p = strstr(type_name, "__")) != NULL) {
|
||||
type_name = p + 2;
|
||||
}
|
||||
type_name_len = strlen(type_name);
|
||||
|
||||
MAKE_STD_ZVAL(resource);
|
||||
ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata));
|
||||
zend_class_entry **ce = NULL;
|
||||
zval *classname;
|
||||
MAKE_STD_ZVAL(classname);
|
||||
/* _p_Foo -> Foo */
|
||||
ZVAL_STRING(classname, (char*)type->name+3, 1);
|
||||
/* class names are stored in lowercase */
|
||||
php_strtolower(Z_STRVAL_PP(&classname), Z_STRLEN_PP(&classname));
|
||||
if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
if (SWIG_PREFIX_LEN > 0) {
|
||||
char * classname = (char*)emalloc(SWIG_PREFIX_LEN + type_name_len + 1);
|
||||
strcpy(classname, SWIG_PREFIX);
|
||||
strcpy(classname + SWIG_PREFIX_LEN, type_name);
|
||||
result = zend_lookup_class(classname, SWIG_PREFIX_LEN + type_name_len, &ce TSRMLS_CC);
|
||||
efree(classname);
|
||||
} else {
|
||||
result = zend_lookup_class((char *)type_name, type_name_len, &ce TSRMLS_CC);
|
||||
}
|
||||
if (result != SUCCESS) {
|
||||
/* class does not exist */
|
||||
object_init(z);
|
||||
} else {
|
||||
|
|
@ -139,7 +154,6 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
Z_SET_REFCOUNT_P(z, 1);
|
||||
Z_SET_ISREF_P(z);
|
||||
zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL);
|
||||
FREE_ZVAL(classname);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -192,7 +206,7 @@ SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) {
|
|||
swig_object_wrapper *value;
|
||||
void *p;
|
||||
int type;
|
||||
char *type_name;
|
||||
const char *type_name;
|
||||
|
||||
value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type);
|
||||
if ( flags & SWIG_POINTER_DISOWN ) {
|
||||
|
|
@ -238,7 +252,7 @@ SWIG_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC
|
|||
}
|
||||
|
||||
static char const_name[] = "swig_runtime_data_type_pointer";
|
||||
static swig_module_info *SWIG_Php_GetModule() {
|
||||
static swig_module_info *SWIG_Php_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
||||
zval *pointer;
|
||||
swig_module_info *ret = 0;
|
||||
|
||||
|
|
@ -246,7 +260,7 @@ static swig_module_info *SWIG_Php_GetModule() {
|
|||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_get_constant(const_name, sizeof(const_name), pointer TSRMLS_CC)) {
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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> &);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace std {
|
|||
%}
|
||||
|
||||
%typemap(directorin) string, const string& %{
|
||||
ZVAL_STRINGL($input, const_cast<char*>($1_name.data()), $1_name.size(), 1);
|
||||
ZVAL_STRINGL($input, const_cast<char*>($1.data()), $1.size(), 1);
|
||||
%}
|
||||
|
||||
%typemap(out) const 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) %{
|
||||
%typemap(directorout) string & ($*1_ltype *temp) %{
|
||||
convert_to_string_ex($input);
|
||||
temp = new std::string(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
|
||||
temp = new $*1_ltype(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
|
||||
swig_acquire_ownership(temp);
|
||||
$result = temp;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -24,76 +24,108 @@
|
|||
* its value can be changed by foo().
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define double_typemap(TYPE)
|
||||
%typemap(in) TYPE *INPUT(TYPE temp)
|
||||
%define BOOL_TYPEMAP(TYPE)
|
||||
%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
|
||||
%{
|
||||
convert_to_boolean_ex($input);
|
||||
temp = Z_LVAL_PP($input) ? true : false;
|
||||
$1 = &temp;
|
||||
%}
|
||||
%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
|
||||
%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT
|
||||
{
|
||||
zval *o;
|
||||
MAKE_STD_ZVAL(o);
|
||||
ZVAL_BOOL(o,temp$argnum);
|
||||
t_output_helper( &$result, o );
|
||||
}
|
||||
%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
|
||||
%{
|
||||
convert_to_boolean_ex($input);
|
||||
lvalue = (*$input)->value.lval ? true : false;
|
||||
$1 = &lvalue;
|
||||
%}
|
||||
%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
|
||||
%{
|
||||
(*$arg)->value.lval = lvalue$argnum ? true : false;
|
||||
(*$arg)->type = IS_BOOL;
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%define DOUBLE_TYPEMAP(TYPE)
|
||||
%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
|
||||
%{
|
||||
convert_to_double_ex($input);
|
||||
temp = (TYPE) Z_DVAL_PP($input);
|
||||
$1 = &temp;
|
||||
%}
|
||||
%typemap(argout) TYPE *INPUT "";
|
||||
%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") TYPE *OUTPUT
|
||||
%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
|
||||
%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT
|
||||
{
|
||||
zval *o;
|
||||
MAKE_STD_ZVAL(o);
|
||||
ZVAL_DOUBLE(o,temp$argnum);
|
||||
t_output_helper( &$result, o );
|
||||
}
|
||||
%typemap(in) TYPE *REFERENCE (TYPE dvalue)
|
||||
%typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue)
|
||||
%{
|
||||
convert_to_double_ex($input);
|
||||
dvalue = (TYPE) (*$input)->value.dval;
|
||||
$1 = &dvalue;
|
||||
%}
|
||||
%typemap(argout) TYPE *REFERENCE
|
||||
%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
|
||||
%{
|
||||
$1->value.dval = (double)(lvalue$argnum);
|
||||
$1->type = IS_DOUBLE;
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%define int_typemap(TYPE)
|
||||
%typemap(in) TYPE *INPUT(TYPE temp)
|
||||
%define INT_TYPEMAP(TYPE)
|
||||
%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
|
||||
%{
|
||||
convert_to_long_ex($input);
|
||||
temp = (TYPE) Z_LVAL_PP($input);
|
||||
$1 = &temp;
|
||||
%}
|
||||
%typemap(argout) TYPE *INPUT "";
|
||||
%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") TYPE *OUTPUT
|
||||
%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
|
||||
%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT
|
||||
{
|
||||
zval *o;
|
||||
MAKE_STD_ZVAL(o);
|
||||
ZVAL_LONG(o,temp$argnum);
|
||||
t_output_helper( &$result, o );
|
||||
}
|
||||
%typemap(in) TYPE *REFERENCE (TYPE lvalue)
|
||||
%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
|
||||
%{
|
||||
convert_to_long_ex($input);
|
||||
lvalue = (TYPE) (*$input)->value.lval;
|
||||
$1 = &lvalue;
|
||||
%}
|
||||
%typemap(argout) TYPE *REFERENCE
|
||||
%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
|
||||
%{
|
||||
(*$arg)->value.lval = (long)(lvalue$argnum);
|
||||
(*$arg)->type = IS_LONG;
|
||||
%}
|
||||
%enddef
|
||||
|
||||
double_typemap(float);
|
||||
double_typemap(double);
|
||||
BOOL_TYPEMAP(bool);
|
||||
|
||||
int_typemap(int);
|
||||
int_typemap(short);
|
||||
int_typemap(long);
|
||||
int_typemap(unsigned int);
|
||||
int_typemap(unsigned short);
|
||||
int_typemap(unsigned long);
|
||||
int_typemap(unsigned char);
|
||||
DOUBLE_TYPEMAP(float);
|
||||
DOUBLE_TYPEMAP(double);
|
||||
|
||||
int_typemap(long long);
|
||||
INT_TYPEMAP(int);
|
||||
INT_TYPEMAP(short);
|
||||
INT_TYPEMAP(long);
|
||||
INT_TYPEMAP(unsigned int);
|
||||
INT_TYPEMAP(unsigned short);
|
||||
INT_TYPEMAP(unsigned long);
|
||||
INT_TYPEMAP(unsigned char);
|
||||
INT_TYPEMAP(signed char);
|
||||
|
||||
INT_TYPEMAP(long long);
|
||||
%typemap(argout,fragment="t_output_helper") long long *OUTPUT
|
||||
{
|
||||
zval *o;
|
||||
|
|
@ -102,7 +134,7 @@ int_typemap(long long);
|
|||
ZVAL_LONG(o, temp$argnum);
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", temp$argnum);
|
||||
sprintf(temp, "%lld", (long long)temp$argnum);
|
||||
ZVAL_STRING(o, temp, 1);
|
||||
}
|
||||
t_output_helper( &$result, o );
|
||||
|
|
@ -119,7 +151,7 @@ int_typemap(long long);
|
|||
(*$arg)->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", lvalue$argnum);
|
||||
sprintf(temp, "%lld", (long long)lvalue$argnum);
|
||||
ZVAL_STRING((*$arg), temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -130,11 +162,11 @@ int_typemap(long long);
|
|||
($result)->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", *arg$argnum);
|
||||
sprintf(temp, "%lld", (long long)(*arg$argnum));
|
||||
ZVAL_STRING($result, temp, 1);
|
||||
}
|
||||
%}
|
||||
int_typemap(unsigned long long);
|
||||
INT_TYPEMAP(unsigned long long);
|
||||
%typemap(argout,fragment="t_output_helper") unsigned long long *OUTPUT
|
||||
{
|
||||
zval *o;
|
||||
|
|
@ -143,7 +175,7 @@ int_typemap(unsigned long long);
|
|||
ZVAL_LONG(o, temp$argnum);
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", temp$argnum);
|
||||
sprintf(temp, "%llu", (unsigned long long)temp$argnum);
|
||||
ZVAL_STRING(o, temp, 1);
|
||||
}
|
||||
t_output_helper( &$result, o );
|
||||
|
|
@ -160,7 +192,7 @@ int_typemap(unsigned long long);
|
|||
(*$arg)->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", lvalue$argnum);
|
||||
sprintf(temp, "%llu", (unsigned long long)lvalue$argnum);
|
||||
ZVAL_STRING((*$arg), temp, 1);
|
||||
}
|
||||
%}
|
||||
|
|
@ -171,11 +203,12 @@ int_typemap(unsigned long long);
|
|||
($result)->type = IS_LONG;
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", *arg$argnum);
|
||||
sprintf(temp, "%llu", (unsigned long long)(*arg$argnum));
|
||||
ZVAL_STRING($result, temp, 1);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) bool *INOUT = bool *INPUT;
|
||||
%typemap(in) float *INOUT = float *INPUT;
|
||||
%typemap(in) double *INOUT = double *INPUT;
|
||||
|
||||
|
|
@ -188,7 +221,9 @@ int_typemap(unsigned long long);
|
|||
%typemap(in) unsigned long *INOUT = unsigned long *INPUT;
|
||||
%typemap(in) unsigned char *INOUT = unsigned char *INPUT;
|
||||
%typemap(in) unsigned long long *INOUT = unsigned long long *INPUT;
|
||||
%typemap(in) signed char *INOUT = signed char *INPUT;
|
||||
|
||||
%typemap(in) bool &INOUT = bool *INPUT;
|
||||
%typemap(in) float &INOUT = float *INPUT;
|
||||
%typemap(in) double &INOUT = double *INPUT;
|
||||
|
||||
|
|
@ -203,7 +238,9 @@ int_typemap(unsigned long long);
|
|||
%typemap(in) unsigned char &INOUT = unsigned char *INPUT;
|
||||
%typemap(in) unsigned long long &INOUT = unsigned long long *INPUT;
|
||||
%typemap(in) unsigned long long &INPUT = unsigned long long *INPUT;
|
||||
%typemap(in) signed char &INOUT = signed char *INPUT;
|
||||
|
||||
%typemap(argout) bool *INOUT = bool *OUTPUT;
|
||||
%typemap(argout) float *INOUT = float *OUTPUT;
|
||||
%typemap(argout) double *INOUT= double *OUTPUT;
|
||||
|
||||
|
|
@ -215,7 +252,9 @@ int_typemap(unsigned long long);
|
|||
%typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT;
|
||||
%typemap(argout) unsigned char *INOUT = unsigned char *OUTPUT;
|
||||
%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
|
||||
%typemap(argout) signed char *INOUT = signed char *OUTPUT;
|
||||
|
||||
%typemap(argout) bool &INOUT = bool *OUTPUT;
|
||||
%typemap(argout) float &INOUT = float *OUTPUT;
|
||||
%typemap(argout) double &INOUT= double *OUTPUT;
|
||||
|
||||
|
|
@ -227,6 +266,7 @@ int_typemap(unsigned long long);
|
|||
%typemap(argout) unsigned long &INOUT = unsigned long *OUTPUT;
|
||||
%typemap(argout) unsigned char &INOUT = unsigned char *OUTPUT;
|
||||
%typemap(argout) unsigned long long &INOUT = unsigned long long *OUTPUT;
|
||||
%typemap(argout) signed char &INOUT = signed char *OUTPUT;
|
||||
|
||||
%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] )
|
||||
%{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue