diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 06a3a7e6e2..12479dbdf0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,18 @@ +2000-06-01 12:15 UTC-0400 David G. Holm + + * doc/en/file.txt + + Added documentation for HB_FEOF( nHandle ) + + * source/rtl/filesys.c + + Added implementation of hb_fsEof() for defined(__CYGWIN__). + + * source/rtl/philes.c + + Added Harbour wrapper HB_FEOF( nHandle ) for hb_fsEof(). + + * source/rtl/gtos2/gtos2.c + ! Bug fix that should allow video mode changes to work + in full screen mode as well as in windowed mode. + 20000531-23:20 GMT -3 Luiz Rafael Culik *bin/bld.bat *changed HB_LIB_INSTALL to HB_INC_INSTALL on harbour /i command line diff --git a/harbour/doc/en/file.txt b/harbour/doc/en/file.txt index 8cc6559bee..cb5c52a16c 100644 --- a/harbour/doc/en/file.txt +++ b/harbour/doc/en/file.txt @@ -13,6 +13,9 @@ * Documentation for: FOPEN(), FCLOSE(), FWRITE(), FSEEK(), FREAD(), FILE(), * FREADSTR(), FRENAME(), FERROR(), RENAME, ERASE, CURDIR() * + * Copyright 2000 David G. Holm + * Documentation for: HB_FEOF() + * * See doc/license.txt for licensing terms. * */ @@ -900,3 +903,43 @@ * ERASE,RENAME,FRENAME(),FERASE() * $END$ */ + +/* $DOC$ + * $FUNCNAME$ + * HB_FEOF() + * $CATEGORY$ + * Low level + * $ONELINER$ + * Check for end-of-file. + * $SYNTAX$ + * HB_FEOF( ) --> lIsEof + * $ARGUMENTS$ + * The handle of an open file. + * $RETURNS$ + * .T. if the file handle is at end-of-file, otherwise .F. + * $DESCRIPTION$ + * This function checks an open file handle to see if it is at E-O-F. + + * If the file handle is missing, not numeric, or not open, then this + * function returns .T. and sets the value returned by FERROR() to -1 + * (FS_ERROR) or a C-compiler dependent errno value (EBADF or EINVAL). + * $EXAMPLES$ + + * nH:=FOPEN('FILE.TXT') + * ? FREADSTR(nH,80) + * IF HB_FEOF(nH) + * ? 'End-of-file reached.' + * ELSE + * ? FREADSTR(nH,80) + * ENDIF + * + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $FILES$ + * Library is rtl + * $SEEALSO$ + * FERROR() + * $END$ + */ diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index ae70210596..92270589b1 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -51,6 +51,7 @@ * hb_fsIsDevice() * * Copyright 2000 Luiz Rafael Culik + * and David G. Holm * hb_fsEof() * * See doc/license.txt for licensing terms. @@ -1461,5 +1462,20 @@ BOOL hb_fsFile( BYTE * pFilename ) BOOL hb_fsEof( FHANDLE hFileHandle ) { +#if defined(__CYGWIN__) + long curPos = lseek( hFileHandle, 0L, SEEK_CUR ); + long endPos = lseek( hFileHandle, 0L, SEEK_END ); + long newPos = lseek( hFileHandle, curPos, SEEK_SET ); + if( newPos == -1L ) + { + hb_fsSetError( errno ); + } + else if( newPos != curPos ) + { + hb_fsSetError( FS_ERROR ); + } + return curPos >= endPos; +#else return eof( hFileHandle ) != 0; +#endif } diff --git a/harbour/source/rtl/gtos2/gtos2.c b/harbour/source/rtl/gtos2/gtos2.c index 3194a034bc..2bb0ddbb3d 100644 --- a/harbour/source/rtl/gtos2/gtos2.c +++ b/harbour/source/rtl/gtos2/gtos2.c @@ -544,7 +544,6 @@ void hb_gt_SetCursorStyle( USHORT style ) { /* Chen Kedem */ char cellsize; - VIOCURSORINFO vi; HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetCursorStyle(%hu)", style)); @@ -749,10 +748,11 @@ BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetMode(%hu, %hu)", uiRows, uiCols)); + vi.cb = sizeof( VIOMODEINFO ); VioGetMode( &vi, 0 ); /* fill structure with current settings */ vi.row = uiRows; vi.col = uiCols; - return ( BOOL ) VioSetMode( &vi, 0 ); /* 0 = Ok, other = Fail */ + return ! ( BOOL ) VioSetMode( &vi, 0 ); /* 0 = Ok, other = Fail */ } BOOL hb_gt_GetBlink() diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index d7ccc3c569..8fde9bf3e6 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -42,6 +42,11 @@ * * See doc/license.txt for licensing terms. * + * Copyright 2000 David G. Holm + * HB_FEOF() + * + * See doc/license.txt for licensing terms. + * */ #include @@ -209,3 +214,15 @@ HB_FUNC( CURDIR ) hb_fsSetError( uiErrorOld ); } +HB_FUNC( HB_FEOF ) +{ + if( ISNUM( 1 ) ) + { + hb_retl( hb_fsEof( hb_parni( 1 ) ) ); + } + else + { + hb_fsSetError( FS_ERROR ); + hb_retl( 1 ); + } +}