Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src put Lua auxlib and some stdlibs in lua(4)



details:   https://anonhg.NetBSD.org/src/rev/0511561e0fe5
branches:  trunk
changeset: 325053:0511561e0fe5
user:      lneto <lneto%NetBSD.org@localhost>
date:      Mon Dec 02 04:57:41 2013 +0000

description:
put Lua auxlib and some stdlibs in lua(4)

diffstat:

 external/mit/lua/dist/src/lauxlib.c  |   8 ++++++--
 external/mit/lua/dist/src/lbaselib.c |  12 ++++++++++--
 external/mit/lua/dist/src/linit.c    |  10 ++++++++--
 sys/modules/lua/Makefile             |  16 ++++++++++------
 4 files changed, 34 insertions(+), 12 deletions(-)

diffs (173 lines):

diff -r 0e884a1a9161 -r 0511561e0fe5 external/mit/lua/dist/src/lauxlib.c
--- a/external/mit/lua/dist/src/lauxlib.c       Mon Dec 02 04:39:10 2013 +0000
+++ b/external/mit/lua/dist/src/lauxlib.c       Mon Dec 02 04:57:41 2013 +0000
@@ -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 @@
 ** =======================================================
 */
 
+#ifndef _KERNEL
 typedef struct LoadF {
   int extraline;
   FILE *f;
@@ -590,6 +591,7 @@
   lua_remove(L, fnameindex);
   return status;
 }
+#endif
 
 
 typedef struct LoadS {
@@ -626,6 +628,7 @@
 /* }====================================================== */
 
 
+#ifndef _KERNEL
 static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
   (void)ud;
   (void)osize;
@@ -651,4 +654,5 @@
   if (L) lua_atpanic(L, &panic);
   return L;
 }
+#endif
 
diff -r 0e884a1a9161 -r 0511561e0fe5 external/mit/lua/dist/src/lbaselib.c
--- a/external/mit/lua/dist/src/lbaselib.c      Mon Dec 02 04:39:10 2013 +0000
+++ b/external/mit/lua/dist/src/lbaselib.c      Mon Dec 02 04:57:41 2013 +0000
@@ -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 @@
 }
 
 
+#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 @@
 }
 
 
+#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 @@
   lua_call(L, 0, LUA_MULTRET);
   return lua_gettop(L) - n;
 }
+#endif
 
 
 static int luaB_assert (lua_State *L) {
@@ -449,12 +453,16 @@
 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},
diff -r 0e884a1a9161 -r 0511561e0fe5 external/mit/lua/dist/src/linit.c
--- a/external/mit/lua/dist/src/linit.c Mon Dec 02 04:39:10 2013 +0000
+++ b/external/mit/lua/dist/src/linit.c Mon Dec 02 04:57:41 2013 +0000
@@ -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}
 };
 
diff -r 0e884a1a9161 -r 0511561e0fe5 sys/modules/lua/Makefile
--- a/sys/modules/lua/Makefile  Mon Dec 02 04:39:10 2013 +0000
+++ b/sys/modules/lua/Makefile  Mon Dec 02 04:57:41 2013 +0000
@@ -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 @@
 
 WARNS=         1
 
-# Lua source code
+# Lua core source code
 SRCS+=         lapi.c \
                lcode.c \
                ldebug.c \
@@ -29,11 +29,15 @@
                ltm.c \
                lundump.c \
                lvm.c \
-               lzio.c \
-               # lauxlib.c \
+               lzio.c
+
+# Lua auxlib source code
+SRCS+=         lauxlib.c
+
+# Lua stdlibs source code
+SRCS+=         lbaselib.c \
+               lstrlib.c \
                ltablib.c \
-               lstrlib.c \
-               lbaselib.c \
                linit.c
 
 # Compatability code



Home | Main Index | Thread Index | Old Index