From: John L. <jr...@us...> - 2006-12-07 22:05:59
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11065/wxLua/samples Modified Files: editor.wx.lua unittest.wx.lua Log Message: cleanup arg processing for wxLua program to match the lua program Index: editor.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/editor.wx.lua,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** editor.wx.lua 7 Dec 2006 06:32:44 -0000 1.34 --- editor.wx.lua 7 Dec 2006 22:05:53 -0000 1.35 *************** *** 45,49 **** local ID_ATTACH_DEBUG = NewID() local ID_START_DEBUG = NewID() ! local ID_RESET = NewID() local ID_STEP = NewID() local ID_STEP_OVER = NewID() --- 45,49 ---- local ID_ATTACH_DEBUG = NewID() local ID_START_DEBUG = NewID() ! local ID_STOP_DEBUG = NewID() local ID_STEP = NewID() local ID_STEP_OVER = NewID() *************** *** 755,759 **** function LoadFile(filePath, fileName, editor) - local result = nil if not editor then editor = FindDocumentToReuse() --- 755,758 ---- *************** *** 762,784 **** editor = CreateEditor(fileName) end local handle = io.open(filePath, "rb") if handle then ! local st = handle:read("*a") handle:close() - editor:Clear() - editor:ClearAll() - editor:MarkerDeleteAll(BREAKPOINT_MARKER) - editor:MarkerDeleteAll(CURRENT_LINE_MARKER) - editor:AppendText(st) - SetupKeywords(editor, IsLuaFile(filePath)) - editor:EmptyUndoBuffer() - local id = editor:GetId() - openDocuments[id].filePath = filePath - openDocuments[id].fileName = fileName - SetDocumentModified(id, false, true) - result = editor end ! return result end --- 761,785 ---- editor = CreateEditor(fileName) end + + local file_text = "" local handle = io.open(filePath, "rb") if handle then ! file_text = handle:read("*a") handle:close() end ! editor:Clear() ! editor:ClearAll() ! editor:MarkerDeleteAll(BREAKPOINT_MARKER) ! editor:MarkerDeleteAll(CURRENT_LINE_MARKER) ! editor:AppendText(file_text) ! SetupKeywords(editor, IsLuaFile(filePath)) ! editor:EmptyUndoBuffer() ! local id = editor:GetId() ! openDocuments[id].filePath = filePath ! openDocuments[id].fileName = fileName ! SetDocumentModified(id, false, true) ! ! return editor end *************** *** 1410,1416 **** { ID_RUN, "Run\tF6", "Execute the current file" }, { ID_ATTACH_DEBUG, "Attach\tShift-F6", "Allow a client to start a debugging session" }, ! { ID_START_DEBUG, "Start Debug\tShift-F5", "Start a debugging session" }, { }, ! { ID_RESET, "Reset\tShift-F12", "Reset and end the debugging session" }, { ID_STEP, "Step\tF11", "Step into the next line" }, { ID_STEP_OVER, "Step Over\tShift-F11", "Step over the next line" }, --- 1411,1417 ---- { ID_RUN, "Run\tF6", "Execute the current file" }, { ID_ATTACH_DEBUG, "Attach\tShift-F6", "Allow a client to start a debugging session" }, ! { ID_START_DEBUG, "Start Debugging\tShift-F5", "Start a debugging session" }, { }, ! { ID_STOP_DEBUG, "Stop Debugging\tShift-F12", "Stop and end the debugging session" }, { ID_STEP, "Step\tF11", "Step into the next line" }, { ID_STEP_OVER, "Step Over\tShift-F11", "Step over the next line" }, *************** *** 1753,1757 **** end) ! frame:Connect(ID_RESET, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) for id, document in pairs(openDocuments) do --- 1754,1758 ---- end) ! frame:Connect(ID_STOP_DEBUG, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) for id, document in pairs(openDocuments) do *************** *** 1770,1776 **** ignoredFilesList = {} fIsRunning = false ! DisplayOutput("\nClient reset\n") end) ! frame:Connect(ID_RESET, wx.wxEVT_UPDATE_UI, function (event) local editor = GetEditor() --- 1771,1777 ---- ignoredFilesList = {} fIsRunning = false ! DisplayOutput("\nDebuggee client stopped.\n") end) ! frame:Connect(ID_STOP_DEBUG, wx.wxEVT_UPDATE_UI, function (event) local editor = GetEditor() *************** *** 1999,2003 **** for index = 1, #arg do fileName = arg[index] ! LoadFile(fileName, fileName) end --- 2000,2006 ---- for index = 1, #arg do fileName = arg[index] ! if fileName ~= "--" then ! LoadFile(fileName, wx.wxFileName(fileName):GetFullName()) ! end end Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** unittest.wx.lua 15 May 2006 04:48:38 -0000 1.4 --- unittest.wx.lua 7 Dec 2006 22:05:53 -0000 1.5 *************** *** 28,32 **** print(string.format("Program arg count %d", #arg)) ! for n = start_n, 10000 do if arg[n] then print(string.format("Program arg #%2d of %2d '%s'", n, #arg, arg[n])) --- 28,32 ---- print(string.format("Program arg count %d", #arg)) ! for n = start_n, #arg do if arg[n] then print(string.format("Program arg #%2d of %2d '%s'", n, #arg, arg[n])) |