From 75d25d0d155ff874cb1b088aa50d37dd2f673d7a Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 9 Jun 2017 06:39:18 +0000 Subject: [PATCH] LPeg: Necessary changes for building in our environment and with our project. See lpeg-lunatic.patch. git-svn-id: https://svn.eduke32.com/eduke32@6156 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/elauxlib.h | 19 +++++++++++++++++++ source/build/include/elua.h | 19 +++++++++++++++++++ source/build/include/lunatic.h | 15 +-------------- source/lpeg/Dependencies.mak | 6 ++++++ source/lpeg/src/lpcap.c | 4 ++-- source/lpeg/src/lpcode.c | 4 ++-- source/lpeg/src/lpcode.h | 2 +- source/lpeg/src/lptree.c | 7 +++++-- source/lpeg/src/lptypes.h | 2 +- source/lpeg/src/lpvm.c | 4 ++-- 10 files changed, 58 insertions(+), 24 deletions(-) create mode 100644 source/build/include/elauxlib.h create mode 100644 source/build/include/elua.h create mode 100644 source/lpeg/Dependencies.mak diff --git a/source/build/include/elauxlib.h b/source/build/include/elauxlib.h new file mode 100644 index 000000000..e5e3dba16 --- /dev/null +++ b/source/build/include/elauxlib.h @@ -0,0 +1,19 @@ + +#ifndef elauxlib_h_ +#define elauxlib_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef USE_LUAJIT_2_1 +# include +#else +# include +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/build/include/elua.h b/source/build/include/elua.h new file mode 100644 index 000000000..b3bc611cc --- /dev/null +++ b/source/build/include/elua.h @@ -0,0 +1,19 @@ + +#ifndef elua_h_ +#define elua_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef USE_LUAJIT_2_1 +# include +#else +# include +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/build/include/lunatic.h b/source/build/include/lunatic.h index d2c9b71a2..21fc66fb3 100644 --- a/source/build/include/lunatic.h +++ b/source/build/include/lunatic.h @@ -3,20 +3,7 @@ #ifndef ENGINE_LUNATIC_H_ #define ENGINE_LUNATIC_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef USE_LUAJIT_2_1 -# include -#else -# include -#endif - -#ifdef __cplusplus -} -#endif - +#include "elua.h" typedef struct { diff --git a/source/lpeg/Dependencies.mak b/source/lpeg/Dependencies.mak new file mode 100644 index 000000000..8ce9cbfff --- /dev/null +++ b/source/lpeg/Dependencies.mak @@ -0,0 +1,6 @@ + +$(LPEG_OBJ)/lpcap.$o: $(addprefix $(LPEG_SRC)/,lpcap.c lpcap.h lptypes.h) +$(LPEG_OBJ)/lpcode.$o: $(addprefix $(LPEG_SRC)/,lpcode.c lptypes.h lpcode.h lptree.h lpvm.h lpcap.h) +$(LPEG_OBJ)/lpprint.$o: $(addprefix $(LPEG_SRC)/,lpprint.c lptypes.h lpprint.h lptree.h lpvm.h lpcap.h) +$(LPEG_OBJ)/lptree.$o: $(addprefix $(LPEG_SRC)/,lptree.c lptypes.h lpcap.h lpcode.h lptree.h lpvm.h lpprint.h) +$(LPEG_OBJ)/lpvm.$o: $(addprefix $(LPEG_SRC)/,lpvm.c lpcap.h lptypes.h lpvm.h lpprint.h lptree.h) diff --git a/source/lpeg/src/lpcap.c b/source/lpeg/src/lpcap.c index c9085de06..978ad90e8 100644 --- a/source/lpeg/src/lpcap.c +++ b/source/lpeg/src/lpcap.c @@ -3,8 +3,8 @@ ** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license) */ -#include "lua.h" -#include "lauxlib.h" +#include "elua.h" +#include "elauxlib.h" #include "lpcap.h" #include "lptypes.h" diff --git a/source/lpeg/src/lpcode.c b/source/lpeg/src/lpcode.c index 2722d716b..2d33febd4 100644 --- a/source/lpeg/src/lpcode.c +++ b/source/lpeg/src/lpcode.c @@ -6,8 +6,8 @@ #include -#include "lua.h" -#include "lauxlib.h" +#include "elua.h" +#include "elauxlib.h" #include "lptypes.h" #include "lpcode.h" diff --git a/source/lpeg/src/lpcode.h b/source/lpeg/src/lpcode.h index 2a5861ef0..5eb4a959d 100644 --- a/source/lpeg/src/lpcode.h +++ b/source/lpeg/src/lpcode.h @@ -5,7 +5,7 @@ #if !defined(lpcode_h) #define lpcode_h -#include "lua.h" +#include "elua.h" #include "lptypes.h" #include "lptree.h" diff --git a/source/lpeg/src/lptree.c b/source/lpeg/src/lptree.c index bda61b91b..7f55ab2eb 100644 --- a/source/lpeg/src/lptree.c +++ b/source/lpeg/src/lptree.c @@ -8,8 +8,8 @@ #include -#include "lua.h" -#include "lauxlib.h" +#include "elua.h" +#include "elauxlib.h" #include "lptypes.h" #include "lpcap.h" @@ -1288,6 +1288,9 @@ static struct luaL_Reg metareg[] = { }; +#ifdef __cplusplus +extern "C" +#endif int luaopen_lpeg (lua_State *L); int luaopen_lpeg (lua_State *L) { luaL_newmetatable(L, PATTERN_T); diff --git a/source/lpeg/src/lptypes.h b/source/lpeg/src/lptypes.h index 8e78bc81b..10ca1b2e7 100644 --- a/source/lpeg/src/lptypes.h +++ b/source/lpeg/src/lptypes.h @@ -16,7 +16,7 @@ #include #include -#include "lua.h" +#include "elua.h" #define VERSION "1.0.1" diff --git a/source/lpeg/src/lpvm.c b/source/lpeg/src/lpvm.c index 05a5f68c8..205581eb1 100644 --- a/source/lpeg/src/lpvm.c +++ b/source/lpeg/src/lpvm.c @@ -7,8 +7,8 @@ #include -#include "lua.h" -#include "lauxlib.h" +#include "elua.h" +#include "elauxlib.h" #include "lpcap.h" #include "lptypes.h"