Apply patch from SF bug: [ 1466086 ] PHP namespace clash - ErrorCode
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9262 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b42168cf6e
commit
44eaee3a01
3 changed files with 26 additions and 14 deletions
|
|
@ -1,6 +1,18 @@
|
||||||
Version 1.3.30 (in progress)
|
Version 1.3.30 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
09/05/2006: olly
|
||||||
|
[php] Rename ErrorCode and ErrorMsg #define-s to SWIG_ErrorCode
|
||||||
|
and SWIG_ErrorMsg to avoid clashes with code the user might be
|
||||||
|
wrapping (patch from Darren Warner in SF bug #1466086). Any
|
||||||
|
user typemaps which use ErrorCode and/or ErrorMsg directly will
|
||||||
|
need adjusting - you can easily fix them to work with both old
|
||||||
|
and new SWIG by changing to use SWIG_ErrorMsg and adding:
|
||||||
|
|
||||||
|
#ifndef SWIG_ErrorMsg
|
||||||
|
#define SWIG_ErrorMsg() ErrorMsg()
|
||||||
|
#endif
|
||||||
|
|
||||||
08/29/2006: olly
|
08/29/2006: olly
|
||||||
[php] Move constant initialisation from RINIT to MINIT to fix a
|
[php] Move constant initialisation from RINIT to MINIT to fix a
|
||||||
warning when using Apache and mod_php. We only need to create
|
warning when using Apache and mod_php. We only need to create
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ static int default_error_code = E_ERROR;
|
||||||
|
|
||||||
#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg
|
#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg
|
||||||
|
|
||||||
#define SWIG_PHP_Error(code,msg) do { ErrorCode() = code; ErrorMsg() = msg; SWIG_fail; } while (0)
|
#define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0)
|
||||||
|
|
||||||
#define SWIG_contract_assert(expr,msg) \
|
#define SWIG_contract_assert(expr,msg) \
|
||||||
if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
|
if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
|
||||||
|
|
|
||||||
|
|
@ -661,11 +661,11 @@ public:
|
||||||
Printf(s_header, "ZEND_END_MODULE_GLOBALS(%s)\n", module );
|
Printf(s_header, "ZEND_END_MODULE_GLOBALS(%s)\n", module );
|
||||||
Printf(s_header, "ZEND_DECLARE_MODULE_GLOBALS(%s)\n",module );
|
Printf(s_header, "ZEND_DECLARE_MODULE_GLOBALS(%s)\n",module );
|
||||||
Printf(s_header, "#ifdef ZTS\n" );
|
Printf(s_header, "#ifdef ZTS\n" );
|
||||||
Printf(s_header, "#define ErrorMsg() TSRMG(%s_globals_id, zend_%s_globals *, error_msg )\n",module,module);
|
Printf(s_header, "#define SWIG_ErrorMsg() TSRMG(%s_globals_id, zend_%s_globals *, error_msg )\n",module,module);
|
||||||
Printf(s_header, "#define ErrorCode() TSRMG(%s_globals_id, zend_%s_globals *, error_code )\n",module,module);
|
Printf(s_header, "#define SWIG_ErrorCode() TSRMG(%s_globals_id, zend_%s_globals *, error_code )\n",module,module);
|
||||||
Printf(s_header, "#else\n" );
|
Printf(s_header, "#else\n" );
|
||||||
Printf(s_header, "#define ErrorMsg() (%s_globals.error_msg)\n",module);
|
Printf(s_header, "#define SWIG_ErrorMsg() (%s_globals.error_msg)\n",module);
|
||||||
Printf(s_header, "#define ErrorCode() (%s_globals.error_code)\n",module);
|
Printf(s_header, "#define SWIG_ErrorCode() (%s_globals.error_code)\n",module);
|
||||||
Printf(s_header, "#endif\n\n" );
|
Printf(s_header, "#endif\n\n" );
|
||||||
|
|
||||||
Printf(s_header, "static void %s_init_globals(zend_%s_globals *globals ) {\n",module,module);
|
Printf(s_header, "static void %s_init_globals(zend_%s_globals *globals ) {\n",module,module);
|
||||||
|
|
@ -678,8 +678,8 @@ public:
|
||||||
Printf(s_header, "\n");
|
Printf(s_header, "\n");
|
||||||
Printf(s_header, "static void SWIG_ResetError() {\n");
|
Printf(s_header, "static void SWIG_ResetError() {\n");
|
||||||
Printf(s_header, " TSRMLS_FETCH();\n");
|
Printf(s_header, " TSRMLS_FETCH();\n");
|
||||||
Printf(s_header, " ErrorMsg() = default_error_msg;\n");
|
Printf(s_header, " SWIG_ErrorMsg() = default_error_msg;\n");
|
||||||
Printf(s_header, " ErrorCode() = default_error_code;\n");
|
Printf(s_header, " SWIG_ErrorCode() = default_error_code;\n");
|
||||||
Printf(s_header, "}\n");
|
Printf(s_header, "}\n");
|
||||||
|
|
||||||
Printf(s_header,"#define SWIG_name \"%s\"\n", module);
|
Printf(s_header,"#define SWIG_name \"%s\"\n", module);
|
||||||
|
|
@ -926,14 +926,14 @@ public:
|
||||||
else {
|
else {
|
||||||
Printf(f->code,"zend_get_parameters_array_ex(argc,argv);\n");
|
Printf(f->code,"zend_get_parameters_array_ex(argc,argv);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Replaceall(dispatch,"$args","self,args");
|
Replaceall(dispatch,"$args","self,args");
|
||||||
|
|
||||||
Printv(f->code,dispatch,"\n",NIL);
|
Printv(f->code,dispatch,"\n",NIL);
|
||||||
|
|
||||||
Printf(f->code,"ErrorCode() = E_ERROR;\n");
|
Printf(f->code,"SWIG_ErrorCode() = E_ERROR;\n");
|
||||||
Printf(f->code,"ErrorMsg() = \"No matching function for overloaded '%s'\";\n", symname);
|
Printf(f->code,"SWIG_ErrorMsg() = \"No matching function for overloaded '%s'\";\n", symname);
|
||||||
Printv(f->code,"zend_error(ErrorCode(),ErrorMsg());\n",NIL);
|
Printv(f->code,"zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());\n",NIL);
|
||||||
|
|
||||||
Printv(f->code,"}\n",NIL);
|
Printv(f->code,"}\n",NIL);
|
||||||
Wrapper_print(f,s_wrappers);
|
Wrapper_print(f,s_wrappers);
|
||||||
|
|
@ -1285,7 +1285,7 @@ public:
|
||||||
|
|
||||||
if (mvr) {
|
if (mvr) {
|
||||||
if (! mvrset) {
|
if (! mvrset) {
|
||||||
Printf(f->code,"return _return_value;\n");
|
Printf(f->code,"return _return_value;\n");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Printf(f->code,"return SUCCESS;\n");
|
Printf(f->code,"return SUCCESS;\n");
|
||||||
|
|
@ -1298,9 +1298,9 @@ public:
|
||||||
/* Error handling code */
|
/* Error handling code */
|
||||||
Printf(f->code,"fail:\n");
|
Printf(f->code,"fail:\n");
|
||||||
Printv(f->code,cleanup,NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
Printv(f->code,"zend_error(ErrorCode(),ErrorMsg());",NIL);
|
Printv(f->code,"zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());",NIL);
|
||||||
|
|
||||||
Printf(f->code, "}\n");
|
Printf(f->code, "}\n");
|
||||||
|
|
||||||
Replaceall(f->code,"$cleanup",cleanup);
|
Replaceall(f->code,"$cleanup",cleanup);
|
||||||
Replaceall(f->code,"$symname",iname);
|
Replaceall(f->code,"$symname",iname);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue