Added support for %minit, %mshutdown, %rinit, %rshutdown user supplied code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7401 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e974e259b7
commit
cce19f492a
2 changed files with 28 additions and 7 deletions
|
|
@ -13,9 +13,23 @@
|
||||||
%include "globalvar.i" // Global variables.
|
%include "globalvar.i" // Global variables.
|
||||||
%include "const.i"
|
%include "const.i"
|
||||||
|
|
||||||
|
// use %init %{ "/*code goes here*/ " %}
|
||||||
|
// or %minit %{ "/* code goes here*/ " %} to
|
||||||
|
// insert code in the PHP_MINIT_FUNCTION
|
||||||
|
#define %minit %insert("init")
|
||||||
|
|
||||||
|
// use %rinit %{ "/* code goes here*/ " %} to
|
||||||
|
// insert code in the PHP_RINIT_FUNCTION
|
||||||
|
#define %rinit %insert("rinit")
|
||||||
|
|
||||||
// use %shutdown %{ " /*code goes here*/ " %} to
|
// use %shutdown %{ " /*code goes here*/ " %} to
|
||||||
// insert code in the PHP_MSHUTDOWN_FUNCTION
|
// insert code in the PHP_MSHUTDOWN_FUNCTION
|
||||||
#define %shutdown %insert("shutdown")
|
#define %shutdown %insert("shutdown")
|
||||||
|
#define %mshutdown %insert("shutdown")
|
||||||
|
|
||||||
|
// use %rshutdown %{ " /*code goes here*/" %} to
|
||||||
|
// insert code in the PHP_RSHUTDOWN_FUNCTION
|
||||||
|
#define %rshutdown %insert("rshutdown")
|
||||||
|
|
||||||
/* Typemaps for input parameters by value */
|
/* Typemaps for input parameters by value */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,12 @@ static String *phpfilename =0;
|
||||||
static String *s_header;
|
static String *s_header;
|
||||||
static String *s_wrappers;
|
static String *s_wrappers;
|
||||||
static String *s_init;
|
static String *s_init;
|
||||||
static String *s_shutdown;
|
static String *r_init; // RINIT user code
|
||||||
static String *s_vinit;
|
static String *s_shutdown; // MSHUTDOWN user code
|
||||||
|
static String *r_shutdown; // RSHUTDOWN user code
|
||||||
|
static String *s_vinit; // varinit initialization code.
|
||||||
static String *s_vdecl;
|
static String *s_vdecl;
|
||||||
static String *s_cinit;
|
static String *s_cinit; // consttab initialization code.
|
||||||
static String *s_oinit;
|
static String *s_oinit;
|
||||||
static String *s_entry;
|
static String *s_entry;
|
||||||
static String *cs_entry;
|
static String *cs_entry;
|
||||||
|
|
@ -534,7 +536,9 @@ public:
|
||||||
|
|
||||||
/* sections of the output file */
|
/* sections of the output file */
|
||||||
s_init = NewString("/* init section */\n");
|
s_init = NewString("/* init section */\n");
|
||||||
|
r_init = NewString("/* rinit section */\n");
|
||||||
s_shutdown = NewString("/* shutdown section */\n");
|
s_shutdown = NewString("/* shutdown section */\n");
|
||||||
|
r_shutdown = NewString("/* rshutdown section */\n");
|
||||||
s_header = NewString("/* header section */\n");
|
s_header = NewString("/* header section */\n");
|
||||||
s_wrappers = NewString("/* wrapper section */\n");
|
s_wrappers = NewString("/* wrapper section */\n");
|
||||||
s_type = NewString("");
|
s_type = NewString("");
|
||||||
|
|
@ -548,7 +552,9 @@ public:
|
||||||
/* Register file targets with the SWIG file handler */
|
/* Register file targets with the SWIG file handler */
|
||||||
Swig_register_filebyname("runtime",f_runtime);
|
Swig_register_filebyname("runtime",f_runtime);
|
||||||
Swig_register_filebyname("init",s_init);
|
Swig_register_filebyname("init",s_init);
|
||||||
|
Swig_register_filebyname("rinit",r_init);
|
||||||
Swig_register_filebyname("shutdown",s_shutdown);
|
Swig_register_filebyname("shutdown",s_shutdown);
|
||||||
|
Swig_register_filebyname("rshutdown",r_shutdown);
|
||||||
Swig_register_filebyname("header",s_header);
|
Swig_register_filebyname("header",s_header);
|
||||||
Swig_register_filebyname("wrapper",s_wrappers);
|
Swig_register_filebyname("wrapper",s_wrappers);
|
||||||
|
|
||||||
|
|
@ -724,18 +730,18 @@ public:
|
||||||
|
|
||||||
// Now do REQUEST init which holds cinit and vinit
|
// Now do REQUEST init which holds cinit and vinit
|
||||||
Printf(s_init,"PHP_RINIT_FUNCTION(%s)\n{\n",module);
|
Printf(s_init,"PHP_RINIT_FUNCTION(%s)\n{\n",module);
|
||||||
|
Printf(s_init,"%s\n",r_init);
|
||||||
Printf(s_init,"%s\n",s_cinit);
|
Printf(s_init,"%s\n",s_cinit);
|
||||||
Clear(s_cinit);
|
Clear(s_cinit);
|
||||||
|
Delete(s_cinit);
|
||||||
|
|
||||||
Printf(s_init, "%s\n", s_vinit);
|
Printf(s_init, "%s\n", s_vinit);
|
||||||
Clear(s_vinit);
|
Clear(s_vinit);
|
||||||
|
Delete(s_vinit);
|
||||||
|
|
||||||
Printf(s_init," return SUCCESS;\n");
|
Printf(s_init," return SUCCESS;\n");
|
||||||
Printf(s_init,"}\n");
|
Printf(s_init,"}\n");
|
||||||
|
|
||||||
Delete(s_cinit);
|
|
||||||
Delete(s_vinit);
|
|
||||||
|
|
||||||
Printf(s_init,"PHP_MSHUTDOWN_FUNCTION(%s)\n{\n",module);
|
Printf(s_init,"PHP_MSHUTDOWN_FUNCTION(%s)\n{\n",module);
|
||||||
Printf(s_init,"%s\n",s_shutdown);
|
Printf(s_init,"%s\n",s_shutdown);
|
||||||
|
|
@ -743,6 +749,7 @@ public:
|
||||||
Printf(s_init,"}\n");
|
Printf(s_init,"}\n");
|
||||||
|
|
||||||
Printf(s_init,"PHP_RSHUTDOWN_FUNCTION(%s)\n{\n",module);
|
Printf(s_init,"PHP_RSHUTDOWN_FUNCTION(%s)\n{\n",module);
|
||||||
|
Printf(s_init,"%s\n",r_shutdown);
|
||||||
Printf(s_init," return SUCCESS;\n");
|
Printf(s_init," return SUCCESS;\n");
|
||||||
Printf(s_init,"}\n");
|
Printf(s_init,"}\n");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue