Sat Feb 21 18:16:21 2015 UTC ()
Pull up following revision(s) (requested by lneto in ticket #534):
	external/mit/lua/dist/src/lvm.c: revision 1.5
	external/mit/lua/dist/src/lapi.c: revision 1.4
	external/mit/lua/dist/src/ldebug.c: revision 1.4
	external/mit/lua/dist/src/lstrlib.c: revision 1.7
	external/mit/lua/dist/src/lua.h: revision 1.4
	external/mit/lua/dist/src/luaconf.h: revision 1.13
	external/mit/lua/dist/src/llimits.h: revision 1.4
	external/mit/lua/dist/src/llex.c: revision 1.4
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


(martin)
diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/lapi.c
diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/ldebug.c
diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/llex.c
diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/llimits.h
diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/lua.h
diff -r1.5.2.1 -r1.5.2.2 src/external/mit/lua/dist/src/lstrlib.c
diff -r1.9.2.2 -r1.9.2.3 src/external/mit/lua/dist/src/luaconf.h
diff -r1.3.2.1 -r1.3.2.2 src/external/mit/lua/dist/src/lvm.c

cvs diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/lapi.c (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/lapi.c 2015/02/04 21:32:46 1.2.2.1
+++ src/external/mit/lua/dist/src/lapi.c 2015/02/21 18:16:21 1.2.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lapi.c,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: lapi.c,v 1.2.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: lapi.c,v 2.244 2014/12/26 14:43:45 roberto Exp  4** Id: lapi.c,v 2.244 2014/12/26 14:43:45 roberto Exp
5** Lua API 5** Lua API
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#define lapi_c 9#define lapi_c
10#define LUA_CORE 10#define LUA_CORE
11 11
12#include "lprefix.h" 12#include "lprefix.h"
13 13
14 14
@@ -266,33 +266,31 @@ LUA_API const char *lua_typename (lua_St @@ -266,33 +266,31 @@ LUA_API const char *lua_typename (lua_St
266 266
267LUA_API int lua_iscfunction (lua_State *L, int idx) { 267LUA_API int lua_iscfunction (lua_State *L, int idx) {
268 StkId o = index2addr(L, idx); 268 StkId o = index2addr(L, idx);
269 return (ttislcf(o) || (ttisCclosure(o))); 269 return (ttislcf(o) || (ttisCclosure(o)));
270} 270}
271 271
272 272
273LUA_API int lua_isinteger (lua_State *L, int idx) { 273LUA_API int lua_isinteger (lua_State *L, int idx) {
274 StkId o = index2addr(L, idx); 274 StkId o = index2addr(L, idx);
275 return ttisinteger(o); 275 return ttisinteger(o);
276} 276}
277 277
278 278
279#ifndef _KERNEL 
280LUA_API int lua_isnumber (lua_State *L, int idx) { 279LUA_API int lua_isnumber (lua_State *L, int idx) {
281 lua_Number n; 280 lua_Number n;
282 const TValue *o = index2addr(L, idx); 281 const TValue *o = index2addr(L, idx);
283 return tonumber(o, &n); 282 return tonumber(o, &n);
284} 283}
285#endif 
286 284
287 285
288LUA_API int lua_isstring (lua_State *L, int idx) { 286LUA_API int lua_isstring (lua_State *L, int idx) {
289 const TValue *o = index2addr(L, idx); 287 const TValue *o = index2addr(L, idx);
290 return (ttisstring(o) || cvt2str(o)); 288 return (ttisstring(o) || cvt2str(o));
291} 289}
292 290
293 291
294LUA_API int lua_isuserdata (lua_State *L, int idx) { 292LUA_API int lua_isuserdata (lua_State *L, int idx) {
295 const TValue *o = index2addr(L, idx); 293 const TValue *o = index2addr(L, idx);
296 return (ttisfulluserdata(o) || ttislightuserdata(o)); 294 return (ttisfulluserdata(o) || ttislightuserdata(o));
297} 295}
298 296

cvs diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/ldebug.c (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/ldebug.c 2015/02/04 21:32:46 1.2.2.1
+++ src/external/mit/lua/dist/src/ldebug.c 2015/02/21 18:16:21 1.2.2.2
@@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
1/* $NetBSD: ldebug.c,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: ldebug.c,v 1.2.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: ldebug.c,v 2.110 2015/01/02 12:52:22 roberto Exp  4** Id: ldebug.c,v 2.110 2015/01/02 12:52:22 roberto Exp
5** Debug Interface 5** Debug Interface
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#define ldebug_c 9#define ldebug_c
10#define LUA_CORE 10#define LUA_CORE
11 11
12#include "lprefix.h" 12#include "lprefix.h"
13 13
14 14
15#ifndef _KERNEL 
16#include <stdarg.h> 15#include <stdarg.h>
 16#ifndef _KERNEL
17#include <stddef.h> 17#include <stddef.h>
18#include <string.h> 18#include <string.h>
19#endif 19#endif
20 20
21#include "lua.h" 21#include "lua.h"
22 22
23#include "lapi.h" 23#include "lapi.h"
24#include "lcode.h" 24#include "lcode.h"
25#include "ldebug.h" 25#include "ldebug.h"
26#include "ldo.h" 26#include "ldo.h"
27#include "lfunc.h" 27#include "lfunc.h"
28#include "lobject.h" 28#include "lobject.h"
29#include "lopcodes.h" 29#include "lopcodes.h"

cvs diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/llex.c (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/llex.c 2015/02/04 21:32:46 1.2.2.1
+++ src/external/mit/lua/dist/src/llex.c 2015/02/21 18:16:21 1.2.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: llex.c,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: llex.c,v 1.2.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp  4** Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp
5** Lexical Analyzer 5** Lexical Analyzer
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#define llex_c 9#define llex_c
10#define LUA_CORE 10#define LUA_CORE
11 11
12#include "lprefix.h" 12#include "lprefix.h"
13 13
14 14
@@ -192,41 +192,41 @@ void luaX_setinput (lua_State *L, LexSta @@ -192,41 +192,41 @@ void luaX_setinput (lua_State *L, LexSta
192** ======================================================= 192** =======================================================
193*/ 193*/
194 194
195 195
196static int check_next1 (LexState *ls, int c) { 196static int check_next1 (LexState *ls, int c) {
197 if (ls->current == c) { 197 if (ls->current == c) {
198 next(ls); 198 next(ls);
199 return 1; 199 return 1;
200 } 200 }
201 else return 0; 201 else return 0;
202} 202}
203 203
204 204
205#ifndef _KERNEL 
206/* 205/*
207** Check whether current char is in set 'set' (with two chars) and 206** Check whether current char is in set 'set' (with two chars) and
208** saves it 207** saves it
209*/ 208*/
210static int check_next2 (LexState *ls, const char *set) { 209static int check_next2 (LexState *ls, const char *set) {
211 lua_assert(set[2] == '\0'); 210 lua_assert(set[2] == '\0');
212 if (ls->current == set[0] || ls->current == set[1]) { 211 if (ls->current == set[0] || ls->current == set[1]) {
213 save_and_next(ls); 212 save_and_next(ls);
214 return 1; 213 return 1;
215 } 214 }
216 else return 0; 215 else return 0;
217} 216}
218 217
219 218
 219#ifndef _KERNEL
220/* 220/*
221** change all characters 'from' in buffer to 'to' 221** change all characters 'from' in buffer to 'to'
222*/ 222*/
223static void buffreplace (LexState *ls, char from, char to) { 223static void buffreplace (LexState *ls, char from, char to) {
224 if (from != to) { 224 if (from != to) {
225 size_t n = luaZ_bufflen(ls->buff); 225 size_t n = luaZ_bufflen(ls->buff);
226 char *p = luaZ_buffer(ls->buff); 226 char *p = luaZ_buffer(ls->buff);
227 while (n--) 227 while (n--)
228 if (p[n] == from) p[n] = to; 228 if (p[n] == from) p[n] = to;
229 } 229 }
230} 230}
231 231
232 232
@@ -286,28 +286,31 @@ static int read_numeral (LexState *ls, S @@ -286,28 +286,31 @@ static int read_numeral (LexState *ls, S
286 return TK_INT; 286 return TK_INT;
287 } 287 }
288 else { 288 else {
289 lua_assert(ttisfloat(&obj)); 289 lua_assert(ttisfloat(&obj));
290 seminfo->r = fltvalue(&obj); 290 seminfo->r = fltvalue(&obj);
291 return TK_FLT; 291 return TK_FLT;
292 } 292 }
293} 293}
294 294
295#else /* _KERNEL */ 295#else /* _KERNEL */
296 296
297static int read_numeral (LexState *ls, SemInfo *seminfo) { 297static int read_numeral (LexState *ls, SemInfo *seminfo) {
298 TValue obj; 298 TValue obj;
 299 int first = ls->current;
299 lua_assert(lisdigit(ls->current)); 300 lua_assert(lisdigit(ls->current));
300 save_and_next(ls); 301 save_and_next(ls);
 302 if (first == '0')
 303 check_next2(ls, "xX"); /* hexadecimal? */
301 for (;;) { 304 for (;;) {
302 if (lisxdigit(ls->current)) 305 if (lisxdigit(ls->current))
303 save_and_next(ls); 306 save_and_next(ls);
304 else break; 307 else break;
305 } 308 }
306 save(ls, '\0'); 309 save(ls, '\0');
307 if (!buff2num(ls->buff, &obj)) /* format error? */ 310 if (!buff2num(ls->buff, &obj)) /* format error? */
308 lexerror(ls, "malformed number", TK_INT); 311 lexerror(ls, "malformed number", TK_INT);
309 lua_assert(ttisinteger(&obj)); 312 lua_assert(ttisinteger(&obj));
310 seminfo->i = ivalue(&obj); 313 seminfo->i = ivalue(&obj);
311 return TK_INT; 314 return TK_INT;
312} 315}
313#endif 316#endif

cvs diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/llimits.h (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/llimits.h 2015/02/04 21:32:46 1.2.2.1
+++ src/external/mit/lua/dist/src/llimits.h 2015/02/21 18:16:21 1.2.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: llimits.h,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: llimits.h,v 1.2.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: llimits.h,v 1.125 2014/12/19 13:30:23 roberto Exp  4** Id: llimits.h,v 1.125 2014/12/19 13:30:23 roberto Exp
5** Limits, basic types, and some other 'installation-dependent' definitions 5** Limits, basic types, and some other 'installation-dependent' definitions
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#ifndef llimits_h 9#ifndef llimits_h
10#define llimits_h 10#define llimits_h
11 11
12 12
13#ifndef _KERNEL 13#ifndef _KERNEL
14#include <limits.h> 14#include <limits.h>
@@ -58,33 +58,39 @@ typedef unsigned char lu_byte; @@ -58,33 +58,39 @@ typedef unsigned char lu_byte;
58/* 58/*
59** conversion of pointer to integer: 59** conversion of pointer to integer:
60** this is for hashing only; there is no problem if the integer 60** this is for hashing only; there is no problem if the integer
61** cannot hold the whole pointer value 61** cannot hold the whole pointer value
62*/ 62*/
63#define point2int(p) ((unsigned int)((size_t)(p) & UINT_MAX)) 63#define point2int(p) ((unsigned int)((size_t)(p) & UINT_MAX))
64 64
65 65
66 66
67/* type to ensure maximum alignment */ 67/* type to ensure maximum alignment */
68#if defined(LUAI_USER_ALIGNMENT_T) 68#if defined(LUAI_USER_ALIGNMENT_T)
69typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; 69typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
70#else 70#else
 71#ifndef _KERNEL
71typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign; 72typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign;
 73#else /* _KERNEL */
 74typedef union { void *s; lua_Integer i; long l; } L_Umaxalign;
 75#endif
72#endif 76#endif
73 77
74 78
75 79
76/* types of 'usual argument conversions' for lua_Number and lua_Integer */ 80/* types of 'usual argument conversions' for lua_Number and lua_Integer */
 81#ifndef _KERNEL
77typedef LUAI_UACNUMBER l_uacNumber; 82typedef LUAI_UACNUMBER l_uacNumber;
 83#endif
78typedef LUAI_UACINT l_uacInt; 84typedef LUAI_UACINT l_uacInt;
79 85
80 86
81/* internal assertions for in-house debugging */ 87/* internal assertions for in-house debugging */
82#if defined(lua_assert) 88#if defined(lua_assert)
83#define check_exp(c,e) (lua_assert(c), (e)) 89#define check_exp(c,e) (lua_assert(c), (e))
84/* to avoid problems with conditions too long */ 90/* to avoid problems with conditions too long */
85#define lua_longassert(c) { if (!(c)) lua_assert(0); } 91#define lua_longassert(c) { if (!(c)) lua_assert(0); }
86#else 92#else
87#define lua_assert(c) ((void)0) 93#define lua_assert(c) ((void)0)
88#define check_exp(c,e) (e) 94#define check_exp(c,e) (e)
89#define lua_longassert(c) ((void)0) 95#define lua_longassert(c) ((void)0)
90#endif 96#endif

cvs diff -r1.2.2.1 -r1.2.2.2 src/external/mit/lua/dist/src/lua.h (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/lua.h 2015/02/04 21:32:46 1.2.2.1
+++ src/external/mit/lua/dist/src/lua.h 2015/02/21 18:16:21 1.2.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lua.h,v 1.2.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: lua.h,v 1.2.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: lua.h,v 1.325 2014/12/26 17:24:27 roberto Exp  4** Id: lua.h,v 1.325 2014/12/26 17:24:27 roberto Exp
5** Lua - A Scripting Language 5** Lua - A Scripting Language
6** Lua.org, PUC-Rio, Brazil (http://www.lua.org) 6** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
7** See Copyright Notice at the end of this file 7** See Copyright Notice at the end of this file
8*/ 8*/
9 9
10 10
11#ifndef lua_h 11#ifndef lua_h
12#define lua_h 12#define lua_h
13 13
14#include <stdarg.h> 14#include <stdarg.h>
@@ -172,31 +172,27 @@ LUA_API int (lua_gettop) (lua_State *L @@ -172,31 +172,27 @@ LUA_API int (lua_gettop) (lua_State *L
172LUA_API void (lua_settop) (lua_State *L, int idx); 172LUA_API void (lua_settop) (lua_State *L, int idx);
173LUA_API void (lua_pushvalue) (lua_State *L, int idx); 173LUA_API void (lua_pushvalue) (lua_State *L, int idx);
174LUA_API void (lua_rotate) (lua_State *L, int idx, int n); 174LUA_API void (lua_rotate) (lua_State *L, int idx, int n);
175LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); 175LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);
176LUA_API int (lua_checkstack) (lua_State *L, int n); 176LUA_API int (lua_checkstack) (lua_State *L, int n);
177 177
178LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); 178LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
179 179
180 180
181/* 181/*
182** access functions (stack -> C) 182** access functions (stack -> C)
183*/ 183*/
184 184
185#ifndef _KERNEL 
186LUA_API int (lua_isnumber) (lua_State *L, int idx); 185LUA_API int (lua_isnumber) (lua_State *L, int idx);
187#else /* _KERNEL */ 
188#define lua_isnumber lua_isinteger 
189#endif 
190LUA_API int (lua_isstring) (lua_State *L, int idx); 186LUA_API int (lua_isstring) (lua_State *L, int idx);
191LUA_API int (lua_iscfunction) (lua_State *L, int idx); 187LUA_API int (lua_iscfunction) (lua_State *L, int idx);
192LUA_API int (lua_isinteger) (lua_State *L, int idx); 188LUA_API int (lua_isinteger) (lua_State *L, int idx);
193LUA_API int (lua_isuserdata) (lua_State *L, int idx); 189LUA_API int (lua_isuserdata) (lua_State *L, int idx);
194LUA_API int (lua_type) (lua_State *L, int idx); 190LUA_API int (lua_type) (lua_State *L, int idx);
195LUA_API const char *(lua_typename) (lua_State *L, int tp); 191LUA_API const char *(lua_typename) (lua_State *L, int tp);
196 192
197#ifndef _KERNEL 193#ifndef _KERNEL
198LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); 194LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
199#else /* _KERNEL */ 195#else /* _KERNEL */
200#define lua_tonumberx (lua_Integer) lua_tointegerx 196#define lua_tonumberx (lua_Integer) lua_tointegerx
201#endif 197#endif
202LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); 198LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum);

cvs diff -r1.5.2.1 -r1.5.2.2 src/external/mit/lua/dist/src/lstrlib.c (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/lstrlib.c 2015/02/04 21:32:46 1.5.2.1
+++ src/external/mit/lua/dist/src/lstrlib.c 2015/02/21 18:16:21 1.5.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lstrlib.c,v 1.5.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: lstrlib.c,v 1.5.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: lstrlib.c,v 1.221 2014/12/11 14:03:07 roberto Exp  4** Id: lstrlib.c,v 1.221 2014/12/11 14:03:07 roberto Exp
5** Standard library for string operations and pattern-matching 5** Standard library for string operations and pattern-matching
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#define lstrlib_c 9#define lstrlib_c
10#define LUA_LIB 10#define LUA_LIB
11 11
12#include "lprefix.h" 12#include "lprefix.h"
13 13
14 14
@@ -975,27 +975,31 @@ static int str_format (lua_State *L) { @@ -975,27 +975,31 @@ static int str_format (lua_State *L) {
975#define SZINT ((int)sizeof(lua_Integer)) 975#define SZINT ((int)sizeof(lua_Integer))
976 976
977 977
978/* dummy union to get native endianness */ 978/* dummy union to get native endianness */
979static const union { 979static const union {
980 int dummy; 980 int dummy;
981 char little; /* true iff machine is little endian */ 981 char little; /* true iff machine is little endian */
982} nativeendian = {1}; 982} nativeendian = {1};
983 983
984 984
985/* dummy structure to get native alignment requirements */ 985/* dummy structure to get native alignment requirements */
986struct cD { 986struct cD {
987 char c; 987 char c;
 988#ifndef _KERNEL
988 union { double d; void *p; lua_Integer i; lua_Number n; } u; 989 union { double d; void *p; lua_Integer i; lua_Number n; } u;
 990#else /* _KERNEL */
 991 union { void *p; lua_Integer i; lua_Number n; } u;
 992#endif
989}; 993};
990 994
991#define MAXALIGN (offsetof(struct cD, u)) 995#define MAXALIGN (offsetof(struct cD, u))
992 996
993 997
994#ifndef _KERNEL 998#ifndef _KERNEL
995/* 999/*
996** Union for serializing floats 1000** Union for serializing floats
997*/ 1001*/
998typedef union Ftypes { 1002typedef union Ftypes {
999 float f; 1003 float f;
1000 double d; 1004 double d;
1001 lua_Number n; 1005 lua_Number n;
@@ -1162,42 +1166,44 @@ static void packint (luaL_Buffer *b, lua @@ -1162,42 +1166,44 @@ static void packint (luaL_Buffer *b, lua
1162 buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ 1166 buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */
1163 for (i = 1; i < size; i++) { 1167 for (i = 1; i < size; i++) {
1164 n >>= NB; 1168 n >>= NB;
1165 buff[islittle ? i : size - 1 - i] = (char)(n & MC); 1169 buff[islittle ? i : size - 1 - i] = (char)(n & MC);
1166 } 1170 }
1167 if (neg && size > SZINT) { /* negative number need sign extension? */ 1171 if (neg && size > SZINT) { /* negative number need sign extension? */
1168 for (i = SZINT; i < size; i++) /* correct extra bytes */ 1172 for (i = SZINT; i < size; i++) /* correct extra bytes */
1169 buff[islittle ? i : size - 1 - i] = (char)MC; 1173 buff[islittle ? i : size - 1 - i] = (char)MC;
1170 } 1174 }
1171 luaL_addsize(b, size); /* add result to buffer */ 1175 luaL_addsize(b, size); /* add result to buffer */
1172} 1176}
1173 1177
1174 1178
 1179#ifndef _KERNEL
1175/* 1180/*
1176** Copy 'size' bytes from 'src' to 'dest', correcting endianness if 1181** Copy 'size' bytes from 'src' to 'dest', correcting endianness if
1177** given 'islittle' is different from native endianness. 1182** given 'islittle' is different from native endianness.
1178*/ 1183*/
1179static void copywithendian (volatile char *dest, volatile const char *src, 1184static void copywithendian (volatile char *dest, volatile const char *src,
1180 int size, int islittle) { 1185 int size, int islittle) {
1181 if (islittle == nativeendian.little) { 1186 if (islittle == nativeendian.little) {
1182 while (size-- != 0) 1187 while (size-- != 0)
1183 *(dest++) = *(src++); 1188 *(dest++) = *(src++);
1184 } 1189 }
1185 else { 1190 else {
1186 dest += size - 1; 1191 dest += size - 1;
1187 while (size-- != 0) 1192 while (size-- != 0)
1188 *(dest--) = *(src++); 1193 *(dest--) = *(src++);
1189 } 1194 }
1190} 1195}
 1196#endif
1191 1197
1192 1198
1193static int str_pack (lua_State *L) { 1199static int str_pack (lua_State *L) {
1194 luaL_Buffer b; 1200 luaL_Buffer b;
1195 Header h; 1201 Header h;
1196 const char *fmt = luaL_checkstring(L, 1); /* format string */ 1202 const char *fmt = luaL_checkstring(L, 1); /* format string */
1197 int arg = 1; /* current argument to pack */ 1203 int arg = 1; /* current argument to pack */
1198 size_t totalsize = 0; /* accumulate total size of result */ 1204 size_t totalsize = 0; /* accumulate total size of result */
1199 initheader(L, &h); 1205 initheader(L, &h);
1200 lua_pushnil(L); /* mark to separate arguments from string buffer */ 1206 lua_pushnil(L); /* mark to separate arguments from string buffer */
1201 luaL_buffinit(L, &b); 1207 luaL_buffinit(L, &b);
1202 while (*fmt != '\0') { 1208 while (*fmt != '\0') {
1203 int size, ntoalign; 1209 int size, ntoalign;

cvs diff -r1.9.2.2 -r1.9.2.3 src/external/mit/lua/dist/src/luaconf.h (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/luaconf.h 2015/02/04 21:32:46 1.9.2.2
+++ src/external/mit/lua/dist/src/luaconf.h 2015/02/21 18:16:21 1.9.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: luaconf.h,v 1.9.2.2 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: luaconf.h,v 1.9.2.3 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: luaconf.h,v 1.238 2014/12/29 13:27:55 roberto Exp  4** Id: luaconf.h,v 1.238 2014/12/29 13:27:55 roberto Exp
5** Configuration file for Lua 5** Configuration file for Lua
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9 9
10#ifndef luaconf_h 10#ifndef luaconf_h
11#define luaconf_h 11#define luaconf_h
12 12
13#ifndef _KERNEL 13#ifndef _KERNEL
14#include <limits.h> 14#include <limits.h>
@@ -382,26 +382,27 @@ @@ -382,26 +382,27 @@
382 382
383/* }================================================================== */ 383/* }================================================================== */
384 384
385 385
386 386
387/* 387/*
388** {================================================================== 388** {==================================================================
389** Configuration for Numbers. 389** Configuration for Numbers.
390** Change these definitions if no predefined LUA_REAL_* / LUA_INT_* 390** Change these definitions if no predefined LUA_REAL_* / LUA_INT_*
391** satisfy your needs. 391** satisfy your needs.
392** =================================================================== 392** ===================================================================
393*/ 393*/
394 394
 395#ifndef _KERNEL
395/* 396/*
396@@ LUA_NUMBER is the floating-point type used by Lua. 397@@ LUA_NUMBER is the floating-point type used by Lua.
397** 398**
398@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' 399@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
399@@ over a floating number. 400@@ over a floating number.
400** 401**
401@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. 402@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
402@@ LUA_NUMBER_FMT is the format for writing floats. 403@@ LUA_NUMBER_FMT is the format for writing floats.
403@@ lua_number2str converts a float to a string. 404@@ lua_number2str converts a float to a string.
404** 405**
405@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. 406@@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
406** 407**
407@@ lua_str2number converts a decimal numeric string to a number. 408@@ lua_str2number converts a decimal numeric string to a number.
@@ -468,27 +469,26 @@ @@ -468,27 +469,26 @@
468** and therefore its conversion to float may have an ill-defined value.) 469** and therefore its conversion to float may have an ill-defined value.)
469*/ 470*/
470#define lua_numbertointeger(n,p) \ 471#define lua_numbertointeger(n,p) \
471 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ 472 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
472 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ 473 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
473 (*(p) = (LUA_INTEGER)(n), 1)) 474 (*(p) = (LUA_INTEGER)(n), 1))
474 475
475 476
476/* 477/*
477@@ The luai_num* macros define the primitive operations over numbers. 478@@ The luai_num* macros define the primitive operations over numbers.
478** They should work for any size of floating numbers. 479** They should work for any size of floating numbers.
479*/ 480*/
480 481
481#ifndef _KERNEL 
482/* the following operations need the math library */ 482/* the following operations need the math library */
483#if defined(lobject_c) || defined(lvm_c) 483#if defined(lobject_c) || defined(lvm_c)
484#include <math.h> 484#include <math.h>
485 485
486/* floor division (defined as 'floor(a/b)') */ 486/* floor division (defined as 'floor(a/b)') */
487#define luai_numidiv(L,a,b) ((void)L, l_mathop(floor)(luai_numdiv(L,a,b))) 487#define luai_numidiv(L,a,b) ((void)L, l_mathop(floor)(luai_numdiv(L,a,b)))
488 488
489/* 489/*
490** module: defined as 'a - floor(a/b)*b'; the previous definition gives 490** module: defined as 'a - floor(a/b)*b'; the previous definition gives
491** NaN when 'b' is huge, but the result should be 'a'. 'fmod' gives the 491** NaN when 'b' is huge, but the result should be 'a'. 'fmod' gives the
492** result of 'a - trunc(a/b)*b', and therefore must be corrected when 492** result of 'a - trunc(a/b)*b', and therefore must be corrected when
493** 'trunc(a/b) ~= floor(a/b)'. That happens when the division has a 493** 'trunc(a/b) ~= floor(a/b)'. That happens when the division has a
494** non-integer negative result, which is equivalent to the test below 494** non-integer negative result, which is equivalent to the test below
@@ -761,49 +761,41 @@ @@ -761,49 +761,41 @@
761#define LUA_ROOT "/usr/" 761#define LUA_ROOT "/usr/"
762#define LUA_PATH_DEFAULT \ 762#define LUA_PATH_DEFAULT \
763 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 763 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
764 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" 764 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
765#define LUA_CPATH_DEFAULT \ 765#define LUA_CPATH_DEFAULT \
766 LUA_CDIR"?.so;" LUA_CDIR"loadall.so" 766 LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
767 767
768#ifndef _KERNEL 768#ifndef _KERNEL
769 769
770#include <stdint.h> 770#include <stdint.h>
771 771
772#else /* _KERNEL */ 772#else /* _KERNEL */
773 773
774#undef LUA_NUMBER 
775#undef LUA_NUMBER_FMT 
776#undef lua_str2number 
777 
778#define LUA_NUMBER LUA_INTEGER 774#define LUA_NUMBER LUA_INTEGER
779#define LUA_NUMBER_FMT LUA_INTEGER_FMT 775#define LUA_NUMBER_FMT LUA_INTEGER_FMT
780#define lua_str2number(s,p) strtoimax((s),(p),10) 
781 
782#undef lua_numbertointeger 
783#define lua_numbertointeger(n,p) (*(p) = (LUA_INTEGER)(n), 1) 
784 776
785/* setjmp.h */ 777/* setjmp.h */
786#define LUAI_THROW(L,c) longjmp(&((c)->b)) 778#define LUAI_THROW(L,c) longjmp(&((c)->b))
787#define LUAI_TRY(L,c,a) if (setjmp(&((c)->b)) == 0) { a } 779#define LUAI_TRY(L,c,a) if (setjmp(&((c)->b)) == 0) { a }
788#define luai_jmpbuf label_t 780#define luai_jmpbuf label_t
789 781
790/* time.h */ 782/* time.h */
791#include <sys/time.h> 783#include <sys/time.h>
792#define time(p) (time_uptime) 784#define time(p) (time_uptime)
793 785
794/* stdio.h */ 786/* stdio.h */
795#define lua_writestring(s,l) printf("%s", (s)) 787#define lua_writestring(s,l) printf("%s", (s))
796#define lua_writeline() printf("\n") 788#define lua_writeline() printf("\n")
797 789
798#define sprintf(s,fmt,...) snprintf(s, sizeof(s), fmt, __VA_ARGS__) 790#define sprintf(s,fmt,...) snprintf(s, sizeof(s), fmt, __VA_ARGS__)
799 791
800/* string.h */ 792/* string.h */
801#define strcoll strcmp 793#define strcoll strcmp
802 794
803/* stdlib.h */ 795/* stdlib.h */
804#define abort() panic("Lua has aborted!") 796#define abort() panic("Lua has aborted!")
805 797
806#endif /* _KERNEL */ 798#endif /* _KERNEL */
807 799
808#endif /* __NetBSD__ */ 800#endif /* __NetBSD__ */
809 801

cvs diff -r1.3.2.1 -r1.3.2.2 src/external/mit/lua/dist/src/lvm.c (expand / switch to unified diff)

--- src/external/mit/lua/dist/src/lvm.c 2015/02/04 21:32:46 1.3.2.1
+++ src/external/mit/lua/dist/src/lvm.c 2015/02/21 18:16:21 1.3.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lvm.c,v 1.3.2.1 2015/02/04 21:32:46 martin Exp $ */ 1/* $NetBSD: lvm.c,v 1.3.2.2 2015/02/21 18:16:21 martin Exp $ */
2 2
3/* 3/*
4** Id: lvm.c,v 2.232 2014/12/27 20:30:38 roberto Exp  4** Id: lvm.c,v 2.232 2014/12/27 20:30:38 roberto Exp
5** Lua virtual machine 5** Lua virtual machine
6** See Copyright Notice in lua.h 6** See Copyright Notice in lua.h
7*/ 7*/
8 8
9#define lvm_c 9#define lvm_c
10#define LUA_CORE 10#define LUA_CORE
11 11
12#include "lprefix.h" 12#include "lprefix.h"
13 13
14 14
@@ -55,47 +55,47 @@ @@ -55,47 +55,47 @@
55*/ 55*/
56static int tofloat (const TValue *obj, lua_Number *n) { 56static int tofloat (const TValue *obj, lua_Number *n) {
57 if (ttisfloat(obj)) *n = fltvalue(obj); 57 if (ttisfloat(obj)) *n = fltvalue(obj);
58 else if (ttisinteger(obj)) { 58 else if (ttisinteger(obj)) {
59 volatile lua_Number x = cast_num(ivalue(obj)); /* avoid extra precision */ 59 volatile lua_Number x = cast_num(ivalue(obj)); /* avoid extra precision */
60 *n = x; 60 *n = x;
61 } 61 }
62 else { 62 else {
63 *n = 0; /* to avoid warnings */ 63 *n = 0; /* to avoid warnings */
64 return 0; 64 return 0;
65 } 65 }
66 return 1; 66 return 1;
67} 67}
68#endif 
69 68
70 69
71/* 70/*
72** Try to convert a value to a float. The float case is already handled 71** Try to convert a value to a float. The float case is already handled
73** by the macro 'tonumber'. 72** by the macro 'tonumber'.
74*/ 73*/
75int luaV_tonumber_ (const TValue *obj, lua_Number *n) { 74int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
76 TValue v; 75 TValue v;
77 if (ttisinteger(obj)) { 76 if (ttisinteger(obj)) {
78 *n = cast_num(ivalue(obj)); 77 *n = cast_num(ivalue(obj));
79 return 1; 78 return 1;
80 } 79 }
81 else if (cvt2num(obj) && /* string convertible to number? */ 80 else if (cvt2num(obj) && /* string convertible to number? */
82 luaO_str2num(svalue(obj), &v) == tsvalue(obj)->len + 1) { 81 luaO_str2num(svalue(obj), &v) == tsvalue(obj)->len + 1) {
83 *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ 82 *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */
84 return 1; 83 return 1;
85 } 84 }
86 else 85 else
87 return 0; /* conversion failed */ 86 return 0; /* conversion failed */
88} 87}
 88#endif
89 89
90 90
91/* 91/*
92** try to convert a value to an integer, rounding according to 'mode': 92** try to convert a value to an integer, rounding according to 'mode':
93** mode == 0: accepts only integral values 93** mode == 0: accepts only integral values
94** mode == 1: takes the floor of the number 94** mode == 1: takes the floor of the number
95** mode == 2: takes the ceil of the number 95** mode == 2: takes the ceil of the number
96*/ 96*/
97static int tointeger_aux (const TValue *obj, lua_Integer *p, int mode) { 97static int tointeger_aux (const TValue *obj, lua_Integer *p, int mode) {
98 TValue v; 98 TValue v;
99 again: 99 again:
100#ifndef _KERNEL 100#ifndef _KERNEL
101 if (ttisfloat(obj)) { 101 if (ttisfloat(obj)) {