From 5d78ede9d59d5b363f64786d916da9541cfb1878 Mon Sep 17 00:00:00 2001 From: Mark Gossage Date: Mon, 17 Jul 2006 09:33:10 +0000 Subject: [PATCH] addition to support the -external-runtime command line option git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9215 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/lua.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/SWIG/Source/Modules/lua.cxx b/SWIG/Source/Modules/lua.cxx index 30227370e..680a33f74 100644 --- a/SWIG/Source/Modules/lua.cxx +++ b/SWIG/Source/Modules/lua.cxx @@ -1038,6 +1038,38 @@ NEW LANGUAGE NOTE:END ************************************************/ virtual int staticmembervariableHandler(Node *n) { return Language::staticmembervariableHandler(n); } + + /* --------------------------------------------------------------------- + * external runtime generation + * --------------------------------------------------------------------- */ + + /* This is to support the usage + SWIG -external-runtime + The code consists of two functions: + String *runtimeCode() // returns a large string with all the runtimes in + String *defaultExternalRuntimeFilename() // returns the default filename + I an writing a generic solution, even though SWIG-Lua only has one file right now... + */ + String *runtimeCode() { + String *s = NewString(""); + const char* filenames[]={"luarun.swg",0}; // must be 0 termiated + String *sfile; + for (int i=0;filenames[i]!=0;i++) { + sfile = Swig_include_sys(filenames[i]); + if (!sfile) { + Printf(stderr, "*** Unable to open '%s'\n",filenames[i]); + } else { + Append(s, sfile); + Delete(sfile); + } + } + + return s; + } + + String *defaultExternalRuntimeFilename() { + return NewString("swigluarun.h"); + } }; /* NEW LANGUAGE NOTE:***********************************************