Feature #2196 ยป 0029-Update-included-lua-to-version-5.4.9.patch
| dependencies/lua-5.4/Makefile.am | ||
|---|---|---|
|
freeciv_lua.patch \
|
||
|
doc/readme.html \
|
||
|
doc/lua.css \
|
||
|
doc/logo.gif \
|
||
|
doc/OSIApproved_100X125.png
|
||
|
doc/logo.png \
|
||
|
doc/OSIApproved.png
|
||
| dependencies/lua-5.4/README | ||
|---|---|---|
|
This is Lua 5.4.8, released on 21 May 2025.
|
||
|
This is Lua 5.4.9, released on 10 Aug 2026.
|
||
|
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)
|
||
|
Sources here are from lua-5.4.9
|
||
|
(http://www.lua.org/ftp/lua-5.4.9.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.
|
||
| dependencies/lua-5.4/doc/readme.html | ||
|---|---|---|
|
<BODY>
|
||
|
<H1>
|
||
|
<A HREF="https://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
|
||
|
<A HREF="https://www.lua.org/"><IMG SRC="logo.png" ALT="Lua"></A>
|
||
|
Welcome to Lua 5.4
|
||
|
</H1>
|
||
| ... | ... | |
|
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 is implemented in pure ISO C and compiles unmodified in all known
|
||
|
platforms that have an ISO 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.
|
||
| ... | ... | |
|
<OL>
|
||
|
<LI>
|
||
|
Open a terminal window and move to
|
||
|
the top-level directory, which is named <TT>lua-5.4.8</TT>.
|
||
|
the top-level directory, which is named <TT>lua-5.4.9</TT>.
|
||
|
The <TT>Makefile</TT> there controls both the build process and the installation process.
|
||
|
<P>
|
||
|
<LI>
|
||
| ... | ... | |
|
<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>
|
||
|
<IMG SRC="OSIApproved.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>
|
||
| ... | ... | |
|
<A HREF="https://www.lua.org/license.html">license page</A>.
|
||
|
<BLOCKQUOTE STYLE="padding-bottom: 0em">
|
||
|
Copyright © 1994–2025 Lua.org, PUC-Rio.
|
||
|
Copyright © 1994–2026 Lua.org, PUC-Rio.
|
||
|
<P>
|
||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
| ... | ... | |
|
<P CLASS="footer">
|
||
|
Last update:
|
||
|
Wed May 21 21:12:01 UTC 2025
|
||
|
Wed Aug 5 21:42:45 UTC 2026
|
||
|
</P>
|
||
|
<!--
|
||
|
Last change: revised for Lua 5.4.8
|
||
|
Last change: revised for Lua 5.4.9
|
||
|
-->
|
||
|
</BODY>
|
||
| dependencies/lua-5.4/src/lapi.c | ||
|---|---|---|
|
ZIO z;
|
||
|
int status;
|
||
|
lua_lock(L);
|
||
|
luaC_checkGC(L);
|
||
|
if (!chunkname) chunkname = "?";
|
||
|
luaZ_init(L, &z, reader, data);
|
||
|
status = luaD_protectedparser(L, &z, chunkname, mode);
|
||
| dependencies/lua-5.4/src/lauxlib.c | ||
|---|---|---|
|
};
|
||
|
/*
|
||
|
** Get/create metatable (MT) for boxes
|
||
|
*/
|
||
|
static void getBoxMT (lua_State *L) {
|
||
|
const char *BOXMT = "_UBOX*"; /* key for the metatable */
|
||
|
if (luaL_getmetatable(L, BOXMT) == LUA_TNIL) { /* MT not created yet? */
|
||
|
luaL_newlibtable(L, boxmt); /* create it */
|
||
|
luaL_setfuncs(L, boxmt, 0); /* initialize it */
|
||
|
lua_copy(L, -1, -2); /* change stack from nil,MT to MT,MT */
|
||
|
lua_setfield(L, LUA_REGISTRYINDEX, BOXMT); /* store MT in the registry */
|
||
|
}
|
||
|
}
|
||
|
static void newbox (lua_State *L) {
|
||
|
UBox *box = (UBox *)lua_newuserdatauv(L, sizeof(UBox), 0);
|
||
|
box->box = NULL;
|
||
|
box->bsize = 0;
|
||
|
if (luaL_newmetatable(L, "_UBOX*")) /* creating metatable? */
|
||
|
luaL_setfuncs(L, boxmt, 0); /* set its metamethods */
|
||
|
getBoxMT(L);
|
||
|
lua_setmetatable(L, -2);
|
||
|
}
|
||
| dependencies/lua-5.4/src/ldo.c | ||
|---|---|---|
|
}
|
||
|
/*
|
||
|
** Check whether stacks have enough space to run a simple function (such
|
||
|
** as a finalizer): At least BASIC_STACK_SIZE in the Lua stack, two
|
||
|
** available CallInfos, and two "slots" in the C stack.
|
||
|
*/
|
||
|
int luaD_checkminstack (lua_State *L) {
|
||
|
if (getCcalls(L) >= LUAI_MAXCCALLS - 2)
|
||
|
return 0; /* not enough C-stack slots */
|
||
|
if (L->ci->next == NULL && luaE_extendCI(L, 0) == NULL)
|
||
|
return 0; /* unable to allocate first ci */
|
||
|
if (L->ci->next->next == NULL && luaE_extendCI(L, 0) == NULL)
|
||
|
return 0; /* unable to allocate second ci */
|
||
|
if (L->stack_last.p - L->top.p >= BASIC_STACK_SIZE)
|
||
|
return 1; /* enough (BASIC_STACK_SIZE) free slots in the Lua stack */
|
||
|
else /* try to grow stack to a size with enough free slots */
|
||
|
return luaD_growstack(L, BASIC_STACK_SIZE, 0);
|
||
|
}
|
||
|
/*
|
||
|
** Reallocate the stack to a new size, correcting all pointers into it.
|
||
|
** In ISO C, any pointer use after the pointer has been deallocated is
|
||
| ... | ... | |
|
#define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L))
|
||
|
#define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L, 1))
|
||
|
l_sinline CallInfo *prepCallInfo (lua_State *L, StkId func, int nret,
|
||
| dependencies/lua-5.4/src/ldo.h | ||
|---|---|---|
|
LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror);
|
||
|
LUAI_FUNC void luaD_shrinkstack (lua_State *L);
|
||
|
LUAI_FUNC void luaD_inctop (lua_State *L);
|
||
|
LUAI_FUNC int luaD_checkminstack (lua_State *L);
|
||
|
LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
|
||
|
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
|
||
| dependencies/lua-5.4/src/lgc.c | ||
|---|---|---|
|
correctgraylists(g);
|
||
|
checkSizes(L, g);
|
||
|
g->gcstate = GCSpropagate; /* skip restart */
|
||
|
if (!g->gcemergency)
|
||
|
if (g->tobefnz != NULL && !g->gcemergency && luaD_checkminstack(L))
|
||
|
callallpendingfinalizers(L);
|
||
|
}
|
||
| ... | ... | |
|
break;
|
||
|
}
|
||
|
case GCScallfin: { /* call remaining finalizers */
|
||
|
if (g->tobefnz && !g->gcemergency) {
|
||
|
if (g->tobefnz && !g->gcemergency && luaD_checkminstack(L)) {
|
||
|
g->gcstopem = 0; /* ok collections during finalizers */
|
||
|
work = runafewfinalizers(L, GCFINMAX) * GCFINALIZECOST;
|
||
|
}
|
||
|
else { /* emergency mode or no more finalizers */
|
||
|
else { /* no more finalizers or emergency mode or no enough stack
|
||
|
to run finalizers */
|
||
|
g->gcstate = GCSpause; /* finish collection */
|
||
|
work = 0;
|
||
|
}
|
||
| dependencies/lua-5.4/src/lstate.c | ||
|---|---|---|
|
}
|
||
|
CallInfo *luaE_extendCI (lua_State *L) {
|
||
|
CallInfo *luaE_extendCI (lua_State *L, int err) {
|
||
|
CallInfo *ci;
|
||
|
lua_assert(L->ci->next == NULL);
|
||
|
ci = luaM_new(L, CallInfo);
|
||
|
lua_assert(L->ci->next == NULL);
|
||
|
L->ci->next = ci;
|
||
|
ci = luaM_reallocvector(L, NULL, 0, 1, CallInfo);
|
||
|
if (l_unlikely(ci == NULL)) { /* allocation failed? */
|
||
|
if (err)
|
||
|
luaM_error(L); /* raise the error */
|
||
|
return NULL; /* else only report it */
|
||
|
}
|
||
|
ci->next = L->ci->next;
|
||
|
ci->previous = L->ci;
|
||
|
ci->next = NULL;
|
||
|
L->ci->next = ci;
|
||
|
if (ci->next)
|
||
|
ci->next->previous = ci;
|
||
|
ci->u.l.trap = 0;
|
||
|
L->nci++;
|
||
|
return ci;
|
||
| dependencies/lua-5.4/src/lstate.h | ||
|---|---|---|
|
LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
|
||
|
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
|
||
|
LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
|
||
|
LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L, int err);
|
||
|
LUAI_FUNC void luaE_shrinkCI (lua_State *L);
|
||
|
LUAI_FUNC void luaE_checkcstack (lua_State *L);
|
||
|
LUAI_FUNC void luaE_incCstack (lua_State *L);
|
||
| dependencies/lua-5.4/src/lstrlib.c | ||
|---|---|---|
|
static void prepstate (MatchState *ms, lua_State *L,
|
||
|
const char *s, size_t ls, const char *p, size_t lp) {
|
||
|
ms->L = L;
|
||
|
ms->matchdepth = MAXCCALLS;
|
||
|
ms->src_init = s;
|
||
|
ms->src_end = s + ls;
|
||
|
ms->p_end = p + lp;
|
||
| ... | ... | |
|
static void reprepstate (MatchState *ms) {
|
||
|
ms->matchdepth = MAXCCALLS;
|
||
|
ms->level = 0;
|
||
|
lua_assert(ms->matchdepth == MAXCCALLS);
|
||
|
}
|
||
| dependencies/lua-5.4/src/lua.h | ||
|---|---|---|
|
#define LUA_VERSION_MAJOR "5"
|
||
|
#define LUA_VERSION_MINOR "4"
|
||
|
#define LUA_VERSION_RELEASE "8"
|
||
|
#define LUA_VERSION_RELEASE "9"
|
||
|
#define LUA_VERSION_NUM 504
|
||
|
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 8)
|
||
|
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 9)
|
||
|
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
||
|
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
||
|
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2025 Lua.org, PUC-Rio"
|
||
|
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2026 Lua.org, PUC-Rio"
|
||
|
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
|
||
| ... | ... | |
|
/******************************************************************************
|
||
|
* Copyright (C) 1994-2025 Lua.org, PUC-Rio.
|
||
|
* Copyright (C) 1994-2026 Lua.org, PUC-Rio.
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||
|
* a copy of this software and associated documentation files (the
|
||
| dependencies/lua-5.4/src/lutf8lib.c | ||
|---|---|---|
|
utfint res = 0; /* final result */
|
||
|
if (c < 0x80) /* ascii? */
|
||
|
res = c;
|
||
|
else if (c >= 0xfe) /* c >= 1111 1110b ? */
|
||
|
return NULL; /* would need six or more continuation bytes */
|
||
|
else {
|
||
|
int count = 0; /* to count number of continuation bytes */
|
||
|
for (; c & 0x40; c <<= 1) { /* while it needs continuation bytes... */
|
||
| ... | ... | |
|
res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */
|
||
|
}
|
||
|
res |= ((utfint)(c & 0x7F) << (count * 5)); /* add first byte */
|
||
|
if (count > 5 || res > MAXUTF || res < limits[count])
|
||
|
if (res > MAXUTF || res < limits[count])
|
||
|
return NULL; /* invalid byte sequence */
|
||
|
s += count; /* skip continuation bytes read */
|
||
|
}
|
||
| dependencies/lua-5.4/src/lvm.c | ||
|---|---|---|
|
}
|
||
|
t = tm; /* else repeat assignment over 'tm' */
|
||
|
if (luaV_fastget(L, t, key, slot, luaH_get)) {
|
||
|
luaV_finishfastset(L, t, slot, val);
|
||
|
/* execute 'luaV_finishfastset', but preserving the original 't'
|
||
|
for the barrier. 't' and 'slot' can point to the same value,
|
||
|
and so the assignment can change 't' value */
|
||
|
GCObject *h = gcvalue(t);
|
||
|
setobj2t(L, cast(TValue *,slot), val);
|
||
|
luaC_barrierback(L, h, val);
|
||
|
return; /* done */
|
||
|
}
|
||
|
/* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */
|
||