Source-Changes-HG archive

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

[src/trunk]: src/external/mit/lua/dist/src lua(4): small fixes in kernel Lua



details:   https://anonhg.NetBSD.org/src/rev/2b2230841b10
branches:  trunk
changeset: 806363:2b2230841b10
user:      lneto <lneto%NetBSD.org@localhost>
date:      Thu Feb 19 04:46:22 2015 +0000

description:
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

diffstat:

 external/mit/lua/dist/src/lapi.c    |   4 +---
 external/mit/lua/dist/src/ldebug.c  |   4 ++--
 external/mit/lua/dist/src/llex.c    |   7 +++++--
 external/mit/lua/dist/src/llimits.h |   8 +++++++-
 external/mit/lua/dist/src/lstrlib.c |   8 +++++++-
 external/mit/lua/dist/src/lua.h     |   6 +-----
 external/mit/lua/dist/src/luaconf.h |  14 +++-----------
 external/mit/lua/dist/src/lvm.c     |   4 ++--
 8 files changed, 28 insertions(+), 27 deletions(-)

diffs (242 lines):

diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/lapi.c
--- a/external/mit/lua/dist/src/lapi.c  Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/lapi.c  Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
 }
 
 
-#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) {
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/ldebug.c
--- a/external/mit/lua/dist/src/ldebug.c        Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/ldebug.c        Thu Feb 19 04:46:22 2015 +0000
@@ -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"
 
 
+#include <stdarg.h>
 #ifndef _KERNEL
-#include <stdarg.h>
 #include <stddef.h>
 #include <string.h>
 #endif
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/llex.c
--- a/external/mit/lua/dist/src/llex.c  Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/llex.c  Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
 }
 
 
-#ifndef _KERNEL
 /*
 ** Check whether current char is in set 'set' (with two chars) and
 ** saves it
@@ -217,6 +216,7 @@
 }
 
 
+#ifndef _KERNEL
 /*
 ** change all characters 'from' in buffer to 'to'
 */
@@ -296,8 +296,11 @@
 
 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);
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/llimits.h
--- a/external/mit/lua/dist/src/llimits.h       Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/llimits.h       Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
 #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;
 
 
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/lstrlib.c
--- a/external/mit/lua/dist/src/lstrlib.c       Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/lstrlib.c       Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
 /* 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 @@
 }
 
 
+#ifndef _KERNEL
 /*
 ** Copy 'size' bytes from 'src' to 'dest', correcting endianness if
 ** given 'islittle' is different from native endianness.
@@ -1188,6 +1193,7 @@
       *(dest--) = *(src++);
   }
 }
+#endif
 
 
 static int str_pack (lua_State *L) {
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/lua.h
--- a/external/mit/lua/dist/src/lua.h   Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/lua.h   Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
 ** 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);
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/luaconf.h
--- a/external/mit/lua/dist/src/luaconf.h       Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/luaconf.h       Thu Feb 19 04:46:22 2015 +0000
@@ -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__)
 
diff -r 364a825cb432 -r 2b2230841b10 external/mit/lua/dist/src/lvm.c
--- a/external/mit/lua/dist/src/lvm.c   Thu Feb 19 02:27:30 2015 +0000
+++ b/external/mit/lua/dist/src/lvm.c   Thu Feb 19 04:46:22 2015 +0000
@@ -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 @@
   }
   return 1;
 }
-#endif
 
 
 /*
@@ -86,6 +85,7 @@
   else
     return 0;  /* conversion failed */
 }
+#endif
 
 
 /*



Home | Main Index | Thread Index | Old Index