Commit ab90c721 authored by Richard Gobeille's avatar Richard Gobeille

Merge branch 'goodbye_lunatic' into 'master'

Remove Lunatic-related code

This removes almost anything related to Lunatic, not just LunaCON. It may remove a bit more than desired, e.g., functions that can be used as possible hooks (I believe that this was one purpose of LUNATIC_EXTERN, now replaced with static anywhere).

Some bits like the optional fix for software rendering of walls with non-POT tile heights remain, albeit they're still compile-time disabled.

As previously written, I still know that Philipp Kutin was spending a lot of time on this.

See merge request terminx/eduke32!13
parents dc0e6cc0 f3b7ab97
......@@ -208,9 +208,6 @@ STRIP := $(CROSS)strip$(CROSS_SUFFIX)
AS := nasm
# LuaJIT standalone interpreter executable:
LUAJIT := luajit$(HOSTEXESUFFIX)
PKG_CONFIG := pkg-config
ELF2DOL := elf2dol
......@@ -344,8 +341,6 @@ STARTUP_WINDOW ?= 1
RETAIL_MENU ?= 0
POLYMER ?= 1
USE_OPENGL := 1
LUNATIC := 0
USE_LUAJIT_2_1 := 0
# Library toggles
HAVE_GTK2 := 1
......@@ -453,11 +448,6 @@ ifneq (0,$(CLANG))
LTO := 0
endif
endif
ifneq ($(LUNATIC),0)
# FIXME: Lunatic builds with LTO don't start up properly as the required
# symbol names are apparently not exported.
override LTO := 0
endif
ifeq (0,$(CLANG))
ifeq (0,$(GCC_PREREQ_4))
override LTO := 0
......@@ -495,8 +485,6 @@ CXXONLYFLAGS := $(CXXSTD) -fno-exceptions -fno-rtti
ASFLAGS := -s #-g
LUAJIT_BCOPTS :=
LINKERFLAGS :=
L_CXXONLYFLAGS :=
......@@ -508,8 +496,6 @@ LIBDIRS :=
##### Mandatory platform parameters
ASFORMAT := elf$(BITS)
# Options to "luajit -b" for synthesis. Since it runs on Linux, we need to tell
# the native LuaJIT to emit PE object files.
ifeq ($(PLATFORM),WINDOWS)
LINKERFLAGS += -static-libgcc -static
ifeq (0,$(CLANG))
......@@ -536,14 +522,6 @@ ifeq ($(PLATFORM),WINDOWS)
ifneq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
LINKERFLAGS += -Wl,--large-address-aware
endif
LUAJIT_BCOPTS := -o windows
ifeq (32,$(BITS))
LUAJIT_BCOPTS += -a x86
endif
ifeq (64,$(BITS))
LUAJIT_BCOPTS += -a x64
endif
else ifeq ($(PLATFORM),DARWIN)
ifneq ($(ARCH),)
ifneq ($(findstring -arch,$(ARCH)),-arch)
......@@ -897,18 +875,6 @@ endif
##### External libraries
ifneq ($(LUNATIC),0)
ifneq ($(USE_LUAJIT_2_1),0)
COMPILERFLAGS += -DUSE_LUAJIT_2_1
endif
ifeq ($(PLATFORM),WINDOWS)
LIBS += -lluajit
else
LIBS += -lluajit-5.1
endif
endif
ifneq (0,$(USE_LIBVPX))
COMPILERFLAGS += -DUSE_LIBVPX
LIBS += -lvpx
......
......@@ -85,23 +85,6 @@ libxmplite_obj := $(obj)/$(libxmplite)
libxmplite_cflags := -DHAVE_ROUND -DLIBXMP_CORE_PLAYER -DBUILDING_STATIC -I$(libxmplite_inc)/libxmp-lite -Wno-unused-parameter -Wno-sign-compare
#### LPeg
lpeg := lpeg
lpeg_objs := \
lpcap.c \
lpcode.c \
lpprint.c \
lptree.c \
lpvm.c \
lpeg_root := $(source)/$(lpeg)
lpeg_src := $(lpeg_root)/src
lpeg_inc := $(lpeg_root)/include
lpeg_obj := $(obj)/$(lpeg)
#### PhysicsFS
physfs := physfs
......@@ -299,9 +282,6 @@ ifeq (1,$(USE_OPENGL))
engine_objs += glbuild.cpp polymer.cpp
endif
endif
ifneq (0,$(LUNATIC))
engine_objs += lunatic.cpp
endif
ifeq ($(PLATFORM),DARWIN)
engine_objs += osxbits.mm
engine_tools_objs += osxbits.mm
......@@ -538,11 +518,6 @@ common_editor_deps := duke3d_common_editor engine_editor
duke3d_game_deps := audiolib mact
duke3d_editor_deps := audiolib
ifneq (0,$(LUNATIC))
duke3d_game_deps += lunatic lunatic_game lpeg
duke3d_editor_deps += lunatic lunatic_editor lpeg
endif
duke3d_game := eduke32
duke3d_editor := mapster32
......@@ -607,83 +582,6 @@ duke3d_editor_miscdeps :=
duke3d_game_orderonlydeps :=
duke3d_editor_orderonlydeps :=
## Lunatic devel
lunatic := lunatic
lunatic_src := $(duke3d_src)/$(lunatic)
lunatic_obj := $(duke3d_obj)
ifneq (0,$(LUNATIC))
COMPILERFLAGS += -I$(lunatic_src) -DLUNATIC
# Determine size of _defs*.lua bytecode once.
ifndef DEFS_BC_SIZE
DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_game.lua -)
DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
endif
ifndef DEFS_M32_BC_SIZE
DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_editor.lua -)
DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE))
endif
duke3d_cflags += -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE)
# Lunatic object base names. These are not used in targets directly.
lunatic_objs := \
defs_common.lua \
engine_maptext.lua \
engine.lua \
bcarray.lua \
bcheck.lua \
bitar.lua \
xmath.lua \
v.lua \
dump.lua \
dis_x86.lua \
dis_x64.lua \
lunatic_game_objs := \
lunatic_game.cpp \
_defs_game.lua \
con_lang.lua \
lunacon.lua \
randgen.lua \
stat.lua \
control.lua \
lunasave.lua \
fs.lua \
lunatic_editor_objs := \
lunatic_editor.cpp \
_defs_editor.lua \
# TODO: remove debugging modules from release build
# now, take care of having the necessary symbols (sector, wall, etc.) in the
# executable no matter what the debugging level
ifeq ($(PLATFORM),DARWIN)
# strip on OSX says: removing global symbols from a final linked no longer supported.
# Use -exported_symbols_list at link time when building
# But, following _their_ directions does not give us the symbols! wtf?
# Instead of using -alias_list and -exported_symbols_list, prevent stripping them.
duke3d_game_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_game_osx
duke3d_editor_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_editor_osx
duke3d_game_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_game_osx
duke3d_editor_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_editor_osx
LINKERFLAGS += -pagezero_size 10000 -image_base 100000000
endif
ifeq ($(PLATFORM),WINDOWS)
override STRIP :=
duke3d_game_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_game.def
duke3d_editor_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_editor.def
endif
ifeq ($(SUBPLATFORM),LINUX)
override STRIP :=
duke3d_game_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_game.lds
duke3d_editor_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_editor.lds
endif
endif
ifeq ($(SUBPLATFORM),LINUX)
LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lasound
endif
......@@ -887,7 +785,6 @@ libraries := \
engine \
glad \
libxmplite \
lpeg \
mact \
voidwrap \
......@@ -1001,27 +898,6 @@ $(voidwrap_lib): $(foreach i,$(voidwrap),$(call expandobjs,$i))
$(RECIPE_IF) $(LINKER) -shared -Wl,-soname,$@ -o $@ $^ $(LIBDIRS) $(voidwrap_root)/sdk/redistributable_bin/$(steamworks_lib) $(RECIPE_RESULT_LINK)
### Lunatic
# Create object files directly with luajit
$(duke3d_obj)/%.$o: $(lunatic_src)/%.lua | $(duke3d_obj)
$(COMPILE_STATUS)
$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
$(duke3d_obj)/%.$o: $(lunatic_src)/%.cpp | $(duke3d_obj)
$(COMPILE_STATUS)
$(RECIPE_IF) $(COMPILER_CXX) $(duke3d_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
# List of exported symbols, OS X
$(duke3d_obj)/lunatic_%_osx: $(lunatic_src)/%.lds | $(duke3d_obj)
sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
# List of exported symbols, Windows
$(duke3d_obj)/lunatic_%.def: $(lunatic_src)/%.lds | $(duke3d_obj)
echo EXPORTS > $@
sed 's/[{};]//g' $< >> $@
### Main Rules
define OBJECTRULES
......
This directory currently resides below eduke32/ because luajit (the stand-alone
LuaJIT interpreter) requires "jit.bcsave" for creating bytecode dumps. However,
there seems to be no way invoke luajit so as to add a directory to its search
path AND create bytecode in one run from a Makefile. Because the build is done
from eduke32/, in this setup, "jit.bcsave" is found since the current working
directory is part of the Lua load path by default.
This diff is collapsed.
......@@ -235,7 +235,6 @@
<ClCompile Include="..\..\source\build\src\jwzgles.c" />
<ClCompile Include="..\..\source\build\src\klzw.cpp" />
<ClCompile Include="..\..\source\build\src\kplib.cpp" />
<ClCompile Include="..\..\source\build\src\lunatic.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
......
......@@ -74,9 +74,6 @@
<ClCompile Include="..\..\source\build\src\kplib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\build\src\lunatic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\build\src\lz4.c">
<Filter>Source Files</Filter>
</ClCompile>
......
/*
** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l);
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
const char *name);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
const char *fname, int szhint);
/* From Lua 5.2. */
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname);
LUALIB_API int luaL_execresult(lua_State *L, int stat);
LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
const char *mode);
LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
const char *name, const char *mode);
LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
int level);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_argcheck(L, cond,numarg,extramsg) \
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *p; /* current position in buffer */
int lvl; /* number of strings in the stack (level) */
lua_State *L;
char buffer[LUAL_BUFFERSIZE];
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
(*(B)->p++ = (char)(c)))
/* compatibility only */
#define luaL_putchar(B,c) luaL_addchar(B,c)
#define luaL_addsize(B,n) ((B)->p += (n))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
/* }====================================================== */
/* compatibility with ref system */
/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
#define luaL_reg luaL_Reg
#endif
This diff is collapsed.
// C++ wrapper for LuaJIT header files.
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "luajit.h"
}
/*
** Configuration header.
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef luaconf_h
#define luaconf_h
#ifndef WINVER
#define WINVER 0x0501
#endif
#include <limits.h>
#include <stddef.h>
/* Default path for loading Lua and C modules with require(). */
#if defined(_WIN32)
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LDIR "!\\lua\\"
#define LUA_CDIR "!\\"
#define LUA_PATH_DEFAULT \
".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
#define LUA_CPATH_DEFAULT \
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
/*
** Note to distribution maintainers: do NOT patch the following lines!
** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
*/
#ifndef LUA_MULTILIB
#define LUA_MULTILIB "lib"
#endif
#ifndef LUA_LMULTILIB
#define LUA_LMULTILIB "lib"
#endif
#define LUA_LROOT "/usr/local"
#define LUA_LUADIR "/lua/5.1/"
#define LUA_LJDIR "/luajit-2.0.4/"
#ifdef LUA_ROOT
#define LUA_JROOT LUA_ROOT
#define LUA_RLDIR LUA_ROOT "/share" LUA_LUADIR
#define LUA_RCDIR LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
#define LUA_RLPATH ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
#define LUA_RCPATH ";" LUA_RCDIR "?.so"
#else
#define LUA_JROOT LUA_LROOT
#define LUA_RLPATH
#define LUA_RCPATH
#endif
#define LUA_JPATH ";" LUA_JROOT "/share" LUA_LJDIR "?.lua"
#define LUA_LLDIR LUA_LROOT "/share" LUA_LUADIR
#define LUA_LCDIR LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
#define LUA_LLPATH ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
#define LUA_LCPATH1 ";" LUA_LCDIR "?.so"
#define LUA_LCPATH2 ";" LUA_LCDIR "loadall.so"
#define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
#define LUA_CPATH_DEFAULT "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
#endif
/* Environment variable names for path overrides and initialization code. */
#define LUA_PATH "LUA_PATH"
#define LUA_CPATH "LUA_CPATH"
#define LUA_INIT "LUA_INIT"
/* Special file system characters. */
#if defined(_WIN32)
#define LUA_DIRSEP "\\"
#else
#define LUA_DIRSEP "/"
#endif
#define LUA_PATHSEP ";"
#define LUA_PATH_MARK "?"
#define LUA_EXECDIR "!"
#define LUA_IGMARK "-"
#define LUA_PATH_CONFIG \
LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
LUA_EXECDIR "\n" LUA_IGMARK
/* Quoting in error messages. */
#define LUA_QL(x) "'" x "'"
#define LUA_QS LUA_QL("%s")
/* Various tunables. */
#define LUAI_MAXSTACK 65500 /* Max. # of stack slots for a thread (<64K). */
#define LUAI_MAXCSTACK 64000 /*8000*/ /* Max. # of stack slots for a C func (<10K). */
#define LUAI_GCPAUSE 200 /* Pause GC until memory is at 200%. */
#define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
#define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
/* Compatibility with older library function names. */
#define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
#define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */
/* Configuration for the frontend (the luajit executable). */
#if defined(luajit_c)
#define LUA_PROGNAME "luajit" /* Fallback frontend name. */
#define LUA_PROMPT "> " /* Interactive prompt. */
#define LUA_PROMPT2 ">> " /* Continuation prompt. */
#define LUA_MAXINPUT 512 /* Max. input line length. */
#endif
/* Note: changing the following defines breaks the Lua 5.1 ABI. */
#define LUA_INTEGER ptrdiff_t
#define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
/*
** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
** unreasonable amounts of stack space, but still retain ABI compatibility.
** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
*/
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
/* The following defines are here only for compatibility with luaconf.h
** from the standard Lua distribution. They must not be changed for LuaJIT.
*/
#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER double
#define LUAI_UACNUMBER double
#define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_FMT "%.14g"
#define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32
#define LUA_INTFRMLEN "l"
#define LUA_INTFRM_T long
/* Linkage of public API functions. */
#if defined(LUA_BUILD_AS_DLL)
#if defined(LUA_CORE) || defined(LUA_LIB)
#define LUA_API __declspec(dllexport)
#else
#define LUA_API __declspec(dllimport)
#endif
#else
#define LUA_API extern
#endif
#define LUALIB_API LUA_API
/* Support for internal assertions. */
#if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
#include <assert.h>
#endif
#ifdef LUA_USE_ASSERT
#define lua_assert(x) assert(x)
#endif
#ifdef LUA_USE_APICHECK
#define luai_apicheck(L, o) { (void)L; assert(o); }
#else
#define luai_apicheck(L, o) { (void)L; }
#endif
#endif
/*
** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
**
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
**
** 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,