From acaab45cdaf64244e066009f6ddfa2b8b1fa44c7 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Sat, 21 Aug 1999 18:37:57 +0000 Subject: [PATCH] Updating TBrwText --- harbour/ChangeLog | 48 +++++++------- harbour/makefile.b32 | 13 ++-- harbour/source/debug/tbrwtext.prg | 100 ++++++++++++++---------------- 3 files changed, 82 insertions(+), 79 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8a821eba32..2d881c25ff 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,10 +1,16 @@ +19990821-22:18 GMT+3 Alexander Kresin + * source/debug/tbrwtext.prg + * minor improvements + * makefile.b32 + * added tone.c + 19990821-14:20 GMT+2 Ryszard Glab *source/rtl/inkey.c - * added test code for OS_UNIX_COMPATIBLE based on noncanonical - low-level terminal functions - we need however to extend this - code to support different terminals - + * added test code for OS_UNIX_COMPATIBLE based on noncanonical + low-level terminal functions - we need however to extend this + code to support different terminals + 19990821-00:05 GMT+1 Antonio Linares * source/debug/debugger.prg * improved debugger functionality. @@ -41,36 +47,36 @@ 19990820-15:05 GMT+2 Ryszard Glab *source/rtl/strings.c - * corrected a NULL assigment to '\x0' + * corrected a NULL assigment to '\x0' *source/rdd/dbcmd.c - * corrected SELF_DELETE to SELF_DELETED in HB_DELETED function + * corrected SELF_DELETE to SELF_DELETED in HB_DELETED function *source/runner/runner.c - * corrected NULL to 0L (we are returning LONG in ReadLong()) + * corrected NULL to 0L (we are returning LONG in ReadLong()) *include/external.ch - + new file with EXTERNAL declaration for all harbour - functions/procedures + + new file with EXTERNAL declaration for all harbour + functions/procedures *source/rtl/dir.c - * corrected a parameter passed to 'opendir' function when - Watcom C/C++ is used + * corrected a parameter passed to 'opendir' function when + Watcom C/C++ is used *source/runner/Makefile *source/runner/external.prg *source/runner/runhrb.c *source/runner/runmain.prg - * new files to create the runner executable. - + external.prg is here temporary because the preprocessor doesn't - process EXTERNAL statement yet - + runhrb.c is copied from runner.c however without all code used - to handle the symbol table - + runmain.prg calls HB_RUN from runhrb.c - NOTE: I have left runner.c unchanged because I was unable to - replace it with new files in all these build*.bat - these - build*.bat doesn't allow to create an executable from more then - one source file :( + * new files to create the runner executable. + + external.prg is here temporary because the preprocessor doesn't + process EXTERNAL statement yet + + runhrb.c is copied from runner.c however without all code used + to handle the symbol table + + runmain.prg calls HB_RUN from runhrb.c + NOTE: I have left runner.c unchanged because I was unable to + replace it with new files in all these build*.bat - these + build*.bat doesn't allow to create an executable from more then + one source file :( 19990820-14:40 GMT+1 Victor Szel * include/hbsetup.h diff --git a/harbour/makefile.b32 b/harbour/makefile.b32 index 51b83922ed..a156f7523d 100644 --- a/harbour/makefile.b32 +++ b/harbour/makefile.b32 @@ -22,7 +22,7 @@ harbour.lib : achoice.obj adir.obj alert.obj arrays.obj asort.obj \ langapi.obj math.obj mathx.obj memvars.obj menuto.obj mtran.obj msges.obj \ objfunc.obj \ set.obj setcolor.obj setkey.obj strings.obj symbols.obj stringp.obj \ - stringsx.obj tbcolumn.obj tbrowse.obj tbrwtext.obj tclass.obj tget.obj tgetlist.obj transfrm.obj + stringsx.obj tbcolumn.obj tbrowse.obj tbrwtext.obj tclass.obj tget.obj tgetlist.obj tone.obj transfrm.obj symbols.obj : symbols.asm @@ -80,6 +80,7 @@ tbrwtext.obj : tbrwtext.c extend.h hbdefs.h tclass.obj : tclass.c extend.h hbdefs.h tget.obj : tget.c extend.h hbdefs.h tgetlist.obj : tgetlist.c extend.h hbdefs.h +tone.obj : tone.c extend.h init.h inkey.h transfrm.obj : transfrm.c extend.h hbdefs.h achoice.c : achoice.prg harbour.exe @@ -107,14 +108,14 @@ tgetlist.c : tgetlist.prg harbour.exe tlib .\libs\b32\harbour.lib -+$@,, .prg.c: - bin\harbour $< /n /osource\rtl /iinclude /p + bin\harbour $< /n /osource\rtl /iinclude .c.obj: - bcc32 -c -O2 -I.\include -v -o$@ -DHARBOUR_USE_GTAPI $< + bcc32 -c -O2 -I.\include -o$@ -DHARBOUR_USE_GTAPI $< tlib .\libs\b32\harbour.lib -+$@,, harbour.exe : harboury.c harbourl.c genobj32.obj harbour.obj compiler.h hbppint.c hbpp.c table.c - echo -v -O2 > bld.32 + echo -O2 > bld.32 echo -ebin\harbour.exe >> bld.32 echo -Iinclude;source\compiler;source\hbpp >> bld.32 echo source\compiler\harboury.c >> bld.32 @@ -134,9 +135,9 @@ harbourl.c : harbour.l flex -i -8 -osource\compiler\harbourl.c source\compiler\harbour.l genobj32.obj : genobj32.c - bcc32 -c -O2 -v -I.\include -osource\compiler\genobj32.obj \ + bcc32 -c -O2 -I.\include -osource\compiler\genobj32.obj \ source\compiler\genobj32.c harbour.obj : harbour.c - bcc32 -c -O2 -v -I.\include -osource\compiler\harbour.obj \ + bcc32 -c -O2 -I.\include -osource\compiler\harbour.obj \ source\compiler\harbour.c diff --git a/harbour/source/debug/tbrwtext.prg b/harbour/source/debug/tbrwtext.prg index 3549b81dcf..693156628d 100644 --- a/harbour/source/debug/tbrwtext.prg +++ b/harbour/source/debug/tbrwtext.prg @@ -16,10 +16,6 @@ CLASS TBrwText FROM TBrowse DATA nLine METHOD New( nTop, nLeft, nBottom, nRight, cFileName, cColors ) - METHOD GoTop() - METHOD GoBottom() - METHOD Skipper( nLines ) - METHOD GotoLine( nLine ) ENDCLASS @@ -44,59 +40,14 @@ METHOD New( nTop, nLeft, nBottom, nRight, cFileName, cColors ) CLASS TBrwText ::Autolite = .t. ::AddColumn( TbColumnNew( "", { || Alltrim( Str( ::nLine ) ) + ": " + ::cLine } ) ) - ::GoTopBlock = { || ::GoTop() } - ::GoBottomBlock = { || ::GoBottom() } - ::SkipBlock = { | nLines | ::Skipper( nLines ) } + ::GoTopBlock = { || GoFirstLine( Self ) } + ::GoBottomBlock = { || GoLastLine( Self ) } + ::SkipBlock = { | nLines | Skipper( Self, nLines ) } ::GoTop() return Self -METHOD GoTop() CLASS TBrwText - - local cLine - - FSeek( ::nHandle, 0, FS_SET ) - FReadLn( ::nHandle, @cLine ) - ::cLine = cLine - ::nLine = 1 - FSeek( ::nHandle, 0, FS_SET ) - -return nil - -METHOD GoBottom() CLASS TBrwText - - local cLine := ::cLine - - FSeek( ::nHandle, -1, FS_END ) - GoPrevLine( ::nHandle, @cLine, ::nFileSize ) - ::cLine = cLine - -return nil - -METHOD Skipper( nLines ) CLASS TBrwText - - local nSkipped := 0 - local cLine := ::cLine - - // Skip down - if nLines > 0 - while nSkipped != nLines .and. GoNextLine( ::nHandle, @cLine ) - nSkipped++ - end - ::cLine = cLine - // Skip Up - else - while nSkipped != nLines .and. GoPrevLine( ::nHandle, @cLine, ::nFileSize ) - nSkipped-- - end - ::cLine = cLine - endif - - ::nLine += nSkipped - -return nSkipped - METHOD GotoLine( nLine ) CLASS TBrwText if nLine > ::nLine @@ -113,6 +64,51 @@ METHOD GotoLine( nLine ) CLASS TBrwText return nil +static function GoFirstLine( oBrw ) + + local cLine + + FSeek( oBrw:nHandle, 0, FS_SET ) + FReadLn( oBrw:nHandle, @cLine ) + oBrw:cLine = cLine + oBrw:nLine = 1 + FSeek( oBrw:nHandle, 0, FS_SET ) + +return nil + +static function GoLastLine( oBrw ) + + local cLine := oBrw:cLine + + FSeek( oBrw:nHandle, -1, FS_END ) + GoPrevLine( oBrw:nHandle, @cLine, oBrw:nFileSize ) + oBrw:cLine = cLine + +return nil + +static function Skipper( oBrw, nLines ) + + local nSkipped := 0 + local cLine := oBrw:cLine + + // Skip down + if nLines > 0 + while nSkipped != nLines .and. GoNextLine( oBrw:nHandle, @cLine ) + nSkipped++ + end + oBrw:cLine = cLine + // Skip Up + else + while nSkipped != nLines .and. GoPrevLine( oBrw:nHandle, @cLine, oBrw:nFileSize ) + nSkipped-- + end + oBrw:cLine = cLine + endif + + oBrw:nLine += nSkipped + +return nSkipped + static function FReadLn( nHandle, cBuffer ) local nEOL, ; // End Of Line Postion