Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions vendor/compat53/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/auto-update-actions
# https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
cooldown: # https://nesbitt.io/2026/03/04/package-managers-need-to-cool-down.html
default-days: 7
53 changes: 53 additions & 0 deletions vendor/compat53/.github/workflows/bit32-multi-arch-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: bit32-multi-arch-tests
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
bit32-test:
runs-on: ubuntu-latest
name: bit32 tests on ${{ matrix.luaVersion }} ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
luaVersion: ["5.1.5", "5.4.1"]
luaRocksVersion: ["3.3.1"]
arch: ["armv7", "aarch64"]
steps:
- uses: actions/checkout@v7
- uses: actions/cache@v6
id: lua-cache
with:
path: .install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}
key: lua-on-linux-${{ matrix.arch }}-${{ matrix.luaVersion }}
- uses: uraimo/run-on-arch-action@v3
with:
arch: ${{ matrix.arch }}
distro: ubuntu_rolling
githubToken: ${{ github.token }}
setup: |
mkdir -p ".install/${{ matrix.arch }}"
install: |
apt-get update -q -y
apt-get install -q -y curl unzip build-essential libreadline-dev libncurses-dev clang
rm -rf /var/lib/apt/lists/*
run: |
v() {
echo -n -e "\033[36m" >&2
echo -n "# $*" >&2
echo -e "\033[0m" >&2
"$@"
}
export CC=clang
if [ "${{ steps.lua-cache.outputs.cache-hit }}" != true ]; then
(set -o pipefail; cd ".install/${{ matrix.arch }}" && v curl --fail --silent --location "http://www.lua.org/ftp/lua-${{ matrix.luaVersion }}.tar.gz" | tar xzpf -)
(cd ".install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}" && v make linux)
fi
(cd ".install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}" && v make install)
(set -o pipefail; cd .install && v curl --fail --silent --location "http://luarocks.org/releases/luarocks-${{ matrix.luaRocksVersion }}.tar.gz" | tar xzpf -)
(cd ".install/luarocks-${{ matrix.luaRocksVersion }}" && v ./configure && v make bootstrap)
eval "$(luarocks path)"
v luarocks make rockspecs/bit32-scm-1.rockspec
v lua tests/test-bit32.lua

100 changes: 100 additions & 0 deletions vendor/compat53/.github/workflows/compat53-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: compat53-tests
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
compat53-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- luaVersion: "lua=5.1"
compiler: gcc
external: false
- luaVersion: "lua=5.1"
compiler: gcc
external: true
- luaVersion: "lua=5.1"
compiler: g++
external: true
- luaVersion: "lua=5.1"
compiler: clang
external: false
- luaVersion: "luajit=@v2.1 --compat=none"
compiler: gcc
external: false
- luaVersion: "luajit=@v2.1 --compat=none"
compiler: gcc
external: true
- luaVersion: "luajit=@v2.1 --compat=all"
compiler: gcc
external: false
- luaVersion: "luajit=@v2.1 --compat=all"
compiler: gcc
external: true
- luaVersion: "lua=5.2"
compiler: gcc
external: false
- luaVersion: "lua=5.2"
compiler: gcc
external: true
- luaVersion: "lua=5.2"
compiler: g++
external: true
steps:
- uses: actions/checkout@v7
- name: install Lua
run: |
sudo apt install libreadline-dev
pip3 install --user hererocks
~/.local/bin/hererocks old --${{ matrix.luaVersion }}
test -e old/bin/lua || (cd old/bin && ln -s luajit* lua)
~/.local/bin/hererocks new --lua=5.3
- name: compile C modules
run: |
export CC=${{ matrix.compiler }} CFLAGS="-Wall -Wextra -Ic-api -O2 -fPIC"
export DEF="" SRC=""
if [ "${{ matrix.external }}" = true ]; then DEF="-DCOMPAT53_PREFIX=compat53" SRC="c-api/compat-5.3.c"; fi
${CC} ${CFLAGS} -Iold/include ${DEF} -shared -o old/testmod.so tests/testmod.c ${SRC}
${CC} ${CFLAGS} -Inew/include ${DEF} -shared -o new/testmod.so tests/testmod.c ${SRC}
${CC} ${CFLAGS} -Iold/include ${DEF} -shared -o old/compat53.so ltablib.c lutf8lib.c lstrlib.c liolib.c ${SRC}
- name: run test scripts
run: |
(cd old && bin/lua ../tests/test.lua) > old.txt
(cd new && bin/lua ../tests/test.lua) > new.txt
- name: compare script output
run: diff old.txt new.txt || true

compat53-install:
strategy:
fail-fast: false # https://github.com/actions/runner-images#available-images
matrix: # https://www.lua.org/versions.html
os: [ubuntu-latest]
lua-version: [5.1, 5.2, 5.3, 5.4, 5.5]
include:
- os: macos-latest
lua-version: 5.1
- os: macos-latest
lua-version: 5.5
runs-on: ${{ matrix.os }}
steps:
- run: echo "${{ runner.os }} on ${{ runner.arch }}"
- uses: actions/checkout@v7
- uses: luarocks/gh-actions-lua@master
with:
luaVersion: ${{ matrix.lua-version }}
- uses: luarocks/gh-actions-luarocks@master
with:
luaRocksVersion: "3.13.0"
- run: lua -v && luarocks --version
- run: luarocks lint rockspecs/compat53-scm-1.rockspec
# Install the local version of compat53.
- run: luarocks --local make rockspecs/compat53-scm-1.rockspec
- run: luarocks list && luarocks show compat53
- run: luarocks --local remove compat53
# Install the public version of compat53.
- run: luarocks install --check-lua-versions compat53
- run: luarocks list && luarocks show compat53
2 changes: 1 addition & 1 deletion vendor/compat53/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ install:
- if [ "x${EXTERNAL:-}" = xtrue ]; then DEF="-DCOMPAT53_PREFIX=compat53" SRC="c-api/compat-5.3.c"; fi
- ${CC} ${CFLAGS} -Iold/include ${DEF} -shared -o old/testmod.so tests/testmod.c ${SRC}
- ${CC} ${CFLAGS} -Inew/include ${DEF} -shared -o new/testmod.so tests/testmod.c ${SRC}
- gcc ${CFLAGS} -Iold/include ${DEF} -shared -o old/compat53.so ltablib.c lutf8lib.c lstrlib.c ${SRC}
- gcc ${CFLAGS} -Iold/include ${DEF} -shared -o old/compat53.so ltablib.c lutf8lib.c lstrlib.c liolib.c ${SRC}

script:
- (cd old && bin/lua ../tests/test.lua) > old.txt
Expand Down
3 changes: 2 additions & 1 deletion vendor/compat53/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2015 Kepler Project.
Copyright (C) 1994-2020 Lua.org, PUC-Rio.
Copyright (C) 2013-2023 The Lua-Compat-5.3 authors.

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
Expand Down
51 changes: 27 additions & 24 deletions vendor/compat53/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/keplerproject/lua-compat-5.3.svg?branch=master)](https://travis-ci.org/keplerproject/lua-compat-5.3)
[![Compat53 Status](https://github.com/lunarmodules/lua-compat-5.3/workflows/compat53-tests/badge.svg)](https://github.com/lunarmodules/lua-compat-5.3/actions?workflow=compat53-tests)
[![Bit32 Status](https://github.com/lunarmodules/lua-compat-5.3/workflows/bit32-multi-arch-tests/badge.svg)](https://github.com/lunarmodules/lua-compat-5.3/actions?workflow=bit32-multi-arch-tests)

# lua-compat-5.3

Expand Down Expand Up @@ -116,6 +117,8 @@ For Lua 5.1 additionally:
* `io.write` and `file:write` return file handle
* `io.lines` and `file:lines` accept format arguments (like `io.read`)
(see [here][10] and [here][11])
* `file:close` returns three results when a process is opened
with `io.popen`
* `debug.setmetatable` returns object
* `debug.getuservalue` (see [here][12])
* `debug.setuservalue` (see [here][13])
Expand Down Expand Up @@ -214,27 +217,27 @@ This package contains code written by:


[1]: http://www.inf.puc-rio.br/~roberto/struct/
[2]: http://github.com/keplerproject/lua-compat-5.2/
[3]: http://keplerproject.org/compat/
[4]: https://github.com/keplerproject/lua-compat-5.3/wiki/string_packing
[5]: https://github.com/keplerproject/lua-compat-5.3/wiki/math.type
[6]: https://github.com/keplerproject/lua-compat-5.3/wiki/pattern_matching
[7]: https://github.com/keplerproject/lua-compat-5.3/wiki/pairs
[8]: https://github.com/keplerproject/lua-compat-5.3/wiki/package.searchpath
[9]: https://github.com/keplerproject/lua-compat-5.3/wiki/os.execute
[10]: https://github.com/keplerproject/lua-compat-5.3/wiki/io.lines
[11]: https://github.com/keplerproject/lua-compat-5.3/wiki/file.lines
[12]: https://github.com/keplerproject/lua-compat-5.3/wiki/debug.getuservalue
[13]: https://github.com/keplerproject/lua-compat-5.3/wiki/debug.setuservalue
[14]: https://github.com/keplerproject/lua-compat-5.3/wiki/yieldable_c_functions
[15]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_dump
[16]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_getuservalue
[17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue
[18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber
[19]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Stream
[20]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith
[21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion
[22]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer
[23]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running
[24]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_getextraspace
[2]: http://github.com/lunarmodules/lua-compat-5.2/
[3]: http://lunarmodules.org/compat/
[4]: https://github.com/lunarmodules/lua-compat-5.3/wiki/string_packing
[5]: https://github.com/lunarmodules/lua-compat-5.3/wiki/math.type
[6]: https://github.com/lunarmodules/lua-compat-5.3/wiki/pattern_matching
[7]: https://github.com/lunarmodules/lua-compat-5.3/wiki/pairs
[8]: https://github.com/lunarmodules/lua-compat-5.3/wiki/package.searchpath
[9]: https://github.com/lunarmodules/lua-compat-5.3/wiki/os.execute
[10]: https://github.com/lunarmodules/lua-compat-5.3/wiki/io.lines
[11]: https://github.com/lunarmodules/lua-compat-5.3/wiki/file.lines
[12]: https://github.com/lunarmodules/lua-compat-5.3/wiki/debug.getuservalue
[13]: https://github.com/lunarmodules/lua-compat-5.3/wiki/debug.setuservalue
[14]: https://github.com/lunarmodules/lua-compat-5.3/wiki/yieldable_c_functions
[15]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_dump
[16]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_getuservalue
[17]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_setuservalue
[18]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_stringtonumber
[19]: https://github.com/lunarmodules/lua-compat-5.3/wiki/luaL_Stream
[20]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_arith
[21]: https://github.com/lunarmodules/lua-compat-5.3/wiki/luaL_checkversion
[22]: https://github.com/lunarmodules/lua-compat-5.3/wiki/luaL_Buffer
[23]: https://github.com/lunarmodules/lua-compat-5.3/wiki/coroutine.running
[24]: https://github.com/lunarmodules/lua-compat-5.3/wiki/lua_getextraspace

13 changes: 11 additions & 2 deletions vendor/compat53/c-api/compat-5.3.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#endif /* VC++ _fsopen for share-allowed file read */

#ifndef COMPAT53_HAVE_STRERROR_R
# if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
# if (!defined(_WIN32)) && \
((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || \
defined(__APPLE__)
defined(__APPLE__))
# define COMPAT53_HAVE_STRERROR_R 1
# else /* none of the defines matched: define to 0 */
# define COMPAT53_HAVE_STRERROR_R 0
Expand Down Expand Up @@ -715,6 +716,14 @@ void luaL_pushresult (luaL_Buffer_53 *B) {
#if defined( LUA_VERSION_NUM ) && LUA_VERSION_NUM <= 502


COMPAT53_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {
#undef lua_pushlstring
lua_pushlstring(L, len > 0 ? s : "", len);
#define lua_pushlstring COMPAT53_CONCAT(COMPAT53_PREFIX, _pushlstring_53)
return lua_tostring(L, -1);
}


COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i) {
index = lua_absindex(L, index);
lua_pushinteger(L, i);
Expand Down
35 changes: 26 additions & 9 deletions vendor/compat53/c-api/compat-5.3.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ COMPAT53_API void lua_len (lua_State *L, int i);
#define lua_pushstring(L, s) \
(lua_pushstring((L), (s)), lua_tostring((L), -1))

#define lua_pushlstring(L, s, len) \
((((len) == 0) ? lua_pushlstring((L), "", 0) : lua_pushlstring((L), (s), (len))), lua_tostring((L), -1))

#ifndef luaL_newlibtable
# define luaL_newlibtable(L, l) \
(lua_createtable((L), 0, sizeof((l))/sizeof(*(l))-1))
Expand Down Expand Up @@ -290,6 +287,9 @@ typedef int (*lua_KFunction)(lua_State *L, int status, lua_KContext ctx);
#define lua_gettable(L, i) \
(lua_gettable((L), (i)), lua_type((L), -1))

#define lua_pushlstring COMPAT53_CONCAT(COMPAT53_PREFIX, _pushlstring_53)
COMPAT53_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len);

#define lua_geti COMPAT53_CONCAT(COMPAT53_PREFIX, _geti)
COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i);

Expand Down Expand Up @@ -352,9 +352,6 @@ COMPAT53_API void luaL_requiref (lua_State *L, const char *modname,
#define lua_getuservalue(L, i) \
(lua_getuservalue((L), (i)), lua_type((L), -1))

#define lua_pushlstring(L, s, len) \
(((len) == 0) ? lua_pushlstring((L), "", 0) : lua_pushlstring((L), (s), (len)))

#define lua_rawgetp(L, i, p) \
(lua_rawgetp((L), (i), (p)), lua_type((L), -1))

Expand Down Expand Up @@ -398,12 +395,32 @@ COMPAT53_API void luaL_requiref (lua_State *L, const char *modname,



/* declarations for Lua 5.5 */
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 505

/*
** Internal assertions for in-house debugging
*/
#if defined LUAI_ASSERT
# undef NDEBUG
# include <assert.h>
# define lua_assert(c) assert(c)
#endif

#if !defined(lua_assert)
# define lua_assert(c) ((void)0)
#endif

#endif /* Lua 5.5 only */



/* other Lua versions */
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 504
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 505

# error "unsupported Lua version (i.e. not Lua 5.1, 5.2, 5.3, or 5.4)"
# error "unsupported Lua version (i.e. not Lua 5.1, 5.2, 5.3, 5.4, or 5.5)"

#endif /* other Lua versions except 5.1, 5.2, 5.3, and 5.4 */
#endif /* other Lua versions except 5.1, 5.2, 5.3, 5.4, and 5.5 */



Expand Down
Loading