From: <ste...@us...> - 2012-12-28 01:55:12
|
Revision: 3255 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3255&view=rev Author: stef145g Date: 2012-12-28 01:55:05 +0000 (Fri, 28 Dec 2012) Log Message: ----------- Removing code relocated to lua_interface Modified Paths: -------------- trunk/mmex/src/util.cpp trunk/mmex/src/util.h Modified: trunk/mmex/src/util.cpp =================================================================== --- trunk/mmex/src/util.cpp 2012-12-28 01:42:49 UTC (rev 3254) +++ trunk/mmex/src/util.cpp 2012-12-28 01:55:05 UTC (rev 3255) @@ -1065,73 +1065,3 @@ wxMessageDialog msgDlg(parent, msg, _("Currency rate updated")); msgDlg.ShowModal(); } - -wxString lua2cppReportErrors(lua_State *L, int status) -{ - if ( status != 0 ) - { - wxString e = wxString::Format(_("Error: %s\n"), wxString::FromUTF8(lua_tostring(L, -1)).c_str()); - lua_pop(L, 1); // remove error message - return e; - } - return wxT(""); -} - -int cpp2luaGetTranslation(lua_State *L) -{ - wxString data = wxString::FromUTF8(lua_tostring(L, -1)); - data = wxGetTranslation(data); - lua_pushstring(L, data.ToUTF8()); - - return 1; -} - -int cpp2luaGetTextFromUser(lua_State *L) -{ - wxString value = wxString::FromUTF8(lua_tostring(L, -1)); - lua_pop(L, 1); // remove error message - wxString header = wxString::FromUTF8(lua_tostring(L, -1)); - lua_pop(L, 1); // remove error message - wxString message = wxString::FromUTF8(lua_tostring(L, -1)); - lua_pop(L, 1); // remove error message - value = wxGetTextFromUser(message, header, value); - lua_pushstring(L, value.ToUTF8()); - - return 1; -} - -int lua2cppGetString(wxString sInput, wxString& sOutput, wxString& sError) -{ - // create new Lua state - int result; - lua_State *L; - L = luaL_newstate(); - luaopen_string(L); - luaL_openlibs(L); - - // make my_function() available to Lua programs - lua_register(L, "_", cpp2luaGetTranslation); - lua_register(L, "mmGetTextFromUser", cpp2luaGetTextFromUser); - - result = luaL_loadstring(L, sInput.ToUTF8()); - if (result) - { - sError = lua2cppReportErrors(L, result); - return result; - } - - result = lua_pcall(L, 0, LUA_MULTRET, 0); - - if (result) - { - sError = lua2cppReportErrors(L, result); - return result; - } - sOutput = wxString::FromUTF8(lua_tostring(L, -1)); - - // close the Lua state - lua_close(L); - - return result; -} - Modified: trunk/mmex/src/util.h =================================================================== --- trunk/mmex/src/util.h 2012-12-28 01:42:49 UTC (rev 3254) +++ trunk/mmex/src/util.h 2012-12-28 01:55:05 UTC (rev 3255) @@ -367,10 +367,5 @@ void windowsFreezeThaw(wxWindow* pWindow); void OnlineUpdateCurRate(wxWindow *parent, mmCoreDB* core); -//Lua functions -wxString lua2cppReportErrors(lua_State *L, int status); -int cpp2luaGetTranslation(lua_State *L); -int lua2cppGetString(wxString sInput, wxString& sOutput, wxString& sError); - #endif // _MM_EX_UTIL_H_ //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |