Module Name:    src
Committed By:   lneto
Date:           Thu Feb 19 04:46:22 UTC 2015

Modified Files:
        src/external/mit/lua/dist/src: lapi.c ldebug.c llex.c llimits.h
            lstrlib.c lua.h luaconf.h lvm.c

Log Message:
lua(4): small fixes in kernel Lua

* fixed hex parsing
* restored lua_isnumber
* removed unwanted macros from luaconf.h
* restored <stdarg.h> include in ldebug.c
* removed doubles from unions
* removed unused functions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/lua/dist/src/lapi.c \
    src/external/mit/lua/dist/src/ldebug.c \
    src/external/mit/lua/dist/src/llex.c \
    src/external/mit/lua/dist/src/llimits.h \
    src/external/mit/lua/dist/src/lua.h
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.12 -r1.13 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lvm.c

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/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.3 src/external/mit/lua/dist/src/lapi.c:1.4
--- src/external/mit/lua/dist/src/lapi.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lapi.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lapi.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.244 2014/12/26 14:43:45 roberto Exp 
@@ -276,13 +276,11 @@ LUA_API int lua_isinteger (lua_State *L,
 }
 
 
-#ifndef _KERNEL
 LUA_API int lua_isnumber (lua_State *L, int idx) {
   lua_Number n;
   const TValue *o = index2addr(L, idx);
   return tonumber(o, &n);
 }
-#endif
 
 
 LUA_API int lua_isstring (lua_State *L, int idx) {
Index: src/external/mit/lua/dist/src/ldebug.c
diff -u src/external/mit/lua/dist/src/ldebug.c:1.3 src/external/mit/lua/dist/src/ldebug.c:1.4
--- src/external/mit/lua/dist/src/ldebug.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/ldebug.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldebug.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: ldebug.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: ldebug.c,v 2.110 2015/01/02 12:52:22 roberto Exp 
@@ -12,8 +12,8 @@
 #include "lprefix.h"
 
 
-#ifndef _KERNEL
 #include <stdarg.h>
+#ifndef _KERNEL
 #include <stddef.h>
 #include <string.h>
 #endif
Index: src/external/mit/lua/dist/src/llex.c
diff -u src/external/mit/lua/dist/src/llex.c:1.3 src/external/mit/lua/dist/src/llex.c:1.4
--- src/external/mit/lua/dist/src/llex.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/llex.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: llex.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: llex.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp 
@@ -202,7 +202,6 @@ static int check_next1 (LexState *ls, in
 }
 
 
-#ifndef _KERNEL
 /*
 ** Check whether current char is in set 'set' (with two chars) and
 ** saves it
@@ -217,6 +216,7 @@ static int check_next2 (LexState *ls, co
 }
 
 
+#ifndef _KERNEL
 /*
 ** change all characters 'from' in buffer to 'to'
 */
@@ -296,8 +296,11 @@ static int read_numeral (LexState *ls, S
 
 static int read_numeral (LexState *ls, SemInfo *seminfo) {
   TValue obj;
+  int first = ls->current;
   lua_assert(lisdigit(ls->current));
   save_and_next(ls);
+  if (first == '0')
+    check_next2(ls, "xX");  /* hexadecimal? */
   for (;;) {
     if (lisxdigit(ls->current))
       save_and_next(ls);
Index: src/external/mit/lua/dist/src/llimits.h
diff -u src/external/mit/lua/dist/src/llimits.h:1.3 src/external/mit/lua/dist/src/llimits.h:1.4
--- src/external/mit/lua/dist/src/llimits.h:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/llimits.h	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: llimits.h,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: llimits.h,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: llimits.h,v 1.125 2014/12/19 13:30:23 roberto Exp 
@@ -68,13 +68,19 @@ typedef unsigned char lu_byte;
 #if defined(LUAI_USER_ALIGNMENT_T)
 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
 #else
+#ifndef _KERNEL
 typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign;
+#else /* _KERNEL */
+typedef union { void *s; lua_Integer i; long l; } L_Umaxalign;
+#endif
 #endif
 
 
 
 /* types of 'usual argument conversions' for lua_Number and lua_Integer */
+#ifndef _KERNEL
 typedef LUAI_UACNUMBER l_uacNumber;
+#endif
 typedef LUAI_UACINT l_uacInt;
 
 
Index: src/external/mit/lua/dist/src/lua.h
diff -u src/external/mit/lua/dist/src/lua.h:1.3 src/external/mit/lua/dist/src/lua.h:1.4
--- src/external/mit/lua/dist/src/lua.h:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lua.h	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.h,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lua.h,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lua.h,v 1.325 2014/12/26 17:24:27 roberto Exp 
@@ -182,11 +182,7 @@ LUA_API void  (lua_xmove) (lua_State *fr
 ** access functions (stack -> C)
 */
 
-#ifndef _KERNEL
 LUA_API int             (lua_isnumber) (lua_State *L, int idx);
-#else /* _KERNEL */
-#define lua_isnumber	lua_isinteger
-#endif
 LUA_API int             (lua_isstring) (lua_State *L, int idx);
 LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
 LUA_API int             (lua_isinteger) (lua_State *L, int idx);

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.6 src/external/mit/lua/dist/src/lstrlib.c:1.7
--- src/external/mit/lua/dist/src/lstrlib.c:1.6	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lstrlib.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.6 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.7 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.221 2014/12/11 14:03:07 roberto Exp 
@@ -985,7 +985,11 @@ static const union {
 /* dummy structure to get native alignment requirements */
 struct cD {
   char c;
+#ifndef _KERNEL
   union { double d; void *p; lua_Integer i; lua_Number n; } u;
+#else /* _KERNEL */
+  union { void *p; lua_Integer i; lua_Number n; } u;
+#endif
 };
 
 #define MAXALIGN	(offsetof(struct cD, u))
@@ -1172,6 +1176,7 @@ static void packint (luaL_Buffer *b, lua
 }
 
 
+#ifndef _KERNEL
 /*
 ** Copy 'size' bytes from 'src' to 'dest', correcting endianness if
 ** given 'islittle' is different from native endianness.
@@ -1188,6 +1193,7 @@ static void copywithendian (volatile cha
       *(dest--) = *(src++);
   }
 }
+#endif
 
 
 static int str_pack (lua_State *L) {

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.12 src/external/mit/lua/dist/src/luaconf.h:1.13
--- src/external/mit/lua/dist/src/luaconf.h:1.12	Wed Feb  4 04:47:57 2015
+++ src/external/mit/lua/dist/src/luaconf.h	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.12 2015/02/04 04:47:57 lneto Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.13 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.238 2014/12/29 13:27:55 roberto Exp 
@@ -392,6 +392,7 @@
 ** ===================================================================
 */
 
+#ifndef _KERNEL
 /*
 @@ LUA_NUMBER is the floating-point type used by Lua.
 **
@@ -478,7 +479,6 @@
 ** They should work for any size of floating numbers.
 */
 
-#ifndef _KERNEL
 /* the following operations need the math library */
 #if defined(lobject_c) || defined(lvm_c)
 #include <math.h>
@@ -771,16 +771,8 @@
 
 #else /* _KERNEL */
 
-#undef LUA_NUMBER
-#undef LUA_NUMBER_FMT
-#undef lua_str2number
-
 #define LUA_NUMBER		LUA_INTEGER
 #define LUA_NUMBER_FMT		LUA_INTEGER_FMT
-#define lua_str2number(s,p)	strtoimax((s),(p),10)
-
-#undef lua_numbertointeger
-#define lua_numbertointeger(n,p)	(*(p) = (LUA_INTEGER)(n), 1)
 
 /* setjmp.h */
 #define LUAI_THROW(L,c)		longjmp(&((c)->b))
@@ -793,7 +785,7 @@
 
 /* stdio.h */
 #define lua_writestring(s,l)	printf("%s", (s))
-#define lua_writeline()	printf("\n")
+#define lua_writeline()		printf("\n")
 
 #define sprintf(s,fmt,...)	snprintf(s, sizeof(s), fmt, __VA_ARGS__)
 

Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.4 src/external/mit/lua/dist/src/lvm.c:1.5
--- src/external/mit/lua/dist/src/lvm.c:1.4	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lvm.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.c,v 1.4 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lvm.c,v 1.5 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lvm.c,v 2.232 2014/12/27 20:30:38 roberto Exp 
@@ -65,7 +65,6 @@ static int tofloat (const TValue *obj, l
   }
   return 1;
 }
-#endif
 
 
 /*
@@ -86,6 +85,7 @@ int luaV_tonumber_ (const TValue *obj, l
   else
     return 0;  /* conversion failed */
 }
+#endif
 
 
 /*

Reply via email to