Feature #1759 ยป 0031-Drop-lua-5.4-from-under-version-control.patch
| dependencies/lua-5.4/.gitignore | ||
|---|---|---|
|
/Makefile.in
|
||
| dependencies/lua-5.4/Makefile.am | ||
|---|---|---|
|
## Process this file with automake to produce Makefile.in
|
||
|
SUBDIRS = src
|
||
|
EXTRA_DIST = Version.txt \
|
||
|
freeciv_lua.patch \
|
||
|
doc/readme.html \
|
||
|
doc/lua.css \
|
||
|
doc/logo.gif \
|
||
|
doc/OSIApproved_100X125.png
|
||
| dependencies/lua-5.4/README | ||
|---|---|---|
|
This is Lua 5.4.8, released on 21 May 2025.
|
||
|
For installation instructions, license details, and
|
||
|
further information about Lua, see doc/readme.html.
|
||
| dependencies/lua-5.4/Version.txt | ||
|---|---|---|
|
Sources here are from lua-5.4.8
|
||
|
(http://www.lua.org/ftp/lua-5.4.8.tar.gz)
|
||
|
Upstream bug fixes from https://www.lua.org/bugs.html applied:
|
||
|
1, 3
|
||
|
Upstream bug fixes not applicable to our tree:
|
||
|
2
|
||
|
Not entire lua distribution directory hierarchy is included here, and
|
||
|
some files needed for Freeciv usage have been added.
|
||
|
Changes applied to included lua source files are included in freeciv_lua.patch
|
||
| dependencies/lua-5.4/doc/lua.css | ||
|---|---|---|
|
html {
|
||
|
background-color: #F8F8F8 ;
|
||
|
}
|
||
|
body {
|
||
|
background-color: #FFFFFF ;
|
||
|
color: #000000 ;
|
||
|
font-family: Helvetica, Arial, sans-serif ;
|
||
|
text-align: justify ;
|
||
|
line-height: 1.25 ;
|
||
|
margin: 16px auto ;
|
||
|
padding: 32px ;
|
||
|
border: solid #ccc 1px ;
|
||
|
border-radius: 20px ;
|
||
|
max-width: 70em ;
|
||
|
width: 90% ;
|
||
|
}
|
||
|
h1, h2, h3, h4 {
|
||
|
color: #000080 ;
|
||
|
font-family: Verdana, Geneva, sans-serif ;
|
||
|
font-weight: normal ;
|
||
|
font-style: normal ;
|
||
|
text-align: left ;
|
||
|
}
|
||
|
h1 {
|
||
|
font-size: 28pt ;
|
||
|
}
|
||
|
h1 img {
|
||
|
vertical-align: text-bottom ;
|
||
|
}
|
||
|
h2:before {
|
||
|
content: "\2756" ;
|
||
|
padding-right: 0.5em ;
|
||
|
}
|
||
|
a {
|
||
|
text-decoration: none ;
|
||
|
}
|
||
|
a:link {
|
||
|
color: #000080 ;
|
||
|
}
|
||
|
a:link:hover, a:visited:hover {
|
||
|
background-color: #D0D0FF ;
|
||
|
color: #000080 ;
|
||
|
border-radius: 4px ;
|
||
|
}
|
||
|
a:link:active, a:visited:active {
|
||
|
color: #FF0000 ;
|
||
|
}
|
||
|
div.menubar {
|
||
|
padding-bottom: 0.5em ;
|
||
|
}
|
||
|
p.menubar {
|
||
|
margin-left: 2.5em ;
|
||
|
}
|
||
|
.menubar a:hover {
|
||
|
margin: -3px -3px -3px -3px ;
|
||
|
padding: 3px 3px 3px 3px ;
|
||
|
border-radius: 4px ;
|
||
|
}
|
||
|
:target {
|
||
|
background-color: #F0F0F0 ;
|
||
|
margin: -8px ;
|
||
|
padding: 8px ;
|
||
|
border-radius: 8px ;
|
||
|
outline: none ;
|
||
|
}
|
||
|
hr {
|
||
|
display: none ;
|
||
|
}
|
||
|
table hr {
|
||
|
background-color: #a0a0a0 ;
|
||
|
color: #a0a0a0 ;
|
||
|
border: 0 ;
|
||
|
height: 1px ;
|
||
|
display: block ;
|
||
|
}
|
||
|
.footer {
|
||
|
color: gray ;
|
||
|
font-size: x-small ;
|
||
|
text-transform: lowercase ;
|
||
|
}
|
||
|
input[type=text] {
|
||
|
border: solid #a0a0a0 2px ;
|
||
|
border-radius: 2em ;
|
||
|
background-image: url('images/search.png') ;
|
||
|
background-repeat: no-repeat ;
|
||
|
background-position: 4px center ;
|
||
|
padding-left: 20px ;
|
||
|
height: 2em ;
|
||
|
}
|
||
|
pre.session {
|
||
|
background-color: #F8F8F8 ;
|
||
|
padding: 1em ;
|
||
|
border-radius: 8px ;
|
||
|
}
|
||
|
table {
|
||
|
border: none ;
|
||
|
border-spacing: 0 ;
|
||
|
border-collapse: collapse ;
|
||
|
}
|
||
|
td {
|
||
|
padding: 0 ;
|
||
|
margin: 0 ;
|
||
|
}
|
||
|
td.gutter {
|
||
|
width: 4% ;
|
||
|
}
|
||
|
table.columns td {
|
||
|
vertical-align: top ;
|
||
|
padding-bottom: 1em ;
|
||
|
text-align: justify ;
|
||
|
line-height: 1.25 ;
|
||
|
}
|
||
|
table.book td {
|
||
|
vertical-align: top ;
|
||
|
}
|
||
|
table.book td.cover {
|
||
|
padding-right: 1em ;
|
||
|
}
|
||
|
table.book img {
|
||
|
border: solid #000080 1px ;
|
||
|
border-radius: 2px ;
|
||
|
}
|
||
|
table.book span {
|
||
|
font-size: small ;
|
||
|
text-align: left ;
|
||
|
display: block ;
|
||
|
margin-top: 0.25em ;
|
||
|
}
|
||
|
p.logos a:link:hover, p.logos a:visited:hover {
|
||
|
background-color: inherit ;
|
||
|
}
|
||
|
img {
|
||
|
background-color: white ;
|
||
|
}
|
||
| dependencies/lua-5.4/doc/readme.html | ||
|---|---|---|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>Lua 5.4 readme</TITLE>
|
||
|
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
|
||
|
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
|
||
|
<STYLE TYPE="text/css">
|
||
|
blockquote, .display {
|
||
|
border: solid #a0a0a0 2px ;
|
||
|
border-radius: 8px ;
|
||
|
padding: 1em ;
|
||
|
margin: 0px ;
|
||
|
}
|
||
|
.display {
|
||
|
word-spacing: 0.25em ;
|
||
|
}
|
||
|
dl.display dd {
|
||
|
padding-bottom: 0.2em ;
|
||
|
}
|
||
|
tt, kbd, code {
|
||
|
font-size: 12pt ;
|
||
|
}
|
||
|
</STYLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1>
|
||
|
<A HREF="https://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
|
||
|
Welcome to Lua 5.4
|
||
|
</H1>
|
||
|
<DIV CLASS="menubar">
|
||
|
<A HREF="#about">about</A>
|
||
|
·
|
||
|
<A HREF="#install">installation</A>
|
||
|
·
|
||
|
<A HREF="#changes">changes</A>
|
||
|
·
|
||
|
<A HREF="#license">license</A>
|
||
|
·
|
||
|
<A HREF="contents.html">reference manual</A>
|
||
|
</DIV>
|
||
|
<H2><A NAME="about">About Lua</A></H2>
|
||
|
<P>
|
||
|
Lua is a powerful, efficient, lightweight, embeddable scripting language
|
||
|
developed by a
|
||
|
<A HREF="https://www.lua.org/authors.html">team</A>
|
||
|
at
|
||
|
<A HREF="https://www.puc-rio.br/">PUC-Rio</A>,
|
||
|
the Pontifical Catholic University of Rio de Janeiro in Brazil.
|
||
|
Lua is
|
||
|
<A HREF="#license">free software</A>
|
||
|
used in
|
||
|
<A HREF="https://www.lua.org/uses.html">many products and projects</A>
|
||
|
around the world.
|
||
|
<P>
|
||
|
Lua's
|
||
|
<A HREF="https://www.lua.org/">official website</A>
|
||
|
provides complete information
|
||
|
about Lua,
|
||
|
including
|
||
|
an
|
||
|
<A HREF="https://www.lua.org/about.html">executive summary</A>,
|
||
|
tips on
|
||
|
<A HREF="https://www.lua.org/start.html">getting started</A>,
|
||
|
and
|
||
|
updated
|
||
|
<A HREF="https://www.lua.org/docs.html">documentation</A>,
|
||
|
especially the
|
||
|
<A HREF="https://www.lua.org/manual/5.4/">reference manual</A>,
|
||
|
which may differ slightly from the
|
||
|
<A HREF="contents.html">local copy</A>
|
||
|
distributed in this package.
|
||
|
<H2><A NAME="install">Installing Lua</A></H2>
|
||
|
<P>
|
||
|
Lua is distributed in
|
||
|
<A HREF="https://www.lua.org/ftp/">source</A>
|
||
|
form.
|
||
|
You need to build it before using it.
|
||
|
Building Lua should be straightforward
|
||
|
because
|
||
|
Lua is implemented in pure ANSI C and compiles unmodified in all known
|
||
|
platforms that have an ANSI C compiler.
|
||
|
Lua also compiles unmodified as C++.
|
||
|
The instructions given below for building Lua are for Unix-like platforms,
|
||
|
such as Linux and macOS.
|
||
|
See also
|
||
|
<A HREF="#other">instructions for other systems</A>
|
||
|
and
|
||
|
<A HREF="#customization">customization options</A>.
|
||
|
<P>
|
||
|
If you don't have the time or the inclination to compile Lua yourself,
|
||
|
get a binary from
|
||
|
<A HREF="https://luabinaries.sourceforge.net">LuaBinaries</A>.
|
||
|
<H3>Building Lua</H3>
|
||
|
<P>
|
||
|
In most common Unix-like platforms, simply do "<KBD>make</KBD>".
|
||
|
Here are the details.
|
||
|
<OL>
|
||
|
<LI>
|
||
|
Open a terminal window and move to
|
||
|
the top-level directory, which is named <TT>lua-5.4.8</TT>.
|
||
|
The <TT>Makefile</TT> there controls both the build process and the installation process.
|
||
|
<P>
|
||
|
<LI>
|
||
|
Do "<KBD>make</KBD>". The <TT>Makefile</TT> will guess your platform and build Lua for it.
|
||
|
<P>
|
||
|
<LI>
|
||
|
If the guess failed, do "<KBD>make help</KBD>" and see if your platform is listed.
|
||
|
The platforms currently supported are:
|
||
|
<P>
|
||
|
<P CLASS="display">
|
||
|
guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
|
||
|
</P>
|
||
|
<P>
|
||
|
If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx
|
||
|
is your platform name.
|
||
|
<P>
|
||
|
If your platform is not listed, try the closest one or posix, generic,
|
||
|
c89, in this order.
|
||
|
<P>
|
||
|
<LI>
|
||
|
The compilation takes only a few moments
|
||
|
and produces three files in the <TT>src</TT> directory:
|
||
|
lua (the interpreter),
|
||
|
luac (the compiler),
|
||
|
and liblua.a (the library).
|
||
|
<P>
|
||
|
<LI>
|
||
|
To check that Lua has been built correctly, do "<KBD>make test</KBD>"
|
||
|
after building Lua. This will run the interpreter and print its version.
|
||
|
</OL>
|
||
|
<P>
|
||
|
If you're running Linux, try "<KBD>make linux-readline</KBD>" to build the interactive Lua interpreter with handy line-editing and history capabilities.
|
||
|
If you get compilation errors,
|
||
|
make sure you have installed the <TT>readline</TT> development package
|
||
|
(which is probably named <TT>libreadline-dev</TT> or <TT>readline-devel</TT>).
|
||
|
If you get link errors after that,
|
||
|
then try "<KBD>make linux-readline MYLIBS=-ltermcap</KBD>".
|
||
|
<H3>Installing Lua</H3>
|
||
|
<P>
|
||
|
Once you have built Lua, you may want to install it in an official
|
||
|
place in your system. In this case, do "<KBD>make install</KBD>". The official
|
||
|
place and the way to install files are defined in the <TT>Makefile</TT>. You'll
|
||
|
probably need the right permissions to install files, and so may need to do "<KBD>sudo make install</KBD>".
|
||
|
<P>
|
||
|
To build and install Lua in one step, do "<KBD>make all install</KBD>",
|
||
|
or "<KBD>make xxx install</KBD>",
|
||
|
where xxx is your platform name.
|
||
|
<P>
|
||
|
To install Lua locally after building it, do "<KBD>make local</KBD>".
|
||
|
This will create a directory <TT>install</TT> with subdirectories
|
||
|
<TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, <TT>share</TT>,
|
||
|
and install Lua as listed below.
|
||
|
To install Lua locally, but in some other directory, do
|
||
|
"<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory.
|
||
|
The installation starts in the <TT>src</TT> and <TT>doc</TT> directories,
|
||
|
so take care if <TT>INSTALL_TOP</TT> is not an absolute path.
|
||
|
<DL CLASS="display">
|
||
|
<DT>
|
||
|
bin:
|
||
|
<DD>
|
||
|
lua luac
|
||
|
<DT>
|
||
|
include:
|
||
|
<DD>
|
||
|
lua.h luaconf.h lualib.h lauxlib.h lua.hpp
|
||
|
<DT>
|
||
|
lib:
|
||
|
<DD>
|
||
|
liblua.a
|
||
|
<DT>
|
||
|
man/man1:
|
||
|
<DD>
|
||
|
lua.1 luac.1
|
||
|
</DL>
|
||
|
<P>
|
||
|
These are the only directories you need for development.
|
||
|
If you only want to run Lua programs,
|
||
|
you only need the files in <TT>bin</TT> and <TT>man</TT>.
|
||
|
The files in <TT>include</TT> and <TT>lib</TT> are needed for
|
||
|
embedding Lua in C or C++ programs.
|
||
|
<H3><A NAME="customization">Customization</A></H3>
|
||
|
<P>
|
||
|
Three kinds of things can be customized by editing a file:
|
||
|
<UL>
|
||
|
<LI> Where and how to install Lua — edit <TT>Makefile</TT>.
|
||
|
<LI> How to build Lua — edit <TT>src/Makefile</TT>.
|
||
|
<LI> Lua features — edit <TT>src/luaconf.h</TT>.
|
||
|
</UL>
|
||
|
<P>
|
||
|
You don't actually need to edit the Makefiles because you may set the
|
||
|
relevant variables in the command line when invoking make.
|
||
|
Nevertheless, it's probably best to edit and save the Makefiles to
|
||
|
record the changes you've made.
|
||
|
<P>
|
||
|
On the other hand, if you need to customize some Lua features,
|
||
|
edit <TT>src/luaconf.h</TT> before building and installing Lua.
|
||
|
The edited file will be the one installed, and
|
||
|
it will be used by any Lua clients that you build, to ensure consistency.
|
||
|
Further customization is available to experts by editing the Lua sources.
|
||
|
<H3><A NAME="other">Building Lua on other systems</A></H3>
|
||
|
<P>
|
||
|
If you're not using the usual Unix tools, then the instructions for
|
||
|
building Lua depend on the compiler you use. You'll need to create
|
||
|
projects (or whatever your compiler uses) for building the library,
|
||
|
the interpreter, and the compiler, as follows:
|
||
|
<DL CLASS="display">
|
||
|
<DT>
|
||
|
library:
|
||
|
<DD>
|
||
|
lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c
|
||
|
lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c
|
||
|
<DT>
|
||
|
interpreter:
|
||
|
<DD>
|
||
|
library, lua.c
|
||
|
<DT>
|
||
|
compiler:
|
||
|
<DD>
|
||
|
library, luac.c
|
||
|
</DL>
|
||
|
<P>
|
||
|
To use Lua as a library in your own programs, you need to know how to
|
||
|
create and use libraries with your compiler. Moreover, to dynamically load
|
||
|
C libraries for Lua, you'll need to know how to create dynamic libraries
|
||
|
and you'll need to make sure that the Lua API functions are accessible to
|
||
|
those dynamic libraries — but <EM>don't</EM> link the Lua library
|
||
|
into each dynamic library. For Unix, we recommend that the Lua library
|
||
|
be linked statically into the host program and its symbols exported for
|
||
|
dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
|
||
|
For Windows, we recommend that the Lua library be a DLL.
|
||
|
In all cases, the compiler luac should be linked statically.
|
||
|
<P>
|
||
|
As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
|
||
|
some features before building Lua.
|
||
|
<H2><A NAME="changes">Changes since Lua 5.3</A></H2>
|
||
|
<P>
|
||
|
Here are the main changes introduced in Lua 5.4.
|
||
|
The
|
||
|
<A HREF="contents.html">reference manual</A>
|
||
|
lists the
|
||
|
<A HREF="manual.html#8">incompatibilities</A> that had to be introduced.
|
||
|
<H3>Main changes</H3>
|
||
|
<UL>
|
||
|
<LI> new generational mode for garbage collection
|
||
|
<LI> to-be-closed variables
|
||
|
<LI> const variables
|
||
|
<LI> userdata can have multiple user values
|
||
|
<LI> new implementation for math.random
|
||
|
<LI> warning system
|
||
|
<LI> debug information about function arguments and returns
|
||
|
<LI> new semantics for the integer 'for' loop
|
||
|
<LI> optional 'init' argument to 'string.gmatch'
|
||
|
<LI> new functions 'lua_resetthread' and 'coroutine.close'
|
||
|
<LI> string-to-number coercions moved to the string library
|
||
|
<LI> allocation function allowed to fail when shrinking a memory block
|
||
|
<LI> new format '%p' in 'string.format'
|
||
|
<LI> utf8 library accepts codepoints up to 2^31
|
||
|
</UL>
|
||
|
<H2><A NAME="license">License</A></H2>
|
||
|
<P>
|
||
|
<A HREF="https://opensource.org/osd">
|
||
|
<IMG SRC="OSIApproved_100X125.png" ALIGN="right" ALT="[Open Source Initiative Approved License]" STYLE="padding-left: 1em" WIDTH=50>
|
||
|
</A>
|
||
|
Lua is free software distributed under the terms of the
|
||
|
<A HREF="https://opensource.org/license/mit">MIT license</A>
|
||
|
reproduced below;
|
||
|
it may be used for any purpose, including commercial purposes,
|
||
|
at absolutely no cost without having to ask us.
|
||
|
The only requirement is that if you do use Lua,
|
||
|
then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
|
||
|
For details, see the
|
||
|
<A HREF="https://www.lua.org/license.html">license page</A>.
|
||
|
<BLOCKQUOTE STYLE="padding-bottom: 0em">
|
||
|
Copyright © 1994–2025 Lua.org, PUC-Rio.
|
||
|
<P>
|
||
|
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:
|
||
|
<P>
|
||
|
The above copyright notice and this permission notice shall be included in
|
||
|
all copies or substantial portions of the Software.
|
||
|
<P>
|
||
|
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.
|
||
|
</BLOCKQUOTE>
|
||
|
<P>
|
||
|
<P CLASS="footer">
|
||
|
Last update:
|
||
|
Wed May 21 21:12:01 UTC 2025
|
||
|
</P>
|
||
|
<!--
|
||
|
Last change: revised for Lua 5.4.8
|
||
|
-->
|
||
|
</BODY>
|
||
|
</HTML>
|
||
| dependencies/lua-5.4/freeciv_lua.patch | ||
|---|---|---|
|
diff -Nurd lua-5.4/src/ldo.c lua-5.4/src/ldo.c
|
||
|
--- lua-5.4/src/ldo.c 2023-06-08 05:45:43.164933363 +0300
|
||
|
+++ lua-5.4/src/ldo.c 2023-06-08 05:45:54.989049862 +0300
|
||
|
@@ -60,7 +60,7 @@
|
||
|
try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
|
||
|
#define luai_jmpbuf int /* dummy variable */
|
||
|
|
||
|
-#elif defined(LUA_USE_POSIX) /* }{ */
|
||
|
+#elif defined(LUA_USE_ULONGJMP) /* }{ */
|
||
|
|
||
|
/* in POSIX, try _longjmp/_setjmp (more efficient) */
|
||
|
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
|
||
|
@@ -129,9 +129,9 @@
|
||
|
lua_unlock(L);
|
||
|
g->panic(L); /* call panic function (last chance to jump out) */
|
||
|
}
|
||
|
- abort();
|
||
|
}
|
||
|
}
|
||
|
+ abort();
|
||
|
}
|
||
|
|
||
|
|
||
|
diff -Nurd lua-5.4/src/liolib.c lua-5.4/src/liolib.c
|
||
|
--- lua-5.4/src/liolib.c 2023-06-08 05:45:43.164933363 +0300
|
||
|
+++ lua-5.4/src/liolib.c 2023-06-08 05:45:54.989049862 +0300
|
||
|
@@ -54,7 +54,7 @@
|
||
|
|
||
|
#if !defined(l_popen) /* { */
|
||
|
|
||
|
-#if defined(LUA_USE_POSIX) /* { */
|
||
|
+#if defined(LUA_USE_POPEN) /* { */
|
||
|
|
||
|
#define l_popen(L,c,m) (fflush(NULL), popen(c,m))
|
||
|
#define l_pclose(L,file) (pclose(file))
|
||
|
@@ -115,7 +115,7 @@
|
||
|
|
||
|
#if !defined(l_fseek) /* { */
|
||
|
|
||
|
-#if defined(LUA_USE_POSIX) /* { */
|
||
|
+#if defined(LUA_USE_FSEEKO) /* { */
|
||
|
|
||
|
#include <sys/types.h>
|
||
|
|
||
|
diff -Nurd lua-5.4/src/loslib.c lua-5.4/src/loslib.c
|
||
|
--- lua-5.4/src/loslib.c 2023-06-08 05:45:43.164933363 +0300
|
||
|
+++ lua-5.4/src/loslib.c 2023-06-08 05:45:54.989049862 +0300
|
||
|
@@ -74,7 +74,7 @@
|
||
|
** where it uses gmtime_r/localtime_r
|
||
|
*/
|
||
|
|
||
|
-#if defined(LUA_USE_POSIX) /* { */
|
||
|
+#if defined(LUA_USE_GMTIME_R) /* { */
|
||
|
|
||
|
#define l_gmtime(t,r) gmtime_r(t,r)
|
||
|
#define l_localtime(t,r) localtime_r(t,r)
|
||
|
@@ -101,7 +101,7 @@
|
||
|
*/
|
||
|
#if !defined(lua_tmpnam) /* { */
|
||
|
|
||
|
-#if defined(LUA_USE_POSIX) /* { */
|
||
|
+#if defined(LUA_USE_MKSTEMP) /* { */
|
||
|
|
||
|
#include <unistd.h>
|
||
|
|
||
|
diff -Nurd lua-5.4/src/luaconf.h lua-5.4/src/luaconf.h
|
||
|
--- lua-5.4/src/luaconf.h 2023-06-08 05:45:43.164933363 +0300
|
||
|
+++ lua-5.4/src/luaconf.h 2023-06-08 05:45:54.989049862 +0300
|
||
|
@@ -11,6 +11,7 @@
|
||
|
#include <limits.h>
|
||
|
#include <stddef.h>
|
||
|
|
||
|
+#include "localluaconf.h"
|
||
|
|
||
|
/*
|
||
|
** ===================================================================
|
||
| dependencies/lua-5.4/src/.gitignore | ||
|---|---|---|
|
/Makefile.in
|
||
| dependencies/lua-5.4/src/Makefile.am | ||
|---|---|---|
|
## Process this file with automake to produce Makefile.in
|
||
|
noinst_LTLIBRARIES = liblua.la
|
||
|
AM_CPPFLAGS =
|
||
|
liblua_la_LIBADD = -lm
|
||
|
liblua_la_SOURCES = \
|
||
|
localluaconf.h \
|
||
|
lapi.c \
|
||
|
lapi.h \
|
||
|
lauxlib.c \
|
||
|
lauxlib.h \
|
||
|
lbaselib.c \
|
||
|
lcode.c \
|
||
|
lcode.h \
|
||
|
lcorolib.c \
|
||
|
lctype.c \
|
||
|
lctype.h \
|
||
|
ldblib.c \
|
||
|
ldebug.c \
|
||
|
ldebug.h \
|
||
|
ldo.c \
|
||
|
ldo.h \
|
||
|
ldump.c \
|
||
|
lfunc.c \
|
||
|
lfunc.h \
|
||
|
lgc.c \
|
||
|
lgc.h \
|
||
|
linit.c \
|
||
|
liolib.c \
|
||
|
ljumptab.h \
|
||
|
llex.c \
|
||
|
llex.h \
|
||
|
llimits.h \
|
||
|
lmathlib.c \
|
||
|
lmem.c \
|
||
|
lmem.h \
|
||
|
loadlib.c \
|
||
|
lobject.c \
|
||
|
lobject.h \
|
||
|
lopcodes.c \
|
||
|
lopcodes.h \
|
||
|
lopnames.h \
|
||
|
loslib.c \
|
||
|
lparser.c \
|
||
|
lparser.h \
|
||
|
lprefix.h \
|
||
|
lstate.c \
|
||
|
lstate.h \
|
||
|
lstring.c \
|
||
|
lstring.h \
|
||
|
lstrlib.c \
|
||
|
ltable.c \
|
||
|
ltable.h \
|
||
|
ltablib.c \
|
||
|
ltm.c \
|
||
|
ltm.h \
|
||
|
luaconf.h \
|
||
|
lua.h \
|
||
|
lua.hpp \
|
||
|
lualib.h \
|
||
|
lundump.c \
|
||
|
lundump.h \
|
||
|
lutf8lib.c \
|
||
|
lvm.c \
|
||
|
lvm.h \
|
||
|
lzio.c \
|
||
|
lzio.h
|
||
|
if !SYS_TOLUA_CMD
|
||
|
EXTRA_DIST = \
|
||
|
dist-stamp
|
||
|
# To trick 'make dist' to build tolua, needed later to generate source files
|
||
|
dist-stamp : liblua.la
|
||
|
touch dist-stamp
|
||
|
DISTCLEANFILES = dist-stamp
|
||
|
endif
|
||
| dependencies/lua-5.4/src/lapi.c | ||
|---|---|---|
|
/*
|
||
|
** $Id: lapi.c $
|
||
|
** Lua API
|
||
|
** See Copyright Notice in lua.h
|
||
|
*/
|
||
|
#define lapi_c
|
||
|
#define LUA_CORE
|
||
|
#include "lprefix.h"
|
||
|
#include <limits.h>
|
||
|
#include <stdarg.h>
|
||
|
#include <string.h>
|
||
|
#include "lua.h"
|
||
|
#include "lapi.h"
|
||
|
#include "ldebug.h"
|
||
|
#include "ldo.h"
|
||
|
#include "lfunc.h"
|
||
|
#include "lgc.h"
|
||
|
#include "lmem.h"
|
||
|
#include "lobject.h"
|
||
|
#include "lstate.h"
|
||
|
#include "lstring.h"
|
||
|
#include "ltable.h"
|
||
|
#include "ltm.h"
|
||
|
#include "lundump.h"
|
||
|
#include "lvm.h"
|
||
|
const char lua_ident[] =
|
||
|
"$LuaVersion: " LUA_COPYRIGHT " $"
|
||
|
"$LuaAuthors: " LUA_AUTHORS " $";
|
||
|
/*
|
||
|
** Test for a valid index (one that is not the 'nilvalue').
|
||
|
** '!ttisnil(o)' implies 'o != &G(L)->nilvalue', so it is not needed.
|
||
|
** However, it covers the most common cases in a faster way.
|
||
|
*/
|
||
|
#define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue)
|
||
|
/* test for pseudo index */
|
||
|
#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX)
|
||
|
/* test for upvalue */
|
||
|
#define isupvalue(i) ((i) < LUA_REGISTRYINDEX)
|
||
|
/*
|
||
|
** Convert an acceptable index to a pointer to its respective value.
|
||
|
** Non-valid indices return the special nil value 'G(L)->nilvalue'.
|
||
|
*/
|
||
|
static TValue *index2value (lua_State *L, int idx) {
|
||
|
CallInfo *ci = L->ci;
|
||
|
if (idx > 0) {
|
||
|
StkId o = ci->func.p + idx;
|
||
|
api_check(L, idx <= ci->top.p - (ci->func.p + 1), "unacceptable index");
|
||
|
if (o >= L->top.p) return &G(L)->nilvalue;
|
||
|
else return s2v(o);
|
||
|
}
|
||
|
else if (!ispseudo(idx)) { /* negative index */
|
||
|
api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1),
|
||
|
"invalid index");
|
||
|
return s2v(L->top.p + idx);
|
||
|
}
|
||
|
else if (idx == LUA_REGISTRYINDEX)
|
||
|
return &G(L)->l_registry;
|
||
|
else { /* upvalues */
|
||
|
idx = LUA_REGISTRYINDEX - idx;
|
||
|
api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large");
|
||
|
if (ttisCclosure(s2v(ci->func.p))) { /* C closure? */
|
||
|
CClosure *func = clCvalue(s2v(ci->func.p));
|
||
|
return (idx <= func->nupvalues) ? &func->upvalue[idx-1]
|
||
|
: &G(L)->nilvalue;
|
||
|
}
|
||
|
else { /* light C function or Lua function (through a hook)?) */
|
||
|
api_check(L, ttislcf(s2v(ci->func.p)), "caller not a C function");
|
||
|
return &G(L)->nilvalue; /* no upvalues */
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/*
|
||
|
** Convert a valid actual index (not a pseudo-index) to its address.
|
||
|
*/
|
||
|
l_sinline StkId index2stack (lua_State *L, int idx) {
|
||
|
CallInfo *ci = L->ci;
|
||
|
if (idx > 0) {
|
||
|
StkId o = ci->func.p + idx;
|
||
|
api_check(L, o < L->top.p, "invalid index");
|
||
|
return o;
|
||
|
}
|
||
|
else { /* non-positive index */
|
||
|
api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1),
|
||
|
"invalid index");
|
||
|
api_check(L, !ispseudo(idx), "invalid index");
|
||
|
return L->top.p + idx;
|
||
|
}
|
||
|
}
|
||
|
LUA_API int lua_checkstack (lua_State *L, int n) {
|
||
|
int res;
|
||
|
CallInfo *ci;
|
||
|
lua_lock(L);
|
||
|
ci = L->ci;
|
||
|
api_check(L, n >= 0, "negative 'n'");
|
||
|
if (L->stack_last.p - L->top.p > n) /* stack large enough? */
|
||
|
res = 1; /* yes; check is OK */
|
||
|
else /* need to grow stack */
|
||
|
res = luaD_growstack(L, n, 0);
|
||
|
if (res && ci->top.p < L->top.p + n)
|
||
|
ci->top.p = L->top.p + n; /* adjust frame top */
|
||
|
lua_unlock(L);
|
||
|
return res;
|
||
|
}
|
||
|
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
|
||
|
int i;
|
||
|
if (from == to) return;
|
||
|
lua_lock(to);
|
||
|
api_checknelems(from, n);
|
||
|
api_check(from, G(from) == G(to), "moving among independent states");
|
||
|
api_check(from, to->ci->top.p - to->top.p >= n, "stack overflow");
|
||
|
from->top.p -= n;
|
||
|
for (i = 0; i < n; i++) {
|
||
|
setobjs2s(to, to->top.p, from->top.p + i);
|
||
|
to->top.p++; /* stack already checked by previous 'api_check' */
|
||
|
}
|
||
|
lua_unlock(to);
|
||
|
}
|
||
|
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
|
||
|
lua_CFunction old;
|
||
|
lua_lock(L);
|
||
|
old = G(L)->panic;
|
||
|
G(L)->panic = panicf;
|
||
|
lua_unlock(L);
|
||
|
return old;
|
||
|
}
|
||
|
LUA_API lua_Number lua_version (lua_State *L) {
|
||
|
UNUSED(L);
|
||
|
return LUA_VERSION_NUM;
|
||