Skip to content

Commit f8f9e22

Browse files
committed
Merge remote-tracking branch 'upstream/master' into july
2 parents afafb03 + 2638dc4 commit f8f9e22

File tree

482 files changed

+37956
-5150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+37956
-5150
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ IF(WITH_LUA51)
1717
SET(LUA_EXE_NAME lua)
1818
SET(LUA_VERSION 5.1)
1919
ADD_SUBDIRECTORY(lua-5.1)
20+
ELSEIF(WITH_LUA51RC)
21+
SET(LUA_EXE_NAME lua)
22+
SET(LUA_VERSION 5.1)
23+
ADD_SUBDIRECTORY(lua-5.1-rc)
2024
ELSEIF(WITH_LUA52)
2125
SET(LUA_EXE_NAME lua)
2226
SET(LUA_VERSION 5.2)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ In addition,
2121

2222
- Readline support for LuaJIT.
2323

24+
- Experimental: Lua 5.1 with [reference counting](https://github.com/jjensen/luaplus51-all/).
25+
2426
# Pre-requisites
2527

2628
Install [CMake](http://cmake.org) on your system.
@@ -54,5 +56,6 @@ Note: we do not recommend (nor we support) installation under Cygwin.
5456
## Additional CMake flags
5557

5658
- If you prefer vanilla Lua 5.1 instead of LuaJIT, use `-DWITH_LUA51=ON`
59+
- If you prefer vanilla Lua 5.1 with reference counting instead of LuaJIT, use `-DWITH_LUA51RC=ON` (*experimental*)
5760
- If you prefer vanilla Lua 5.2 instead of LuaJIT, use `-DWITH_LUA52=ON`
5861
- If you prefer LuaJIT 2.1 instead of LuaJIT 2.0, use `-DWITH_LUAJIT21=ON`

lua-5.1-rc/CMakeLists.txt

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# -*- cmake -*-
2+
3+
PROJECT(Lua)
4+
5+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
6+
CMAKE_POLICY(VERSION 2.6)
7+
8+
ADD_DEFINITIONS(-DLUA_REFCOUNT=1)
9+
10+
SET(CMAKE_MODULE_PATH
11+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
12+
"${CMAKE_MODULE_PATH}")
13+
14+
SET(INSTALL_INCLUDE_SUBDIR "include" CACHE STRING "installation include subdirectory name")
15+
IF(WIN32)
16+
SET(INSTALL_BIN_SUBDIR "." CACHE STRING "installation executable subdirectory name")
17+
SET(INSTALL_LIB_SUBDIR "." CACHE STRING "installation library subdirectory name")
18+
SET(INSTALL_LUA_PATH_SUBDIR "lua") # not editable
19+
SET(INSTALL_LUA_CPATH_SUBDIR ".") # not editable
20+
ELSE()
21+
SET(INSTALL_BIN_SUBDIR "bin" CACHE STRING "installation executable subdirectory name")
22+
SET(INSTALL_LIB_SUBDIR "lib" CACHE STRING "installation library subdirectory name")
23+
SET(INSTALL_LUA_PATH_SUBDIR "share/lua/5.1") # not editable
24+
SET(INSTALL_LUA_LIB_SUBDIR "lib" CACHE STRING "installation lua lib subdirectory name")
25+
SET(INSTALL_LUA_CPATH_SUBDIR "${INSTALL_LUA_LIB_SUBDIR}/lua/5.1") # not editable
26+
ENDIF()
27+
28+
IF(UNIX)
29+
# IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
30+
# ADD_DEFINITIONS(-DLUA_ROOT="${CMAKE_INSTALL_PREFIX}")
31+
# ENDIF()
32+
SET(LUA_ROOT "${CMAKE_INSTALL_PREFIX}")
33+
ENDIF()
34+
35+
# Readline support
36+
FIND_PACKAGE(Readline)
37+
IF(READLINE_FOUND)
38+
SET(LUA_USE_READLINE 1)
39+
LIST(APPEND LIBS ${READLINE_LIBRARIES})
40+
INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
41+
ENDIF(READLINE_FOUND)
42+
43+
INCLUDE(CheckLibraryExists)
44+
INCLUDE(CheckSymbolExists)
45+
INCLUDE(CheckFunctionExists)
46+
47+
CHECK_FUNCTION_EXISTS(_longjmp LUA_USE_ULONGJMP)
48+
CHECK_SYMBOL_EXISTS(isatty unistd.h LUA_USE_ISATTY)
49+
CHECK_SYMBOL_EXISTS(mkstemp stdlib.h LUA_USE_MKSTEMP)
50+
CHECK_SYMBOL_EXISTS(popen stdio.h LUA_USE_POPEN)
51+
CHECK_LIBRARY_EXISTS(m sin "" LUA_USE_LIBM)
52+
IF(LUA_USE_LIBM)
53+
LIST(APPEND LIBS "m")
54+
ENDIF()
55+
56+
IF(NOT WIN32)
57+
FIND_LIBRARY(DL_LIBRARY "dl")
58+
IF(DL_LIBRARY)
59+
SET(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY})
60+
LIST(APPEND LIBS ${DL_LIBRARY})
61+
ENDIF(DL_LIBRARY)
62+
CHECK_FUNCTION_EXISTS(dlopen LUA_USE_DLOPEN)
63+
IF(NOT LUA_USE_DLOPEN)
64+
MESSAGE(FATAL_ERROR "Cannot compile a useful lua.
65+
Function dlopen() seems not to be supported on your platform.
66+
Apparently you are not on a Windows platform as well.
67+
So lua has no way to deal with shared libraries!")
68+
ENDIF(NOT LUA_USE_DLOPEN)
69+
ELSE()
70+
SET(LUA_BUILD_AS_DLL 1)
71+
ENDIF()
72+
73+
SET(CMAKE_THREAD_PREFER_PTHREAD TRUE)
74+
FIND_PACKAGE(Threads)
75+
IF(THREADS_FOUND)
76+
LIST(APPEND LIBS ${CMAKE_THREAD_LIBS_INIT})
77+
ENDIF()
78+
79+
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR} src)
80+
CONFIGURE_FILE(src/luaconf.h.in
81+
${CMAKE_CURRENT_BINARY_DIR}/luaconf.h)
82+
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/luaconf.h src/lua.h src/lauxlib.h src/lualib.h
83+
DESTINATION "${INSTALL_INCLUDE_SUBDIR}")
84+
85+
SET(SRC_LIB
86+
src/lapi.c src/lcode.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c src/llex.c src/lmem.c
87+
src/lobject.c src/lopcodes.c src/lparser.c src/lstate.c src/lstring.c src/ltable.c src/ltm.c
88+
src/lundump.c src/lvm.c src/lzio.c
89+
src/lauxlib.c src/lbaselib.c src/ldblib.c src/liolib.c
90+
src/lmathlib.c src/loslib.c src/ltablib.c src/lstrlib.c src/loadlib.c src/linit.c
91+
${CMAKE_CURRENT_BINARY_DIR}/luaconf.h)
92+
93+
# Shared library and executables
94+
ADD_LIBRARY(liblua SHARED ${SRC_LIB})
95+
SET_TARGET_PROPERTIES(liblua PROPERTIES
96+
PREFIX "lib" IMPORT_PREFIX "lib" OUTPUT_NAME "lua")
97+
ADD_EXECUTABLE(lua src/lua.c ${SRC_LIB})
98+
ADD_EXECUTABLE(luac src/luac.c src/print.c ${SRC_LIB})
99+
TARGET_LINK_LIBRARIES(liblua ${LIBS})
100+
TARGET_LINK_LIBRARIES(lua ${LIBS})
101+
TARGET_LINK_LIBRARIES(luac ${LIBS})
102+
103+
# Install files
104+
INSTALL(TARGETS lua luac liblua
105+
RUNTIME DESTINATION "${INSTALL_BIN_SUBDIR}"
106+
LIBRARY DESTINATION "${INSTALL_LIB_SUBDIR}"
107+
ARCHIVE DESTINATION "${INSTALL_LIB_SUBDIR}")
108+
109+
INSTALL(FILES src/lua.h ${CMAKE_CURRENT_BINARY_DIR}/luaconf.h src/lualib.h src/lauxlib.h
110+
DESTINATION "${INSTALL_INCLUDE_SUBDIR}/lua")

lua-5.1-rc/COPYRIGHT

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Lua License
2+
-----------
3+
4+
Lua is licensed under the terms of the MIT license reproduced below.
5+
This means that Lua is free software and can be used for both academic
6+
and commercial purposes at absolutely no cost.
7+
8+
For details and rationale, see http://www.lua.org/license.html .
9+
10+
===============================================================================
11+
12+
Copyright (C) 1994-2012 Lua.org, PUC-Rio.
13+
14+
Permission is hereby granted, free of charge, to any person obtaining a copy
15+
of this software and associated documentation files (the "Software"), to deal
16+
in the Software without restriction, including without limitation the rights
17+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18+
copies of the Software, and to permit persons to whom the Software is
19+
furnished to do so, subject to the following conditions:
20+
21+
The above copyright notice and this permission notice shall be included in
22+
all copies or substantial portions of the Software.
23+
24+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30+
THE SOFTWARE.
31+
32+
===============================================================================
33+
34+
(end of COPYRIGHT)

lua-5.1-rc/HISTORY

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
HISTORY for Lua 5.1
2+
3+
* Changes from version 5.0 to 5.1
4+
-------------------------------
5+
Language:
6+
+ new module system.
7+
+ new semantics for control variables of fors.
8+
+ new semantics for setn/getn.
9+
+ new syntax/semantics for varargs.
10+
+ new long strings and comments.
11+
+ new `mod' operator (`%')
12+
+ new length operator #t
13+
+ metatables for all types
14+
API:
15+
+ new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
16+
+ user supplies memory allocator (lua_open becomes lua_newstate).
17+
+ luaopen_* functions must be called through Lua.
18+
Implementation:
19+
+ new configuration scheme via luaconf.h.
20+
+ incremental garbage collection.
21+
+ better handling of end-of-line in the lexer.
22+
+ fully reentrant parser (new Lua function `load')
23+
+ better support for 64-bit machines.
24+
+ native loadlib support for Mac OS X.
25+
+ standard distribution in only one library (lualib.a merged into lua.a)
26+
27+
* Changes from version 4.0 to 5.0
28+
-------------------------------
29+
Language:
30+
+ lexical scoping.
31+
+ Lua coroutines.
32+
+ standard libraries now packaged in tables.
33+
+ tags replaced by metatables and tag methods replaced by metamethods,
34+
stored in metatables.
35+
+ proper tail calls.
36+
+ each function can have its own global table, which can be shared.
37+
+ new __newindex metamethod, called when we insert a new key into a table.
38+
+ new block comments: --[[ ... ]].
39+
+ new generic for.
40+
+ new weak tables.
41+
+ new boolean type.
42+
+ new syntax "local function".
43+
+ (f()) returns the first value returned by f.
44+
+ {f()} fills a table with all values returned by f.
45+
+ \n ignored in [[\n .
46+
+ fixed and-or priorities.
47+
+ more general syntax for function definition (e.g. function a.x.y:f()...end).
48+
+ more general syntax for function calls (e.g. (print or write)(9)).
49+
+ new functions (time/date, tmpfile, unpack, require, load*, etc.).
50+
API:
51+
+ chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer.
52+
+ introduced lightweight userdata, a simple "void*" without a metatable.
53+
+ new error handling protocol: the core no longer prints error messages;
54+
all errors are reported to the caller on the stack.
55+
+ new lua_atpanic for host cleanup.
56+
+ new, signal-safe, hook scheme.
57+
Implementation:
58+
+ new license: MIT.
59+
+ new, faster, register-based virtual machine.
60+
+ support for external multithreading and coroutines.
61+
+ new and consistent error message format.
62+
+ the core no longer needs "stdio.h" for anything (except for a single
63+
use of sprintf to convert numbers to strings).
64+
+ lua.c now runs the environment variable LUA_INIT, if present. It can
65+
be "@filename", to run a file, or the chunk itself.
66+
+ support for user extensions in lua.c.
67+
sample implementation given for command line editing.
68+
+ new dynamic loading library, active by default on several platforms.
69+
+ safe garbage-collector metamethods.
70+
+ precompiled bytecodes checked for integrity (secure binary dostring).
71+
+ strings are fully aligned.
72+
+ position capture in string.find.
73+
+ read('*l') can read lines with embedded zeros.
74+
75+
* Changes from version 3.2 to 4.0
76+
-------------------------------
77+
Language:
78+
+ new "break" and "for" statements (both numerical and for tables).
79+
+ uniform treatment of globals: globals are now stored in a Lua table.
80+
+ improved error messages.
81+
+ no more '$debug': full speed *and* full debug information.
82+
+ new read form: read(N) for next N bytes.
83+
+ general read patterns now deprecated.
84+
(still available with -DCOMPAT_READPATTERNS.)
85+
+ all return values are passed as arguments for the last function
86+
(old semantics still available with -DLUA_COMPAT_ARGRET)
87+
+ garbage collection tag methods for tables now deprecated.
88+
+ there is now only one tag method for order.
89+
API:
90+
+ New API: fully re-entrant, simpler, and more efficient.
91+
+ New debug API.
92+
Implementation:
93+
+ faster than ever: cleaner virtual machine and new hashing algorithm.
94+
+ non-recursive garbage-collector algorithm.
95+
+ reduced memory usage for programs with many strings.
96+
+ improved treatment for memory allocation errors.
97+
+ improved support for 16-bit machines (we hope).
98+
+ code now compiles unmodified as both ANSI C and C++.
99+
+ numbers in bases other than 10 are converted using strtoul.
100+
+ new -f option in Lua to support #! scripts.
101+
+ luac can now combine text and binaries.
102+
103+
* Changes from version 3.1 to 3.2
104+
-------------------------------
105+
+ redirected all output in Lua's core to _ERRORMESSAGE and _ALERT.
106+
+ increased limit on the number of constants and globals per function
107+
(from 2^16 to 2^24).
108+
+ debugging info (lua_debug and hooks) moved into lua_state and new API
109+
functions provided to get and set this info.
110+
+ new debug lib gives full debugging access within Lua.
111+
+ new table functions "foreachi", "sort", "tinsert", "tremove", "getn".
112+
+ new io functions "flush", "seek".
113+
114+
* Changes from version 3.0 to 3.1
115+
-------------------------------
116+
+ NEW FEATURE: anonymous functions with closures (via "upvalues").
117+
+ new syntax:
118+
- local variables in chunks.
119+
- better scope control with DO block END.
120+
- constructors can now be also written: { record-part; list-part }.
121+
- more general syntax for function calls and lvalues, e.g.:
122+
f(x).y=1
123+
o:f(x,y):g(z)
124+
f"string" is sugar for f("string")
125+
+ strings may now contain arbitrary binary data (e.g., embedded zeros).
126+
+ major code re-organization and clean-up; reduced module interdependecies.
127+
+ no arbitrary limits on the total number of constants and globals.
128+
+ support for multiple global contexts.
129+
+ better syntax error messages.
130+
+ new traversal functions "foreach" and "foreachvar".
131+
+ the default for numbers is now double.
132+
changing it to use floats or longs is easy.
133+
+ complete debug information stored in pre-compiled chunks.
134+
+ sample interpreter now prompts user when run interactively, and also
135+
handles control-C interruptions gracefully.
136+
137+
* Changes from version 2.5 to 3.0
138+
-------------------------------
139+
+ NEW CONCEPT: "tag methods".
140+
Tag methods replace fallbacks as the meta-mechanism for extending the
141+
semantics of Lua. Whereas fallbacks had a global nature, tag methods
142+
work on objects having the same tag (e.g., groups of tables).
143+
Existing code that uses fallbacks should work without change.
144+
+ new, general syntax for constructors {[exp] = exp, ... }.
145+
+ support for handling variable number of arguments in functions (varargs).
146+
+ support for conditional compilation ($if ... $else ... $end).
147+
+ cleaner semantics in API simplifies host code.
148+
+ better support for writing libraries (auxlib.h).
149+
+ better type checking and error messages in the standard library.
150+
+ luac can now also undump.
151+
152+
* Changes from version 2.4 to 2.5
153+
-------------------------------
154+
+ io and string libraries are now based on pattern matching;
155+
the old libraries are still available for compatibility
156+
+ dofile and dostring can now return values (via return statement)
157+
+ better support for 16- and 64-bit machines
158+
+ expanded documentation, with more examples
159+
160+
* Changes from version 2.2 to 2.4
161+
-------------------------------
162+
+ external compiler creates portable binary files that can be loaded faster
163+
+ interface for debugging and profiling
164+
+ new "getglobal" fallback
165+
+ new functions for handling references to Lua objects
166+
+ new functions in standard lib
167+
+ only one copy of each string is stored
168+
+ expanded documentation, with more examples
169+
170+
* Changes from version 2.1 to 2.2
171+
-------------------------------
172+
+ functions now may be declared with any "lvalue" as a name
173+
+ garbage collection of functions
174+
+ support for pipes
175+
176+
* Changes from version 1.1 to 2.1
177+
-------------------------------
178+
+ object-oriented support
179+
+ fallbacks
180+
+ simplified syntax for tables
181+
+ many internal improvements
182+
183+
(end of HISTORY)

0 commit comments

Comments
 (0)