Skip to content

Commit

Permalink
luaJIT
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Feb 10, 2018
1 parent 3462ebc commit 23a92e1
Show file tree
Hide file tree
Showing 116 changed files with 306 additions and 27,718 deletions.
6 changes: 6 additions & 0 deletions StepmaniaCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ if(WIN32)
link_libraries(${SM_EXTERN_DIR}/MinaCalc/MinaCalc.lib)
include_directories(${SM_EXTERN_DIR}/discord-rpc-2.0.1/include)
link_libraries(${SM_EXTERN_DIR}/discord-rpc-2.0.1/lib/discord-rpc.lib)
link_libraries(${SM_EXTERN_DIR}/LuaJIT/lua51.lib)
include_directories(${SM_EXTERN_DIR}/LuaJIT/include)

if (MINGW AND WITH_FFMPEG)
include("${SM_CMAKE_DIR}/SetupFfmpeg.cmake")
Expand Down Expand Up @@ -305,6 +307,8 @@ elseif(MACOSX)


link_libraries(${SM_EXTERN_DIR}/MinaCalc/libMinaCalc.a)
link_libraries(${SM_EXTERN_DIR}/LuaJIT/lua51Mac.a)
include_directories(${SM_EXTERN_DIR}/LuaJIT/include)

set(SYSTEM_PCRE_FOUND FALSE)
set(WITH_CRASH_HANDLER TRUE)
Expand Down Expand Up @@ -357,6 +361,8 @@ elseif(LINUX)
endif()

link_libraries(${SM_EXTERN_DIR}/MinaCalc/MinaCalc.a)
link_libraries(${SM_EXTERN_DIR}/LuaJIT/lua51.a)
include_directories(${SM_EXTERN_DIR}/LuaJIT/include)

find_package(X11)
if(${X11_FOUND})
Expand Down
4 changes: 2 additions & 2 deletions Themes/_fallback/Scripts/02 ActorDef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ setmetatable( Def, {
local info = debug.getinfo(level,"Sl");

-- Source file of caller:
local Source = info.source
local Source = info and info.source or ""
t._Source = Source

t._Dir = DebugPathToRealPath( Source )

-- Line number of caller:
t._Line = info.currentline
t._Line = info and info.currentline or 0

setmetatable( t, DefMetatable )
return t
Expand Down
1 change: 0 additions & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include(CMakeProject-lua.cmake)
include(CMakeProject-glew.cmake)
include(CMakeProject-json.cmake)
if (APPLE OR MSVC)
Expand Down
72 changes: 0 additions & 72 deletions extern/CMakeProject-lua.cmake

This file was deleted.

Binary file added extern/LuaJIT/buildvm.lib
Binary file not shown.
27 changes: 10 additions & 17 deletions extern/lua-5.1/src/lauxlib.h → extern/LuaJIT/include/lauxlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,18 @@
#include "lua.h"


#if defined(LUA_COMPAT_GETN)
LUALIB_API int (luaL_getn) (lua_State *L, int t);
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
#else
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif

#if defined(LUA_COMPAT_OPENLIB)
#define luaI_openlib luaL_openlib
#endif


/* 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 (luaI_openlib) (lua_State *L, const char *libname,
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);
Expand Down Expand Up @@ -88,7 +75,15 @@ LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
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);


/*
Expand Down Expand Up @@ -170,5 +165,3 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
#define luaL_reg luaL_Reg

#endif


19 changes: 12 additions & 7 deletions extern/lua-5.1/src/lua.h → extern/LuaJIT/include/lua.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $
** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
** Lua - An Extensible Extension Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
Expand All @@ -17,10 +17,10 @@


#define LUA_VERSION "Lua 5.1"
#define LUA_RELEASE "Lua 5.1.5"
#define LUA_RELEASE "Lua 5.1.4"
#define LUA_VERSION_NUM 501
#define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"


/* mark for precompiled code (`<esc>Lua') */
Expand Down Expand Up @@ -245,7 +245,7 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);



/*
/*
** ===============================================================
** some useful macros
** ===============================================================
Expand Down Expand Up @@ -336,12 +336,17 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);

LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
LUA_API lua_Hook lua_gethook (lua_State *L);
LUA_API int lua_gethookmask (lua_State *L);
LUA_API int lua_gethookcount (lua_State *L);

/* From Lua 5.2. */
LUA_API void *lua_upvalueid (lua_State *L, int idx, int n);
LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2);
LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,
const char *chunkname, const char *mode);


struct lua_Debug {
int event;
Expand All @@ -362,7 +367,7 @@ struct lua_Debug {


/******************************************************************************
* Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved.
* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
Expand Down
156 changes: 156 additions & 0 deletions extern/LuaJIT/include/luaconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
** Configuration header.
** Copyright (C) 2005-2017 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.5/"

#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 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
Loading

0 comments on commit 23a92e1

Please sign in to comment.