Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Mar 2015 07:27:39 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r280676 - projects/lua-bootloader/sys/boot/liblua
Message-ID:  <201503260727.t2Q7RdUs002156@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Thu Mar 26 07:27:38 2015
New Revision: 280676
URL: https://svnweb.freebsd.org/changeset/base/280676

Log:
  Add more compatibility functions for lua 5.3.0.

Modified:
  projects/lua-bootloader/sys/boot/liblua/Makefile
  projects/lua-bootloader/sys/boot/liblua/lstd.c
  projects/lua-bootloader/sys/boot/liblua/lstd.h

Modified: projects/lua-bootloader/sys/boot/liblua/Makefile
==============================================================================
--- projects/lua-bootloader/sys/boot/liblua/Makefile	Thu Mar 26 07:26:28 2015	(r280675)
+++ projects/lua-bootloader/sys/boot/liblua/Makefile	Thu Mar 26 07:27:38 2015	(r280676)
@@ -10,6 +10,8 @@ INTERNALLIB=
 SRCS=	lapi.c lcode.c lctype.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
+SRCS+=	lauxlib.c lbaselib.c lbitlib.c ldblib.c lstrlib.c ltablib.c loadlib.c \
+	linit.c
 
 # Our utilities.
 SRCS+=	lstd.c lutils.c
@@ -17,7 +19,7 @@ SRCS+=	lstd.c lutils.c
 WARNS=	3
 
 CFLAGS+= -DBOOT_LUA -ffreestanding -nostdlib
-CFLAGS+= -fno-stack-protector
+CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE
 CFLAGS+= -I${.CURDIR}/../liblua -I${LUA_PATH} -I${.CURDIR}/../common
 
 .if ${MACHINE_CPUARCH} == "i386" || \

Modified: projects/lua-bootloader/sys/boot/liblua/lstd.c
==============================================================================
--- projects/lua-bootloader/sys/boot/liblua/lstd.c	Thu Mar 26 07:26:28 2015	(r280675)
+++ projects/lua-bootloader/sys/boot/liblua/lstd.c	Thu Mar 26 07:27:38 2015	(r280676)
@@ -462,4 +462,12 @@ memchr(const void *s, int c, size_t n)
 	return (NULL);
 }
 
+void
+abort(void)
+{
+	printf("abort called!\n");
+	for (;;)
+		;
+}
+
 #endif /* BOOT_LUA */

Modified: projects/lua-bootloader/sys/boot/liblua/lstd.h
==============================================================================
--- projects/lua-bootloader/sys/boot/liblua/lstd.h	Thu Mar 26 07:26:28 2015	(r280675)
+++ projects/lua-bootloader/sys/boot/liblua/lstd.h	Thu Mar 26 07:27:38 2015	(r280676)
@@ -38,6 +38,7 @@
 #include <string.h>
 #include <machine/stdarg.h>
 
+
 typedef struct FILE
 {
 	int fd;
@@ -97,5 +98,43 @@ int ispunct(int c);
 
 void * memchr(const void *ptr, int value, size_t num);
 
+void abort(void) __dead2;
+
+static inline char
+_l_getlocaledecpoint(void)
+{
+	return ('.');
+}
+
+#ifndef l_getlocaledecpoint
+#define l_getlocaledecpoint _l_getlocaledecpoint
+#endif
+
+#ifndef lua_writestringerror
+#define lua_writestringerror(s,p) \
+	(printf((s), (p)))
+#endif
+
+#ifndef lua_writestring
+#define lua_writestring(s,l) \
+	(write(1, __DECONST(void *, (s)), (l)))
+#endif
+
+#define stdout 1
+#define fflush	/* */
+#define fgets(b,l,s) fgetstr((b), (l), 0)
+
+static inline double
+frexp(double value, int *exp)
+{
+	return 0; /* XXX */
+}
+
+static inline double
+fmod(double x, double y)
+{
+	return 0; /* XXX */
+}
+
 #endif
 #endif //LSTD_H



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503260727.t2Q7RdUs002156>