From: John L. <jr...@us...> - 2006-05-15 04:48:41
|
Update of /cvsroot/wxlua/wxLua/apps/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3872/wxLua/apps/wxlua/src Modified Files: Makefile editor.h lconsole.cpp lconsole.h wxlua.cpp wxlua.h Log Message: cleanup the app wxlua editor, don't try to run all the notebook pages at once make lconsole available for app wxLua use wxCmdLineParser in app wxlua push full args in app wxlua fix splittree to scroll child for generic treectrl in 2.6.3 Index: editor.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/editor.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** editor.h 23 Apr 2006 19:36:48 -0000 1.12 --- editor.h 15 May 2006 04:48:37 -0000 1.13 *************** *** 9,14 **** extern const unsigned char wxLuaEditor[]; ! const size_t wxLuaEditor_len = 80266; ! const unsigned char wxLuaEditor[80267] = { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 61, 45, 45, 45, 10, 45, 45, 32, 78, 97,109,101, 58, 32, 32, 32, 32, 32, 32, 32, 32, 69,100,105,116,111,114, 46,119,120, 46,108,117, 97, 10, --- 9,14 ---- extern const unsigned char wxLuaEditor[]; ! const size_t wxLuaEditor_len = 77502; [...2181 lines suppressed...] ! 10, ! 105,102, 32, 97,114,103, 32,116,104,101,110, 10, ! 32, 32, 32, 32, 45, 45, 32, 97,114,103,117,109,101,110,116,115, 32,112,117,115,104,101,100, 32,105,110,116,111, 32,119,120, 76,117, 97, 32, 97,114,101, 32, 91, 67, 43, 43, 32, 97,112,112, 93, 91,108,117, 97, 32,112,114,111,103, 93, 91, 97,114,103,115, 32,102,111,114, 32,108,117, 97, 32,115,116, 97,114,116, 32, 97,116, 32, 49, 93, 10, ! 32, 32, 32, 32,108,111, 99, 97,108, 32,110, 32, 61, 32, 48, 10, ! 32, 32, 32, 32,119,104,105,108,101, 32, 49, 32,100,111, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32,110,111,116, 32, 97,114,103, 91,110, 93, 32,116,104,101,110, 32, 98,114,101, 97,107, 32,101,110,100, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,105,102, 32, 97,114,103, 91,110, 93, 32, 97,110,100, 32,110,111,116, 32, 97,114,103, 91,110, 45, 49, 93, 32,116,104,101,110, 32,112,114,111,103,114, 97,109, 78, 97,109,101, 32, 61, 32, 97,114,103, 91,110, 93, 32,101,110,100, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,110, 32, 61, 32,110, 32, 45, 32, 49, 10, 32, 32, 32, 32,101,110,100, 10, ! 10, ! 32, 32, 32, 32,102,111,114, 32,105,110,100,101,120, 32, 61, 32, 49, 44, 32, 35, 97,114,103, 32,100,111, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,102,105,108,101, 78, 97,109,101, 32, 61, 32, 97,114,103, 91,105,110,100,101,120, 93, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,108,111, 97,100, 70,105,108,101, 40,102,105,108,101, 78, 97,109,101, 44, 32,102,105,108,101, 78, 97,109,101, 41, 10, ! 32, 32, 32, 32,101,110,100, 10, ! 10, ! 32, 32, 32, 32,105,102, 32,110,111,116,101, 98,111,111,107, 58, 71,101,116, 80, 97,103,101, 67,111,117,110,116, 40, 41, 32, 62, 32, 48, 32,116,104,101,110, 10, ! 32, 32, 32, 32, 32, 32, 32, 32,110,111,116,101, 98,111,111,107, 58, 83,101,116, 83,101,108,101, 99,116,105,111,110, 40, 48, 41, 10, ! 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,101,100,105,116,111,114, 32, 61, 32, 99,114,101, 97,116,101, 69,100,105,116,111,114, 40, 34, 85,110,116,105,116,108,101,100, 34, 41, 10, 32, 32, 32, 32, 32, 32, 32,115,101,116,117,112, 75,101,121,119,111,114,100,115, 40,101,100,105,116,111,114, 44, 32, 49, 41, 10, Index: lconsole.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/lconsole.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lconsole.h 1 Mar 2006 05:25:52 -0000 1.4 --- lconsole.h 15 May 2006 04:48:37 -0000 1.5 *************** *** 33,37 **** void OnSizeWindow(wxSizeEvent& event); ! void OnEraseBackground(wxEraseEvent& event); DECLARE_EVENT_TABLE() --- 33,37 ---- void OnSizeWindow(wxSizeEvent& event); ! void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) {} DECLARE_EVENT_TABLE() *************** *** 50,54 **** private: void OnCloseWindow(wxCloseEvent& event); ! void OnEraseBackground(wxEraseEvent& event); void FillListbox(); --- 50,54 ---- private: void OnCloseWindow(wxCloseEvent& event); ! void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) {} void FillListbox(); Index: Makefile =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/Makefile,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Makefile 13 May 2006 21:05:35 -0000 1.16 --- Makefile 15 May 2006 04:48:37 -0000 1.17 *************** *** 56,60 **** APPEXTRALIBS=-L$(WXLIB_DIR) -L$(WXLUA_LIBDIR) -l$(WXSTC_LIB) -l$(WXXRC_LIB) -l$(WXLUABIND_LIB) -l$(WXLUASTC_LIB) -l$(WXLUA_LIB) -l$(WXLUADEBUG_LIB) -l$(WXLUASOCKET_LIB) $(LUA_LIBS) ! OBJECTS=wxlua.o DEPFILES=$(OBJECTS:.o=.d) --- 56,60 ---- APPEXTRALIBS=-L$(WXLIB_DIR) -L$(WXLUA_LIBDIR) -l$(WXSTC_LIB) -l$(WXXRC_LIB) -l$(WXLUABIND_LIB) -l$(WXLUASTC_LIB) -l$(WXLUA_LIB) -l$(WXLUADEBUG_LIB) -l$(WXLUASOCKET_LIB) $(LUA_LIBS) ! OBJECTS=wxlua.o lconsole.o DEPFILES=$(OBJECTS:.o=.d) Index: wxlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/wxlua.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** wxlua.cpp 14 May 2006 01:49:10 -0000 1.30 --- wxlua.cpp 15 May 2006 04:48:37 -0000 1.31 *************** *** 31,41 **** #include "wxlua/include/internal.h" #include "wxluasocket/include/wxldserv.h" #include "wxlua.h" - #if wxCHECK_VERSION(2, 3, 0) - #include "wxluadebug/include/splttree.h" - #include "wxluadebug/include/staktree.h" - #endif // wxCHECK_VERSION(2, 3, 0) - #include "art/wxluasmall.xpm" --- 31,38 ---- #include "wxlua/include/internal.h" #include "wxluasocket/include/wxldserv.h" + #include "wxluasocket/include/wxlhandl.h" + #include "wxluadebug/include/staktree.h" #include "wxlua.h" #include "art/wxluasmall.xpm" *************** *** 56,60 **** int LUACALL wxLua_lua_stackDialog(lua_State *L) { - #if wxCHECK_VERSION(2, 3, 0) wxLuaInterface* li = new wxLuaInterface(L); wxLuaStackDialog *pStackDialog = new wxLuaStackDialog(NULL, --- 53,56 ---- *************** *** 67,71 **** wxGetApp().SetStackDialog(NULL); pStackDialog->Destroy(); ! #endif // wxCHECK_VERSION(2, 3, 0) return 0; } --- 63,67 ---- wxGetApp().SetStackDialog(NULL); pStackDialog->Destroy(); ! return 0; } *************** *** 112,115 **** --- 108,138 ---- // --------------------------------------------------------------------------- + static const wxCmdLineEntryDesc cmdLineDesc[] = + { + { wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), wxT("help on command line switches"), + wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_OPTION_HELP }, + + { wxCMD_LINE_SWITCH, wxT("c"), wxT("console"), wxT("show message console"), + wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, + + { wxCMD_LINE_OPTION, wxT("d"), wxT("debuggee"), wxT("run as debuggee, internal use"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + + { wxCMD_LINE_OPTION, wxT("e"), wxT("edit"), wxT("open file(s) to edit"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE|wxCMD_LINE_NEEDS_SEPARATOR }, + + { wxCMD_LINE_OPTION, wxT("r"), wxT("run"), wxT("run wxLua program w/ command line args"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_NEEDS_SEPARATOR }, + + { wxCMD_LINE_PARAM, wxT(""), wxT(""), wxT("run wxLua program w/ command line args"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE }, + + { wxCMD_LINE_NONE } + }; + + // --------------------------------------------------------------------------- + // wxLuaStandaloneApp + // --------------------------------------------------------------------------- + IMPLEMENT_APP(wxLuaStandaloneApp) *************** *** 118,124 **** EVT_LUA_ERROR (wxID_ANY, wxLuaStandaloneApp::OnLua) EVT_LUA_DEBUG_HOOK (wxID_ANY, wxLuaStandaloneApp::OnLua) ! EVT_WXLUA_DEBUG_STACK_ENUM(wxLuaStandaloneApp::OnDebugStackEnum) EVT_WXLUA_DEBUG_STACK_ENTRY_ENUM(wxLuaStandaloneApp::OnDebugStackEntryEnum) ! EVT_WXLUA_DEBUG_TABLE_ENUM(wxLuaStandaloneApp::OnDebugTableEnum) END_EVENT_TABLE() --- 141,148 ---- EVT_LUA_ERROR (wxID_ANY, wxLuaStandaloneApp::OnLua) EVT_LUA_DEBUG_HOOK (wxID_ANY, wxLuaStandaloneApp::OnLua) ! ! EVT_WXLUA_DEBUG_STACK_ENUM( wxLuaStandaloneApp::OnDebugStackEnum) EVT_WXLUA_DEBUG_STACK_ENTRY_ENUM(wxLuaStandaloneApp::OnDebugStackEntryEnum) ! EVT_WXLUA_DEBUG_TABLE_ENUM( wxLuaStandaloneApp::OnDebugTableEnum) END_EVENT_TABLE() *************** *** 143,154 **** m_fMemoryBitmapAdded = false; - #if wxCHECK_VERSION(2, 3, 0) m_pDebugTarget = NULL; ! #endif // wxCHECK_VERSION(2, 3, 0) ! #ifdef __WXMSW__ m_pConsole = NULL; - #endif // __WXMSW__ wxInitAllImageHandlers(); #ifdef __WXGTK__ --- 167,178 ---- m_fMemoryBitmapAdded = false; m_pDebugTarget = NULL; ! m_pConsole = NULL; wxInitAllImageHandlers(); + wxFileSystem::AddHandler(new wxMemoryFSHandler); + wxMemoryFSHandler::AddFile(wxT("wxLua"), wxBitmap(wxLuaSmall_xpm), wxBITMAP_TYPE_XPM); + m_fMemoryBitmapAdded = true; #ifdef __WXGTK__ *************** *** 175,344 **** m_luaHandler = new LuaHandler(this); ! // add our wxLuaStackDialog and some bitmaps for people to use m_wxlState.RegisterFunction(wxLua_lua_stackDialog, "wxLuaStackDialog"); ! if (argc == 1) ! { ! CreateSimpleArgs(); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! } ! else ! // If there is only one command line argument ! #if wxCHECK_VERSION(2, 3, 0) || defined(__WXMSW__) ! if (argc == 2 && (*argv[1] == wxT('-'))) { ! #if wxCHECK_VERSION(2, 3, 0) ! // Check if we are launched as a debuggee ! if (wxStrlen(argv[1]) > 2 && (argv[1][1] == wxT('d'))) { ! // Set up for debugging ! wxChar *serverPtr = argv[1] + 2; ! wxChar *portPtr = wxStrrchr(serverPtr, wxT(':')); ! ! if (portPtr != NULL) ! { ! *portPtr = 0; ! int portNumber = wxAtoi(portPtr + 1); ! ! m_pDebugTarget = new wxLuaDebugTarget(L, ! serverPtr, ! portNumber); ! if (m_pDebugTarget != NULL) ! return m_pDebugTarget->Run(); ! } return false; } ! #endif // wxCHECK_VERSION(2, 3, 0) ! #ifdef __WXMSW__ ! // Check if we are to display the console ! if ((wxStrlen(argv[1]) == 2) && (argv[1][1] == wxT('c'))) { ! wxLuaConsole *pConsole = new wxLuaConsole(this, m_wxlState); ! if (pConsole != NULL) ! pConsole->Show(true); ! CreateSimpleArgs(); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! } ! else ! #endif // __WXMSW__ ! // See if a file has been specified that we are to edit ! if ((wxStrlen(argv[1]) > 2) && (argv[1][1] == wxT('e'))) ! { ! wxString fileName = argv[1] + 2; ! lua_newtable(L); ! lua_pushstring(L, wx2lua(fileName)); ! lua_rawseti(L, -2, 1); ! lua_pushstring(L, wx2lua(m_programName)); ! lua_rawseti(L, -2, 0); ! lua_setglobal(L, "args"); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! } ! else ! // Otherwise just run the file ! { ! CreateSimpleArgs(); ! int rc = m_wxlState.RunFile(argv[1]); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! } ! } ! else ! #endif // wxCHECK_VERSION(2, 3, 0) || defined(__WXMSW__) ! // execute the program using argc, argv; ! for (int idx = 1; idx < argc; ++idx) ! { ! #ifdef __WXMSW__ ! if ((m_pConsole == NULL) && (wxStrlen(argv[idx]) == 2) && (argv[idx][0] == wxT('-')) && (argv[idx][1] == wxT('c'))) ! { ! wxLuaConsole *pConsole = new wxLuaConsole(this, m_wxlState); ! if (pConsole != NULL) ! pConsole->Show(true); ! } ! else ! #endif // __WXMSW__ ! // See if we are to run the specified file with command-line arguments. ! if ((wxStrlen(argv[idx]) > 2) && (argv[idx][0] == wxT('-')) && (argv[idx][1] == wxT('f'))) ! { ! wxString fileName = argv[idx] + 2; ! lua_newtable(L); ! // accumulate the arguments into the 'args' table ! for (++idx; idx < argc; ++idx) ! { ! lua_pushstring(L, wx2lua(argv[idx])); ! lua_rawseti(L, -2, ++argCount); } ! lua_pushstring(L, wx2lua(fileName)); ! lua_rawseti(L, -2, 0); ! ! lua_setglobal(L, "args"); ! ! int rc = m_wxlState.RunFile(fileName); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! break; ! } ! else ! // See if a file has been specified that we are to edit ! if ((wxStrlen(argv[idx]) > 2) && (argv[idx][0] == wxT('-')) && (argv[idx][1] == wxT('e'))) ! { ! wxString fileName = argv[idx] + 2; ! lua_newtable(L); ! lua_pushstring(L, wx2lua(fileName)); ! lua_rawseti(L, -2, 1); ! lua_pushstring(L, wx2lua(m_programName)); ! lua_rawseti(L, -2, 0); ! lua_setglobal(L, "args"); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); break; } ! else { ! CreateSimpleArgs(); ! int rc = m_wxlState.RunFile(argv[idx]); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); } } - #ifdef __WXMSW__ return (m_pConsole != NULL) || fOk; - #else - return fOk; - #endif // __WXMSW__ } int wxLuaStandaloneApp::OnExit() { - #if wxCHECK_VERSION(2, 3, 0) // If acting as a debuggee, we're done - disconnect from the debugger. if (m_pDebugTarget != NULL) --- 199,301 ---- m_luaHandler = new LuaHandler(this); ! // add our wxLuaStackDialog function m_wxlState.RegisterFunction(wxLua_lua_stackDialog, "wxLuaStackDialog"); ! wxCmdLineParser parser(cmdLineDesc, argc, argv); ! switch ( parser.Parse() ) { ! case -1 : { ! // help should be given by the wxCmdLineParser, exit program return false; } ! case 0: { ! argCount = 0; ! wxString value; ! if (parser.Found(wxT("d"), &value)) ! { ! // wxLuaDebugServer::StartClient() runs wxExecute(m_programName -d[host]:[port], ...) ! // Set up for debugging ! wxString serverName(value.BeforeFirst(wxT(':'))); ! long portNumber = 0; ! if (value.AfterFirst(wxT(':')).ToLong(&portNumber)) ! { ! m_pDebugTarget = new wxLuaDebugTarget(L, serverName, (int)portNumber); ! if (m_pDebugTarget != NULL) ! return m_pDebugTarget->Run(); ! } ! return false; ! } ! // Check if we are to display the console ! if (parser.Found(wxT("c"))) ! { ! argCount++; ! wxLuaConsole *pConsole = new wxLuaConsole(this, m_wxlState); ! if (pConsole != NULL) ! pConsole->Show(true); ! } ! // See if a file has been specified that we are to edit ! if (parser.Found(wxT("e"), &value)) ! { ! argCount++; ! wxString fileName = value; ! PushArgs(argv, argc, argCount); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! break; } ! if (parser.GetParamCount() == 0) ! { ! PushArgs(argv, argc, argCount); ! int rc = RunEditor(); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! break; ! } ! // See if we are to run the specified file with command-line arguments. ! //if (parser.Found(wxT("r"), &value)) ! { ! argCount++; // skip the program we're running ! wxString fileName = parser.GetParam(0); // already handled 0 params ! PushArgs(argv, argc, argCount); ! int rc = m_wxlState.RunFile(fileName); ! fOk = wxLuaState::CheckRunError(rc, &errorStr); ! if (!fOk) ! DisplayError(errorStr); ! break; ! } break; } ! default: { ! wxLogMessage(wxT("Unknown command line option, aborting.")); ! return false; } } return (m_pConsole != NULL) || fOk; } int wxLuaStandaloneApp::OnExit() { // If acting as a debuggee, we're done - disconnect from the debugger. if (m_pDebugTarget != NULL) *************** *** 348,352 **** m_pDebugTarget = NULL; } - #endif // wxCHECK_VERSION(2, 3, 0) if (m_fMemoryBitmapAdded) --- 305,308 ---- *************** *** 372,382 **** if (event.GetEventType() == wxEVT_LUA_PRINT) { - #ifdef __WXMSW__ if (m_pConsole != NULL) m_pConsole->DisplayText(event.GetString()); else wxMessageBox(event.GetString(), wxT("wxLua")); #else ! wxPrintf(wxT("%s\n"), event.GetString().c_str()); #endif // __WXMSW__ } --- 328,338 ---- if (event.GetEventType() == wxEVT_LUA_PRINT) { if (m_pConsole != NULL) m_pConsole->DisplayText(event.GetString()); else + #ifdef __WXMSW__ wxMessageBox(event.GetString(), wxT("wxLua")); #else ! fprintf(stderr, wx2lua(event.GetString() + wxT("\n"))); #endif // __WXMSW__ } *************** *** 391,398 **** int wxLuaStandaloneApp::RunEditor() { - wxFileSystem::AddHandler(new wxMemoryFSHandler); - wxMemoryFSHandler::AddFile(wxT("wxLua"), wxBitmap(wxLuaSmall_xpm), wxBITMAP_TYPE_XPM); - m_fMemoryBitmapAdded = true; - return m_wxlState.RunBuffer(wxLuaEditor, wxLuaEditor_len, m_programName); } --- 347,350 ---- *************** *** 404,415 **** else { - #ifdef __WXMSW__ if (m_pConsole != NULL) m_pConsole->DisplayText(errorStr, true); else wxMessageBox(errorStr, wxT("wxLua")); #else ! fprintf(stderr, wx2lua(errorStr)); #endif // __WXMSW__ } } --- 356,368 ---- else { if (m_pConsole != NULL) m_pConsole->DisplayText(errorStr, true); else + #ifdef __WXMSW__ wxMessageBox(errorStr, wxT("wxLua")); #else ! fprintf(stderr, wx2lua(errorStr + wxT("\n"))); #endif // __WXMSW__ + } } *************** *** 421,425 **** lua_pushstring(L, wx2lua(m_programName)); lua_rawseti(L, -2, 0); ! lua_setglobal(L, "args"); } --- 374,414 ---- lua_pushstring(L, wx2lua(m_programName)); lua_rawseti(L, -2, 0); ! lua_setglobal(L, "arg"); ! } ! ! // Push the program args into lua, see lua.c function ! // static int getargs (lua_State *L, char **argv, int n) ! int wxLuaStandaloneApp::PushArgs(wxChar **argv, int argc, int start_n) ! { ! lua_State* L = m_wxlState.GetLuaState(); ! ! int i = 0; ! int narg = argc - (start_n + 1); // number of arguments to the script ! if (narg < 1) ! { ! // no real args, just stick in the name of this program ! lua_newtable(L); ! lua_pushstring(L, wx2lua(m_programName)); ! lua_rawseti(L, -2, 0); ! lua_setglobal(L, "arg"); ! ! return narg; ! } ! ! luaL_checkstack(L, narg + 3, "too many arguments to script"); ! for (i = start_n+1; i < argc; i++) ! lua_pushstring(L, wx2lua(argv[i])); ! ! lua_createtable(L, narg, start_n + 1); ! ! for (i = 0; i < argc; i++) ! { ! lua_pushstring(L, wx2lua(argv[i])); ! lua_rawseti(L, -2, i - start_n); ! } ! ! lua_setglobal(L, "arg"); ! ! return narg; } Index: wxlua.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/wxlua.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wxlua.h 8 Mar 2006 02:46:37 -0000 1.15 --- wxlua.h 15 May 2006 04:48:37 -0000 1.16 *************** *** 17,34 **** #endif ! #include "wxluasocket/include/wxlhandl.h" ! ! #ifdef __WXMSW__ ! #include "lconsole.h" ! #endif ! ! #if wxCHECK_VERSION(2, 3, 0) ! #include "wxluasocket/include/wxldtarg.h" ! #endif ! #include "wx/app.h" class WXDLLIMPEXP_WXLUA wxLuaEvent; class LuaHandler; // ---------------------------------------------------------------------------- --- 17,28 ---- #endif ! #include "lconsole.h" ! #include "wxluasocket/include/wxldtarg.h" #include "wx/app.h" class WXDLLIMPEXP_WXLUA wxLuaEvent; class LuaHandler; + class WXDLLIMPEXP_WXLUA wxLuaStackDialog; + class WXDLLIMPEXP_WXLUA wxLuaDebugEvent; // ---------------------------------------------------------------------------- *************** *** 45,51 **** // set the lua console - #ifdef __WXMSW__ void SetLuaConsole(wxLuaConsole *pConsole) { m_pConsole = pConsole; } - #endif // __WXMSW__ void SetStackDialog(wxLuaStackDialog *pStackDialog) { m_pStackDialog = pStackDialog; } --- 39,43 ---- *************** *** 54,59 **** int RunEditor(); - private: void CreateSimpleArgs(); void OnDebugStackEnum(wxLuaDebugEvent &event); --- 46,51 ---- int RunEditor(); void CreateSimpleArgs(); + int PushArgs(wxChar **argv, int argc, int start_n); void OnDebugStackEnum(wxLuaDebugEvent &event); *************** *** 65,76 **** LuaHandler *m_luaHandler; wxLuaState m_wxlState; - #ifdef __WXMSW__ wxLuaConsole *m_pConsole; - #endif // __WXMSW__ bool m_fMemoryBitmapAdded; - #if wxCHECK_VERSION(2, 3, 0) wxLuaDebugTarget *m_pDebugTarget; - #endif // wxCHECK_VERSION(2, 3, 0) DECLARE_EVENT_TABLE(); }; --- 57,66 ---- LuaHandler *m_luaHandler; wxLuaState m_wxlState; wxLuaConsole *m_pConsole; bool m_fMemoryBitmapAdded; wxLuaDebugTarget *m_pDebugTarget; + + private: DECLARE_EVENT_TABLE(); }; Index: lconsole.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxlua/src/lconsole.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** lconsole.cpp 7 Mar 2006 11:53:42 -0000 1.9 --- lconsole.cpp 15 May 2006 04:48:37 -0000 1.10 *************** *** 46,55 **** { m_wxlState = wxlState; ! m_listBox = new wxListBox( this, ! wxID_ANY, ! wxPoint(0, 20), ! wxSize(0, 130), ! 0, NULL, ! wxLB_SINGLE); } --- 46,51 ---- { m_wxlState = wxlState; ! m_listBox = new wxListBox( this, wxID_ANY, wxPoint(0, 20), wxSize(0, 130), ! 0, NULL, wxLB_SINGLE); } *************** *** 103,110 **** } - void wxLuaDebugPanel::OnEraseBackground(wxEraseEvent& WXUNUSED(event)) - { - } - // ---------------------------------------------------------------------------- // wxLuaConsole --- 99,102 ---- *************** *** 117,139 **** wxLuaConsole::wxLuaConsole(wxLuaStandaloneApp *pApp, const wxLuaState& wxlState) ! : wxFrame(0, wxID_ANY, wxT("wxLua Console"), wxPoint(0, 0), wxSize(250, 340)), m_pApp(pApp), m_fError(false) { - #ifdef __WXMSW__ - pApp->SetLuaConsole(this); - #endif - SetIcon(wxICON(LUA)); ! m_splitter = new wxSplitterWindow(this, ! wxID_ANY, ! wxPoint(0, 0), ! wxSize(0, 0), ! wxSP_3DSASH); ! m_textCtrl = new wxTextCtrl( m_splitter, ! wxID_ANY, ! wxT(""), ! wxPoint(0, 0), ! wxSize(0, 0), wxTE_MULTILINE | wxTE_READONLY #ifdef __WXMSW__ --- 109,121 ---- wxLuaConsole::wxLuaConsole(wxLuaStandaloneApp *pApp, const wxLuaState& wxlState) ! : wxFrame(0, wxID_ANY, wxT("wxLua Console"), wxDefaultPosition, wxSize(250, 340)), m_pApp(pApp), m_fError(false) { SetIcon(wxICON(LUA)); ! m_splitter = new wxSplitterWindow(this, wxID_ANY, ! wxPoint(0, 0), wxSize(0, 0), wxSP_3DSASH); ! m_textCtrl = new wxTextCtrl( m_splitter, wxID_ANY, wxT(""), ! wxPoint(0, 0), wxSize(0, 0), wxTE_MULTILINE | wxTE_READONLY #ifdef __WXMSW__ *************** *** 144,158 **** m_splitter->SplitHorizontally( m_textCtrl, m_panel, 150); m_splitter->SetMinimumPaneSize(50); - } ! void wxLuaConsole::OnEraseBackground(wxEraseEvent& WXUNUSED(event)) ! { } void wxLuaConsole::OnCloseWindow(wxCloseEvent&) { - #ifdef __WXMSW__ m_pApp->SetLuaConsole(NULL); ! #endif Destroy(); if (m_fError) --- 126,137 ---- m_splitter->SplitHorizontally( m_textCtrl, m_panel, 150); m_splitter->SetMinimumPaneSize(50); ! pApp->SetLuaConsole(this); } void wxLuaConsole::OnCloseWindow(wxCloseEvent&) { m_pApp->SetLuaConsole(NULL); ! Destroy(); if (m_fError) |