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 imported Lua 5.3.0



details:   https://anonhg.NetBSD.org/src/rev/7eabe3b06444
branches:  trunk
changeset: 335956:7eabe3b06444
user:      lneto <lneto%NetBSD.org@localhost>
date:      Mon Feb 02 02:01:06 2015 +0000

description:
imported Lua 5.3.0

diffstat:

 external/mit/lua/dist/src/lbitlib.c  |  31 +++++++++++++----------
 external/mit/lua/dist/src/lcorolib.c |  17 ++++++------
 external/mit/lua/dist/src/lctype.c   |   7 +++-
 external/mit/lua/dist/src/lprefix.h  |  47 ++++++++++++++++++++++++++++++++++++
 external/mit/lua/dist/src/lutf8lib.c |  22 +++++++++------
 5 files changed, 91 insertions(+), 33 deletions(-)

diffs (290 lines):

diff -r 091f83434ec8 -r 7eabe3b06444 external/mit/lua/dist/src/lbitlib.c
--- a/external/mit/lua/dist/src/lbitlib.c       Mon Feb 02 00:55:28 2015 +0000
+++ b/external/mit/lua/dist/src/lbitlib.c       Mon Feb 02 02:01:06 2015 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: lbitlib.c,v 1.1.1.1 2014/07/20 23:17:33 lneto Exp $    */
+/*     $NetBSD: lbitlib.c,v 1.1.1.2 2015/02/02 02:01:06 lneto Exp $    */
 
 /*
-** Id: lbitlib.c,v 1.26 2014/05/15 19:28:34 roberto Exp 
+** Id: lbitlib.c,v 1.28 2014/11/02 19:19:04 roberto Exp 
 ** Standard library for bitwise operations
 ** See Copyright Notice in lua.h
 */
@@ -9,6 +9,9 @@
 #define lbitlib_c
 #define LUA_LIB
 
+#include "lprefix.h"
+
+
 #include "lua.h"
 
 #include "lauxlib.h"
@@ -91,7 +94,7 @@
 }
 
 
-static int b_shift (lua_State *L, lua_Unsigned r, int i) {
+static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) {
   if (i < 0) {  /* shift right? */
     i = -i;
     r = trim(r);
@@ -109,18 +112,18 @@
 
 
 static int b_lshift (lua_State *L) {
-  return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2));
+  return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkinteger(L, 2));
 }
 
 
 static int b_rshift (lua_State *L) {
-  return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2));
+  return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkinteger(L, 2));
 }
 
 
 static int b_arshift (lua_State *L) {
   lua_Unsigned r = luaL_checkunsigned(L, 1);
-  int i = luaL_checkint(L, 2);
+  lua_Integer i = luaL_checkinteger(L, 2);
   if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1))))
     return b_shift(L, r, -i);
   else {  /* arithmetic shift for 'negative' number */
@@ -133,9 +136,9 @@
 }
 
 
-static int b_rot (lua_State *L, int i) {
+static int b_rot (lua_State *L, lua_Integer d) {
   lua_Unsigned r = luaL_checkunsigned(L, 1);
-  i &= (LUA_NBITS - 1);  /* i = i % NBITS */
+  int i = d & (LUA_NBITS - 1);  /* i = d % NBITS */
   r = trim(r);
   if (i != 0)  /* avoid undefined shift of LUA_NBITS when i == 0 */
     r = (r << i) | (r >> (LUA_NBITS - i));
@@ -145,12 +148,12 @@
 
 
 static int b_lrot (lua_State *L) {
-  return b_rot(L, luaL_checkint(L, 2));
+  return b_rot(L, luaL_checkinteger(L, 2));
 }
 
 
 static int b_rrot (lua_State *L) {
-  return b_rot(L, -luaL_checkint(L, 2));
+  return b_rot(L, -luaL_checkinteger(L, 2));
 }
 
 
@@ -161,14 +164,14 @@
 ** 'width' being used uninitialized.)
 */
 static int fieldargs (lua_State *L, int farg, int *width) {
-  int f = luaL_checkint(L, farg);
-  int w = luaL_optint(L, farg + 1, 1);
+  lua_Integer f = luaL_checkinteger(L, farg);
+  lua_Integer w = luaL_optinteger(L, farg + 1, 1);
   luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
   luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
   if (f + w > LUA_NBITS)
     luaL_error(L, "trying to access non-existent bits");
-  *width = w;
-  return f;
+  *width = (int)w;
+  return (int)f;
 }
 
 
diff -r 091f83434ec8 -r 7eabe3b06444 external/mit/lua/dist/src/lcorolib.c
--- a/external/mit/lua/dist/src/lcorolib.c      Mon Feb 02 00:55:28 2015 +0000
+++ b/external/mit/lua/dist/src/lcorolib.c      Mon Feb 02 02:01:06 2015 +0000
@@ -1,18 +1,19 @@
-/*     $NetBSD: lcorolib.c,v 1.1.1.1 2014/07/20 23:17:33 lneto Exp $   */
+/*     $NetBSD: lcorolib.c,v 1.1.1.2 2015/02/02 02:01:08 lneto Exp $   */
 
 /*
-** Id: lcorolib.c,v 1.6 2014/05/08 13:52:20 roberto Exp 
+** Id: lcorolib.c,v 1.9 2014/11/02 19:19:04 roberto Exp 
 ** Coroutine Library
 ** See Copyright Notice in lua.h
 */
 
+#define lcorolib_c
+#define LUA_LIB
+
+#include "lprefix.h"
+
 
 #include <stdlib.h>
 
-
-#define lcorolib_c
-#define LUA_LIB
-
 #include "lua.h"
 
 #include "lauxlib.h"
@@ -21,7 +22,7 @@
 
 static lua_State *getco (lua_State *L) {
   lua_State *co = lua_tothread(L, 1);
-  luaL_argcheck(L, co, 1, "coroutine expected");
+  luaL_argcheck(L, co, 1, "thread expected");
   return co;
 }
 
@@ -67,7 +68,7 @@
   else {
     lua_pushboolean(L, 1);
     lua_insert(L, -(r + 1));
-    return r + 1;  /* return true + `resume' returns */
+    return r + 1;  /* return true + 'resume' returns */
   }
 }
 
diff -r 091f83434ec8 -r 7eabe3b06444 external/mit/lua/dist/src/lctype.c
--- a/external/mit/lua/dist/src/lctype.c        Mon Feb 02 00:55:28 2015 +0000
+++ b/external/mit/lua/dist/src/lctype.c        Mon Feb 02 02:01:06 2015 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: lctype.c,v 1.1.1.1 2014/07/20 23:17:33 lneto Exp $     */
+/*     $NetBSD: lctype.c,v 1.1.1.2 2015/02/02 02:01:11 lneto Exp $     */
 
 /*
-** Id: lctype.c,v 1.11 2011/10/03 16:19:23 roberto Exp 
+** Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp 
 ** 'ctype' functions for Lua
 ** See Copyright Notice in lua.h
 */
@@ -9,6 +9,9 @@
 #define lctype_c
 #define LUA_CORE
 
+#include "lprefix.h"
+
+
 #include "lctype.h"
 
 #if !LUA_USE_CTYPE     /* { */
diff -r 091f83434ec8 -r 7eabe3b06444 external/mit/lua/dist/src/lprefix.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/lua/dist/src/lprefix.h       Mon Feb 02 02:01:06 2015 +0000
@@ -0,0 +1,47 @@
+/*     $NetBSD: lprefix.h,v 1.1.1.1 2015/02/02 02:01:13 lneto Exp $    */
+
+/*
+** Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp 
+** Definitions for Lua code that must come before any other header file
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lprefix_h
+#define lprefix_h
+
+
+/*
+** Allows POSIX/XSI stuff
+*/
+#if !defined(LUA_USE_C89)      /* { */
+
+#if !defined(_XOPEN_SOURCE)
+#define _XOPEN_SOURCE           600
+#elif _XOPEN_SOURCE == 0
+#undef _XOPEN_SOURCE  /* use -D_XOPEN_SOURCE=0 to undefine it */
+#endif
+
+/*
+** Allows manipulation of large files in gcc and some other compilers
+*/
+#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS)
+#define _LARGEFILE_SOURCE       1
+#define _FILE_OFFSET_BITS       64
+#endif
+
+#endif                         /* } */
+
+
+/*
+** Windows stuff
+*/
+#if defined(_WIN32)    /* { */
+
+#if !defined(_CRT_SECURE_NO_WARNINGS)
+#define _CRT_SECURE_NO_WARNINGS  /* avoid warnings about ISO C functions */
+#endif
+
+#endif                 /* } */
+
+#endif
+
diff -r 091f83434ec8 -r 7eabe3b06444 external/mit/lua/dist/src/lutf8lib.c
--- a/external/mit/lua/dist/src/lutf8lib.c      Mon Feb 02 00:55:28 2015 +0000
+++ b/external/mit/lua/dist/src/lutf8lib.c      Mon Feb 02 02:01:06 2015 +0000
@@ -1,19 +1,21 @@
-/*     $NetBSD: lutf8lib.c,v 1.1.1.1 2014/07/20 23:17:39 lneto Exp $   */
+/*     $NetBSD: lutf8lib.c,v 1.1.1.2 2015/02/02 02:01:09 lneto Exp $   */
 
 /*
-** Id: lutf8lib.c,v 1.9 2014/05/14 18:33:37 roberto Exp 
+** Id: lutf8lib.c,v 1.13 2014/11/02 19:19:04 roberto Exp 
 ** Standard library for UTF-8 manipulation
 ** See Copyright Notice in lua.h
 */
 
+#define lutf8lib_c
+#define LUA_LIB
+
+#include "lprefix.h"
+
 
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
-#define lutf8lib_c
-#define LUA_LIB
-
 #include "lua.h"
 
 #include "lauxlib.h"
@@ -125,9 +127,9 @@
 
 
 static void pushutfchar (lua_State *L, int arg) {
-  int code = luaL_checkint(L, arg);
+  lua_Integer code = luaL_checkinteger(L, arg);
   luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range");
-  lua_pushfstring(L, "%U", code);
+  lua_pushfstring(L, "%U", (long)code);
 }
 
 
@@ -159,7 +161,7 @@
 static int byteoffset (lua_State *L) {
   size_t len;
   const char *s = luaL_checklstring(L, 1, &len);
-  int n  = luaL_checkint(L, 2);
+  lua_Integer n  = luaL_checkinteger(L, 2);
   lua_Integer posi = (n >= 0) ? 1 : len + 1;
   posi = u_posrelat(luaL_optinteger(L, 3, posi), len);
   luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3,
@@ -240,6 +242,8 @@
   {"char", utfchar},
   {"len", utflen},
   {"codes", iter_codes},
+  /* placeholders */
+  {"charpattern", NULL},
   {NULL, NULL}
 };
 
@@ -247,7 +251,7 @@
 LUAMOD_API int luaopen_utf8 (lua_State *L) {
   luaL_newlib(L, funcs);
   lua_pushliteral(L, UTF8PATT);
-  lua_setfield(L, -2, "charpatt");
+  lua_setfield(L, -2, "charpattern");
   return 1;
 }
 



Home | Main Index | Thread Index | Old Index