Added a centralized method to manage Lua compatibility build options. - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/gsl-shell.c
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2011年02月02日 18:13:11 +0100
committerfrancesco-ST <francesco.abbate@st.com>2011年02月02日 18:13:11 +0100
commit87feed1b8c36fd42a3750d01382a4978971416cc (patch)
tree90f68f0d96a64b3f8ea14fb59655c8154808a24f /gsl-shell.c
parent00cb071098589dc5824509d7e7786fde16a00ff2 (diff)
downloadgsl-shell-87feed1b8c36fd42a3750d01382a4978971416cc.tar.gz
Added a centralized method to manage Lua compatibility build options.
The build is controlled by the variable LUA_COMPATIBLE in makeconfig. The possible values are 'no', 'yes' and 'strict'.
Diffstat (limited to 'gsl-shell.c')
-rw-r--r--gsl-shell.c 15
1 files changed, 6 insertions, 9 deletions
diff --git a/gsl-shell.c b/gsl-shell.c
index 691b340c..f716296d 100644
--- a/gsl-shell.c
+++ b/gsl-shell.c
@@ -85,7 +85,7 @@ static const luaL_Reg gshlibs[] = {
{LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string},
-#if 0
+#ifdef LUA_STRICT
{LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
{MLUA_GSLLIBNAME, luaopen_gsl},
@@ -135,6 +135,7 @@ gsl_shell_openlibs (lua_State *L)
lua_call(L, 1, 0);
}
+#ifndef LUA_STRICT
lua_pushvalue (L, LUA_GLOBALSINDEX); /* open math in global scope */
lua_setglobal (L, LUA_MATHLIBNAME);
luaopen_math (L);
@@ -148,6 +149,7 @@ gsl_shell_openlibs (lua_State *L)
lua_pop (L, 1);
lua_pushnil (L); /* remove gsl */
lua_setglobal (L, MLUA_GSLLIBNAME);
+#endif
}
static void l_message (const char *pname, const char *msg) {
@@ -495,9 +497,11 @@ static int pmain (lua_State *L) {
lua_gc(L, LUA_GCRESTART, 0);
dolibrary (L, "base");
- dolibrary (L, "igsl");
dolibrary (L, "integ");
+#ifndef LUA_STRICT
+ dolibrary (L, "igsl");
dolibrary (L, "draw");
+#endif
s->status = handle_luainit(L);
if (s->status != 0) return 0;
@@ -544,13 +548,6 @@ int main (int argc, char **argv) {
l_message(argv[0], "cannot create state: not enough memory");
return EXIT_FAILURE;
}
- /* Checking 'sizeof(lua_Integer)' cannot be made in preprocessor on all compilers.
- */
-#ifdef LNUM_INT32
- lua_assert( sizeof(lua_Integer) == 4 );
-#elif defined(LNUM_INT64)
- lua_assert( sizeof(lua_Integer) == 8 );
-#endif
s.argc = argc;
s.argv = argv;
status = lua_cpcall(L, &pmain, &s);
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月26日 14:05:42 +0000

AltStyle によって変換されたページ (->オリジナル) /