add new %begin directive for inserting code at top of wrapper file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11133 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a1933f7bbc
commit
efa11dee52
31 changed files with 334 additions and 162 deletions
|
|
@ -22,6 +22,7 @@ public:
|
|||
String *f_clhead;
|
||||
String *f_clwrap;
|
||||
bool CWrap; // generate wrapper file for C code?
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_cxx_header;
|
||||
File *f_cxx_wrapper;
|
||||
|
|
@ -127,8 +128,8 @@ int CFFI::top(Node *n) {
|
|||
}
|
||||
|
||||
if (CPlusPlus || CWrap) {
|
||||
f_runtime = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_runtime) {
|
||||
f_begin = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
Close(f_lisp);
|
||||
Delete(f_lisp);
|
||||
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
|
||||
|
|
@ -145,15 +146,17 @@ int CFFI::top(Node *n) {
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
f_runtime = NewString("");
|
||||
f_begin = NewString("");
|
||||
f_clos = NewString("");
|
||||
}
|
||||
|
||||
f_runtime = NewString("");
|
||||
f_cxx_header = f_runtime;
|
||||
f_cxx_wrapper = NewString("");
|
||||
|
||||
Swig_register_filebyname("header", f_cxx_header);
|
||||
Swig_register_filebyname("wrapper", f_cxx_wrapper);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("lisphead", f_clhead);
|
||||
if (!no_swig_lisp)
|
||||
|
|
@ -161,8 +164,9 @@ int CFFI::top(Node *n) {
|
|||
else
|
||||
Swig_register_filebyname("swiglisp", f_null);
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGCFFI\n");
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
|
|
@ -178,8 +182,10 @@ int CFFI::top(Node *n) {
|
|||
Delete(f_cl);
|
||||
Delete(f_clhead);
|
||||
Delete(f_clwrap);
|
||||
Close(f_runtime);
|
||||
Dump(f_runtime, f_begin);
|
||||
Close(f_begin);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
Delete(f_cxx_wrapper);
|
||||
Delete(f_null);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue