Lua fix for -external-runtime

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13119 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-05-24 23:05:07 +00:00
commit 49b6c39d98
4 changed files with 47 additions and 30 deletions

View file

@ -284,12 +284,7 @@ public:
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGLUA\n");
if (elua_ltr)
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUA\n");
else if (eluac_ltr)
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUAC\n");
else
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA\n");
emitLuaFlavor(f_runtime);
if (nomoduleglobal) {
Printf(f_runtime, "#define SWIG_LUA_NO_MODULE_GLOBAL\n");
@ -1269,6 +1264,9 @@ public:
String *runtimeCode() {
String *s = NewString("");
const char *filenames[] = { "luarun.swg", 0 } ; // must be 0 terminated
emitLuaFlavor(s);
String *sfile;
for (int i = 0; filenames[i] != 0; i++) {
sfile = Swig_include_sys(filenames[i]);
@ -1279,6 +1277,7 @@ public:
Delete(sfile);
}
}
return s;
}
@ -1290,6 +1289,16 @@ public:
* helpers
* --------------------------------------------------------------------- */
void emitLuaFlavor(String *s) {
if (elua_ltr)
Printf(s, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUA\n");
else if (eluac_ltr)
Printf(s, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUAC\n");
else
Printf(s, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA\n");
}
/* This is to convert the string of Lua code into a proper string, which can then be
emitted into the C/C++ code.
Basically is is a lot of search & replacing of odd sequences