#
# patch "ChangeLog"
# from [19887a23ee7b025a576acb24e651a03890dd3ce0]
# to [e261217ecb9f380f65ab4569ec5ed18b67cdcf95]
#
# patch "lua.cc"
# from [8ce1c41f34fb0b52d6b4ba1646f5ed782835cc03]
# to [51659bca46465ce818dc3ed0adf1a81568c64cf3]
#
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,11 @@
2005-05-09 Matthew Gregan
+ * lua.cc (loadstring, run_string): New parameter to identify the
+ source of the Lua string being loaded.
+ (add_{std,test}_hooks, load_rcfile): Pass an identity through.
+
+2005-05-09 Matthew Gregan
+
* monotone.cc: Absolutify and tilde expand pid file.
2005-05-09 Matthew Gregan
--- lua.cc
+++ lua.cc
@@ -498,11 +498,11 @@
return *this;
}
- Lua & loadstring(string const & str)
+ Lua & loadstring(string const & str, string const & identity)
{
if (!failed)
{
- if (luaL_loadbuffer(st, str.c_str(), str.size(), ""))
+ if (luaL_loadbuffer(st, str.c_str(), str.size(), identity.c_str()))
{
report_error();
}
@@ -526,12 +526,12 @@
std::set Lua::missing_functions;
static bool
-run_string(lua_State * st, string const &str)
+run_string(lua_State * st, string const &str, string const & identity)
{
I(st);
return
Lua(st)
- .loadstring(str)
+ .loadstring(str, identity)
.call(0,1)
.ok();
}
@@ -552,7 +552,7 @@
void
lua_hooks::add_test_hooks()
{
- if (!run_string(st, test_hooks_constant))
+ if (!run_string(st, test_hooks_constant, string("")))
throw oops("lua error while setting up testing hooks");
}
#endif
@@ -560,7 +560,7 @@
void
lua_hooks::add_std_hooks()
{
- if (!run_string(st, std_hooks_constant))
+ if (!run_string(st, std_hooks_constant, string("")))
throw oops("lua error while setting up standard hooks");
}
@@ -584,7 +584,7 @@
data dat;
L(F("opening rcfile '%s' ...\n") % rc);
read_data_for_command_line(rc, dat);
- N(run_string(st, dat()),
+ N(run_string(st, dat(), rc().c_str()),
F("lua error while loading rcfile '%s'") % rc);
L(F("'%s' is ok\n") % rc);
}