mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
Support build for Lua 5.1 (for LuaJIT), Lua 5.2 and Lua 5.3 (Step 2/?)
See #195
This commit is contained in:
@@ -119,7 +119,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;CONSOLE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;CONSOLE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_IPV6;LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;USE_LUA_FILE_SYSTEM;USE_WEBSOCKET;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party;$(ProjectDir)..\..\src\third_party\lua-5.2.4\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -209,6 +209,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\include\civetweb.h" />
|
<ClInclude Include="..\..\include\civetweb.h" />
|
||||||
|
<ClInclude Include="..\..\src\third_party\civetweb_lua.h" />
|
||||||
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lauxlib.h" />
|
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lauxlib.h" />
|
||||||
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lua.h" />
|
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lua.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -30,6 +30,9 @@
|
|||||||
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lauxlib.h">
|
<ClInclude Include="..\..\src\third_party\lua-5.2.4\src\lauxlib.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\third_party\civetweb_lua.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\civetweb.c">
|
<ClCompile Include="..\..\src\civetweb.c">
|
||||||
|
|||||||
@@ -1,29 +1,7 @@
|
|||||||
#include <lua.h>
|
#include "civetweb_lua.h"
|
||||||
#include <lauxlib.h>
|
|
||||||
#include "lua_civet.h"
|
#include "lua_civet.h"
|
||||||
|
|
||||||
#ifndef LUA_VERSION_NUM
|
|
||||||
#error "Unknown Lua version"
|
|
||||||
|
|
||||||
#elif LUA_VERSION_NUM == 501
|
|
||||||
/* Lua 5.1 detected */
|
|
||||||
#define LUA_OK 0
|
|
||||||
#define LUA_ERRGCMM 999 /* not supported */
|
|
||||||
#define mg_lua_load(a,b,c,d,e) lua_load(a,b,c,d)
|
|
||||||
#define lua_rawlen lua_objlen
|
|
||||||
#define lua_newstate(a, b) luaL_newstate() /* Must use luaL_newstate() for 64 bit target */
|
|
||||||
|
|
||||||
#elif LUA_VERSION_NUM == 502
|
|
||||||
/* Lua 5.2 detected */
|
|
||||||
#define mg_lua_load lua_load
|
|
||||||
|
|
||||||
#elif LUA_VERSION_NUM == 503
|
|
||||||
/* Lua 5.3 detected */
|
|
||||||
#define mg_lua_load lua_load
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static void *
|
static void *
|
||||||
mmap(void *addr, int64_t len, int prot, int flags, int fd, int offset)
|
mmap(void *addr, int64_t len, int prot, int flags, int fd, int offset)
|
||||||
|
|||||||
56
src/third_party/civetweb_lua.h
vendored
Normal file
56
src/third_party/civetweb_lua.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright (c) 2015 the Civetweb developers
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This header is intended to support Lua 5.1, Lua 5.2 and Lua 5.3 in the same
|
||||||
|
* C source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CIVETWEB_LUA_H
|
||||||
|
#define CIVETWEB_LUA_H
|
||||||
|
|
||||||
|
#define LUA_LIB
|
||||||
|
#include "lua.h"
|
||||||
|
#include "lauxlib.h"
|
||||||
|
#include "lualib.h"
|
||||||
|
|
||||||
|
#ifndef LUA_VERSION_NUM
|
||||||
|
#error "Unknown Lua version"
|
||||||
|
|
||||||
|
#elif LUA_VERSION_NUM == 501
|
||||||
|
/* Lua 5.1 detected */
|
||||||
|
#define LUA_OK 0
|
||||||
|
#define LUA_ERRGCMM 999 /* not supported */
|
||||||
|
#define mg_lua_load(a,b,c,d,e) lua_load(a,b,c,d)
|
||||||
|
#define lua_rawlen lua_objlen
|
||||||
|
#define lua_newstate(a, b) luaL_newstate() /* Must use luaL_newstate() for 64 bit target */
|
||||||
|
#define lua_pushinteger lua_pushnumber
|
||||||
|
|
||||||
|
#elif LUA_VERSION_NUM == 502
|
||||||
|
/* Lua 5.2 detected */
|
||||||
|
#define mg_lua_load lua_load
|
||||||
|
|
||||||
|
#elif LUA_VERSION_NUM == 503
|
||||||
|
/* Lua 5.3 detected */
|
||||||
|
#define mg_lua_load lua_load
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* #ifndef CIVETWEB_LUA_H */
|
||||||
4
src/third_party/lfs.c
vendored
4
src/third_party/lfs.c
vendored
@@ -64,9 +64,7 @@
|
|||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <lua.h>
|
#include "civetweb_lua.h"
|
||||||
#include <lauxlib.h>
|
|
||||||
#include <lualib.h>
|
|
||||||
|
|
||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
|
||||||
|
|||||||
8
src/third_party/lsqlite3.c
vendored
8
src/third_party/lsqlite3.c
vendored
@@ -30,13 +30,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define LUA_LIB
|
#include "civetweb_lua.h"
|
||||||
#include "lua.h"
|
|
||||||
#include "lauxlib.h"
|
|
||||||
|
|
||||||
#if LUA_VERSION_NUM == 501
|
|
||||||
#define lua_pushinteger lua_pushnumber
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LUA_VERSION_NUM > 501
|
#if LUA_VERSION_NUM > 501
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user