revert Lua patches

This commit is contained in:
Jeremy Baxter 2023-12-27 23:17:00 +00:00
parent 7fd3b3282f
commit 787820e82f
3 changed files with 10 additions and 75 deletions

21
external/lua/Makefile vendored
View file

@ -6,12 +6,12 @@
# Your platform. See PLATS for possible values.
PLAT= guess
CC= cc -std=c99
CFLAGS= -O2 -fpic -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
CC= gcc -std=gnu99
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
AR= ar cr
AR= ar rcu
RANLIB= ranlib
RM= rm -f
UNAME= uname
@ -30,10 +30,9 @@ CMCFLAGS=
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
LUA_A= liblua.a
LUA_SO= liblua.so
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
@ -45,7 +44,7 @@ LUAC_T= luac
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
# Targets start here.
@ -61,9 +60,6 @@ $(LUA_A): $(BASE_O)
$(AR) $@ $(BASE_O)
$(RANLIB) $@
$(LUA_SO): $(CORE_O) $(LIB_O)
$(CC) -shared -Wl,-soname,$(LUA_SO) -o $@ $? -lm $(MYLDFLAGS)
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
@ -121,13 +117,16 @@ FreeBSD NetBSD OpenBSD freebsd:
generic: $(ALL)
ios:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_IOS"
Linux linux: linux-noreadline
linux-noreadline:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E"
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
linux-readline:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -lreadline"
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
Darwin macos macosx:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"

View file

@ -4,11 +4,6 @@
** See Copyright Notice in lua.h
*/
/***
* Math and algorithms.
* @module math
*/
#define lmathlib_c
#define LUA_LIB
@ -651,26 +646,6 @@ static void setrandfunc (lua_State *L) {
luaL_setfuncs(L, randfuncs, 1);
}
/***
* Linearly interpolates using the values given.
*
* Returns `x + (y - x) * z`
*
* @function lerp
* @tparam number x
* @tparam number y
* @tparam number z
*/
static int
math_lerp(lua_State *L)
{
double x; /* parameter 1 (number) */
x = luaL_checknumber(L, 1);
lua_pushnumber(L, x + (luaL_checknumber(L, 2) - x) * luaL_checknumber(L, 3));
return 1;
}
/* }================================================================== */
@ -740,7 +715,6 @@ static const luaL_Reg mathlib[] = {
{"floor", math_floor},
{"fmod", math_fmod},
{"ult", math_ult},
{"lerp", math_lerp},
{"log", math_log},
{"max", math_max},
{"min", math_min},

38
external/lua/loslib.c vendored
View file

@ -4,18 +4,6 @@
** See Copyright Notice in lua.h
*/
/***
* Operating system related facilities.
* @module os
*/
#ifdef __linux__
# include <bits/local_lim.h>
#else
/* assume OpenBSD/NetBSD */
# include <sys/syslimits.h>
#endif
#define loslib_c
#define LUA_LIB
@ -26,7 +14,6 @@
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include "lua.h"
@ -414,30 +401,6 @@ static int os_exit (lua_State *L) {
return 0;
}
#ifndef HOST_NAME_MAX
# define HOST_NAME_MAX 256 /* according to POSIX */
#endif
/***
* Returns the system hostname.
*
* @function hostname
* @usage local hostname = os.hostname()
*/
static int
os_hostname(lua_State *L)
{
char *buffer;
buffer = malloc(HOST_NAME_MAX * sizeof(char *));
gethostname(buffer, HOST_NAME_MAX); /* get hostname */
lua_pushstring(L, buffer);
free(buffer);
return 1;
}
static const luaL_Reg syslib[] = {
{"clock", os_clock},
@ -446,7 +409,6 @@ static const luaL_Reg syslib[] = {
{"execute", os_execute},
{"exit", os_exit},
{"getenv", os_getenv},
{"hostname", os_hostname},
{"remove", os_remove},
{"rename", os_rename},
{"setlocale", os_setlocale},