Просмотр исходного кода

Support build for Lua 5.1 (for LuaJIT), Lua 5.2 and Lua 5.3 (Step 3/?)

See #195
bel 10 лет назад
Родитель
Сommit
5f189803bb
3 измененных файлов с 7 добавлено и 14 удалено
  1. 1 1
      src/civetweb_private_lua.h
  2. 3 9
      src/main.c
  3. 3 4
      src/mod_lua.inl

+ 1 - 1
src/lua_civet.h → src/civetweb_private_lua.h

@@ -2,4 +2,4 @@
 /* Project internal header to allow main.c to call a non-public function in
  * mod_lua.inl */
 
-void lua_civet_open_all_libs(lua_State *L);
+void civetweb_open_lua_libs(lua_State *L);

+ 3 - 9
src/main.c

@@ -651,15 +651,9 @@ static void set_absolute_path(char *options[],
 }
 
 #ifdef USE_LUA
-#include "lua.h"
-#include "lauxlib.h"
-#include "lua_civet.h"
-
-#if LUA_VERSION_NUM == 501
-/* Lua 5.1 detected */
-#define LUA_OK 0
-#endif
 
+#include "civetweb_lua.h"
+#include "civetweb_private_lua.h"
 
 static int run_lua(const char *file_name)
 {
@@ -677,7 +671,7 @@ static int run_lua(const char *file_name)
 		fprintf(stderr, "Error: Cannot create Lua state\n");
 		return EXIT_FAILURE;
 	}
-	lua_civet_open_all_libs(L);
+	civetweb_open_lua_libs(L);
 
 	lua_ret = luaL_loadfile(L, file_name);
 	if (lua_ret != LUA_OK) {

+ 3 - 4
src/mod_lua.inl

@@ -1,6 +1,5 @@
 #include "civetweb_lua.h"
-
-#include "lua_civet.h"
+#include "civetweb_private_lua.h"
 
 #ifdef _WIN32
 static void *
@@ -1100,7 +1099,7 @@ static void prepare_lua_request_info(struct mg_connection *conn, lua_State *L)
 	lua_rawset(L, -3);
 }
 
-void lua_civet_open_all_libs(lua_State *L)
+void civetweb_open_lua_libs(lua_State *L)
 {
 	{
 		extern void luaL_openlibs(lua_State *);
@@ -1144,7 +1143,7 @@ static void prepare_lua_environment(struct mg_context *ctx,
                                     const char *script_name,
                                     int lua_env_type)
 {
-	lua_civet_open_all_libs(L);
+	civetweb_open_lua_libs(L);
 
 #if LUA_VERSION_NUM != 501
 	luaL_newmetatable(L, LUASOCKET);