Module Name: src Committed By: lneto Date: Mon Dec 2 04:57:41 UTC 2013
Modified Files: src/external/mit/lua/dist/src: lauxlib.c lbaselib.c linit.c src/sys/modules/lua: Makefile Log Message: put Lua auxlib and some stdlibs in lua(4) To generate a diff of this commit: cvs rdiff -u -r1.1.1.2 -r1.2 src/external/mit/lua/dist/src/lauxlib.c \ src/external/mit/lua/dist/src/lbaselib.c \ src/external/mit/lua/dist/src/linit.c cvs rdiff -u -r1.3 -r1.4 src/sys/modules/lua/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/mit/lua/dist/src/lauxlib.c diff -u src/external/mit/lua/dist/src/lauxlib.c:1.1.1.2 src/external/mit/lua/dist/src/lauxlib.c:1.2 --- src/external/mit/lua/dist/src/lauxlib.c:1.1.1.2 Thu Mar 15 00:08:09 2012 +++ src/external/mit/lua/dist/src/lauxlib.c Mon Dec 2 04:57:41 2013 @@ -1,7 +1,7 @@ -/* $NetBSD: lauxlib.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $ */ +/* $NetBSD: lauxlib.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ */ /* -** $Id: lauxlib.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $ +** $Id: lauxlib.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -521,6 +521,7 @@ LUALIB_API void luaL_unref (lua_State *L ** ======================================================= */ +#ifndef _KERNEL typedef struct LoadF { int extraline; FILE *f; @@ -590,6 +591,7 @@ LUALIB_API int luaL_loadfile (lua_State lua_remove(L, fnameindex); return status; } +#endif typedef struct LoadS { @@ -626,6 +628,7 @@ LUALIB_API int (luaL_loadstring) (lua_St /* }====================================================== */ +#ifndef _KERNEL static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { (void)ud; (void)osize; @@ -651,4 +654,5 @@ LUALIB_API lua_State *luaL_newstate (voi if (L) lua_atpanic(L, &panic); return L; } +#endif Index: src/external/mit/lua/dist/src/lbaselib.c diff -u src/external/mit/lua/dist/src/lbaselib.c:1.1.1.2 src/external/mit/lua/dist/src/lbaselib.c:1.2 --- src/external/mit/lua/dist/src/lbaselib.c:1.1.1.2 Thu Mar 15 00:08:06 2012 +++ src/external/mit/lua/dist/src/lbaselib.c Mon Dec 2 04:57:41 2013 @@ -1,7 +1,7 @@ -/* $NetBSD: lbaselib.c,v 1.1.1.2 2012/03/15 00:08:06 alnsn Exp $ */ +/* $NetBSD: lbaselib.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ */ /* -** $Id: lbaselib.c,v 1.1.1.2 2012/03/15 00:08:06 alnsn Exp $ +** $Id: lbaselib.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ ** Basic library ** See Copyright Notice in lua.h */ @@ -284,10 +284,12 @@ static int luaB_loadstring (lua_State *L } +#ifndef _KERNEL static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); return load_aux(L, luaL_loadfile(L, fname)); } +#endif /* @@ -324,6 +326,7 @@ static int luaB_load (lua_State *L) { } +#ifndef _KERNEL static int luaB_dofile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); int n = lua_gettop(L); @@ -331,6 +334,7 @@ static int luaB_dofile (lua_State *L) { lua_call(L, 0, LUA_MULTRET); return lua_gettop(L) - n; } +#endif static int luaB_assert (lua_State *L) { @@ -449,12 +453,16 @@ static int luaB_newproxy (lua_State *L) static const luaL_Reg base_funcs[] = { {"assert", luaB_assert}, {"collectgarbage", luaB_collectgarbage}, +#ifndef _KERNEL {"dofile", luaB_dofile}, +#endif {"error", luaB_error}, {"gcinfo", luaB_gcinfo}, {"getfenv", luaB_getfenv}, {"getmetatable", luaB_getmetatable}, +#ifndef _KERNEL {"loadfile", luaB_loadfile}, +#endif {"load", luaB_load}, {"loadstring", luaB_loadstring}, {"next", luaB_next}, Index: src/external/mit/lua/dist/src/linit.c diff -u src/external/mit/lua/dist/src/linit.c:1.1.1.2 src/external/mit/lua/dist/src/linit.c:1.2 --- src/external/mit/lua/dist/src/linit.c:1.1.1.2 Thu Mar 15 00:08:04 2012 +++ src/external/mit/lua/dist/src/linit.c Mon Dec 2 04:57:41 2013 @@ -1,7 +1,7 @@ -/* $NetBSD: linit.c,v 1.1.1.2 2012/03/15 00:08:04 alnsn Exp $ */ +/* $NetBSD: linit.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ */ /* -** $Id: linit.c,v 1.1.1.2 2012/03/15 00:08:04 alnsn Exp $ +** $Id: linit.c,v 1.2 2013/12/02 04:57:41 lneto Exp $ ** Initialization of libraries for lua.c ** See Copyright Notice in lua.h */ @@ -18,13 +18,19 @@ static const luaL_Reg lualibs[] = { {"", luaopen_base}, +#ifndef _KERNEL {LUA_LOADLIBNAME, luaopen_package}, +#endif {LUA_TABLIBNAME, luaopen_table}, +#ifndef _KERNEL {LUA_IOLIBNAME, luaopen_io}, {LUA_OSLIBNAME, luaopen_os}, +#endif {LUA_STRLIBNAME, luaopen_string}, +#ifndef _KERNEL {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, +#endif {NULL, NULL} }; Index: src/sys/modules/lua/Makefile diff -u src/sys/modules/lua/Makefile:1.3 src/sys/modules/lua/Makefile:1.4 --- src/sys/modules/lua/Makefile:1.3 Mon Dec 2 04:39:10 2013 +++ src/sys/modules/lua/Makefile Mon Dec 2 04:57:41 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2013/12/02 04:39:10 lneto Exp $ +# $NetBSD: Makefile,v 1.4 2013/12/02 04:57:41 lneto Exp $ .include "../Makefile.inc" @@ -10,7 +10,7 @@ SRCS= lua.c WARNS= 1 -# Lua source code +# Lua core source code SRCS+= lapi.c \ lcode.c \ ldebug.c \ @@ -29,11 +29,15 @@ SRCS+= lapi.c \ ltm.c \ lundump.c \ lvm.c \ - lzio.c \ - # lauxlib.c \ - ltablib.c \ + lzio.c + +# Lua auxlib source code +SRCS+= lauxlib.c + +# Lua stdlibs source code +SRCS+= lbaselib.c \ lstrlib.c \ - lbaselib.c \ + ltablib.c \ linit.c # Compatability code