Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/modules/lua welcome lua(4), a devide driver that can cre...
details: https://anonhg.NetBSD.org/src/rev/b16f2fca31fd
branches: trunk
changeset: 790537:b16f2fca31fd
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Wed Oct 16 19:44:57 2013 +0000
description:
welcome lua(4), a devide driver that can create and control Lua states inside the kernel
diffstat:
sys/modules/lua/Makefile | 48 ++
sys/modules/lua/assert.h | 34 +
sys/modules/lua/ctype.h | 66 +++
sys/modules/lua/errno.h | 8 +
sys/modules/lua/infinite.lua | 2 +
sys/modules/lua/inttypes.h | 6 +
sys/modules/lua/limits.h | 8 +
sys/modules/lua/locale.h | 47 ++
sys/modules/lua/lua.c | 862 +++++++++++++++++++++++++++++++++++++++++++
sys/modules/lua/luaconf.h | 791 +++++++++++++++++++++++++++++++++++++++
sys/modules/lua/luavar.h | 49 ++
sys/modules/lua/math.h | 6 +
sys/modules/lua/setjmp.h | 10 +
sys/modules/lua/signal.h | 6 +
sys/modules/lua/stdarg.h | 8 +
sys/modules/lua/stddef.h | 16 +
sys/modules/lua/stdio.h | 49 ++
sys/modules/lua/stdlib.h | 48 ++
sys/modules/lua/string.h | 21 +
sys/modules/lua/test.lua | 8 +
20 files changed, 2093 insertions(+), 0 deletions(-)
diffs (truncated from 2173 to 300 lines):
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/Makefile Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,48 @@
+# $NetBSD: Makefile,v 1.1 2013/10/16 19:44:57 mbalmer Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/../external/mit/lua/dist/src \
+ ${S}/../lib/libc/string
+
+KMOD= lua
+SRCS= lua.c
+
+WARNS= 1
+
+# Lua source code
+SRCS+= lapi.c \
+ lcode.c \
+ ldebug.c \
+ ldo.c \
+ ldump.c \
+ lfunc.c \
+ lgc.c \
+ llex.c \
+ lmem.c \
+ lobject.c \
+ lopcodes.c \
+ lparser.c \
+ lstate.c \
+ lstring.c \
+ ltable.c \
+ ltm.c \
+ lundump.c \
+ lvm.c \
+ lzio.c \
+ # lauxlib.c \
+ ltablib.c \
+ lstrlib.c \
+ lbaselib.c \
+ linit.c
+
+# Compatability code
+SRCS+= strcspn.c \
+ strncat.c \
+ strpbrk.c \
+ strspn.c
+
+CPPFLAGS+= -include ${.CURDIR}/luaconf.h \
+ -I${S}/../external/mit/lua/dist/src
+
+.include <bsd.kmodule.mk>
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/assert.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/assert.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,34 @@
+/* $NetBSD */
+
+/*
+ * Copyright (c) 2011, Marc Balmer <mbalmer%NetBSD.org@localhost>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/ctype.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/ctype.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,66 @@
+/* $NetBSD */
+
+/*
+ * Copyright (c) 2011, Lourival Neto <lneto%NetBSD.org@localhost>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
+
+#include <sys/systm.h>
+
+#ifndef _LUA_INCLUDE_CTYPE_
+#define _LUA_INCLUDE_CTYPE_
+
+LIBKERN_INLINE int
+isalnum(int ch)
+{
+ return (isalpha(ch) || isdigit(ch));
+}
+
+LIBKERN_INLINE int
+iscntrl(int ch)
+{
+ return ((ch >= 0x00 && ch <= 0x1F) || ch == 0x7F);
+}
+
+LIBKERN_INLINE int
+isprint(int ch)
+{
+ return (ch >= 0x20 && ch <= 0x7E);
+}
+
+LIBKERN_INLINE int
+ispunct(int ch)
+{
+ return (isprint(ch) && ch != ' ' && !isalnum(ch));
+}
+
+#endif
+
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/errno.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/errno.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,8 @@
+/* $NetBSD */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
+
+#include <sys/errno.h>
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/infinite.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/infinite.lua Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,2 @@
+while (1) do end
+
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/inttypes.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/inttypes.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,6 @@
+/* $NetBSD: inttypes.h,v 1.1 2013/10/16 19:44:57 mbalmer Exp $ */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/limits.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/limits.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,8 @@
+/* $NetBSD */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
+
+#include <machine/limits.h>
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/locale.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/locale.h Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,47 @@
+/* $NetBSD */
+
+/*
+ * Copyright (c) 2011, Lourival Neto <lneto%NetBSD.org@localhost>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file is a placeholder only, to allow Lua to be compiled from
+ * unchanged sources.
+ */
+
+#include <sys/null.h>
+
+#ifndef _LUA_INCLUDE_LOCALE_
+#define _LUA_INCLUDE_LOCALE_
+
+struct lconv {
+ char *decimal_point;
+};
+
+#define localeconv() NULL
+#endif
+
diff -r c88b34083901 -r b16f2fca31fd sys/modules/lua/lua.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/lua/lua.c Wed Oct 16 19:44:57 2013 +0000
@@ -0,0 +1,862 @@
+/* $NetBSD */
+
+/*
+ * Copyright (c) 2011 by Marc Balmer <mbalmer%NetBSD.org@localhost>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* Lua device driver */
+
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/conf.h>
+#include <sys/condvar.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/lock.h>
+#include <sys/lua.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/namei.h>
+#include <sys/queue.h>
Home |
Main Index |
Thread Index |
Old Index