Rebase for lua 5.3.3 32/98632/1
authorAnas Nashif <anas.nashif@intel.com>
Mon, 5 Nov 2012 19:04:08 +0000 (11:04 -0800)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 16 Nov 2016 08:31:15 +0000 (17:31 +0900)
Change-Id: I26f45555fbefca78f57642c839d82170bcb24328
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
15 files changed:
Makefile
packaging/baselibs.conf [new file with mode: 0644]
packaging/lua.changes [new file with mode: 0644]
packaging/lua.manifest [new file with mode: 0644]
packaging/lua.spec [new file with mode: 0644]
packaging/macros.lua [new file with mode: 0644]
src/Makefile
src/lcode.c
src/ldblib.c
src/liolib.c
src/llex.c
src/loadlib.c
src/lstrlib.c
src/luaconf.h
src/lvm.c

index c795dd7..9537728 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,8 +40,8 @@ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
 
 # What to install.
 TO_BIN= lua luac
-TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+TO_LIB= liblua.a liblua.so.$(V)
 TO_MAN= lua.1 luac.1
 
 # Lua version and release.
@@ -61,6 +61,7 @@ install: dummy
        cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
        cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
        cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+       ln -s liblua.so.$(V) $(INSTALL_LIB)/liblua.so
        cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
        cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
 
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644 (file)
index 0000000..9860296
--- /dev/null
@@ -0,0 +1,2 @@
+liblua
+       targetarch ia64 block!
diff --git a/packaging/lua.changes b/packaging/lua.changes
new file mode 100644 (file)
index 0000000..909bd2f
--- /dev/null
@@ -0,0 +1,10 @@
+* Fri Mar 22 2013 Anas Nashif <anas.nashif@intel.com> submit/trunk/20121215.004706@978b56f
+- Fixed package groups
+
+* Thu Feb 21 2013 Patrick McCarty <patrick.mccarty@linux.intel.com> 8fc91fd
+- Resolve rpmlint warnings
+- Install a /usr/bin/lua symlink
+
+* Fri Dec 14 2012 Anas Nashif <anas.nashif@intel.com> upstream/5.1.4@c9e8879
+- Update to version 5.1.4
+
diff --git a/packaging/lua.manifest b/packaging/lua.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/lua.spec b/packaging/lua.spec
new file mode 100644 (file)
index 0000000..7ff6fba
--- /dev/null
@@ -0,0 +1,142 @@
+Name:           lua
+Version:        5.1.4
+Release:        0
+License:        MIT
+Summary:        Small Embeddable Language with Simple Procedural Syntax
+Url:            http://www.lua.org
+Group:          Base/Libraries
+Source:         %{name}-%{version}.tar.gz
+Source1:        macros.lua
+Source2:        baselibs.conf
+Source1001:    lua.manifest
+%define major_version 5.1
+BuildRequires:  pkg-config
+BuildRequires:  readline-devel
+
+%description
+Lua is a programming language originally designed for extending
+applications, but also frequently used as a general-purpose,
+stand-alone language.
+
+Lua combines simple procedural syntax (similar to Pascal) with powerful
+data description constructs based on associative arrays and extensible
+semantics. Lua is dynamically typed, interpreted from byte codes, and
+has automatic memory management, making it ideal for configuration,
+scripting, and rapid prototyping. Lua is implemented as a small library
+of C functions, written in ANSI C, and the implementation goals are
+simplicity, efficiency, portability, and low embedding cost.
+
+%package devel
+Summary:        Development files for lua
+Group:          Development/Libraries
+Requires:       %{name} = %{version}
+
+%description devel
+Lua is a programming language originally designed for extending
+applications, but also frequently used as a general-purpose,
+stand-alone language.
+
+This package contains files needed for embedding lua into your
+application.
+
+%package -n liblua
+Summary:        Small Embeddable Language with Simple Procedural Syntax
+Group:          Base/Libraries
+
+%description -n liblua
+Lua is a programming language originally designed for extending
+applications, but also frequently used as a general-purpose,
+stand-alone language.
+
+Lua combines simple procedural syntax (similar to Pascal) with powerful
+data description constructs based on associative arrays and extensible
+semantics. Lua is dynamically typed, interpreted from byte codes, and
+has automatic memory management, making it ideal for configuration,
+scripting, and rapid prototyping. Lua is implemented as a small library
+of C functions, written in ANSI C, and the implementation goals are
+simplicity, efficiency, portability, and low embedding cost.
+
+%package doc
+Summary:        Small Embeddable Language with Simple Procedural Syntax
+Group:          Documentation
+BuildArch:      noarch
+
+%description doc
+Lua is a programming language originally designed for extending
+applications, but also frequently used as a general-purpose,
+stand-alone language.
+
+Lua combines simple procedural syntax (similar to Pascal) with powerful
+data description constructs based on associative arrays and extensible
+semantics. Lua is dynamically typed, interpreted from byte codes, and
+has automatic memory management, making it ideal for configuration,
+scripting, and rapid prototyping. Lua is implemented as a small library
+of C functions, written in ANSI C, and the implementation goals are
+simplicity, efficiency, portability, and low embedding cost.
+
+%prep
+%setup -q -n lua-%{version}
+cp %{SOURCE1001} .
+
+%build
+export LDFLAGS+=" -Wl,-E -ldl -lreadline -lhistory -lncurses"
+sed -i 's:LUA_ROOT2 "LIBDIR/lua/%{major_version}/":LUA_ROOT2 \"%{_lib}/lua/%{major_version}/":' src/luaconf.h
+make %{?_smp_mflags} -C src CC="%{__cc}" MYCFLAGS="%{optflags} -fPIC -DLUA_USE_LINUX" MYLIBS="$LDFLAGS" V=%{major_version} all
+
+%install
+make install INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1"
+install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
+for file in lua luac ; do
+    mv "%{buildroot}%{_bindir}/${file}"        "%{buildroot}%{_bindir}/${file}%{major_version}"
+    mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1"
+done
+install -d -m 0755 %{buildroot}%{_libdir}/lua/%{major_version}
+install -d -m 0755 %{buildroot}%{_datadir}/lua/%{major_version}
+install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua
+
+chmod +x %{buildroot}/%{_libdir}/liblua.so.%{major_version}
+
+ln -s lua%{major_version} %{buildroot}%{_bindir}/lua
+
+%post -n liblua -p /sbin/ldconfig
+
+%postun -n liblua -p /sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_mandir}/man1/lua%{major_version}.1*
+%{_mandir}/man1/luac%{major_version}.1*
+%{_bindir}/lua
+%{_bindir}/lua%{major_version}
+%{_bindir}/luac%{major_version}
+%dir %{_libdir}/lua
+%dir %{_libdir}/lua/%{major_version}
+%dir %{_datadir}/lua
+%dir %{_datadir}/lua/%{major_version}
+%{_sysconfdir}/rpm/macros.lua
+
+%files -n liblua
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%license COPYRIGHT
+%{_libdir}/liblua.so.%{major_version}
+
+%files devel
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_includedir}/lauxlib.h
+%{_includedir}/lua.h
+%{_includedir}/lua.hpp
+%{_includedir}/luaconf.h
+%{_includedir}/lualib.h
+%{_libdir}/pkgconfig/lua.pc
+%{_libdir}/liblua.a
+%{_libdir}/liblua.so
+
+%files doc
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%doc doc/*
+
+%changelog
diff --git a/packaging/macros.lua b/packaging/macros.lua
new file mode 100644 (file)
index 0000000..d5e06dc
--- /dev/null
@@ -0,0 +1,10 @@
+# RPM macros for Lua
+
+# The major.minor version of Lua
+%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
+
+# compiled modules should go here
+%lua_archdir %{_libdir}/lua/%{lua_version}
+
+# pure Lua modules should go here
+%lua_noarchdir %{_datadir}/lua/%{lua_version}
index d71c75c..962fac4 100644 (file)
@@ -29,12 +29,12 @@ MYOBJS=
 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
 
 LUA_A= liblua.a
-CORE_O=        lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
-       lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
-       ltm.o lundump.o lvm.o lzio.o
-LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \
-       lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
-BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+LUA_SO=        liblua.so
+CORE_O=        lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
+       lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
+       lundump.o lvm.o lzio.o
+LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
+       lstrlib.o loadlib.o linit.o
 
 LUA_T= lua
 LUA_O= lua.o
@@ -42,8 +42,8 @@ LUA_O=        lua.o
 LUAC_T=        luac
 LUAC_O=        luac.o
 
-ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+ALL_T= $(LUA_SO) $(LUA_A) $(LUA_T) $(LUAC_T)
 ALL_A= $(LUA_A)
 
 # Targets start here.
@@ -55,15 +55,20 @@ o:  $(ALL_O)
 
 a:     $(ALL_A)
 
-$(LUA_A): $(BASE_O)
-       $(AR) $@ $(BASE_O)
+# shared libraries (for Linux)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+       $(CC) -o $(LUA_SO).$V -shared -Wl,-soname,$(LUA_SO).$V $(CORE_O) $(LIB_O) -lm -ldl
+       ln -fs $(LUA_SO).$(V) $(LUA_SO)
+
+$(LUA_A): $(CORE_O) $(LIB_O)
+       $(AR) $@ $?
        $(RANLIB) $@
 
 $(LUA_T): $(LUA_O) $(LUA_A)
-       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+       $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) -L. -llua $(LIBS)
 
 $(LUAC_T): $(LUAC_O) $(LUA_A)
-       $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+       $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) -L. -llua $(LIBS)
 
 clean:
        $(RM) $(ALL_T) $(ALL_O)
index 2cd0dd2..e878152 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp $
+** $Id: lcode.c,v 2.25.1.4 2009/06/15 14:12:25 roberto Exp $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -863,10 +863,18 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
       pc = e->u.info;  /* save jump position */
       break;
     }
-    case VK: case VKFLT: case VKINT: case VTRUE: {
-      pc = NO_JUMP;  /* always true; do nothing */
+    case VJMP: {
+      invertjump(fs, e);
+      pc = e->u.s.info;
       break;
     }
+    case VFALSE: {
+      if (!hasjumps(e)) {
+        pc = luaK_jump(fs);  /* always jump */
+        break;
+      }
+      /* else go through */
+    }
     default: {
       pc = jumponcond(fs, e, 0);  /* jump when false */
       break;
@@ -885,14 +893,21 @@ void luaK_goiffalse (FuncState *fs, expdesc *e) {
   int pc;  /* pc of new jump */
   luaK_dischargevars(fs, e);
   switch (e->k) {
-    case VJMP: {
-      pc = e->u.info;  /* already jump if true */
-      break;
-    }
     case VNIL: case VFALSE: {
       pc = NO_JUMP;  /* always false; do nothing */
       break;
     }
+    case VJMP: {
+      pc = e->u.s.info;
+      break;
+    }
+    case VTRUE: {
+      if (!hasjumps(e)) {
+        pc = luaK_jump(fs);  /* always jump */
+        break;
+      }
+      /* else go through */
+    }
     default: {
       pc = jumponcond(fs, e, 1);  /* jump if true */
       break;
index 786f6cd..0956e19 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $
+** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -63,11 +63,9 @@ static int db_setmetatable (lua_State *L) {
 }
 
 
-static int db_getuservalue (lua_State *L) {
-  if (lua_type(L, 1) != LUA_TUSERDATA)
-    lua_pushnil(L);
-  else
-    lua_getuservalue(L, 1);
+static int db_getfenv (lua_State *L) {
+  luaL_checkany(L, 1);
+  lua_getfenv(L, 1);
   return 1;
 }
 
index aa78e59..208983e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: liolib.c,v 2.149 2016/05/02 14:03:19 roberto Exp $
+** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $
 ** Standard I/O (and system) library
 ** See Copyright Notice in lua.h
 */
@@ -402,65 +402,9 @@ static int nextc (RN *rn) {
     rn->c = l_getc(rn->f);  /* read next one */
     return 1;
   }
-}
-
-
-/*
-** Accept current char if it is in 'set' (of size 2)
-*/
-static int test2 (RN *rn, const char *set) {
-  if (rn->c == set[0] || rn->c == set[1])
-    return nextc(rn);
-  else return 0;
-}
-
-
-/*
-** Read a sequence of (hex)digits
-*/
-static int readdigits (RN *rn, int hex) {
-  int count = 0;
-  while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn))
-    count++;
-  return count;
-}
-
-
-/*
-** Read a number: first reads a valid prefix of a numeral into a buffer.
-** Then it calls 'lua_stringtonumber' to check whether the format is
-** correct and to convert it to a Lua number
-*/
-static int read_number (lua_State *L, FILE *f) {
-  RN rn;
-  int count = 0;
-  int hex = 0;
-  char decp[2];
-  rn.f = f; rn.n = 0;
-  decp[0] = lua_getlocaledecpoint();  /* get decimal point from locale */
-  decp[1] = '.';  /* always accept a dot */
-  l_lockfile(rn.f);
-  do { rn.c = l_getc(rn.f); } while (isspace(rn.c));  /* skip spaces */
-  test2(&rn, "-+");  /* optional signal */
-  if (test2(&rn, "00")) {
-    if (test2(&rn, "xX")) hex = 1;  /* numeral is hexadecimal */
-    else count = 1;  /* count initial '0' as a valid digit */
-  }
-  count += readdigits(&rn, hex);  /* integral part */
-  if (test2(&rn, decp))  /* decimal point? */
-    count += readdigits(&rn, hex);  /* fractional part */
-  if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) {  /* exponent mark? */
-    test2(&rn, "-+");  /* exponent signal */
-    readdigits(&rn, 0);  /* exponent digits */
-  }
-  ungetc(rn.c, rn.f);  /* unread look-ahead char */
-  l_unlockfile(rn.f);
-  rn.buff[rn.n] = '\0';  /* finish string */
-  if (lua_stringtonumber(L, rn.buff))  /* is this a valid number? */
-    return 1;  /* ok */
-  else {  /* invalid format */
-   lua_pushnil(L);  /* "result" to be removed */
-   return 0;  /* read fails */
+  else {
+    lua_pushnil(L);  /* "result" to be removed */
+    return 0;  /* read fails */
   }
 }
 
index 7032827..eea62c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $
+** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 */
@@ -126,20 +126,12 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
 */
 TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
   lua_State *L = ls->L;
-  TValue *o;  /* entry for 'str' */
-  TString *ts = luaS_newlstr(L, str, l);  /* create new string */
-  setsvalue2s(L, L->top++, ts);  /* temporarily anchor it in stack */
-  o = luaH_set(L, ls->h, L->top - 1);
-  if (ttisnil(o)) {  /* not in use yet? */
-    /* boolean value does not need GC barrier;
-       table has no metatable, so it does not need to invalidate cache */
-    setbvalue(o, 1);  /* t[string] = true */
+  TString *ts = luaS_newlstr(L, str, l);
+  TValue *o = luaH_setstr(L, ls->fs->h, ts);  /* entry for `str' */
+  if (ttisnil(o)) {
+    setbvalue(o, 1);  /* make sure `str' will not be collected */
     luaC_checkGC(L);
   }
-  else {  /* string already present */
-    ts = tsvalue(keyfromval(o));  /* re-use value previously stored */
-  }
-  L->top--;  /* remove string from stack */
   return ts;
 }
 
index 7911928..92f88bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: loadlib.c,v 1.127 2015/11/23 11:30:45 roberto Exp $
+** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
 ** Dynamic library loader for Lua
 ** See Copyright Notice in lua.h
 **
@@ -730,12 +730,23 @@ static void createsearcherstable (lua_State *L) {
   static const lua_CFunction searchers[] =
     {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};
   int i;
-  /* create 'searchers' table */
-  lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);
-  /* fill it with predefined searchers */
-  for (i=0; searchers[i] != NULL; i++) {
-    lua_pushvalue(L, -2);  /* set 'package' as upvalue for all searchers */
-    lua_pushcclosure(L, searchers[i], 1);
+  /* create new type _LOADLIB */
+  luaL_newmetatable(L, "_LOADLIB");
+  lua_pushcfunction(L, gctm);
+  lua_setfield(L, -2, "__gc");
+  /* create `package' table */
+  luaL_register(L, LUA_LOADLIBNAME, pk_funcs);
+#if defined(LUA_COMPAT_LOADLIB) 
+  lua_getfield(L, -1, "loadlib");
+  lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
+#endif
+  lua_pushvalue(L, -1);
+  lua_replace(L, LUA_ENVIRONINDEX);
+  /* create `loaders' table */
+  lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
+  /* fill it with pre-defined loaders */
+  for (i=0; loaders[i] != NULL; i++) {
+    lua_pushcfunction(L, loaders[i]);
     lua_rawseti(L, -2, i+1);
   }
 #if defined(LUA_COMPAT_LOADERS)
index 12264f8..85c2992 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.251 2016/05/20 14:13:21 roberto Exp $
+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -1026,9 +1026,8 @@ static int str_format (lua_State *L) {
     else if (*++strfrmt == L_ESC)
       luaL_addchar(&b, *strfrmt++);  /* %% */
     else { /* format item */
-      char form[MAX_FORMAT];  /* to store the format ('%...') */
-      char *buff = luaL_prepbuffsize(&b, MAX_ITEM);  /* to put formatted item */
-      int nb = 0;  /* number of bytes in added item */
+      char form[MAX_FORMAT];  /* to store the format (`%...') */
+      char buff[MAX_ITEM];  /* to store the formatted item */
       if (++arg > top)
         luaL_argerror(L, arg, "no value");
       strfrmt = scanformat(L, strfrmt, form);
index fd447cc..8453298 100644 (file)
 #else                  /* }{ */
 
 #define LUA_ROOT       "/usr/local/"
-#define LUA_LDIR       LUA_ROOT "share/lua/" LUA_VDIR "/"
-#define LUA_CDIR       LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#define LUA_ROOT2      "/usr/"
+#define LUA_LDIR       LUA_ROOT "share/lua/5.1/"
+#define LUA_LDIR2      LUA_ROOT2 "share/lua/5.1/"
+#define LUA_CDIR       LUA_ROOT "lib/lua/5.1/"
+#define LUA_CDIR2      LUA_ROOT2 "LIBDIR/lua/5.1/"
 #define LUA_PATH_DEFAULT  \
-               LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
-               LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
-               "./?.lua;" "./?/init.lua"
+               "./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+                           LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
+                           LUA_LDIR2"?.lua;"  LUA_LDIR2"?/init.lua"
 #define LUA_CPATH_DEFAULT \
-               LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
-#endif                 /* } */
+       "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so"
+#endif
 
 
 /*
 ** definitions and LUAI_DDEC for declarations).
 ** CHANGE them if you need to mark them in some special way. Elf/gcc
 ** (versions 3.2 and later) mark them as "hidden" to optimize access
-** when Lua is compiled as a shared library. Not all elf targets support
-** this attribute. Unfortunately, gcc does not offer a way to check
-** whether the target offers that support, and those without support
-** give a warning about it. To avoid these warnings, change to the
-** default definition.
-*/
-#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
-    defined(__ELF__)           /* { */
-#define LUAI_FUNC      __attribute__((visibility("hidden"))) extern
-#else                          /* }{ */
+** when Lua is compiled as a shared library.
+*/
+#if defined(luaall_c)
+#define LUAI_FUNC      static
+#define LUAI_DATA      /* empty */
+
+#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+      defined(__ELF__)
+#define LUAI_FUNC      extern
+#define LUAI_DATA      LUAI_FUNC
+
+#else
 #define LUAI_FUNC      extern
 #endif                         /* } */
 
index 84ade6b..fb70f53 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.c,v 2.268 2016/02/05 19:59:14 roberto Exp $
+** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -193,16 +193,9 @@ void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val,
 }
 
 
-/*
-** Finish a table assignment 't[key] = val'.
-** If 'slot' is NULL, 't' is not a table.  Otherwise, 'slot' points
-** to the entry 't[key]', or to 'luaO_nilobject' if there is no such
-** entry.  (The value at 'slot' must be nil, otherwise 'luaV_fastset'
-** would have done the job.)
-*/
-void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
-                     StkId val, const TValue *slot) {
-  int loop;  /* counter to avoid infinite loops */
+void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
+  int loop;
+  TValue temp;
   for (loop = 0; loop < MAXTAGLOOP; loop++) {
     const TValue *tm;  /* '__newindex' metamethod */
     if (slot != NULL) {  /* is 't' a table? */
@@ -229,10 +222,9 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
       luaT_callTM(L, tm, t, key, val, 0);
       return;
     }
-    t = tm;  /* else repeat assignment over 'tm' */
-    if (luaV_fastset(L, t, key, slot, luaH_get, val))
-      return;  /* done */
-    /* else loop */
+    /* else repeat with `tm' */
+    setobj(L, &temp, tm);  /* avoid pointing inside table (may rehash) */
+    t = &temp;
   }
   luaG_runerror(L, "'__newindex' chain too long; possible loop");
 }