diff options
| author | lneto <lneto@NetBSD.org> | 2015-02-19 04:46:22 +0000 |
|---|---|---|
| committer | lneto <lneto@NetBSD.org> | 2015-02-19 04:46:22 +0000 |
| commit | 48b9f4df647bae745741b671ce8cb7b4511fb9fd (patch) | |
| tree | d938577ecefa6ea7f8177c24add1a1916017e99a /external/mit/lua | |
| parent | 6da14cd18391b0dbaa8d19ba209f131530fe91e3 (diff) | |
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 (limited to 'external/mit/lua')
| -rw-r--r-- | external/mit/lua/dist/src/lapi.c | 4 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/ldebug.c | 4 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/llex.c | 7 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/llimits.h | 8 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/lstrlib.c | 8 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/lua.h | 6 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/luaconf.h | 14 | ||||
| -rw-r--r-- | external/mit/lua/dist/src/lvm.c | 4 |
8 files changed, 28 insertions, 27 deletions
diff --git a/external/mit/lua/dist/src/lapi.c b/external/mit/lua/dist/src/lapi.c index 20704422d4a..a0087ce216a 100644 --- a/external/mit/lua/dist/src/lapi.c +++ b/external/mit/lua/dist/src/lapi.c @@ -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, int idx) { } -#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 --git a/external/mit/lua/dist/src/ldebug.c b/external/mit/lua/dist/src/ldebug.c index 2223daf0437..e63b99ab9bd 100644 --- a/external/mit/lua/dist/src/ldebug.c +++ b/external/mit/lua/dist/src/ldebug.c @@ -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 diff --git a/external/mit/lua/dist/src/llex.c b/external/mit/lua/dist/src/llex.c index 07af3a56a2a..c039eaba8e3 100644 --- a/external/mit/lua/dist/src/llex.c +++ b/external/mit/lua/dist/src/llex.c @@ -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, int c) { } -#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, const char *set) { } +#ifndef _KERNEL /* ** change all characters 'from' in buffer to 'to' */ @@ -296,8 +296,11 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { 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 --git a/external/mit/lua/dist/src/llimits.h b/external/mit/lua/dist/src/llimits.h index 2e9f3b6f8de..0c92c0f1129 100644 --- a/external/mit/lua/dist/src/llimits.h +++ b/external/mit/lua/dist/src/llimits.h @@ -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; diff --git a/external/mit/lua/dist/src/lstrlib.c b/external/mit/lua/dist/src/lstrlib.c index e533574fb42..47ccda72449 100644 --- a/external/mit/lua/dist/src/lstrlib.c +++ b/external/mit/lua/dist/src/lstrlib.c @@ -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_Unsigned n, } +#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 char *dest, volatile const char *src, *(dest--) = *(src++); } } +#endif static int str_pack (lua_State *L) { diff --git a/external/mit/lua/dist/src/lua.h b/external/mit/lua/dist/src/lua.h index e6f4cf1d536..66638f19eb1 100644 --- a/external/mit/lua/dist/src/lua.h +++ b/external/mit/lua/dist/src/lua.h @@ -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 *from, lua_State *to, int n); ** 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 --git a/external/mit/lua/dist/src/luaconf.h b/external/mit/lua/dist/src/luaconf.h index c30540b3a8e..9deeaf01d25 100644 --- a/external/mit/lua/dist/src/luaconf.h +++ b/external/mit/lua/dist/src/luaconf.h @@ -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 --git a/external/mit/lua/dist/src/lvm.c b/external/mit/lua/dist/src/lvm.c index 1f97a48428b..8e3a0172d5e 100644 --- a/external/mit/lua/dist/src/lvm.c +++ b/external/mit/lua/dist/src/lvm.c @@ -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, lua_Number *n) { } return 1; } -#endif /* @@ -86,6 +85,7 @@ int luaV_tonumber_ (const TValue *obj, lua_Number *n) { else return 0; /* conversion failed */ } +#endif /* |
