Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 00/21] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
Hi, This series targets automatic boot menu generation, but most of it is the Lua upgrade, because I got tired reading deprecated API docs. It's mostly a straightforward forward port of the earlier Syslinux specific changes to Lua 5.1, except that: * I chose the add a stub getenv() implementation to the COM32 API instead of #ifdefing out all the references in Lua, and * I kept oslib for its exit() and getenv() functions. I kept the various changes needed to make Lua compile in separate commits to simplify future forward porting, but this breaks the Syslinux build until the 12th patch in the series. Shall I disable Lua until then, or is this breakage a manageable inconvenience during bisection? Also, the current extension modules are disabled during this series, but reenable at the end (with a slight change in usage: they must be explicitly require()d before use). The Lua 5.2.2 tarball does not contain tests, so that directory is gone now. They were not of much use in my opinion. Maybe the extension modules should be moved into another directory, I'm not sure. And an official stat() implementation would be very useful. After inventing mine, I noticed rosh also invented its own... Given some instructions about which underlying interface it should be based on, I'd give a shot implementing it. Comments welcome. Ferenc W?gner (21): lua: import Lua 5.2.2 lua: replace src/Makefile to build Lua as a Syslinux COM32 module dev.h: get size_t definition lua: the COM32 API does not provide signal.h lua: explicitly put the console in standard mode lua: the COM32 API does not provide locale.h lua: use integer arithmetic lua: the COM32 API does not provide strcoll() lua: the COM32 API supports only part of iolib stdlib.h: provide a stub definition for getenv() lua: the COM32 API actually supports exit() of oslib lua: the COM32 API does not support time() lua: the COM32 API does not support freopen() sys/module.h: remove the #ifdef DYNAMIC_MODULE condition sys/module.h: fix some typos in function documentations lua: enable dynamic module loading lua: add the LuaFileSystem library lua: reactivate the syslinux extension module lua: bind get_key() in the syslinux module lua: also reactivate the cpu, dhcp, dmi, pci and vesa extension modules lua: make the dmi module standalone com32/include/dev.h | 1 + com32/include/stdlib.h | 7 +- com32/include/sys/module.h | 25 +- com32/lua/COPYRIGHT | 34 - com32/lua/HISTORY | 183 - com32/lua/INSTALL | 99 - com32/lua/Makefile | 114 + com32/lua/Makefile-orig | 120 - com32/lua/README | 37 +- com32/lua/doc/amazon.gif | Bin 797 -> 0 bytes com32/lua/doc/contents.html | 286 +- com32/lua/doc/cover.png | Bin 3305 -> 0 bytes com32/lua/doc/lua.1 | 121 +- com32/lua/doc/lua.css | 48 +- com32/lua/doc/lua.html | 172 - com32/lua/doc/luac.1 | 86 +- com32/lua/doc/luac.html | 145 - com32/lua/doc/manual.css | 17 +- com32/lua/doc/manual.html | 7472 ++++++++++++++++++++------------ com32/lua/doc/osi-certified-72x60.png | Bin 0 -> 3774 bytes com32/lua/doc/readme.html | 402 +- com32/lua/doc/syslinux.asc | 6 + com32/lua/etc/Makefile | 44 - com32/lua/etc/README | 37 - com32/lua/etc/all.c | 38 - com32/lua/etc/lua.ico | Bin 1078 -> 0 bytes com32/lua/etc/lua.pc | 31 - com32/lua/etc/luavs.bat | 28 - com32/lua/etc/min.c | 39 - com32/lua/etc/noparser.c | 50 - com32/lua/etc/strict.lua | 41 - com32/lua/src/Makefile | 26 +- com32/lua/src/Makefile-orig | 182 - com32/lua/src/cpu.c | 6 +- com32/lua/src/dhcp.c | 4 +- com32/lua/src/dmi.c | 16 +- com32/lua/src/lapi.c | 867 ++-- com32/lua/src/lapi.h | 14 +- com32/lua/src/lauxlib.c | 947 ++-- com32/lua/src/lauxlib.h | 126 +- com32/lua/src/lbaselib.c | 567 +-- com32/lua/src/lbitlib.c | 211 + com32/lua/src/lcode.c | 404 +- com32/lua/src/lcode.h | 21 +- com32/lua/src/lcorolib.c | 155 + com32/lua/src/lctype.c | 52 + com32/lua/src/lctype.h | 95 + com32/lua/src/ldblib.c | 214 +- com32/lua/src/ldebug.c | 620 ++- com32/lua/src/ldebug.h | 27 +- com32/lua/src/ldo.c | 661 +-- com32/lua/src/ldo.h | 33 +- com32/lua/src/ldump.c | 43 +- com32/lua/src/lfs.c | 294 ++ com32/lua/src/lfunc.c | 81 +- com32/lua/src/lfunc.h | 7 +- com32/lua/src/lgc.c | 1410 ++++-- com32/lua/src/lgc.h | 159 +- com32/lua/src/linit.c | 57 +- com32/lua/src/liolib.c | 548 ++- com32/lua/src/llex.c | 366 +- com32/lua/src/llex.h | 27 +- com32/lua/src/llimits.h | 221 +- com32/lua/src/lmathlib.c | 98 +- com32/lua/src/lmem.c | 45 +- com32/lua/src/lmem.h | 28 +- com32/lua/src/loadlib.c | 613 +-- com32/lua/src/lobject.c | 251 +- com32/lua/src/lobject.h | 460 +- com32/lua/src/lopcodes.c | 31 +- com32/lua/src/lopcodes.h | 106 +- com32/lua/src/loslib.c | 166 +- com32/lua/src/lparser.c | 1015 +++-- com32/lua/src/lparser.h | 75 +- com32/lua/src/lstate.c | 271 +- com32/lua/src/lstate.h | 149 +- com32/lua/src/lstring.c | 174 +- com32/lua/src/lstring.h | 21 +- com32/lua/src/lstrlib.c | 576 ++- com32/lua/src/ltable.c | 203 +- com32/lua/src/ltable.h | 15 +- com32/lua/src/ltablib.c | 140 +- com32/lua/src/ltm.c | 20 +- com32/lua/src/ltm.h | 9 +- com32/lua/src/lua.c | 341 +- com32/lua/src/lua.h | 225 +- com32/lua/{etc => src}/lua.hpp | 0 com32/lua/src/luac.c | 332 +- com32/lua/src/luaconf.h | 737 ++-- com32/lua/src/lualib.h | 47 +- com32/lua/src/lundump.c | 141 +- com32/lua/src/lundump.h | 22 +- com32/lua/src/lvm.c | 923 ++-- com32/lua/src/lvm.h | 26 +- com32/lua/src/lzio.c | 34 +- com32/lua/src/lzio.h | 8 +- com32/lua/src/pci.c | 4 +- com32/lua/src/print.c | 227 - com32/lua/src/syslinux.c | 53 +- com32/lua/src/vesa.c | 4 +- com32/lua/test/README | 26 - com32/lua/test/bisect.lua | 27 - com32/lua/test/cf.lua | 16 - com32/lua/test/cpu.lua | 19 - com32/lua/test/dmi.lua | 21 - com32/lua/test/echo.lua | 5 - com32/lua/test/env.lua | 7 - com32/lua/test/factorial.lua | 32 - com32/lua/test/fib.lua | 40 - com32/lua/test/fibfor.lua | 13 - com32/lua/test/globals.lua | 13 - com32/lua/test/hello.lua | 3 - com32/lua/test/life.lua | 111 - com32/lua/test/luac.lua | 7 - com32/lua/test/pci.lua | 34 - com32/lua/test/printf.lua | 7 - com32/lua/test/readonly.lua | 12 - com32/lua/test/sieve.lua | 29 - com32/lua/test/sort.lua | 66 - com32/lua/test/syslinux-derivative.lua | 38 - com32/lua/test/syslinux.lua | 1 - com32/lua/test/table.lua | 12 - com32/lua/test/trace-calls.lua | 32 - com32/lua/test/trace-globals.lua | 38 - com32/lua/test/vesa.lua | 55 - com32/lua/test/xd.lua | 14 - 126 files changed, 15144 insertions(+), 11268 deletions(-) delete mode 100644 com32/lua/COPYRIGHT delete mode 100644 com32/lua/HISTORY delete mode 100644 com32/lua/INSTALL create mode 100644 com32/lua/Makefile delete mode 100644 com32/lua/Makefile-orig delete mode 100644 com32/lua/doc/amazon.gif delete mode 100644 com32/lua/doc/cover.png delete mode 100644 com32/lua/doc/lua.html delete mode 100644 com32/lua/doc/luac.html create mode 100644 com32/lua/doc/osi-certified-72x60.png delete mode 100644 com32/lua/etc/Makefile delete mode 100644 com32/lua/etc/README delete mode 100644 com32/lua/etc/all.c delete mode 100644 com32/lua/etc/lua.ico delete mode 100644 com32/lua/etc/lua.pc delete mode 100644 com32/lua/etc/luavs.bat delete mode 100644 com32/lua/etc/min.c delete mode 100644 com32/lua/etc/noparser.c delete mode 100644 com32/lua/etc/strict.lua delete mode 100644 com32/lua/src/Makefile-orig create mode 100644 com32/lua/src/lbitlib.c create mode 100644 com32/lua/src/lcorolib.c create mode 100644 com32/lua/src/lctype.c create mode 100644 com32/lua/src/lctype.h create mode 100644 com32/lua/src/lfs.c rename com32/lua/{etc => src}/lua.hpp (100%) delete mode 100644 com32/lua/src/print.c delete mode 100644 com32/lua/test/README delete mode 100644 com32/lua/test/bisect.lua delete mode 100644 com32/lua/test/cf.lua delete mode 100644 com32/lua/test/cpu.lua delete mode 100644 com32/lua/test/dmi.lua delete mode 100644 com32/lua/test/echo.lua delete mode 100644 com32/lua/test/env.lua delete mode 100644 com32/lua/test/factorial.lua delete mode 100644 com32/lua/test/fib.lua delete mode 100644 com32/lua/test/fibfor.lua delete mode 100644 com32/lua/test/globals.lua delete mode 100644 com32/lua/test/hello.lua delete mode 100644 com32/lua/test/life.lua delete mode 100644 com32/lua/test/luac.lua delete mode 100644 com32/lua/test/pci.lua delete mode 100644 com32/lua/test/printf.lua delete mode 100644 com32/lua/test/readonly.lua delete mode 100644 com32/lua/test/sieve.lua delete mode 100644 com32/lua/test/sort.lua delete mode 100644 com32/lua/test/syslinux-derivative.lua delete mode 100644 com32/lua/test/syslinux.lua delete mode 100644 com32/lua/test/table.lua delete mode 100644 com32/lua/test/trace-calls.lua delete mode 100644 com32/lua/test/trace-globals.lua delete mode 100644 com32/lua/test/vesa.lua delete mode 100644 com32/lua/test/xd.lua -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 02/21] lua: replace src/Makefile to build Lua as a Syslinux COM32 module
Start with the src/Makefile in Syslinux before importing Lua 5.2.2. Refresh the core Lua object list based on the original Makefile. Add the new builtin library objects. Temporarily remove the Syslinux extension library objects, as they need adjustments for the new API. --- com32/lua/src/Makefile | 221 +++++++++++------------------------------------- 1 file changed, 49 insertions(+), 172 deletions(-) diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile index fea895b..286a46c 100644 --- a/com32/lua/src/Makefile +++ b/com32/lua/src/Makefile @@ -1,187 +1,64 @@ -# Makefile for building Lua -# See ../doc/readme.html for installation and customization instructions. +## ----------------------------------------------------------------------- +## +## Copyright 2001-2009 H. Peter Anvin - All Rights Reserved +## Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +## Boston MA 02110-1301, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================+## +## Lua Makefile +## -# Your platform. See PLATS for possible values. -PLAT= none +VPATH = $(SRC) +include $(MAKEDIR)/elf.mk -CC= gcc -CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) -LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) -LIBS= -lm $(SYSLIBS) $(MYLIBS) +LNXLIBS = -AR= ar rcu -RANLIB= ranlib -RM= rm -f +# Temporarily allow warnings not being treated as errors +#GCCWARN += -Wno-error -SYSCFLAGS-SYSLDFLAGS-SYSLIBS+CFLAGS += -DSYSLINUX +MODULES = lua.c32 +TESTFILES -MYCFLAGS-MYLDFLAGS-MYLIBS-MYOBJS+OBJS = lua.o -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======+LIBLUA = liblua.c32 -PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris +LIBLUA_OBJS := lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o +LIBLUA_OBJS += lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o +LIBLUA_OBJS += lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o -LUA_A= liblua.a -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 lbitlib.o lcorolib.o ldblib.o liolib.o \ - lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o -BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) +LIBLUA_OBJS += lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o +LIBLUA_OBJS += lstrlib.o ltablib.o loadlib.o linit.o -LUA_T= lua -LUA_O= lua.o +CFLAGS += -DLUA_ANSI -LUAC_T= luac -LUAC_O= luac.o +all: $(MODULES) $(TESTFILES) -ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) +liblua.elf : $(LIBLUA_OBJS) + $(LD) $(LDFLAGS) -shared -soname $(patsubst %.elf,%.c32,$(@F)) \ + -o $@ $^ -# Targets start here. -default: $(PLAT) +lua.elf : $(OBJS) $(LIBLUA) $(C_LIBS) + $(LD) $(LDFLAGS) -o $@ $^ -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(BASE_O) - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c - -echo: - @echo "PLAT= $(PLAT)" - @echo "CC= $(CC)" - @echo "CFLAGS= $(CFLAGS)" - @echo "LDFLAGS= $(SYSLDFLAGS)" - @echo "LIBS= $(LIBS)" - @echo "AR= $(AR)" - @echo "RANLIB= $(RANLIB)" - @echo "RM= $(RM)" - -# Convenience targets for popular platforms -ALL= all - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - -aix: - $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" - -ansi: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_ANSI" - -bsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" - -freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" - -generic: $(ALL) - -linux: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" - -macosx: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" - -mingw: - $(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" - -solaris: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \ - lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h ltable.h lundump.h \ - lvm.h -lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h -lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ - lstring.h ltable.h lvm.h -lcorolib.o: lcorolib.c lua.h luaconf.h lauxlib.h lualib.h -lctype.o: lctype.c lctype.h lua.h luaconf.h llimits.h -ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \ - ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h ldebug.h ldo.h \ - lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \ - lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h \ - lstring.h ltable.h lundump.h lvm.h -ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ - lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h \ - lstate.h ltm.h lzio.h lmem.h -lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lua.h luaconf.h lctype.h llimits.h ldo.h lobject.h \ - lstate.h ltm.h lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h -lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lgc.h -loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lua.h luaconf.h lctype.h llimits.h ldebug.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h lvm.h -lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lfunc.h \ - lstring.h lgc.h ltable.h -lstate.o: lstate.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \ - ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h lstring.h \ - ltable.h -lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ - ltm.h lzio.h lstring.h lgc.h -lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h -ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ - lmem.h lstring.h lgc.h ltable.h -lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lua.h luaconf.h lauxlib.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h -lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h -lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h -lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ - lzio.h +tidy dist: + rm -f *.o *.lo *.lst *.elf .*.d *.tmp +clean: tidy + rm -f *.lnx + +spotless: clean + rm -f *.lss *.c32 *.com + rm -f *~ \#* + +install: + +-include .*.d -- 1.7.10.4
--- com32/include/dev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/com32/include/dev.h b/com32/include/dev.h index 70b3165..077a0eb 100644 --- a/com32/include/dev.h +++ b/com32/include/dev.h @@ -36,6 +36,7 @@ #include <klibc/extern.h> #include <stdint.h> +#include <stddef.h> struct input_dev; struct output_dev; -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 04/21] lua: the COM32 API does not provide signal.h
--- com32/lua/src/lua.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/com32/lua/src/lua.c b/com32/lua/src/lua.c index 6a00712..40de6a9 100644 --- a/com32/lua/src/lua.c +++ b/com32/lua/src/lua.c @@ -5,7 +5,11 @@ */ +#ifdef SYSLINUX +#define signal(x,y) +#else #include <signal.h> +#endif #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -91,6 +95,7 @@ static const char *progname = LUA_PROGNAME; +#ifndef SYSLINUX static void lstop (lua_State *L, lua_Debug *ar) { (void)ar; /* unused arg. */ lua_sethook(L, NULL, 0, 0); @@ -103,6 +108,7 @@ static void laction (int i) { terminate process (default action) */ lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); } +#endif static void print_usage (const char *badoption) { -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 05/21] lua: explicitly put the console in standard mode
--- com32/lua/src/lua.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com32/lua/src/lua.c b/com32/lua/src/lua.c index 40de6a9..98c74a4 100644 --- a/com32/lua/src/lua.c +++ b/com32/lua/src/lua.c @@ -6,6 +6,7 @@ #ifdef SYSLINUX +#include <console.h> #define signal(x,y) #else #include <signal.h> @@ -490,6 +491,9 @@ int main (int argc, char **argv) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; } +#ifdef SYSLINUX + openconsole(&dev_stdcon_r, &dev_stdcon_w); +#endif /* call 'pmain' in protected mode */ lua_pushcfunction(L, &pmain); lua_pushinteger(L, argc); /* 1st argument */ -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 06/21] lua: the COM32 API does not provide locale.h
--- com32/lua/src/llex.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com32/lua/src/llex.c b/com32/lua/src/llex.c index 1a32e34..71fe3a4 100644 --- a/com32/lua/src/llex.c +++ b/com32/lua/src/llex.c @@ -5,7 +5,11 @@ */ +#ifndef SYSLINUX #include <locale.h> +#else +#define getlocaledecpoint() '.' +#endif #include <string.h> #define llex_c -- 1.7.10.4
--- com32/lua/src/linit.c | 2 ++ com32/lua/src/lmathlib.c | 2 ++ com32/lua/src/loslib.c | 4 +++ com32/lua/src/ltable.c | 15 +++++------ com32/lua/src/luaconf.h | 62 +++++++++++++++++++++++++++++++++++++++++++--- com32/lua/src/lvm.c | 20 +++++++++++++++ 6 files changed, 94 insertions(+), 11 deletions(-) diff --git a/com32/lua/src/linit.c b/com32/lua/src/linit.c index 8d3aa65..a2ca186 100644 --- a/com32/lua/src/linit.c +++ b/com32/lua/src/linit.c @@ -35,7 +35,9 @@ static const luaL_Reg loadedlibs[] = { {LUA_OSLIBNAME, luaopen_os}, {LUA_STRLIBNAME, luaopen_string}, {LUA_BITLIBNAME, luaopen_bit32}, +#ifndef LUA_NUMBER_INTEGRAL {LUA_MATHLIBNAME, luaopen_math}, +#endif {LUA_DBLIBNAME, luaopen_debug}, {NULL, NULL} }; diff --git a/com32/lua/src/lmathlib.c b/com32/lua/src/lmathlib.c index a49f1fd..97b935a 100644 --- a/com32/lua/src/lmathlib.c +++ b/com32/lua/src/lmathlib.c @@ -272,8 +272,10 @@ LUAMOD_API int luaopen_math (lua_State *L) { luaL_newlib(L, mathlib); lua_pushnumber(L, PI); lua_setfield(L, -2, "pi"); +#ifndef LUA_NUMBER_INTEGRAL lua_pushnumber(L, HUGE_VAL); lua_setfield(L, -2, "huge"); +#endif return 1; } diff --git a/com32/lua/src/loslib.c b/com32/lua/src/loslib.c index 5170fd0..04f8f9c 100644 --- a/com32/lua/src/loslib.c +++ b/com32/lua/src/loslib.c @@ -263,11 +263,13 @@ static int os_time (lua_State *L) { } +#ifndef LUA_NUMBER_INTEGRAL static int os_difftime (lua_State *L) { lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), (time_t)(luaL_optnumber(L, 2, 0)))); return 1; } +#endif /* }====================================================== */ @@ -300,7 +302,9 @@ static int os_exit (lua_State *L) { static const luaL_Reg syslib[] = { {"clock", os_clock}, {"date", os_date}, +#ifndef LUA_NUMBER_INTEGRAL {"difftime", os_difftime}, +#endif {"execute", os_execute}, {"exit", os_exit}, {"getenv", os_getenv}, diff --git a/com32/lua/src/ltable.c b/com32/lua/src/ltable.c index 420391f..fca20a8 100644 --- a/com32/lua/src/ltable.c +++ b/com32/lua/src/ltable.c @@ -77,15 +77,16 @@ static const Node dummynode_ = { /* ** hash for lua_Numbers */ +/* Taken from Lua 5.1 to avoid frexp() */ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; int i; - luai_hashnum(i, n); - if (i < 0) { - if (cast(unsigned int, i) == 0u - i) /* use unsigned to avoid overflows */ - i = 0; /* handle INT_MIN */ - i = -i; /* must be a positive value */ - } - return hashmod(t, i); + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); } diff --git a/com32/lua/src/luaconf.h b/com32/lua/src/luaconf.h index df802c9..fa6546b 100644 --- a/com32/lua/src/luaconf.h +++ b/com32/lua/src/luaconf.h @@ -383,14 +383,31 @@ ** ================================================================== */ +/* Define LUA_NUMBER_INTEGRAL to produce a system that uses no + floating point operations by changing the type of Lua numbers from + double to long. It implements division and modulus so that + + x == (x / y) * y + x % y. + + The exponentiation function returns zero for negative exponents. + Defining LUA_NUMBER_INTEGRAL also removes the difftime function, + and the math module should not be used. The string.format function + no longer handles the floating point directives %e, %E, %f, %g, and + %G. */ + +#define LUA_NUMBER_INTEGRAL +#ifdef LUA_NUMBER_INTEGRAL +#define LUA_NUMBER long +#else #define LUA_NUMBER_DOUBLE #define LUA_NUMBER double +#endif /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ -#define LUAI_UACNUMBER double +#define LUAI_UACNUMBER LUA_NUMBER /* @@ -399,8 +416,13 @@ @@ lua_number2str converts a number to a string. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. */ +#ifdef LUA_NUMBER_INTEGRAL +#define LUA_NUMBER_SCAN "%ld" +#define LUA_NUMBER_FMT "%ld" +#else #define LUA_NUMBER_SCAN "%lf" #define LUA_NUMBER_FMT "%.14g" +#endif #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ @@ -419,10 +441,14 @@ ** systems, you can leave 'lua_strx2number' undefined and Lua will ** provide its own implementation. */ +#ifdef LUA_NUMBER_INTEGRAL +#define lua_str2number(s,p) strtol((s), (p), 10) +#else #define lua_str2number(s,p) strtod((s), (p)) +#endif -#if defined(LUA_USE_STRTODHEX) -#define lua_strx2number(s,p) strtod((s), (p)) +#ifdef SYSLINUX +#define lua_strx2number(s,p) strtol((s), (p), 16) #endif @@ -430,19 +456,46 @@ @@ The luai_num* macros define the primitive operations over numbers. */ +#ifndef LUA_NUMBER_INTEGRAL /* the following operations need the math library */ #if defined(lobject_c) || defined(lvm_c) #include <math.h> #define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) #define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) #endif +#endif /* these are quite standard operations */ #if defined(LUA_CORE) #define luai_numadd(L,a,b) ((a)+(b)) #define luai_numsub(L,a,b) ((a)-(b)) #define luai_nummul(L,a,b) ((a)*(b)) +#ifdef LUA_NUMBER_INTEGRAL +#define luai_numdiv(L,a,b) \ + (-1/2? \ + (a)/(b): \ + (((a)<0)==((b)<0)||(a)%(b)==0? \ + (a)/(b): \ + (a)/(b)-1)) +#define luai_nummod(L,a,b) \ + (-1/2? \ + (a)%(b): \ + (((a)<0)==((b)<0)||(a)%(b)==0? \ + (a)%(b): \ + (a)%(b)+(b))) +#define luai_lnumdiv(L,a,b) \ + ((b)==0? \ + (luaG_runerror(L,"divide by zero"),0): \ + luai_numdiv(a,b)) +#define luai_lnummod(L,a,b) \ + ((b)==0? \ + (luaG_runerror(L,"modulo by zero"),0): \ + luai_nummod(a,b)) +LUA_NUMBER luai_ipow(void *L, LUA_NUMBER, LUA_NUMBER); +#define luai_numpow(L,a,b) (luai_ipow(L,a,b)) +#else #define luai_numdiv(L,a,b) ((a)/(b)) +#endif #define luai_numunm(L,a) (-(a)) #define luai_numeq(a,b) ((a)==(b)) #define luai_numlt(L,a,b) ((a)<(b)) @@ -457,7 +510,8 @@ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ -#define LUA_INTEGER ptrdiff_t +#define LUA_INTEGER long +/* Changed to long for use with integral Lua numbers. */ /* @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. diff --git a/com32/lua/src/lvm.c b/com32/lua/src/lvm.c index 657d5c4..9cb7571 100644 --- a/com32/lua/src/lvm.c +++ b/com32/lua/src/lvm.c @@ -27,6 +27,26 @@ #include "lvm.h" +#ifdef LUA_NUMBER_INTEGRAL +LUA_NUMBER luai_ipow(void *L, LUA_NUMBER a, LUA_NUMBER b) { + (void)L; + if (b < 0) + return 0; + else if (b == 0) + return 1; + else { + LUA_NUMBER c = 1; + for (;;) { + if (b & 1) + c *= a; + b = b >> 1; + if (b == 0) + return c; + a *= a; + } + } +} +#endif /* limit for table tag-method chains (to avoid loops) */ #define MAXTAGLOOP 100 -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 08/21] lua: the COM32 API does not provide strcoll()
--- com32/lua/src/lvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/com32/lua/src/lvm.c b/com32/lua/src/lvm.c index 9cb7571..58312ac 100644 --- a/com32/lua/src/lvm.c +++ b/com32/lua/src/lvm.c @@ -5,6 +5,9 @@ */ +#ifdef SYSLINUX +#define strcoll strcmp +#endif #include <stdio.h> #include <stdlib.h> #include <string.h> -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 09/21] lua: the COM32 API supports only part of iolib
--- com32/lua/src/liolib.c | 20 ++++++++++++++++++++ com32/lua/src/lua.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/com32/lua/src/liolib.c b/com32/lua/src/liolib.c index 3f80db1..6ff327b 100644 --- a/com32/lua/src/liolib.c +++ b/com32/lua/src/liolib.c @@ -252,11 +252,13 @@ static int io_popen (lua_State *L) { } +#ifndef SYSLINUX static int io_tmpfile (lua_State *L) { LStream *p = newfile(L); p->f = tmpfile(); return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; } +#endif static FILE *getiofile (lua_State *L, const char *findex) { @@ -346,6 +348,7 @@ static int io_lines (lua_State *L) { */ +#ifndef SYSLINUX static int read_number (lua_State *L, FILE *f) { lua_Number d; if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { @@ -365,6 +368,13 @@ static int test_eof (lua_State *L, FILE *f) { lua_pushlstring(L, NULL, 0); return (c != EOF); } +#else +static int test_eof (lua_State *L, FILE *f) { + (void)f; + lua_pushlstring(L, NULL, 0); + return 1; +} +#endif static int read_line (lua_State *L, FILE *f, int chop) { @@ -442,7 +452,11 @@ static int g_read (lua_State *L, FILE *f, int first) { luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); switch (p[1]) { case 'n': /* number */ +#ifndef SYSLINUX success = read_number(L, f); +#else + return luaL_argerror(L, n, "\"*number\" not supported"); +#endif break; case 'l': /* line */ success = read_line(L, f, 1); @@ -542,6 +556,7 @@ static int f_write (lua_State *L) { } +#ifndef SYSLINUX static int f_seek (lua_State *L) { static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; static const char *const modenames[] = {"set", "cur", "end", NULL}; @@ -570,6 +585,7 @@ static int f_setvbuf (lua_State *L) { int res = setvbuf(f, NULL, mode[op], sz); return luaL_fileresult(L, res == 0, NULL); } +#endif @@ -595,7 +611,9 @@ static const luaL_Reg iolib[] = { {"output", io_output}, {"popen", io_popen}, {"read", io_read}, +#ifndef SYSLINUX {"tmpfile", io_tmpfile}, +#endif {"type", io_type}, {"write", io_write}, {NULL, NULL} @@ -610,8 +628,10 @@ static const luaL_Reg flib[] = { {"flush", f_flush}, {"lines", f_lines}, {"read", f_read}, +#ifndef SYSLINUX {"seek", f_seek}, {"setvbuf", f_setvbuf}, +#endif {"write", f_write}, {"__gc", f_gc}, {"__tostring", f_tostring}, diff --git a/com32/lua/src/lua.h b/com32/lua/src/lua.h index eb0482b..1742aa9 100644 --- a/com32/lua/src/lua.h +++ b/com32/lua/src/lua.h @@ -15,6 +15,11 @@ #include "luaconf.h" +#ifdef SYSLINUX +#define clearerr(x) (void)0 +#define feof(x) 0 +#define ferror(x) 0 +#endif #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "2" -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 10/21] stdlib.h: provide a stub definition for getenv()
Which always returns NULL, representing an empty environment. --- com32/include/stdlib.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/com32/include/stdlib.h b/com32/include/stdlib.h index 1441297..1d9f01b 100644 --- a/com32/include/stdlib.h +++ b/com32/include/stdlib.h @@ -45,7 +45,12 @@ __extern long long strtoll(const char *, char **, int); __extern unsigned long strtoul(const char *, char **, int); __extern unsigned long long strtoull(const char *, char **, int); -__extern char *getenv(const char *); +static __inline__ char *getenv(const char *name) +{ + (void)name; + return NULL; +} + __extern int putenv(const char *); __extern int setenv(const char *, const char *, int); __extern int unsetenv(const char *); -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 11/21] lua: the COM32 API actually supports exit() of oslib
--- com32/lua/src/Makefile | 2 +- com32/lua/src/loslib.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile index 286a46c..09edaba 100644 --- a/com32/lua/src/Makefile +++ b/com32/lua/src/Makefile @@ -36,7 +36,7 @@ LIBLUA_OBJS += lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o LIBLUA_OBJS += lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o LIBLUA_OBJS += lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o -LIBLUA_OBJS += lstrlib.o ltablib.o loadlib.o linit.o +LIBLUA_OBJS += loslib.o lstrlib.o ltablib.o loadlib.o linit.o CFLAGS += -DLUA_ANSI diff --git a/com32/lua/src/loslib.c b/com32/lua/src/loslib.c index 04f8f9c..a4c7c9d 100644 --- a/com32/lua/src/loslib.c +++ b/com32/lua/src/loslib.c @@ -6,7 +6,9 @@ #include <errno.h> +#ifndef SYSLINUX #include <locale.h> +#endif #include <stdlib.h> #include <string.h> #include <time.h> @@ -20,6 +22,7 @@ #include "lualib.h" +#ifndef SYSLINUX /* ** list of valid conversion specifiers for the 'strftime' function */ @@ -111,6 +114,7 @@ static int os_tmpname (lua_State *L) { lua_pushstring(L, buff); return 1; } +#endif /* SYSLINUX */ static int os_getenv (lua_State *L) { @@ -119,6 +123,7 @@ static int os_getenv (lua_State *L) { } +#ifndef SYSLINUX static int os_clock (lua_State *L) { lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); return 1; @@ -284,6 +289,7 @@ static int os_setlocale (lua_State *L) { lua_pushstring(L, setlocale(cat[op], l)); return 1; } +#endif /* SYSLINUX */ static int os_exit (lua_State *L) { @@ -300,19 +306,23 @@ static int os_exit (lua_State *L) { static const luaL_Reg syslib[] = { +#ifndef SYSLINUX {"clock", os_clock}, {"date", os_date}, #ifndef LUA_NUMBER_INTEGRAL {"difftime", os_difftime}, #endif {"execute", os_execute}, +#endif {"exit", os_exit}, {"getenv", os_getenv}, +#ifndef SYSLINUX {"remove", os_remove}, {"rename", os_rename}, {"setlocale", os_setlocale}, {"time", os_time}, {"tmpname", os_tmpname}, +#endif {NULL, NULL} }; -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 12/21] lua: the COM32 API does not support time()
--- com32/lua/src/lstate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/com32/lua/src/lstate.c b/com32/lua/src/lstate.c index 207a106..706f5dd 100644 --- a/com32/lua/src/lstate.c +++ b/com32/lua/src/lstate.c @@ -47,8 +47,13 @@ ** created; the seed is used to randomize hashes. */ #if !defined(luai_makeseed) +#ifndef SYSLINUX #include <time.h> #define luai_makeseed() cast(unsigned int, time(NULL)) +#else +#include <sys/times.h> +#define luai_makeseed() cast(unsigned int, times(NULL)) +#endif /* SYSLINUX */ #endif -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 13/21] lua: the COM32 API does not support freopen()
Nor the concept of text vs. binary open mode, so it does not matter. --- com32/lua/src/lauxlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com32/lua/src/lauxlib.c b/com32/lua/src/lauxlib.c index 2e989d6..07a9316 100644 --- a/com32/lua/src/lauxlib.c +++ b/com32/lua/src/lauxlib.c @@ -644,11 +644,13 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, } if (skipcomment(&lf, &c)) /* read initial portion */ lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ +#ifndef SYSLINUX if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ if (lf.f == NULL) return errfile(L, "reopen", fnameindex); skipcomment(&lf, &c); /* re-read initial portion */ } +#endif if (c != EOF) lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 14/21] sys/module.h: remove the #ifdef DYNAMIC_MODULE condition
This makes the module_* functions accessible to COM32 modules. MODULE_INIT and MODULE_EXIT are not used anymore. --- com32/include/sys/module.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/com32/include/sys/module.h b/com32/include/sys/module.h index c1d4253..eaa4182 100644 --- a/com32/include/sys/module.h +++ b/com32/include/sys/module.h @@ -156,24 +156,6 @@ extern struct elf_module *unload_modules_since(const char *name); extern FILE *findpath(char *name); -#ifdef DYNAMIC_MODULE - -/* - * This portion is included by dynamic (ELF) module source files. - */ - -#define MODULE_INIT(fn) static module_init_t __module_init \ - __used __attribute__((section(".ctors_modinit"))) = fn - -#define MODULE_EXIT(fn) static module_exit_t __module_exit \ - __used __attribute__((section(".dtors_modexit"))) = fn - -#else - -/* - * This portion is included by the core COM32 module. - */ - /** * Names of symbols with special meaning (treated as special cases at linking) */ @@ -365,6 +347,4 @@ static inline const struct elf_module *syslinux_current(void) } -#endif // DYNAMIC_MODULE - #endif // MODULE_H_ -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 15/21] sys/module.h: fix some typos in function documentations
--- com32/include/sys/module.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com32/include/sys/module.h b/com32/include/sys/module.h index eaa4182..3e5a8d9 100644 --- a/com32/include/sys/module.h +++ b/com32/include/sys/module.h @@ -175,7 +175,7 @@ extern struct list_head modules_head; #define for_each_module(m) list_for_each_entry(m, &modules_head, list) /** - * for_each_module - iterator loop through the list of loaded modules safe against removal. + * for_each_module_safe - iterator loop through the list of loaded modules safe against removal. */ #define for_each_module_safe(m, n) \ list_for_each_entry_safe(m, n, &modules_head, list) @@ -250,6 +250,7 @@ extern int module_unload(struct elf_module *module); /** * _module_unload - unloads the module without running destructors + * @module: the module descriptor structure. * * This function is the same as module_unload(), except that the * module's destructors are not executed. @@ -257,7 +258,7 @@ extern int module_unload(struct elf_module *module); extern int _module_unload(struct elf_module *module); /** - * module_unload - unloads the module from the system. + * get_module_type - get type of the module * @module: the module descriptor structure. * * This function returns the type of module we're dealing with -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 16/21] lua: enable dynamic module loading
--- com32/lua/src/loadlib.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ com32/lua/src/luaconf.h | 3 +++ 2 files changed, 48 insertions(+) diff --git a/com32/lua/src/loadlib.c b/com32/lua/src/loadlib.c index a995927..3962889 100644 --- a/com32/lua/src/loadlib.c +++ b/com32/lua/src/loadlib.c @@ -212,6 +212,51 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { /* }====================================================== */ +#elif defined(SYSLINUX) +/* +** {========================================================================+** This is an implementation of loadlib for the Syslinux COM32 module system. +** =========================================================================+*/ + +#include <sys/module.h> + +static void ll_unloadlib (void *lib) { + module_unload ((struct elf_module *)lib); +} + + +static void *ll_load (lua_State *L, const char *path, int seeglb) { + int err; + struct elf_module *lib = module_alloc (path); + if (lib == NULL) { + lua_pushstring (L, "module not found"); + return NULL; + } + (void)seeglb; /* gcc, ignore it */ + err = module_load (lib); + if (err) { + printf ("module load error: %d\n", err); + lua_pushstring (L, "failed to load module"); + return NULL; + } + return (void *)lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + Elf_Sym *p = module_find_symbol (sym, (struct elf_module *)lib); + if (p == NULL) { + lua_pushstring (L, "symbol not found in module"); + return NULL; + } + return (lua_CFunction)module_get_absolute(p->st_value, (struct elf_module *)lib); +} + +/* }====================================================== */ + + + #else /* ** {=====================================================diff --git a/com32/lua/src/luaconf.h b/com32/lua/src/luaconf.h index fa6546b..7fd4eaa 100644 --- a/com32/lua/src/luaconf.h +++ b/com32/lua/src/luaconf.h @@ -97,6 +97,9 @@ #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll" +#elif defined(SYSLINUX) +#define LUA_PATH_DEFAULT "./?.lua" +#define LUA_CPATH_DEFAULT "./?.c32" #else /* }{ */ #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 17/21] lua: add the LuaFileSystem library
--- com32/lua/src/Makefile | 1 + com32/lua/src/lfs.c | 294 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 295 insertions(+) create mode 100644 com32/lua/src/lfs.c diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile index 09edaba..070db90 100644 --- a/com32/lua/src/Makefile +++ b/com32/lua/src/Makefile @@ -25,6 +25,7 @@ LNXLIBS CFLAGS += -DSYSLINUX MODULES = lua.c32 +MODULES += lfs.c32 TESTFILES OBJS = lua.o diff --git a/com32/lua/src/lfs.c b/com32/lua/src/lfs.c new file mode 100644 index 0000000..2415fd9 --- /dev/null +++ b/com32/lua/src/lfs.c @@ -0,0 +1,294 @@ +/* +** Read only code copied from: +** +** LuaFileSystem +** Copyright Kepler Project 2003 (http://www.keplerproject.org/luafilesystem) +** +** File system manipulation library. +** This library offers these functions: +** lfs.attributes (filepath [, attributename]) +** lfs.chdir (path) +** lfs.currentdir () +** lfs.dir (path) +** +** $Id: lfs.c,v 1.61 2009/07/04 02:10:16 mascarenhas Exp $ +*/ + +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" + +#define chdir_error strerror(errno) + +/* Size of path buffer string, stolen from pwd.c */ +#ifndef PATH_MAX +# ifdef NAME_MAX +# define PATH_MAX NAME_MAX +# elif FILENAME_MAX +# define PATH_MAX FILENAME_MAX +# else +# define PATH_MAX 256 +# endif /* NAME_MAX */ +#endif /* PATH_MAX */ + + +#define DIR_METATABLE "directory metatable" +typedef struct dir_data { + int closed; + DIR *dir; +} dir_data; + + +#define STAT_STRUCT struct stat +#define STAT_FUNC stat_via_fstat + +/* Emulate stat via fstat */ +int stat_via_fstat (const char *path, struct stat *buf) +{ + int fd = open (path, O_RDONLY); + if (fd == -1) { + DIR *dir = opendir (path); + if (!dir) return -1; + closedir (dir); + buf->st_mode=S_IFDIR; + buf->st_size=0; + return 0; + } + if (fstat (fd, buf) == -1) { + int err = errno; + close (fd); + errno = err; + return -1; + } + close (fd); + return 0; +} + +/* +** This function changes the working (current) directory +*/ +static int change_dir (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + if (chdir(path)) { + lua_pushnil (L); + lua_pushfstring (L,"Unable to change working directory to '%s'\n%s\n", + path, chdir_error); + return 2; + } else { + lua_pushboolean (L, 1); + return 1; + } +} + + +/* +** This function returns the current directory +** If unable to get the current directory, it returns nil +** and a string describing the error +*/ +static int get_dir (lua_State *L) { + char *path; + /* Passing (NULL, 0) is not guaranteed to work. Use a temp buffer and size instead. */ + char buf[PATH_MAX]; + if ((path = getcwd(buf, PATH_MAX)) == NULL) { + lua_pushnil(L); + lua_pushstring(L, strerror(errno)); + return 2; + } + else { + lua_pushstring(L, path); + return 1; + } +} + + +/* +** Directory iterator +*/ +static int dir_iter (lua_State *L) { + struct dirent *entry; + dir_data *d = (dir_data *)luaL_checkudata (L, 1, DIR_METATABLE); + luaL_argcheck (L, d->closed == 0, 1, "closed directory"); + if ((entry = readdir (d->dir)) != NULL) { + lua_pushstring (L, entry->d_name); + return 1; + } else { + /* no more entries => close directory */ + closedir (d->dir); + d->closed = 1; + return 0; + } +} + + +/* +** Closes directory iterators +*/ +static int dir_close (lua_State *L) { + dir_data *d = (dir_data *)lua_touserdata (L, 1); + if (!d->closed && d->dir) { + closedir (d->dir); + } + d->closed = 1; + return 0; +} + + +/* +** Factory of directory iterators +*/ +static int dir_iter_factory (lua_State *L) { + const char *path = luaL_checkstring (L, 1); + dir_data *d; + lua_pushcfunction (L, dir_iter); + d = (dir_data *) lua_newuserdata (L, sizeof(dir_data)); + luaL_getmetatable (L, DIR_METATABLE); + lua_setmetatable (L, -2); + d->closed = 0; + d->dir = opendir (path); + if (d->dir == NULL) + luaL_error (L, "cannot open %s: %s", path, strerror (errno)); + return 2; +} + + +/* +** Creates directory metatable. +*/ +static int dir_create_meta (lua_State *L) { + luaL_newmetatable (L, DIR_METATABLE); + + /* Method table */ + lua_newtable(L); + lua_pushcfunction (L, dir_iter); + lua_setfield(L, -2, "next"); + lua_pushcfunction (L, dir_close); + lua_setfield(L, -2, "close"); + + /* Metamethods */ + lua_setfield(L, -2, "__index"); + lua_pushcfunction (L, dir_close); + lua_setfield (L, -2, "__gc"); + return 1; +} + + +/* +** Convert the inode protection mode to a string. +*/ +static const char *mode2string (mode_t mode) { + if ( S_ISREG(mode) ) + return "file"; + else if ( S_ISDIR(mode) ) + return "directory"; + else if ( S_ISLNK(mode) ) + return "link"; + else if ( S_ISSOCK(mode) ) + return "socket"; + else if ( S_ISFIFO(mode) ) + return "named pipe"; + else if ( S_ISCHR(mode) ) + return "char device"; + else if ( S_ISBLK(mode) ) + return "block device"; + else + return "other"; +} + + +/* inode protection mode */ +static void push_st_mode (lua_State *L, STAT_STRUCT *info) { + lua_pushstring (L, mode2string (info->st_mode)); +} +/* file size, in bytes */ +static void push_st_size (lua_State *L, STAT_STRUCT *info) { + lua_pushnumber (L, (lua_Number)info->st_size); +} +static void push_invalid (lua_State *L, STAT_STRUCT *info) { + luaL_error(L, "invalid attribute name"); + info->st_size = 0; /* never reached */ +} + +typedef void (*_push_function) (lua_State *L, STAT_STRUCT *info); + +struct _stat_members { + const char *name; + _push_function push; +}; + +struct _stat_members members[] = { + { "mode", push_st_mode }, + { "size", push_st_size }, + { NULL, push_invalid } +}; + +/* +** Get file or symbolic link information +*/ +static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { + int i; + STAT_STRUCT info; + const char *file = luaL_checkstring (L, 1); + + if (st(file, &info)) { + lua_pushnil (L); + lua_pushfstring (L, "cannot obtain information from file `%s'", file); + return 2; + } + if (lua_isstring (L, 2)) { + int v; + const char *member = lua_tostring (L, 2); + if (strcmp (member, "mode") == 0) v = 0; +#ifndef _WIN32 + else if (strcmp (member, "blocks") == 0) v = 11; + else if (strcmp (member, "blksize") == 0) v = 12; +#endif + else /* look for member */ + for (v = 1; members[v].name; v++) + if (*members[v].name == *member) + break; + /* push member value and return */ + members[v].push (L, &info); + return 1; + } else if (!lua_istable (L, 2)) + /* creates a table if none is given */ + lua_newtable (L); + /* stores all members in table on top of the stack */ + for (i = 0; members[i].name; i++) { + lua_pushstring (L, members[i].name); + members[i].push (L, &info); + lua_rawset (L, -3); + } + return 1; +} + + +/* +** Get file information using stat. +*/ +static int file_info (lua_State *L) { + return _file_info_ (L, STAT_FUNC); +} + + +static const struct luaL_Reg fslib[] = { + {"attributes", file_info}, + {"chdir", change_dir}, + {"currentdir", get_dir}, + {"dir", dir_iter_factory}, + {NULL, NULL}, +}; + +LUALIB_API int luaopen_lfs (lua_State *L) { + dir_create_meta (L); + luaL_newlib (L, fslib); + return 1; +} -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 18/21] lua: reactivate the syslinux extension module
Under Lua 5.2 modules are not expected to set global variables to reduce namespace pollution. Explicit require() is preferred. --- com32/lua/src/Makefile | 1 + com32/lua/src/syslinux.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile index 070db90..e757396 100644 --- a/com32/lua/src/Makefile +++ b/com32/lua/src/Makefile @@ -26,6 +26,7 @@ LNXLIBS CFLAGS += -DSYSLINUX MODULES = lua.c32 MODULES += lfs.c32 +MODULES += syslinux.c32 TESTFILES OBJS = lua.o diff --git a/com32/lua/src/syslinux.c b/com32/lua/src/syslinux.c index afcdcaa..9983233 100644 --- a/com32/lua/src/syslinux.c +++ b/com32/lua/src/syslinux.c @@ -473,7 +473,7 @@ static int sl_version(lua_State * L) return 1; } -static const luaL_reg syslinuxlib[] = { +static const luaL_Reg syslinuxlib[] = { {"run_command", sl_run_command}, {"run_default", sl_run_default}, {"local_boot", sl_local_boot}, @@ -504,6 +504,6 @@ LUALIB_API int luaopen_syslinux(lua_State * L) luaL_newmetatable(L, SYSLINUX_FILE); - luaL_openlib(L, LUA_SYSLINUXLIBNAME, syslinuxlib, 0); + luaL_newlib(L, syslinuxlib); return 1; } -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 19/21] lua: bind get_key() in the syslinux module
--- com32/lua/src/syslinux.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/com32/lua/src/syslinux.c b/com32/lua/src/syslinux.c index 9983233..ab38166 100644 --- a/com32/lua/src/syslinux.c +++ b/com32/lua/src/syslinux.c @@ -25,6 +25,7 @@ * * ----------------------------------------------------------------------- */ +#include <getkey.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -473,6 +474,19 @@ static int sl_version(lua_State * L) return 1; } +static int sl_get_key (lua_State * L) +{ + int timeout = luaL_checkint (L, 1); + lua_pushinteger (L, get_key (stdin, timeout)); + return 1; +} + +static int sl_KEY_CTRL (lua_State * L) +{ + lua_pushinteger (L, KEY_CTRL (luaL_checkint (L, 1))); + return 1; +} + static const luaL_Reg syslinuxlib[] = { {"run_command", sl_run_command}, {"run_default", sl_run_default}, @@ -494,6 +508,8 @@ static const luaL_Reg syslinuxlib[] = { {"reboot", sl_reboot}, {"derivative", sl_derivative}, {"version", sl_version}, + {"get_key", sl_get_key}, + {"KEY_CTRL", sl_KEY_CTRL}, {NULL, NULL} }; @@ -505,5 +521,38 @@ LUALIB_API int luaopen_syslinux(lua_State * L) luaL_newmetatable(L, SYSLINUX_FILE); luaL_newlib(L, syslinuxlib); + + lua_newtable (L); +#define export_key(x) lua_pushinteger (L, KEY_##x); lua_setfield (L, -2, #x); + export_key (NONE); + export_key (BACKSPACE); + export_key (TAB); + export_key (ENTER); + export_key (ESC); + export_key (DEL); + export_key (F1); + export_key (F2); + export_key (F3); + export_key (F4); + export_key (F5); + export_key (F6); + export_key (F7); + export_key (F8); + export_key (F9); + export_key (F10); + export_key (F11); + export_key (F12); + export_key (UP); + export_key (DOWN); + export_key (LEFT); + export_key (RIGHT); + export_key (PGUP); + export_key (PGDN); + export_key (HOME); + export_key (END); + export_key (INSERT); + export_key (DELETE); + lua_setfield (L, -2, "KEY"); + return 1; } -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 20/21] lua: also reactivate the cpu, dhcp, dmi, pci and vesa extension modules
And document the change in usage. --- com32/lua/doc/syslinux.asc | 6 ++++++ com32/lua/src/Makefile | 5 +++++ com32/lua/src/cpu.c | 2 +- com32/lua/src/dhcp.c | 4 ++-- com32/lua/src/dmi.c | 2 +- com32/lua/src/pci.c | 4 ++-- com32/lua/src/vesa.c | 4 ++-- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/com32/lua/doc/syslinux.asc b/com32/lua/doc/syslinux.asc index 64dc18c..424c51f 100644 --- a/com32/lua/doc/syslinux.asc +++ b/com32/lua/doc/syslinux.asc @@ -20,6 +20,12 @@ APPEND /testit.lua Modules ------- +Modules must be explicitly loaded into the namespace +before use, for example: +...................................................... +syslinux = require ("syslinux") +...................................................... + SYSLINUX ~~~~~~~~ diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile index e757396..20650ef 100644 --- a/com32/lua/src/Makefile +++ b/com32/lua/src/Makefile @@ -25,8 +25,13 @@ LNXLIBS CFLAGS += -DSYSLINUX MODULES = lua.c32 +MODULES += cpu.c32 +MODULES += dhcp.c32 +MODULES += dmi.c32 MODULES += lfs.c32 +MODULES += pci.c32 MODULES += syslinux.c32 +MODULES += vesa.c32 TESTFILES OBJS = lua.o diff --git a/com32/lua/src/cpu.c b/com32/lua/src/cpu.c index 6ef4e5a..69914f7 100644 --- a/com32/lua/src/cpu.c +++ b/com32/lua/src/cpu.c @@ -152,7 +152,7 @@ static const luaL_Reg cpulib[] = { LUALIB_API int luaopen_cpu(lua_State *L) { - luaL_openlib(L, LUA_CPULIBNAME, cpulib, 0); + luaL_newlib(L, cpulib); return 1; } diff --git a/com32/lua/src/dhcp.c b/com32/lua/src/dhcp.c index af94813..14a3934 100644 --- a/com32/lua/src/dhcp.c +++ b/com32/lua/src/dhcp.c @@ -346,13 +346,13 @@ static int dhcp_gettable(lua_State *L) return 1; } -static const luaL_reg dhcplib[] = { +static const luaL_Reg dhcplib[] = { {"gettable", dhcp_gettable}, {"getoptions", dhcp_getoptions}, {NULL, NULL} }; LUALIB_API int luaopen_dhcp (lua_State *L) { - luaL_openlib(L, LUA_DHCPLIBNAME, dhcplib, 0); + luaL_newlib(L, dhcplib); return 1; } diff --git a/com32/lua/src/dmi.c b/com32/lua/src/dmi.c index 984fb60..aa38df3 100644 --- a/com32/lua/src/dmi.c +++ b/com32/lua/src/dmi.c @@ -519,7 +519,7 @@ static const luaL_Reg dmilib[] = { LUALIB_API int luaopen_dmi (lua_State *L) { - luaL_openlib(L, LUA_DMILIBNAME, dmilib, 0); + luaL_newlib(L, dmilib); return 1; } diff --git a/com32/lua/src/pci.c b/com32/lua/src/pci.c index c367ba9..964020f 100644 --- a/com32/lua/src/pci.c +++ b/com32/lua/src/pci.c @@ -160,7 +160,7 @@ static int pci_getidlist(lua_State *L) return(1); } -static const luaL_reg pcilib[] = { +static const luaL_Reg pcilib[] = { {"getinfo", pci_getinfo}, {"getidlist", pci_getidlist}, {NULL, NULL} @@ -169,7 +169,7 @@ static const luaL_reg pcilib[] = { /* This defines a function that opens up your library. */ LUALIB_API int luaopen_pci (lua_State *L) { - luaL_openlib(L, LUA_PCILIBNAME, pcilib, 0); + luaL_newlib(L, pcilib); return 1; } diff --git a/com32/lua/src/vesa.c b/com32/lua/src/vesa.c index 06649e1..02e4b51 100644 --- a/com32/lua/src/vesa.c +++ b/com32/lua/src/vesa.c @@ -122,7 +122,7 @@ static int vesa_load_background(lua_State *L) return 0; } -static const luaL_reg vesalib[] = { +static const luaL_Reg vesalib[] = { {"getmodes", vesa_getmodes}, {"setmode", vesa_setmode}, {"load_background", vesa_load_background}, @@ -132,7 +132,7 @@ static const luaL_reg vesalib[] = { /* This defines a function that opens up your library. */ LUALIB_API int luaopen_vesa (lua_State *L) { - luaL_openlib(L, LUA_VESALIBNAME, vesalib, 0); + luaL_newlib(L, vesalib); return 1; } -- 1.7.10.4
Ferenc Wágner
2013-Oct-15 18:03 UTC
[syslinux] [PATCH 21/21] lua: make the dmi module standalone
By copying two short functions from the cpu module. They do not warrant a separate module. Also make those functions static in both modules. --- com32/lua/src/cpu.c | 4 ++-- com32/lua/src/dmi.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/com32/lua/src/cpu.c b/com32/lua/src/cpu.c index 69914f7..2e822cd 100644 --- a/com32/lua/src/cpu.c +++ b/com32/lua/src/cpu.c @@ -9,13 +9,13 @@ #include"lualib.h" #include"cpuid.h" -void add_string_item(lua_State *L, const char *item, const char *value_str) { +static void add_string_item(lua_State *L, const char *item, const char *value_str) { lua_pushstring(L,item); lua_pushstring(L,value_str); lua_settable(L,-3); } -void add_int_item(lua_State *L, const char *item, int value_int) { +static void add_int_item(lua_State *L, const char *item, int value_int) { lua_pushstring(L,item); lua_pushnumber(L,value_int); lua_settable(L,-3); diff --git a/com32/lua/src/dmi.c b/com32/lua/src/dmi.c index aa38df3..f4755e8 100644 --- a/com32/lua/src/dmi.c +++ b/com32/lua/src/dmi.c @@ -9,8 +9,18 @@ #include "lualib.h" #include "dmi/dmi.h" -extern void add_string_item(lua_State*, const char*, const char*); -extern void add_int_item(lua_State*, const char*, int); +static void add_string_item(lua_State *L, const char *item, const char *value_str) { + lua_pushstring(L,item); + lua_pushstring(L,value_str); + lua_settable(L,-3); +} + +static void add_int_item(lua_State *L, const char *item, int value_int) { + lua_pushstring(L,item); + lua_pushnumber(L,value_int); + lua_settable(L,-3); +} + typedef int (*table_fn)(lua_State*, s_dmi*); /* Add a Lua_String entry to the table on stack -- 1.7.10.4
Geert Stappers
2013-Oct-15 20:09 UTC
[syslinux] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
Op 2013-10-15 om 20:03 schreef Ferenc W?gner:> Hi, > > This series targets automatic boot menu generation, but most of it > is the Lua upgrade, because I got tired reading deprecated API docs. > It's mostly a straightforward forward port of the earlier Syslinux > specific changes to Lua 5.1, except that: > > * I chose the add a stub getenv() implementation to the COM32 API > instead of #ifdefing out all the references in Lua, and > > * I kept oslib for its exit() and getenv() functions. > > I kept the various changes needed to make Lua compile in separate > commits to simplify future forward porting, but this breaks the > Syslinux build until the 12th patch in the series. Shall I disable > Lua until then, or is this breakage a manageable inconvenience during > bisection? Also, the current extension modules are disabled during > this series, but reenable at the end (with a slight change in usage: > they must be explicitly require()d before use). > > The Lua 5.2.2 tarball does not contain tests, so that directory is > gone now. They were not of much use in my opinion. > > Maybe the extension modules should be moved into another directory, > I'm not sure. > > And an official stat() implementation would be very useful. After > inventing mine, I noticed rosh also invented its own... Given some > instructions about which underlying interface it should be based on, > I'd give a shot implementing it. > > Comments welcome. > > Ferenc W?gner (21): > lua: import Lua 5.2.2Posted as [patch01/21] Which was too big for the mailinglist. So some other way is needed to share that information ...> lua: replace src/Makefile to build Lua as a Syslinux COM32 module > dev.h: get size_t definition > lua: the COM32 API does not provide signal.h > lua: explicitly put the console in standard mode > lua: the COM32 API does not provide locale.h > lua: use integer arithmetic > lua: the COM32 API does not provide strcoll() > lua: the COM32 API supports only part of iolib > stdlib.h: provide a stub definition for getenv() > lua: the COM32 API actually supports exit() of oslib > lua: the COM32 API does not support time() > lua: the COM32 API does not support freopen() > sys/module.h: remove the #ifdef DYNAMIC_MODULE condition > sys/module.h: fix some typos in function documentations > lua: enable dynamic module loading > lua: add the LuaFileSystem library > lua: reactivate the syslinux extension module > lua: bind get_key() in the syslinux module > lua: also reactivate the cpu, dhcp, dmi, pci and vesa extension > modules > lua: make the dmi module standalone > > com32/include/dev.h | 1 + > com32/include/stdlib.h | 7 +- > com32/include/sys/module.h | 25 +- > com32/lua/COPYRIGHT | 34 - > com32/lua/HISTORY | 183 - > com32/lua/INSTALL | 99 - > com32/lua/Makefile | 114 + > com32/lua/Makefile-orig | 120 - > com32/lua/README | 37 +- > com32/lua/doc/amazon.gif | Bin 797 -> 0 bytes > com32/lua/doc/contents.html | 286 +- > com32/lua/doc/cover.png | Bin 3305 -> 0 bytes > com32/lua/doc/lua.1 | 121 +- > com32/lua/doc/lua.css | 48 +- > com32/lua/doc/lua.html | 172 - > com32/lua/doc/luac.1 | 86 +- > com32/lua/doc/luac.html | 145 - > com32/lua/doc/manual.css | 17 +- > com32/lua/doc/manual.html | 7472 ++++++++++++++++++++------------ > com32/lua/doc/osi-certified-72x60.png | Bin 0 -> 3774 bytes > com32/lua/doc/readme.html | 402 +- > com32/lua/doc/syslinux.asc | 6 + > com32/lua/etc/Makefile | 44 - > com32/lua/etc/README | 37 - > com32/lua/etc/all.c | 38 - > com32/lua/etc/lua.ico | Bin 1078 -> 0 bytes > com32/lua/etc/lua.pc | 31 - > com32/lua/etc/luavs.bat | 28 - > com32/lua/etc/min.c | 39 - > com32/lua/etc/noparser.c | 50 - > com32/lua/etc/strict.lua | 41 - > com32/lua/src/Makefile | 26 +- > com32/lua/src/Makefile-orig | 182 - > com32/lua/src/cpu.c | 6 +- > com32/lua/src/dhcp.c | 4 +- > com32/lua/src/dmi.c | 16 +- > com32/lua/src/lapi.c | 867 ++-- > com32/lua/src/lapi.h | 14 +- > com32/lua/src/lauxlib.c | 947 ++-- > com32/lua/src/lauxlib.h | 126 +- > com32/lua/src/lbaselib.c | 567 +-- > com32/lua/src/lbitlib.c | 211 + > com32/lua/src/lcode.c | 404 +- > com32/lua/src/lcode.h | 21 +- > com32/lua/src/lcorolib.c | 155 + > com32/lua/src/lctype.c | 52 + > com32/lua/src/lctype.h | 95 + > com32/lua/src/ldblib.c | 214 +- > com32/lua/src/ldebug.c | 620 ++- > com32/lua/src/ldebug.h | 27 +- > com32/lua/src/ldo.c | 661 +-- > com32/lua/src/ldo.h | 33 +- > com32/lua/src/ldump.c | 43 +- > com32/lua/src/lfs.c | 294 ++ > com32/lua/src/lfunc.c | 81 +- > com32/lua/src/lfunc.h | 7 +- > com32/lua/src/lgc.c | 1410 ++++-- > com32/lua/src/lgc.h | 159 +- > com32/lua/src/linit.c | 57 +- > com32/lua/src/liolib.c | 548 ++- > com32/lua/src/llex.c | 366 +- > com32/lua/src/llex.h | 27 +- > com32/lua/src/llimits.h | 221 +- > com32/lua/src/lmathlib.c | 98 +- > com32/lua/src/lmem.c | 45 +- > com32/lua/src/lmem.h | 28 +- > com32/lua/src/loadlib.c | 613 +-- > com32/lua/src/lobject.c | 251 +- > com32/lua/src/lobject.h | 460 +- > com32/lua/src/lopcodes.c | 31 +- > com32/lua/src/lopcodes.h | 106 +- > com32/lua/src/loslib.c | 166 +- > com32/lua/src/lparser.c | 1015 +++-- > com32/lua/src/lparser.h | 75 +- > com32/lua/src/lstate.c | 271 +- > com32/lua/src/lstate.h | 149 +- > com32/lua/src/lstring.c | 174 +- > com32/lua/src/lstring.h | 21 +- > com32/lua/src/lstrlib.c | 576 ++- > com32/lua/src/ltable.c | 203 +- > com32/lua/src/ltable.h | 15 +- > com32/lua/src/ltablib.c | 140 +- > com32/lua/src/ltm.c | 20 +- > com32/lua/src/ltm.h | 9 +- > com32/lua/src/lua.c | 341 +- > com32/lua/src/lua.h | 225 +- > com32/lua/{etc => src}/lua.hpp | 0 > com32/lua/src/luac.c | 332 +- > com32/lua/src/luaconf.h | 737 ++-- > com32/lua/src/lualib.h | 47 +- > com32/lua/src/lundump.c | 141 +- > com32/lua/src/lundump.h | 22 +- > com32/lua/src/lvm.c | 923 ++-- > com32/lua/src/lvm.h | 26 +- > com32/lua/src/lzio.c | 34 +- > com32/lua/src/lzio.h | 8 +- > com32/lua/src/pci.c | 4 +- > com32/lua/src/print.c | 227 - > com32/lua/src/syslinux.c | 53 +- > com32/lua/src/vesa.c | 4 +- > com32/lua/test/README | 26 - > com32/lua/test/bisect.lua | 27 - > com32/lua/test/cf.lua | 16 - > com32/lua/test/cpu.lua | 19 - > com32/lua/test/dmi.lua | 21 - > com32/lua/test/echo.lua | 5 - > com32/lua/test/env.lua | 7 - > com32/lua/test/factorial.lua | 32 - > com32/lua/test/fib.lua | 40 - > com32/lua/test/fibfor.lua | 13 - > com32/lua/test/globals.lua | 13 - > com32/lua/test/hello.lua | 3 - > com32/lua/test/life.lua | 111 - > com32/lua/test/luac.lua | 7 - > com32/lua/test/pci.lua | 34 - > com32/lua/test/printf.lua | 7 - > com32/lua/test/readonly.lua | 12 - > com32/lua/test/sieve.lua | 29 - > com32/lua/test/sort.lua | 66 - > com32/lua/test/syslinux-derivative.lua | 38 - > com32/lua/test/syslinux.lua | 1 - > com32/lua/test/table.lua | 12 - > com32/lua/test/trace-calls.lua | 32 - > com32/lua/test/trace-globals.lua | 38 - > com32/lua/test/vesa.lua | 55 - > com32/lua/test/xd.lua | 14 - > 126 files changed, 15144 insertions(+), 11268 deletions(-) > delete mode 100644 com32/lua/COPYRIGHT > delete mode 100644 com32/lua/HISTORY > delete mode 100644 com32/lua/INSTALL > create mode 100644 com32/lua/Makefile > delete mode 100644 com32/lua/Makefile-orig > delete mode 100644 com32/lua/doc/amazon.gif > delete mode 100644 com32/lua/doc/cover.png > delete mode 100644 com32/lua/doc/lua.html > delete mode 100644 com32/lua/doc/luac.html > create mode 100644 com32/lua/doc/osi-certified-72x60.png > delete mode 100644 com32/lua/etc/Makefile > delete mode 100644 com32/lua/etc/README > delete mode 100644 com32/lua/etc/all.c > delete mode 100644 com32/lua/etc/lua.ico > delete mode 100644 com32/lua/etc/lua.pc > delete mode 100644 com32/lua/etc/luavs.bat > delete mode 100644 com32/lua/etc/min.c > delete mode 100644 com32/lua/etc/noparser.c > delete mode 100644 com32/lua/etc/strict.lua > delete mode 100644 com32/lua/src/Makefile-orig > create mode 100644 com32/lua/src/lbitlib.c > create mode 100644 com32/lua/src/lcorolib.c > create mode 100644 com32/lua/src/lctype.c > create mode 100644 com32/lua/src/lctype.h > create mode 100644 com32/lua/src/lfs.c > rename com32/lua/{etc => src}/lua.hpp (100%) > delete mode 100644 com32/lua/src/print.c > delete mode 100644 com32/lua/test/README > delete mode 100644 com32/lua/test/bisect.lua > delete mode 100644 com32/lua/test/cf.lua > delete mode 100644 com32/lua/test/cpu.lua > delete mode 100644 com32/lua/test/dmi.lua > delete mode 100644 com32/lua/test/echo.lua > delete mode 100644 com32/lua/test/env.lua > delete mode 100644 com32/lua/test/factorial.lua > delete mode 100644 com32/lua/test/fib.lua > delete mode 100644 com32/lua/test/fibfor.lua > delete mode 100644 com32/lua/test/globals.lua > delete mode 100644 com32/lua/test/hello.lua > delete mode 100644 com32/lua/test/life.lua > delete mode 100644 com32/lua/test/luac.lua > delete mode 100644 com32/lua/test/pci.lua > delete mode 100644 com32/lua/test/printf.lua > delete mode 100644 com32/lua/test/readonly.lua > delete mode 100644 com32/lua/test/sieve.lua > delete mode 100644 com32/lua/test/sort.lua > delete mode 100644 com32/lua/test/syslinux-derivative.lua > delete mode 100644 com32/lua/test/syslinux.lua > delete mode 100644 com32/lua/test/table.lua > delete mode 100644 com32/lua/test/trace-calls.lua > delete mode 100644 com32/lua/test/trace-globals.lua > delete mode 100644 com32/lua/test/vesa.lua > delete mode 100644 com32/lua/test/xd.lua > > -- > 1.7.10.4 > > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux > Please do not send private replies to mailing list traffic. >-- Groeten Geert Stappers -- Leven en laten leven
Ferenc Wagner
2013-Oct-16 07:16 UTC
[syslinux] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
Geert Stappers <stappers at stappers.nl> writes:> Op 2013-10-15 om 20:03 schreef Ferenc W?gner: > >> lua: import Lua 5.2.2 > > Posted as [patch01/21] > Which was too big for the mailinglist. > So some other way is needed to share that information ...Hmm, yes. The series is available at https://github.com/wferi/syslinux as well (lua52 branch, based on upstream firmware branch). Cover letter: https://gist.github.com/wferi/6989458#file-lua52_cover-txt -- Thanks, Feri.
Matt Fleming
2013-Nov-20 13:09 UTC
[syslinux] [PATCH 00/21] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
On Tue, 15 Oct, at 08:03:28PM, Ferenc W?gner wrote:> Ferenc W?gner (21): > lua: import Lua 5.2.2 > lua: replace src/Makefile to build Lua as a Syslinux COM32 module > dev.h: get size_t definition > lua: the COM32 API does not provide signal.h > lua: explicitly put the console in standard mode > lua: the COM32 API does not provide locale.h > lua: use integer arithmetic > lua: the COM32 API does not provide strcoll() > lua: the COM32 API supports only part of iolib > stdlib.h: provide a stub definition for getenv() > lua: the COM32 API actually supports exit() of oslib > lua: the COM32 API does not support time() > lua: the COM32 API does not support freopen() > sys/module.h: remove the #ifdef DYNAMIC_MODULE condition > sys/module.h: fix some typos in function documentations > lua: enable dynamic module loading > lua: add the LuaFileSystem library > lua: reactivate the syslinux extension module > lua: bind get_key() in the syslinux module > lua: also reactivate the cpu, dhcp, dmi, pci and vesa extension > modules > lua: make the dmi module standaloneThanks, I pulled your lua52 branch. Unless anyone screams otherwise, I plan on merging this code sometime this week. -- Matt Fleming, Intel Open Source Technology Center
Apparently Analagous Threads
- Upgrade to Lua 5.2.2, add filesystem module and get_key binding
- [PATCH 00/21] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
- version: Bump version & Lua
- Upgrade to Lua 5.2.2, add filesystem module and get_key binding
- pull request: upgrade to Lua 5.2.3, automatic Linux boot menu and cmenu binding