diff --git a/harbour/ChangeLog b/harbour/ChangeLog index decde54c4e..66560bfe1b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,26 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-08-22 09:32 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * common.mak + * source/vm/debug.c + * source/vm/hvm.c + * source/vm/Makefile + + source/vm/debugold.c + + Added some HB_DBG_*() functions for compatibility + with certain 3rd party libs. They are marked with + HB_LEGACY_LEVEL, and will be removed (pbly at 1.1.0), + so everyone is encouraged to use __DBG*() version + for Harbour versions above 0x010000 (or not use + them at all, if this is possible). If these functions + are indeed needed for some functionality, it'd be + good to hear about it, maybe there is a solution + which doesn't require internals. + + * utils/hbdoc/ft_funcs.prg + * utils/hbmake/ft_funcs.prg + * Using FS_* manifest constants. + 2008-08-22 08:20 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * common.mak * make_b32.mak diff --git a/harbour/common.mak b/harbour/common.mak index 069927dc36..f977962f4e 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -393,6 +393,7 @@ VM_COMMON_LIB_OBJS = \ $(OBJ_DIR)\cmdarg$(OBJEXT) \ $(OBJ_DIR)\codebloc$(OBJEXT) \ $(OBJ_DIR)\debug$(OBJEXT) \ + $(OBJ_DIR)\debugold$(OBJEXT) \ $(OBJ_DIR)\dynlibhb$(OBJEXT) \ $(OBJ_DIR)\dynsym$(OBJEXT) \ $(OBJ_DIR)\estack$(OBJEXT) \ diff --git a/harbour/source/vm/Makefile b/harbour/source/vm/Makefile index 9a1ed3272a..7536a5bd07 100644 --- a/harbour/source/vm/Makefile +++ b/harbour/source/vm/Makefile @@ -32,6 +32,7 @@ C_SOURCES=\ classes.c \ cmdarg.c \ debug.c \ + debugold.c \ dynlibhb.c \ dynsym.c \ codebloc.c \ diff --git a/harbour/source/vm/debug.c b/harbour/source/vm/debug.c index dd540679d3..ca6138523e 100644 --- a/harbour/source/vm/debug.c +++ b/harbour/source/vm/debug.c @@ -268,42 +268,3 @@ HB_FUNC( __DBGVMVARLSET ) hb_itemCopyToRef( pLocal, hb_stackItemFromBase( 3 ) ); } } - -#if 0 - -HB_FUNC( __VMSTKLCOUNT ) -{ - HB_FUNC_EXEC( __DBGVMSTKLCOUNT ); -} - -HB_FUNC( __VMPARLLIST ) -{ - HB_FUNC_EXEC( __DBGVMPARLLIST ); -} - -HB_FUNC( __VMSTKLLIST ) -{ - HB_FUNC_EXEC( __DBGVMSTKLLIST ); -} - -HB_FUNC( __VMVARLGET ) -{ - HB_FUNC_EXEC( __DBGVMVARLGET ); -} - -HB_FUNC( __VMVARLSET ) -{ - HB_FUNC_EXEC( __DBGVMVARLSET ); -} - -HB_FUNC( __VMSTKGLIST ) -{ - HB_FUNC_EXEC( __DBGVMSTKGLIST ); -} - -HB_FUNC( __VMSTKGCOUNT ) -{ - HB_FUNC_EXEC( __DBGVMSTKGCOUNT ); -} - -#endif diff --git a/harbour/source/vm/debugold.c b/harbour/source/vm/debugold.c new file mode 100644 index 0000000000..3638d3c175 --- /dev/null +++ b/harbour/source/vm/debugold.c @@ -0,0 +1,145 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Debugging compatibility functions + * + * Copyright 1999 Eddie Runia + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" + +#ifdef HB_LEGACY_LEVEL + +HB_FUNC_EXTERN( __DBGVMSTKLCOUNT ); + +HB_FUNC( HB_DBG_VMSTKLCOUNT ) +{ + HB_FUNC_EXEC( __DBGVMSTKLCOUNT ); +} + +HB_FUNC_EXTERN( __DBGVMPARLLIST ); + +HB_FUNC( HB_DBG_VMPARLLIST ) +{ + HB_FUNC_EXEC( __DBGVMPARLLIST ); +} + +HB_FUNC_EXTERN( __DBGVMVARLGET ); + +HB_FUNC( HB_DBG_VMVARLGET ) +{ + HB_FUNC_EXEC( __DBGVMVARLGET ); +} + +HB_FUNC_EXTERN( __DBGVMVARSLEN ); + +HB_FUNC( HB_DBG_VMVARSLEN ) +{ + HB_FUNC_EXEC( __DBGVMVARSLEN ); +} + +#if 0 + +HB_FUNC_EXTERN( __DBGVMSTKLLIST ); + +HB_FUNC( HB_DBG_VMSTKLLIST ) +{ + HB_FUNC_EXEC( __DBGVMSTKLLIST ); +} + +HB_FUNC_EXTERN( __DBGVMVARLSET ); + +HB_FUNC( HB_DBG_VMVARLSET ) +{ + HB_FUNC_EXEC( __DBGVMVARLSET ); +} + +HB_FUNC_EXTERN( __DBGVMSTKGLIST ); + +HB_FUNC( HB_DBG_VMSTKGLIST ) +{ + HB_FUNC_EXEC( __DBGVMSTKGLIST ); +} + +HB_FUNC_EXTERN( __DBGVMSTKGCOUNT ); + +HB_FUNC( HB_DBG_VMSTKGCOUNT ) +{ + HB_FUNC_EXEC( __DBGVMSTKGCOUNT ); +} + +HB_FUNC_EXTERN( __DBGVMVARGLIST ); + +HB_FUNC( HB_DBG_VMVARGLIST ) +{ + HB_FUNC_EXEC( __DBGVMVARGLIST ); +} + +HB_FUNC_EXTERN( __DBGVMVARSLIST ); + +HB_FUNC( HB_DBG_VMVARSLIST ) +{ + HB_FUNC_EXEC( __DBGVMVARSLIST ); +} + +HB_FUNC_EXTERN( __DBGVMVARSGET ); + +HB_FUNC( HB_DBG_VMVARSGET ) +{ + HB_FUNC_EXEC( __DBGVMVARSGET ); +} + +HB_FUNC_EXTERN( __DBGVMVARSSET ); + +HB_FUNC( HB_DBG_VMVARSSET ) +{ + HB_FUNC_EXEC( __DBGVMVARSSET ); +} + +#endif + +#endif diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index fb610a7d50..14d070efba 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -9725,35 +9725,6 @@ HB_FUNC( __OPGETPRF ) /* profiler: It returns an array with an opcode called and } } -#if 0 - -HB_FUNC( __VMVARGLIST ) -{ - HB_FUNC_EXEC( __DBGVMVARGLIST ); -} - -HB_FUNC( __VMVARSLIST ) -{ - HB_FUNC_EXEC( __DBGVMVARSLIST ); -} - -HB_FUNC( __VMVARSLEN ) -{ - HB_FUNC_EXEC( __DBGVMVARSLEN ); -} - -HB_FUNC( __VMVARSGET ) -{ - HB_FUNC_EXEC( __DBGVMVARSGET ); -} - -HB_FUNC( __VMVARSSET ) -{ - HB_FUNC_EXEC( __DBGVMVARSSET ); -} - -#endif - HB_FUNC( ERRORLEVEL ) { hb_retni( s_nErrorLevel ); diff --git a/harbour/utils/hbdoc/ft_funcs.prg b/harbour/utils/hbdoc/ft_funcs.prg index e5d34deee5..2f08cc232b 100644 --- a/harbour/utils/hbdoc/ft_funcs.prg +++ b/harbour/utils/hbdoc/ft_funcs.prg @@ -131,9 +131,9 @@ METHOD fskip( nRecords ) CLASS FileBase DEFAULT nRecords TO 1 IF ::noDosError() .AND. ::nDosHandle > 0 - FSEEK( ::nDosHandle, ( ::nSkipLength * nRecords ), 1 ) + FSEEK( ::nDosHandle, ( ::nSkipLength * nRecords ), FS_RELATIVE ) ::nLastDosMessage := FERROR() - ::nPosition := FSEEK( ::nDosHandle, 0, 1 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_RELATIVE ) DO CASE CASE ::nPosition == ::nEndOfFile ::lAtBottom := .T. @@ -156,7 +156,7 @@ METHOD fskip( nRecords ) CLASS FileBase METHOD fgotop() CLASS FileBase IF ::noDosError() .AND. ::nDosHandle > 0 - ::nPosition := FSEEK( ::nDosHandle, 0, 0 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_SET ) ::nLastDosMessage := FERROR() ::lAtTop := .T. ::lAtBottom := .F. @@ -172,7 +172,7 @@ METHOD fgotop() CLASS FileBase METHOD fgoBottom() CLASS FileBase IF ::noDosError() .AND. ::nDosHandle > 0 - ::nPosition := FSEEK( ::nDosHandle, 0, 2 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_END ) ::nLastDosMessage := FERROR() ::lAtTop := .F. ::lAtBottom := .T. @@ -212,7 +212,7 @@ METHOD retrieve() CLASS FileBase cReturn := SPACE( ::nSkipLength ) nMoved := FREAD( ::nDosHandle, @cReturn, ::nSkipLength ) ::nLastDosMessage := FERROR() - FSEEK( ::nDosHandle, - ( nMoved ), 1 ) // Re-position the pointer + FSEEK( ::nDosHandle, - ( nMoved ), FS_RELATIVE ) // Re-position the pointer ENDIF RETURN cReturn @@ -230,7 +230,7 @@ METHOD FWRITE( cChar ) CLASS FileBase FWRITE( ::nDosHandle, cChar, 1 ) ::nLastDosMessage := FERROR() IF ::noDosError() - FSEEK( ::nDosHandle, ::nPosition, 0 ) // Re-position the pointer + FSEEK( ::nDosHandle, ::nPosition, FS_SET ) // Re-position the pointer ENDIF ENDIF ENDIF @@ -250,9 +250,9 @@ METHOD fgoto( nValue ) CLASS FileBase IF ISNUMBER( nValue ) IF nValue > 0 .AND. ; ( nValue * ::nSkipLength ) <= ::nEndOfFile - FSEEK( ::nDosHandle, ( nValue * ::nSkipLength ), 0 ) + FSEEK( ::nDosHandle, ( nValue * ::nSkipLength ), FS_SET ) ::nLastDosMessage := FERROR() - ::nPosition := FSEEK( ::nDosHandle, 0, 1 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_RELATIVE ) DO CASE CASE ::nPosition == ::nEndOfFile ::lAtBottom := .T. @@ -298,8 +298,8 @@ METHOD FOPEN() CLASS FileBase IF ::noDosError() ::nDosHandle :=::openfile( ::cName, ::nOpenMode ) - ::nEndOfFile := FSEEK( ::nDosHandle, 0, 2 ) - ::nPosition := FSEEK( ::nDosHandle, 0, 0 ) + ::nEndOfFile := FSEEK( ::nDosHandle, 0, FS_END ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_SET ) ::lAtTop := .T. ::lAtBottom := .F. ENDIF @@ -312,10 +312,10 @@ METHOD fappendByte( cByte ) CLASS FileBase IF !EMPTY( cByte ) // Valid line IF ::noDosError() .AND. ::nDosHandle > 0 // No error - FSEEK( ::nDosHandle, 0, 2 ) + FSEEK( ::nDosHandle, 0, FS_END ) FWRITE( ::nDosHandle, cByte, 1 ) - ::nEndOfFile := FSEEK( ::nDosHandle, 0, 2 ) - ::nPosition := FSEEK( ::nDosHandle, - ( LEN( cByte ) ), 2 ) + ::nEndOfFile := FSEEK( ::nDosHandle, 0, FS_END ) + ::nPosition := FSEEK( ::nDosHandle, - ( LEN( cByte ) ), FS_END ) ::nSkipLength := LEN( cByte ) ::lAtBottom := ::lAtTop := .F. ENDIF @@ -326,8 +326,8 @@ RETURN Self METHOD OPEN() CLASS FileBase Self:nDosHandle := Self:openfile( ::cName, ::nOpenMode ) - ::nEndOfFile := FSEEK( Self:nDosHandle, 0, 2 ) - FSEEK( Self:nDosHandle, 0, 0 ) + ::nEndOfFile := FSEEK( Self:nDosHandle, 0, FS_END ) + FSEEK( Self:nDosHandle, 0, FS_SET ) ::nSkipLength := Self:Buffget() ::lAtTop := .T. ::lAtBottom := .F. @@ -362,7 +362,7 @@ METHOD goBottom() CLASS FileBase ::fgobottom() // Now, back off from the end one line length and set the marker cBuffer := SPACE( pBUFFER_LENGTH ) - FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 2 ) + FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), FS_END ) FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) IF RIGHT( cBuffer, 2 ) == hb_OSNewLine() // We need to remove this extra one! cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 ) @@ -370,9 +370,9 @@ METHOD goBottom() CLASS FileBase ENDIF cBuffer := SUBSTR( cBuffer, RAT( hb_OSNewLine(), cBuffer ) + 2 ) ::nSkipLength := LEN( cBuffer ) + iif( lWithCRLF, 2, 0 ) - ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), 2 ) + ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), FS_END ) IF lWithCRLF - ::nposition := FSEEK( Self:nDosHandle, - 2, 1 ) + ::nposition := FSEEK( Self:nDosHandle, - 2, FS_RELATIVE ) ENDIF ENDIF @@ -393,10 +393,10 @@ METHOD WRITE( cChar ) CLASS FileBase ELSE FWRITE( Self:nDosHandle, cChar, LEN( cChar ) ) ENDIF - FSEEK( Self:nDosHandle, ::nposition, 0 ) + FSEEK( Self:nDosHandle, ::nposition, FS_SET ) Self:nLastDosMessage := FERROR() IF Self:noDosError() - FSEEK( Self:nDosHandle, Self:nPosition, 0 ) // Re-position the pointer + FSEEK( Self:nDosHandle, Self:nPosition, FS_SET ) // Re-position the pointer ENDIF ENDIF ENDIF @@ -419,10 +419,10 @@ METHOD appendLine( cLine ) CLASS FileBase IF !( hb_OSNewLine() $ cLine ) // No CRLF, so add cLIne += hb_OSNewLine() ENDIF - FSEEK( Self:nDosHandle, 0, 2 ) + FSEEK( Self:nDosHandle, 0, FS_END ) FWRITE( Self:nDosHandle, cLine ) - ::nEndOfFile := FSEEK( Self:nDosHandle, 0, 2 ) - ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cLine ) ), 2 ) + ::nEndOfFile := FSEEK( Self:nDosHandle, 0, FS_END ) + ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cLine ) ), FS_END ) ::nSkipLength := LEN( cLine ) ::lAtBottom := ::lAtTop := .F. ENDIF @@ -487,7 +487,7 @@ METHOD GOTO( nValue ) CLASS FileBase IF Self:noDosError() .AND. Self:nDosHandle > 0 IF ISNUMBER( nValue ) IF nValue > 0 // o.k. so far - FSEEK( Self:nDosHandle, 0, 0 ) // start at the top + FSEEK( Self:nDosHandle, 0, FS_SET ) // start at the top WHILE lContinue cBuffer := SPACE( pBUFFER_LENGTH ) lContinue := ( FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) == ; @@ -503,13 +503,13 @@ METHOD GOTO( nValue ) CLASS FileBase cLine := cBuffer ENDDO IF nCount == nValue // We have a match - FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 1 ) // Back off from here + FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), FS_RELATIVE ) // Back off from here ::nposition := FSEEK( Self:nDosHandle, ; ( pBUFFER_LENGTH - LEN( cBuffer ) ), ; - 1 ) // Move + FS_RELATIVE ) // Move ::nSkipLength := Self:Buffget() ELSE - FSEEK( Self:nDosHandle, ::nposition, 0 ) + FSEEK( Self:nDosHandle, ::nposition, FS_SET ) nCount := 0 ENDIF ENDIF @@ -533,7 +533,7 @@ METHOD BufferGet( lForward ) CLASS FileBase - ( iif( ::nposition < pBUFFER_LENGTH, ; ::nposition, ; pBUFFER_LENGTH ) ), ; - 1 ) // rewind backwards + FS_RELATIVE ) // rewind backwards cBuffer := SPACE( ::nposition - nRead ) FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) ) @@ -548,7 +548,7 @@ METHOD BufferGet( lForward ) CLASS FileBase cBuffer := SPACE( pBUFFER_LENGTH ) nRead := FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) FSEEK( Self:nDosHandle, - ( iif( nRead < pBUFFER_LENGTH, nRead, ; - pBUFFER_LENGTH ) ), 1 ) // Rewind + pBUFFER_LENGTH ) ), FS_RELATIVE ) // Rewind // Now, parse the string. and file @@ -654,7 +654,7 @@ METHOD closeAll() CLASS FileMan METHOD rewindAll() CLASS FileMan IF ::nLastDosMessage == 0 - AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, 0 ) } ) + AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, FS_SET ) } ) ENDIF RETURN Self diff --git a/harbour/utils/hbmake/ft_funcs.prg b/harbour/utils/hbmake/ft_funcs.prg index e5d34deee5..2f08cc232b 100644 --- a/harbour/utils/hbmake/ft_funcs.prg +++ b/harbour/utils/hbmake/ft_funcs.prg @@ -131,9 +131,9 @@ METHOD fskip( nRecords ) CLASS FileBase DEFAULT nRecords TO 1 IF ::noDosError() .AND. ::nDosHandle > 0 - FSEEK( ::nDosHandle, ( ::nSkipLength * nRecords ), 1 ) + FSEEK( ::nDosHandle, ( ::nSkipLength * nRecords ), FS_RELATIVE ) ::nLastDosMessage := FERROR() - ::nPosition := FSEEK( ::nDosHandle, 0, 1 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_RELATIVE ) DO CASE CASE ::nPosition == ::nEndOfFile ::lAtBottom := .T. @@ -156,7 +156,7 @@ METHOD fskip( nRecords ) CLASS FileBase METHOD fgotop() CLASS FileBase IF ::noDosError() .AND. ::nDosHandle > 0 - ::nPosition := FSEEK( ::nDosHandle, 0, 0 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_SET ) ::nLastDosMessage := FERROR() ::lAtTop := .T. ::lAtBottom := .F. @@ -172,7 +172,7 @@ METHOD fgotop() CLASS FileBase METHOD fgoBottom() CLASS FileBase IF ::noDosError() .AND. ::nDosHandle > 0 - ::nPosition := FSEEK( ::nDosHandle, 0, 2 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_END ) ::nLastDosMessage := FERROR() ::lAtTop := .F. ::lAtBottom := .T. @@ -212,7 +212,7 @@ METHOD retrieve() CLASS FileBase cReturn := SPACE( ::nSkipLength ) nMoved := FREAD( ::nDosHandle, @cReturn, ::nSkipLength ) ::nLastDosMessage := FERROR() - FSEEK( ::nDosHandle, - ( nMoved ), 1 ) // Re-position the pointer + FSEEK( ::nDosHandle, - ( nMoved ), FS_RELATIVE ) // Re-position the pointer ENDIF RETURN cReturn @@ -230,7 +230,7 @@ METHOD FWRITE( cChar ) CLASS FileBase FWRITE( ::nDosHandle, cChar, 1 ) ::nLastDosMessage := FERROR() IF ::noDosError() - FSEEK( ::nDosHandle, ::nPosition, 0 ) // Re-position the pointer + FSEEK( ::nDosHandle, ::nPosition, FS_SET ) // Re-position the pointer ENDIF ENDIF ENDIF @@ -250,9 +250,9 @@ METHOD fgoto( nValue ) CLASS FileBase IF ISNUMBER( nValue ) IF nValue > 0 .AND. ; ( nValue * ::nSkipLength ) <= ::nEndOfFile - FSEEK( ::nDosHandle, ( nValue * ::nSkipLength ), 0 ) + FSEEK( ::nDosHandle, ( nValue * ::nSkipLength ), FS_SET ) ::nLastDosMessage := FERROR() - ::nPosition := FSEEK( ::nDosHandle, 0, 1 ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_RELATIVE ) DO CASE CASE ::nPosition == ::nEndOfFile ::lAtBottom := .T. @@ -298,8 +298,8 @@ METHOD FOPEN() CLASS FileBase IF ::noDosError() ::nDosHandle :=::openfile( ::cName, ::nOpenMode ) - ::nEndOfFile := FSEEK( ::nDosHandle, 0, 2 ) - ::nPosition := FSEEK( ::nDosHandle, 0, 0 ) + ::nEndOfFile := FSEEK( ::nDosHandle, 0, FS_END ) + ::nPosition := FSEEK( ::nDosHandle, 0, FS_SET ) ::lAtTop := .T. ::lAtBottom := .F. ENDIF @@ -312,10 +312,10 @@ METHOD fappendByte( cByte ) CLASS FileBase IF !EMPTY( cByte ) // Valid line IF ::noDosError() .AND. ::nDosHandle > 0 // No error - FSEEK( ::nDosHandle, 0, 2 ) + FSEEK( ::nDosHandle, 0, FS_END ) FWRITE( ::nDosHandle, cByte, 1 ) - ::nEndOfFile := FSEEK( ::nDosHandle, 0, 2 ) - ::nPosition := FSEEK( ::nDosHandle, - ( LEN( cByte ) ), 2 ) + ::nEndOfFile := FSEEK( ::nDosHandle, 0, FS_END ) + ::nPosition := FSEEK( ::nDosHandle, - ( LEN( cByte ) ), FS_END ) ::nSkipLength := LEN( cByte ) ::lAtBottom := ::lAtTop := .F. ENDIF @@ -326,8 +326,8 @@ RETURN Self METHOD OPEN() CLASS FileBase Self:nDosHandle := Self:openfile( ::cName, ::nOpenMode ) - ::nEndOfFile := FSEEK( Self:nDosHandle, 0, 2 ) - FSEEK( Self:nDosHandle, 0, 0 ) + ::nEndOfFile := FSEEK( Self:nDosHandle, 0, FS_END ) + FSEEK( Self:nDosHandle, 0, FS_SET ) ::nSkipLength := Self:Buffget() ::lAtTop := .T. ::lAtBottom := .F. @@ -362,7 +362,7 @@ METHOD goBottom() CLASS FileBase ::fgobottom() // Now, back off from the end one line length and set the marker cBuffer := SPACE( pBUFFER_LENGTH ) - FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 2 ) + FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), FS_END ) FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) IF RIGHT( cBuffer, 2 ) == hb_OSNewLine() // We need to remove this extra one! cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 ) @@ -370,9 +370,9 @@ METHOD goBottom() CLASS FileBase ENDIF cBuffer := SUBSTR( cBuffer, RAT( hb_OSNewLine(), cBuffer ) + 2 ) ::nSkipLength := LEN( cBuffer ) + iif( lWithCRLF, 2, 0 ) - ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), 2 ) + ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), FS_END ) IF lWithCRLF - ::nposition := FSEEK( Self:nDosHandle, - 2, 1 ) + ::nposition := FSEEK( Self:nDosHandle, - 2, FS_RELATIVE ) ENDIF ENDIF @@ -393,10 +393,10 @@ METHOD WRITE( cChar ) CLASS FileBase ELSE FWRITE( Self:nDosHandle, cChar, LEN( cChar ) ) ENDIF - FSEEK( Self:nDosHandle, ::nposition, 0 ) + FSEEK( Self:nDosHandle, ::nposition, FS_SET ) Self:nLastDosMessage := FERROR() IF Self:noDosError() - FSEEK( Self:nDosHandle, Self:nPosition, 0 ) // Re-position the pointer + FSEEK( Self:nDosHandle, Self:nPosition, FS_SET ) // Re-position the pointer ENDIF ENDIF ENDIF @@ -419,10 +419,10 @@ METHOD appendLine( cLine ) CLASS FileBase IF !( hb_OSNewLine() $ cLine ) // No CRLF, so add cLIne += hb_OSNewLine() ENDIF - FSEEK( Self:nDosHandle, 0, 2 ) + FSEEK( Self:nDosHandle, 0, FS_END ) FWRITE( Self:nDosHandle, cLine ) - ::nEndOfFile := FSEEK( Self:nDosHandle, 0, 2 ) - ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cLine ) ), 2 ) + ::nEndOfFile := FSEEK( Self:nDosHandle, 0, FS_END ) + ::nposition := FSEEK( Self:nDosHandle, - ( LEN( cLine ) ), FS_END ) ::nSkipLength := LEN( cLine ) ::lAtBottom := ::lAtTop := .F. ENDIF @@ -487,7 +487,7 @@ METHOD GOTO( nValue ) CLASS FileBase IF Self:noDosError() .AND. Self:nDosHandle > 0 IF ISNUMBER( nValue ) IF nValue > 0 // o.k. so far - FSEEK( Self:nDosHandle, 0, 0 ) // start at the top + FSEEK( Self:nDosHandle, 0, FS_SET ) // start at the top WHILE lContinue cBuffer := SPACE( pBUFFER_LENGTH ) lContinue := ( FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) == ; @@ -503,13 +503,13 @@ METHOD GOTO( nValue ) CLASS FileBase cLine := cBuffer ENDDO IF nCount == nValue // We have a match - FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 1 ) // Back off from here + FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), FS_RELATIVE ) // Back off from here ::nposition := FSEEK( Self:nDosHandle, ; ( pBUFFER_LENGTH - LEN( cBuffer ) ), ; - 1 ) // Move + FS_RELATIVE ) // Move ::nSkipLength := Self:Buffget() ELSE - FSEEK( Self:nDosHandle, ::nposition, 0 ) + FSEEK( Self:nDosHandle, ::nposition, FS_SET ) nCount := 0 ENDIF ENDIF @@ -533,7 +533,7 @@ METHOD BufferGet( lForward ) CLASS FileBase - ( iif( ::nposition < pBUFFER_LENGTH, ; ::nposition, ; pBUFFER_LENGTH ) ), ; - 1 ) // rewind backwards + FS_RELATIVE ) // rewind backwards cBuffer := SPACE( ::nposition - nRead ) FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) ) @@ -548,7 +548,7 @@ METHOD BufferGet( lForward ) CLASS FileBase cBuffer := SPACE( pBUFFER_LENGTH ) nRead := FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) FSEEK( Self:nDosHandle, - ( iif( nRead < pBUFFER_LENGTH, nRead, ; - pBUFFER_LENGTH ) ), 1 ) // Rewind + pBUFFER_LENGTH ) ), FS_RELATIVE ) // Rewind // Now, parse the string. and file @@ -654,7 +654,7 @@ METHOD closeAll() CLASS FileMan METHOD rewindAll() CLASS FileMan IF ::nLastDosMessage == 0 - AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, 0 ) } ) + AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, FS_SET ) } ) ENDIF RETURN Self