From cb4f2e56f0a7681e6fe2ae1889f8c4f13ac35a39 Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Fri, 20 Aug 1999 22:12:36 +0000 Subject: [PATCH] *** empty log message *** --- harbour/source/debug/debugger.prg | 58 ++++++++++++++++++++++++++++--- harbour/source/vm/hvm.c | 9 +++-- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index c7f34b5180..f9665c453b 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -39,21 +39,22 @@ static oDebugger -function Debugger( uParam ) +function Debugger( uParam ) // debugger entry point do case - case ValType( uParam ) == "C" + case ValType( uParam ) == "C" // called from hvm.c hb_vmModuleName() if oDebugger == nil oDebugger = TDebugger():New() oDebugger:Activate( uParam ) endif - case ValType( uParam ) == "N" + case ValType( uParam ) == "N" // called from hvm.c hb_vmDebugShowLines() if oDebugger != nil oDebugger:cAppImage = SaveScreen() oDebugger:nAppRow = Row() oDebugger:nAppCol = Col() oDebugger:cAppColors = SetColor() + oDebugger:nAppCursor = SetCursor() RestScreen( 0, 0, MaxRow(), MaxCol(), oDebugger:cImage ) DispEnd() oDebugger:GoToLine( uParam ) @@ -70,7 +71,7 @@ CLASS TDebugger DATA oBar, oBrwText DATA cImage, nOldCursor DATA lEnd - DATA cAppImage, nAppRow, nAppCol, cAppColors + DATA cAppImage, nAppRow, nAppCol, cAppColors, nAppCursor METHOD New() METHOD Activate( cModuleName ) @@ -151,6 +152,7 @@ METHOD HandleEvent() CLASS TDebugger RestScreen( 0, 0, MaxRow(), MaxCol(), ::cAppImage ) SetPos( ::nAppRow, ::nAppCol ) SetColor( ::cAppColors ) + SetCursor( ::nAppCursor ) ::Exit() otherwise @@ -257,6 +259,7 @@ CLASS TDbWindow // Debugger windows METHOD New( nTop, nLeft, nBottom, nRight, cCaption, cColor ) METHOD Show( lFocused ) + METHOD Move() ENDCLASS @@ -289,6 +292,53 @@ METHOD Show( lFocused ) CLASS TDbWindow return nil +/*Method move() +Move a window across the screen +Copyright Luiz Rafael Culik 1999 +*/ +METHOD Move() Class TDbWindow + +#define pbar1 replicate(chr(176),8)+chr(32) + + local noldtop := ::nTop + local noldleft := ::nLeft + local noldbottom := ::nbottom + local noldright := ::nright + local nkey + + while .t. + restscreen(,,,, ::cbackimage) + dispbox(::ntop,::nleft,::nright,::nbottom,pbar1) + nkey=inkey(0) + do case + case nkey==K_UP + if(::ntop !=0,(::ntop--,::nbottom--),nil) + + case nkey==K_DOWN + if(::nbottom !=maxrow(),(::ntop++,::nbottom++),nil) + + case nkey==K_LEFT + if(::nleft!=0,(::nleft--,::nright--),nil) + + case nkey==K_RIGHT + if(::nbottom !=maxrow(),(::nleft++,::nright++),nil) + + case nkey==K_ESC + ::ntop:=noldtop + ::nleft:=nolfleft + ::nbottom:=noldbottom + ::nright:=noldright + endcase + + if ( nkey==K_ESC .or. nkey==K_ENTER) + exit + end + end + + // __keyboard(chr(0)),inkey()) + +return nil + CLASS TDbMenu /* debugger menu */ CLASSDATA aMenus diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index b3297f0ac9..58e1e319b5 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -106,7 +106,7 @@ static void hb_vmForceLink( void ); /* virtual machine state */ BOOL bHB_DEBUG = FALSE; /* if TRUE traces the virtual machine activity */ -BOOL bDebugging = FALSE; /* TRUE if we are running a /b compiled module */ +BOOL bDebugging = FALSE; BOOL bDebugShowLines = FALSE; /* update source code line on the debugger display */ STACK stack; HB_SYMB symEval = { "__EVAL", FS_PUBLIC, hb_vmDoBlock, 0 }; /* symbol to evaluate codeblocks */ @@ -378,7 +378,7 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ) case HB_P_LINE: stack.pBase->item.asSymbol.lineno = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - if( bDebugShowLines ) + if( bDebugging && bDebugShowLines ) hb_vmDebuggerShowLine( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; @@ -844,6 +844,9 @@ void hb_vmDo( WORD wParams ) PHB_ITEM pSelf = stack.pPos - wParams - 1; /* NIL, OBJECT or BLOCK */ PHB_FUNC pFunc; int iStatics = stack.iStatics; /* Return iStatics position */ + BOOL bDebugPrevState = bDebugging; + + bDebugging = FALSE; if( ! IS_SYMBOL( pItem ) ) { @@ -895,6 +898,8 @@ void hb_vmDo( WORD wParams ) stack.pBase = stack.pItems + wStackBase; stack.iStatics = iStatics; + + bDebugging = bDebugPrevState; } HARBOUR hb_vmDoBlock( void )