monotone-commits-diffs
[Top][All Lists]
Advanced

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

[Monotone-commits-diffs] net.venge.monotone.lua-5.2: 9e4cd89b1531fa6fafd


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.lua-5.2: 9e4cd89b1531fa6fafdc8d6a0ff5a58f9e432842
Date: Wed, 25 Apr 2012 14:54:55 +0200 (CEST)

revision:            9e4cd89b1531fa6fafdc8d6a0ff5a58f9e432842
date:                2012-04-25T12:54:28
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone.lua-5.2
changelog:
* src/lua.cc, src/luaext_parse_basic_io.cc, src/luaext_platform.cc: Make
  changes so we can still build against Lua 5.1.

manifest:
format_version "1"

new_manifest [b4e20477d007e6aa9f14ce3e671d599c75cd3a2a]

old_revision [28d1b2065efae738627537c1a035286861a7a258]

patch "src/lua.cc"
 from [52eed5f74bd6a2e6ba8e431ceeb230b49971d1c7]
   to [6787dcbd552c2c8772e511dcd12b8f682868c0b3]

patch "src/luaext_parse_basic_io.cc"
 from [ae840132e7608cdc4423abafb69c7e78fb8e1f6e]
   to [f7a89950b6355b57d24ccf12331c7e2beae686bd]

patch "src/luaext_platform.cc"
 from [288a571d7c91fbb4abffb66611b52aac74889aa2]
   to [135278a8a971333575a0d8c92ed5d93262723cc7]
============================================================
--- src/lua.cc	52eed5f74bd6a2e6ba8e431ceeb230b49971d1c7
+++ src/lua.cc	6787dcbd552c2c8772e511dcd12b8f682868c0b3
@@ -44,7 +44,11 @@ dump_stack(lua_State * st)
     switch (t) {
     case LUA_TSTRING:  /* strings */
       out += '`';
+#ifdef lua_strlen
       out += string(lua_tostring(st, i), lua_strlen(st, i));
+#else
+      out += string(lua_tostring(st, i), lua_rawlen(st, i));
+#endif
       out += '\'';
       break;
 
@@ -95,7 +99,11 @@ Lua::report_error()
 Lua::report_error()
 {
 //  I(lua_isstring(st, -1));
+#ifdef lua_strlen
   string err = string(lua_tostring(st, -1), lua_strlen(st, -1));
+#else
+  string err = string(lua_tostring(st, -1), lua_rawlen(st, -1));
+#endif
   W(i18n_format("%s") % err);
   L(FL("lua stack: %s") % dump_stack(st));
   lua_pop(st, 1);
@@ -107,7 +115,11 @@ Lua::check_stack(int count)
 {
   if (!lua_checkstack(st, count))
     {
+#ifdef LUAI_MAXCSTACK
       fail((FL("lua stack limit '%d' reached") % LUAI_MAXCSTACK).str());
+#else
+      fail((FL("lua stack limit '%d' reached") % LUAI_MAXSTACK).str());
+#endif
       return false;
     }
   return true;
@@ -138,7 +150,7 @@ Lua::get(int idx)
       string name;
       extract_str(name);
       pop();
-      lua_getglobal(st, name.c_str);
+      lua_getglobal(st, name.c_str());
     }
   return *this;
 }
@@ -204,7 +216,11 @@ Lua::extract_str_nolog(string & str)
       fail("isstring() in extract_str");
       return *this;
     }
+#ifdef lua_strlen
   str = string(lua_tostring(st, -1), lua_strlen(st, -1));
+#else
+  str = string(lua_tostring(st, -1), lua_rawlen(st, -1));
+#endif
   return *this;
 }
 
============================================================
--- src/luaext_parse_basic_io.cc	ae840132e7608cdc4423abafb69c7e78fb8e1f6e
+++ src/luaext_parse_basic_io.cc	f7a89950b6355b57d24ccf12331c7e2beae686bd
@@ -23,7 +23,11 @@ LUAEXT(parse_basic_io, )
   // followed by one or more string or hex values. It returns a table of
   // lines.
   vector<pair<string, vector<string> > > res;
+#ifdef lua_strlen
+  const string str(luaL_checkstring(LS, -1), lua_strlen(LS, -1));
+#else
   const string str(luaL_checkstring(LS, -1), lua_rawlen(LS, -1));
+#endif
   basic_io::input_source in(str, "monotone_parse_basic_io_for_lua");
   in.made_from = origin::user;
   basic_io::tokenizer tok(in);
============================================================
--- src/luaext_platform.cc	288a571d7c91fbb4abffb66611b52aac74889aa2
+++ src/luaext_platform.cc	135278a8a971333575a0d8c92ed5d93262723cc7
@@ -118,7 +118,10 @@ static FILE **newfile (lua_State *LS) {
   lua_setmetatable(LS, -2);
 
   lua_pushcfunction(LS, io_fclose);
+#ifdef LUA_ENVIRONINDEX
+  // Lua 5.2 removes C function environments
   lua_setfield(LS, LUA_ENVIRONINDEX, "__close");
+#endif
 
   return pf;
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]