From 68d92676c1bcb5d5a70f49cbf70cc8c7ef7e1063 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 4 Sep 2012 12:47:22 +0000 Subject: [PATCH] 2012-09-04 14:47 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/debug/debugger.prg * harbour/src/debug/dbgwa.prg * harbour/src/debug/dbgtarr.prg * harbour/src/debug/tbrwtext.prg * harbour/src/debug/dbgthsh.prg * minor formatting % use: hb_ADel( , , .t. ) instead of: ADel( , ); ASize( , Len( ) - 1 ) ! fixed absolute positioning in HBBrwText class - it was implemented as repeated line skipping from the top causing incredible fatal performance when larger source files are presented. --- harbour/ChangeLog | 13 ++++++++++++ harbour/src/debug/dbgtarr.prg | 3 +-- harbour/src/debug/dbgthsh.prg | 5 ++--- harbour/src/debug/dbgwa.prg | 4 ++-- harbour/src/debug/debugger.prg | 37 ++++++++++++++++------------------ harbour/src/debug/tbrwtext.prg | 24 +++++++++++----------- 6 files changed, 47 insertions(+), 39 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 574902ddb2..51d14542aa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-04 14:47 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/src/debug/debugger.prg + * harbour/src/debug/dbgwa.prg + * harbour/src/debug/dbgtarr.prg + * harbour/src/debug/tbrwtext.prg + * harbour/src/debug/dbgthsh.prg + * minor formatting + % use: hb_ADel( , , .t. ) + instead of: ADel( , ); ASize( , Len( ) - 1 ) + ! fixed absolute positioning in HBBrwText class - it was implemented + as repeated line skipping from the top causing incredible fatal + performance when larger source files are presented. + 2012-09-03 22:03 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/actions.prg * contrib/hbide/docks.prg diff --git a/harbour/src/debug/dbgtarr.prg b/harbour/src/debug/dbgtarr.prg index 40b51921ed..c1c1f4dcf2 100644 --- a/harbour/src/debug/dbgtarr.prg +++ b/harbour/src/debug/dbgtarr.prg @@ -210,8 +210,7 @@ METHOD SetsKeyPressed( nKey, oBrwSets, oWnd, cName, aArray ) CLASS HBDbArray ::AddWindows( aArray[ nSet ], oBrwSets:RowPos + oBrwSets:nTop ) ::arrayname := cOldName - ADel( ::aWindows, ::nCurWindow ) - ASize( ::aWindows, Len( ::aWindows ) - 1 ) + hb_ADel( ::aWindows, ::nCurWindow, .t. ) IF ::nCurWindow == 0 ::nCurWindow := 1 ELSE diff --git a/harbour/src/debug/dbgthsh.prg b/harbour/src/debug/dbgthsh.prg index e48cd72122..ac8c42e0cf 100644 --- a/harbour/src/debug/dbgthsh.prg +++ b/harbour/src/debug/dbgthsh.prg @@ -145,7 +145,7 @@ METHOD addWindows( hHash, nRow ) CLASS HBDbHash oBrwSets:goTopBlock := {|| oBrwSets:cargo[ 1 ] := 1 } oBrwSets:goBottomBlock := {|| oBrwSets:cargo[ 1 ] := Len( oBrwSets:cargo[ 2 ][ 1 ] ) } - oBrwSets:skipBlock := {| nPos | ( nPos := HashBrowseSkip(nPos, oBrwSets), oBrwSets:cargo[ 1 ] := ; + oBrwSets:skipBlock := {| nPos | ( nPos := HashBrowseSkip( nPos, oBrwSets ), oBrwSets:cargo[ 1 ] := ; oBrwSets:cargo[ 1 ] + nPos, nPos ) } ::aWindows[ ::nCurWindow ]:bPainted := {|| ( oBrwSets:forcestable(), RefreshVarsS( oBrwSets ) ) } @@ -220,8 +220,7 @@ METHOD SetsKeyPressed( nKey, oBrwSets, oWnd, cName, hHash ) CLASS HBDbHash ::AddWindows( HB_HValueAt( hHash, nSet ), oBrwSets:RowPos + oBrwSets:nTop ) ::hashName := cOldName - ADel( ::aWindows, ::nCurWindow ) - ASize( ::awindows, Len( ::awindows ) - 1 ) + hb_ADel( ::aWindows, ::nCurWindow, .t. ) IF ::nCurwindow == 0 ::nCurwindow := 1 ELSE diff --git a/harbour/src/debug/dbgwa.prg b/harbour/src/debug/dbgwa.prg index af4bb129aa..e7118c809e 100644 --- a/harbour/src/debug/dbgwa.prg +++ b/harbour/src/debug/dbgwa.prg @@ -88,7 +88,7 @@ PROCEDURE __dbgShowWorkAreas() NEXT IF Len( aAlias ) == 0 - __dbgAlert( "No workareas in use") + __dbgAlert( "No workareas in use" ) RETURN ENDIF @@ -357,7 +357,7 @@ STATIC FUNCTION DbfInfo( aInfo ) EXIT ENDSWITCH - AAdd( aInfo, Space( 8 ) + PadR( FieldName( nFor ), 10) + " = " + PadR( cValue, 17 ) ) + AAdd( aInfo, Space( 8 ) + PadR( FieldName( nFor ), 10 ) + " = " + PadR( cValue, 17 ) ) NEXT diff --git a/harbour/src/debug/debugger.prg b/harbour/src/debug/debugger.prg index d14cab045e..a891bce774 100644 --- a/harbour/src/debug/debugger.prg +++ b/harbour/src/debug/debugger.prg @@ -1439,12 +1439,12 @@ METHOD HideCallStack() CLASS HBDebugger ::RemoveWindow( ::oWndStack ) ::oWndStack := NIL - ::oWndCode:Resize(,,, ::oWndCode:nRight + 16 ) + ::oWndCode:Resize( ,,, ::oWndCode:nRight + 16 ) IF ::oWndVars != NIL - ::oWndVars:Resize(,,, ::oWndVars:nRight + 16 ) + ::oWndVars:Resize( ,,, ::oWndVars:nRight + 16 ) ENDIF IF ::oWndPnt != NIL - ::oWndPnt:Resize(,,, ::oWndPnt:nRight + 16 ) + ::oWndPnt:Resize( ,,, ::oWndPnt:nRight + 16 ) ENDIF DispEnd() ENDIF @@ -2071,7 +2071,7 @@ METHOD RedisplayBreakPoints() CLASS HBDebugger FOR n := 1 TO Len( ::aBreakpoints ) IF hb_FileMatch( ::aBreakpoints[ n ][ 2 ], strip_path( ::cPrgName ) ) - ::oBrwText:ToggleBreakPoint( ::aBreakpoints[ n ][ 1 ], .T.) + ::oBrwText:ToggleBreakPoint( ::aBreakpoints[ n ][ 1 ], .T. ) ENDIF NEXT @@ -2105,8 +2105,7 @@ METHOD RemoveWindow( oWnd ) CLASS HBDebugger LOCAL n := AScan( ::aWindows, {| o | o == oWnd } ) IF n != 0 - ::aWindows := ADel( ::aWindows, n ) - ::aWindows := ASize( ::aWindows, Len( ::aWindows ) - 1 ) + ::aWindows := hb_ADel( ::aWindows, n, .t. ) ENDIF ::nCurrentWindow := 1 @@ -2406,14 +2405,14 @@ METHOD ShowCallStack() CLASS HBDebugger DispBegin() // Resize code window - ::oWndCode:Resize(,,, ::oWndCode:nRight - 16 ) + ::oWndCode:Resize( ,,, ::oWndCode:nRight - 16 ) // Resize vars window IF ::oWndVars != NIL - ::oWndVars:Resize(,,, ::oWndVars:nRight - 16 ) + ::oWndVars:Resize( ,,, ::oWndVars:nRight - 16 ) ENDIF // Resize watchpoints window IF ::oWndPnt != NIL - ::oWndPnt:Resize(,,, ::oWndPnt:nRight - 16) + ::oWndPnt:Resize( ,,, ::oWndPnt:nRight - 16 ) ENDIF DispEnd() @@ -2504,7 +2503,7 @@ METHOD ShowCodeLine( nProc ) CLASS HBDebugger ::oWndCode:Browser := ::oBrwText ELSE - ::oBrwText:LoadFile(cPrgName) + ::oBrwText:LoadFile( cPrgName ) ENDIF ::oWndCode:bPainted := {|| iif( ::oBrwText != NIL, ::oBrwText:RefreshAll():ForceStable(), ::oWndCode:Clear() ) } @@ -2555,7 +2554,7 @@ METHOD ShowVars() CLASS HBDebugger IF ::oWndVars == NIL - nTop := iif( ::oWndPnt != NIL .AND. ::oWndPnt:lVisible, ::oWndPnt:nBottom + 1,1) + nTop := iif( ::oWndPnt != NIL .AND. ::oWndPnt:lVisible, ::oWndPnt:nBottom + 1, 1 ) nBottom := nTop + Min( MAX_VARS_HEIGHT, Len( ::aVars ) + 1 ) ::oWndVars := HBDbWindow():New( nTop, 0, nBottom,; @@ -2567,7 +2566,7 @@ METHOD ShowVars() CLASS HBDebugger ::oWndVars:bLButtonDown := {| nMRow, nMCol | ::WndVarsLButtonDown( nMRow, nMCol ) } ::oWndVars:bLDblClick := {|| ::EditVar( ::oBrwVars:Cargo[ 1 ] ) } - ::oWndVars:bPainted := {|| iif(Len( ::aVars ) > 0, ( ::oBrwVars:RefreshAll():ForceStable(),RefreshVarsS(::oBrwVars) ),) } + ::oWndVars:bPainted := {|| iif( Len( ::aVars ) > 0, ( ::oBrwVars:RefreshAll():ForceStable(),RefreshVarsS( ::oBrwVars ) ), ) } ::oWndVars:bKeyPressed := {| nKey | iif( Len( ::aVars ) == 0, NIL, ( ; iif( nKey == K_DOWN, ::oBrwVars:Down(), NIL ) ; @@ -2577,7 +2576,7 @@ METHOD ShowVars() CLASS HBDebugger , iif( nKey == K_HOME, ::oBrwVars:GoTop(), NIL ) ; , iif( nKey == K_END, ::oBrwVars:GoBottom(), NIL ) ; , iif( nKey == K_ENTER, ::EditVar( ::oBrwVars:Cargo[ 1 ] ), NIL ), ; - iif(Len(::aVars)>0, ::oBrwVars:ForceStable(), NIL) ) ) } + iif( Len( ::aVars ) > 0, ::oBrwVars:ForceStable(), NIL ) ) ) } AAdd( ::aWindows, ::oWndVars ) lWindowCreated := .T. @@ -2752,8 +2751,7 @@ METHOD ToggleBreakPoint( nLine, cFileName ) CLASS HBDebugger ::oBrwText:ToggleBreakPoint( nLine, .T. ) ENDIF ELSE - ADel( ::aBreakPoints, nAt ) - ASize( ::aBreakPoints, Len( ::aBreakPoints ) - 1 ) + hb_ADel( ::aBreakPoints, nAt, .t. ) __dbgDelBreak( ::pInfo, nAt - 1 ) IF hb_FileMatch( cFileName, strip_path( ::cPrgName ) ) ::oBrwText:ToggleBreakPoint( nLine, .F. ) @@ -2964,8 +2962,7 @@ METHOD WatchpointDel( nPos ) CLASS HBDebugger IF nPos >=0 .AND. nPos < Len( ::aWatch ) ::oBrwPnt:gotop() __dbgDelWatch( ::pInfo, nPos ) - ADel( ::aWatch, nPos + 1 ) - ASize( ::aWatch, Len( ::aWatch ) - 1 ) + hb_ADel( ::aWatch, nPos + 1, .t. ) IF Len( ::aWatch ) == 0 ::WatchpointsHide() ELSE @@ -3074,13 +3071,13 @@ METHOD WatchpointsShow() CLASS HBDebugger ::oBrwPnt:Cargo := { 1, {} } // Actual highlighted row aColors := __DbgColors() ::oBrwPnt:ColorSpec := aColors[ 2 ] + "," + aColors[ 5 ] + "," + aColors[ 3 ] + "," + aColors[ 6 ] - ::oBrwPnt:goTopBlock := {|| ::oBrwPnt:cargo[ 1 ] := Min( 1, Len(::aWatch ) ) } + ::oBrwPnt:goTopBlock := {|| ::oBrwPnt:cargo[ 1 ] := Min( 1, Len( ::aWatch ) ) } ::oBrwPnt:goBottomBlock := {|| ::oBrwPnt:cargo[ 1 ] := Len( ::aWatch ) } ::oBrwPnt:skipBlock := {| nSkip, nOld | nOld := ::oBrwPnt:Cargo[ 1 ],; ::oBrwPnt:Cargo[ 1 ] += nSkip,; ::oBrwPnt:Cargo[ 1 ] := Min( Max( ::oBrwPnt:Cargo[ 1 ], 1 ),; Len( ::aWatch ) ),; - iif( Len(::aWatch) > 0, ::oBrwPnt:Cargo[ 1 ] - nOld, 0 ) } + iif( Len( ::aWatch ) > 0, ::oBrwPnt:Cargo[ 1 ] - nOld, 0 ) } oCol := HBDbColumnNew( "", ; {|| PadR( iif( Len( ::aWatch ) > 0, ; @@ -3089,7 +3086,7 @@ METHOD WatchpointsShow() CLASS HBDebugger " " ), ; ::oWndPnt:nWidth() - 2 ) } ) ::oBrwPnt:AddColumn( oCol ) - AAdd( ::oBrwPnt:Cargo[ 2 ], ::aWatch) + AAdd( ::oBrwPnt:Cargo[ 2 ], ::aWatch ) oCol:DefColor := { 1, 2 } ::oWndPnt:bPainted := {|| iif( Len( ::aWatch ) > 0, ( ::oBrwPnt:RefreshAll():ForceStable(), RefreshVarsS( ::oBrwPnt ) /*, ::RefreshVars()*/ ) , ) } diff --git a/harbour/src/debug/tbrwtext.prg b/harbour/src/debug/tbrwtext.prg index 03dfd64906..aab00a263d 100644 --- a/harbour/src/debug/tbrwtext.prg +++ b/harbour/src/debug/tbrwtext.prg @@ -174,19 +174,18 @@ METHOD GetLine() CLASS HBBrwText MemoLine( ::aRows[ ::nRow ], ::nWidth + ::nLineOffset, 1, ::nTabWidth, .f. ),; ::nLineOffset ), ::nWidth ) -METHOD ToggleBreakPoint( nRow, lSet) CLASS HBBrwText +METHOD ToggleBreakPoint( nRow, lSet ) CLASS HBBrwText LOCAL nAt := AScan( ::aBreakPoints, nRow ) IF lSet // add it only if not present IF nAt == 0 - AAdd( ::aBreakPoints, nRow) + AAdd( ::aBreakPoints, nRow ) ENDIF ELSE IF nAt != 0 - ADel( ::aBreakPoints, nAt ) - ASize( ::aBreakPoints, Len( ::aBreakPoints ) - 1 ) + hb_ADel( ::aBreakPoints, nAt, .T. ) ENDIF ENDIF @@ -202,7 +201,6 @@ METHOD LoadFile( cFileName ) CLASS HBBrwText ::nRows := Len( ::aRows ) FOR EACH cLine in ::aRows - MemoLine( cLine, ::nWidth, 1, ::nTabWidth, .f. ) nMaxLineLen := Max( nMaxLineLen, ; Len( RTrim( MemoLine( cLine, Len( cLine ) + 256, 1, ::nTabWidth, .f. ) ) ) ) NEXT @@ -307,13 +305,15 @@ METHOD Skip( n ) CLASS HBBrwText LOCAL nSkipped := 0 IF n > 0 - DO WHILE nSkipped != n .AND. ::GoNext() - nSkipped++ - ENDDO - ELSE - DO WHILE nSkipped != n .AND. ::GoPrev() - nSkipped-- - ENDDO + IF ::nRow < ::nRows + nSkipped := MIN( ::nRows - ::nRow, n ) + ::nRow += nSkipped + ENDIF + ELSEIF n < 0 + IF ::nRow > 1 + nSkipped := MAX( 1 - ::nRow, n ) + ::nRow += nSkipped + ENDIF ENDIF RETURN nSkipped