From b8dd945557c1a50a672a49abb44bb1205fda94f7 Mon Sep 17 00:00:00 2001 From: IdanArye Date: Sat, 24 Jan 2015 02:12:49 +0200 Subject: [PATCH] Fix #5 - Vim7.3 compatibility --- autoload/vebugger/gdb.vim | 36 ++++++++++++++++---------------- autoload/vebugger/jdb.vim | 32 ++++++++++++++--------------- autoload/vebugger/mdbg.vim | 40 ++++++++++++++++++------------------ autoload/vebugger/pdb.vim | 40 ++++++++++++++++++------------------ autoload/vebugger/rdebug.vim | 32 ++++++++++++++--------------- autoload/vebugger/std.vim | 3 ++- doc/vebugger.txt | 2 +- 7 files changed, 93 insertions(+), 92 deletions(-) diff --git a/autoload/vebugger/gdb.vim b/autoload/vebugger/gdb.vim index 716b5b9..e9985b6 100644 --- a/autoload/vebugger/gdb.vim +++ b/autoload/vebugger/gdb.vim @@ -32,16 +32,16 @@ function! vebugger#gdb#start(binaryFile,args) end - call l:debugger.addReadHandler(function('s:readProgramOutput')) - call l:debugger.addReadHandler(function('s:readWhere')) - call l:debugger.addReadHandler(function('s:readFinish')) - call l:debugger.addReadHandler(function('s:readEvaluatedExpressions')) + call l:debugger.addReadHandler(function('vebugger#gdb#_readProgramOutput')) + call l:debugger.addReadHandler(function('vebugger#gdb#_readWhere')) + call l:debugger.addReadHandler(function('vebugger#gdb#_readFinish')) + call l:debugger.addReadHandler(function('vebugger#gdb#_readEvaluatedExpressions')) - call l:debugger.setWriteHandler('std','flow',function('s:writeFlow')) - call l:debugger.setWriteHandler('std','breakpoints',function('s:writeBreakpoints')) - call l:debugger.setWriteHandler('std','closeDebugger',function('s:closeDebugger')) - call l:debugger.setWriteHandler('std','evaluateExpressions',function('s:requestEvaluateExpression')) - call l:debugger.setWriteHandler('std','executeStatements',function('s:executeStatements')) + call l:debugger.setWriteHandler('std','flow',function('vebugger#gdb#_writeFlow')) + call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#gdb#_writeBreakpoints')) + call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#gdb#_closeDebugger')) + call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#gdb#_requestEvaluateExpression')) + call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#gdb#_executeStatements')) call l:debugger.generateWriteActionsFromTemplate() @@ -62,7 +62,7 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace) return l:path endfunction -function! s:readProgramOutput(pipeName,line,readResult,debugger) +function! vebugger#gdb#_readProgramOutput(pipeName,line,readResult,debugger) if 'err'==a:pipeName \&&a:line!~'\v^[=~*&^]' \&&a:line!~'\V(gdb)' @@ -70,7 +70,7 @@ function! s:readProgramOutput(pipeName,line,readResult,debugger) endif endfunction -function! s:readWhere(pipeName,line,readResult,debugger) +function! vebugger#gdb#_readWhere(pipeName,line,readResult,debugger) if 'out'==a:pipeName "let l:matches=matchlist(a:line,'\v^\~"#(\d+)\s+(.+)\s+\(.*\)\s+at\s+([^:]+):(\d+)') let l:matches=matchlist(a:line,'\v^\*stopped.*fullname\=\"([^"]+)\",line\=\"(\d+)"') @@ -84,13 +84,13 @@ function! s:readWhere(pipeName,line,readResult,debugger) endif endfunction -function! s:readFinish(pipeName,line,readResult,debugger) +function! vebugger#gdb#_readFinish(pipeName,line,readResult,debugger) if a:line=~'\c\V\^~"[Inferior \.\*exited normally]' let a:readResult.std.programFinish={'finish':1} endif endfunction -function! s:writeFlow(writeAction,debugger) +function! vebugger#gdb#_writeFlow(writeAction,debugger) if 'stepin'==a:writeAction call a:debugger.writeLine('step') elseif 'stepover'==a:writeAction @@ -102,11 +102,11 @@ function! s:writeFlow(writeAction,debugger) endif endfunction -function! s:closeDebugger(writeAction,debugger) +function! vebugger#gdb#_closeDebugger(writeAction,debugger) call a:debugger.writeLine('quit') endfunction -function! s:writeBreakpoints(writeAction,debugger) +function! vebugger#gdb#_writeBreakpoints(writeAction,debugger) for l:breakpoint in a:writeAction if 'add'==(l:breakpoint.action) call a:debugger.writeLine('break '.fnameescape(l:breakpoint.file).':'.l:breakpoint.line) @@ -116,13 +116,13 @@ function! s:writeBreakpoints(writeAction,debugger) endfor endfunction -function! s:requestEvaluateExpression(writeAction,debugger) +function! vebugger#gdb#_requestEvaluateExpression(writeAction,debugger) for l:evalAction in a:writeAction call a:debugger.writeLine('print '.l:evalAction.expression) endfor endfunction -function! s:executeStatements(writeAction,debugger) +function! vebugger#gdb#_executeStatements(writeAction,debugger) for l:evalAction in a:writeAction if has_key(l:evalAction,'statement') "Use eval to run the statement - but first we need to remove the ; @@ -131,7 +131,7 @@ function! s:executeStatements(writeAction,debugger) endfor endfunction -function! s:readEvaluatedExpressions(pipeName,line,readResult,debugger) dict +function! vebugger#gdb#_readEvaluatedExpressions(pipeName,line,readResult,debugger) dict if 'out'==a:pipeName if has_key(self,'nextExpressionToBePrinted') let l:matches=matchlist(a:line,'\v^\~"\$(\d+) \= (.*)"$') diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index 1040921..612336c 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -16,15 +16,15 @@ function! vebugger#jdb#start(entryClass,args) call vebugger#std#openShellBuffer(l:debugger) endif - call l:debugger.addReadHandler(function('s:readProgramOutput')) - call l:debugger.addReadHandler(function('s:readWhere')) - call l:debugger.addReadHandler(function('s:readException')) - call l:debugger.addReadHandler(function('s:readEvaluatedExpressions')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readProgramOutput')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readWhere')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readException')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readEvaluatedExpressions')) - call l:debugger.setWriteHandler('std','flow',function('s:writeFlow')) - call l:debugger.setWriteHandler('std','breakpoints',function('s:writeBreakpoints')) - call l:debugger.setWriteHandler('std','evaluateExpressions',function('s:requestEvaluateExpression')) - call l:debugger.setWriteHandler('std','executeStatements',function('s:executeStatements')) + call l:debugger.setWriteHandler('std','flow',function('vebugger#jdb#_writeFlow')) + call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#jdb#_writeBreakpoints')) + call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#jdb#_requestEvaluateExpression')) + call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#jdb#_executeStatements')) call l:debugger.generateWriteActionsFromTemplate() @@ -33,7 +33,7 @@ function! vebugger#jdb#start(entryClass,args) return l:debugger endfunction -function! s:readProgramOutput(pipeName,line,readResult,debugger) dict +function! vebugger#jdb#_readProgramOutput(pipeName,line,readResult,debugger) dict if 'out'==a:pipeName if a:line=~'\v^\> \>' \||a:line=='> ' @@ -68,7 +68,7 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace) return l:path endfunction -function! s:readWhere(pipeName,line,readResult,debugger) +function! vebugger#jdb#_readWhere(pipeName,line,readResult,debugger) if 'out'==a:pipeName let l:matches=matchlist(a:line,'\v\s*\[(\d+)]\s*(\S+)\s*\(([^:]*):(\d*)\)') if 4]+)\s*\((.+):(\d+)\)') if 3\s*([^=]+)\=(.*)$') if 2[C" " After executing commands this seems to get appended... let self.programOutputMode=1 @@ -54,7 +54,7 @@ function! s:readProgramOutput(pipeName,line,readResult,debugger) dict endif endfunction -function! s:readWhere(pipeName,line,readResult,debugger) +function! vebugger#pdb#_readWhere(pipeName,line,readResult,debugger) if 'out'==a:pipeName let l:matches=matchlist(a:line,'\v^\> (.+)\((\d+)\).*\(\)$') @@ -70,13 +70,13 @@ function! s:readWhere(pipeName,line,readResult,debugger) endif endfunction -function! s:readFinish(pipeName,line,readResult,debugger) +function! vebugger#pdb#_readFinish(pipeName,line,readResult,debugger) if a:line=='The program finished and will be restarted' let a:readResult.std.programFinish={'finish':1} endif endfunction -function! s:writeFlow(writeAction,debugger) +function! vebugger#pdb#_writeFlow(writeAction,debugger) if 'stepin'==a:writeAction call a:debugger.writeLine('step') elseif 'stepover'==a:writeAction @@ -88,11 +88,11 @@ function! s:writeFlow(writeAction,debugger) endif endfunction -function! s:closeDebugger(writeAction,debugger) +function! vebugger#pdb#_closeDebugger(writeAction,debugger) call a:debugger.writeLine('quit') endfunction -function! s:writeBreakpoints(writeAction,debugger) +function! vebugger#pdb#_writeBreakpoints(writeAction,debugger) for l:breakpoint in a:writeAction if 'add'==(l:breakpoint.action) call a:debugger.writeLine('break '.fnameescape(fnamemodify(l:breakpoint.file,':p')).':'.l:breakpoint.line) @@ -102,13 +102,13 @@ function! s:writeBreakpoints(writeAction,debugger) endfor endfunction -function! s:requestEvaluateExpression(writeAction,debugger) +function! vebugger#pdb#_requestEvaluateExpression(writeAction,debugger) for l:evalAction in a:writeAction call a:debugger.writeLine('p '.l:evalAction.expression) endfor endfunction -function! s:executeStatements(writeAction,debugger) +function! vebugger#pdb#_executeStatements(writeAction,debugger) for l:evalAction in a:writeAction if has_key(l:evalAction,'statement') call a:debugger.writeLine('!'.l:evalAction.statement) @@ -116,7 +116,7 @@ function! s:executeStatements(writeAction,debugger) endfor endfunction -function! s:readEvaluatedExpressions(pipeName,line,readResult,debugger) dict +function! vebugger#pdb#_readEvaluatedExpressions(pipeName,line,readResult,debugger) dict if 'out'==a:pipeName if has_key(self,'expression') "Reading the actual value to print let l:value=a:line @@ -134,7 +134,7 @@ function! s:readEvaluatedExpressions(pipeName,line,readResult,debugger) dict endif endfunction -function! s:removeAfterDisplayed(writeAction,debugger) +function! vebugger#pdb#_removeAfterDisplayed(writeAction,debugger) for l:removeAction in a:writeAction if has_key(l:removeAction,'id') "call a:debugger.writeLine('undisplay '.l:removeAction.id) diff --git a/autoload/vebugger/rdebug.vim b/autoload/vebugger/rdebug.vim index ef248b3..a3c13f4 100644 --- a/autoload/vebugger/rdebug.vim +++ b/autoload/vebugger/rdebug.vim @@ -11,15 +11,15 @@ function! vebugger#rdebug#start(entryFile,args) call vebugger#std#openShellBuffer(l:debugger) endif - call l:debugger.addReadHandler(function('s:readProgramOutput')) - call l:debugger.addReadHandler(function('s:readWhere')) - call l:debugger.addReadHandler(function('s:readEvaluatedExpressions')) + call l:debugger.addReadHandler(function('vebugger#rdebug#_readProgramOutput')) + call l:debugger.addReadHandler(function('vebugger#rdebug#_readWhere')) + call l:debugger.addReadHandler(function('vebugger#rdebug#_readEvaluatedExpressions')) - call l:debugger.setWriteHandler('std','flow',function('s:writeFlow')) - call l:debugger.setWriteHandler('std','breakpoints',function('s:writeBreakpoints')) - call l:debugger.setWriteHandler('std','evaluateExpressions',function('s:requestEvaluateExpression')) - call l:debugger.setWriteHandler('std','executeStatements',function('s:executeStatements')) - call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('s:removeAfterDisplayed')) + call l:debugger.setWriteHandler('std','flow',function('vebugger#rdebug#_writeFlow')) + call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#rdebug#_writeBreakpoints')) + call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#rdebug#_requestEvaluateExpression')) + call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#rdebug#_executeStatements')) + call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#rdebug#_removeAfterDisplayed')) call l:debugger.generateWriteActionsFromTemplate() @@ -28,13 +28,13 @@ function! vebugger#rdebug#start(entryFile,args) return l:debugger endfunction -function! s:readProgramOutput(pipeName,line,readResult,debugger) +function! vebugger#rdebug#_readProgramOutput(pipeName,line,readResult,debugger) if 'err'==a:pipeName let a:readResult.std.programOutput={'line':a:line} endif endfunction -function! s:readWhere(pipeName,line,readResult,debugger) +function! vebugger#rdebug#_readWhere(pipeName,line,readResult,debugger) if 'out'==a:pipeName let l:matches=matchlist(a:line,'\v^([^:]+)\:(\d+)\:(.*)$') @@ -50,7 +50,7 @@ function! s:readWhere(pipeName,line,readResult,debugger) endif endfunction -function! s:writeFlow(writeAction,debugger) +function! vebugger#rdebug#_writeFlow(writeAction,debugger) if 'stepin'==a:writeAction call a:debugger.writeLine('step') elseif 'stepover'==a:writeAction @@ -62,7 +62,7 @@ function! s:writeFlow(writeAction,debugger) endif endfunction -function! s:writeBreakpoints(writeAction,debugger) +function! vebugger#rdebug#_writeBreakpoints(writeAction,debugger) for l:breakpoint in a:writeAction if 'add'==(l:breakpoint.action) call a:debugger.writeLine('break '.fnameescape(l:breakpoint.file).':'.l:breakpoint.line) @@ -72,13 +72,13 @@ function! s:writeBreakpoints(writeAction,debugger) endfor endfunction -function! s:requestEvaluateExpression(writeAction,debugger) +function! vebugger#rdebug#_requestEvaluateExpression(writeAction,debugger) for l:evalAction in a:writeAction call a:debugger.writeLine('display '.l:evalAction.expression) endfor endfunction -function! s:executeStatements(writeAction,debugger) +function! vebugger#rdebug#_executeStatements(writeAction,debugger) for l:evalAction in a:writeAction if has_key(l:evalAction,'statement') "rdebug uses Ruby functions for commands @@ -87,7 +87,7 @@ function! s:executeStatements(writeAction,debugger) endfor endfunction -function! s:readEvaluatedExpressions(pipeName,line,readResult,debugger) +function! vebugger#rdebug#_readEvaluatedExpressions(pipeName,line,readResult,debugger) if 'out'==a:pipeName let l:matches=matchlist(a:line,'\v^(\d+)\: (.*) \= (.*)$') if 4 License: Same terms as Vim itself (see |license|) -Version: 1.2.1 +Version: 1.2.1+ INTRODUCTION *vebugger*