19991012-02:30 GMT+1

This commit is contained in:
Viktor Szakats
1999-10-12 00:41:35 +00:00
parent 4e2ea257bd
commit 823f2a484a
6 changed files with 69 additions and 56 deletions

View File

@@ -1,3 +1,20 @@
19991012-02:30 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/filesys.c
+ Added some info about driver numbering to hb_fsChDrv(), hb_fsIsDrv(),
hb_fsCurDrv(), hb_fsCurDir()
+ hb_fsIsDevice() added. (by Jose Lalin), return value type changed to
BOOL to match Clipper.
! hb_fsIsDrv(), hb_fsChDrv() fixed to call the OS functions with the
right drive number. (Please test this!)
* include/ctoharb.h
+ More undocumented file functions added. (by Jose Lalin)
* include/filesys.h
! Missing hb_fsSetDev*() prototypes added.
* include/ctoharb.h
! Double copyright header fixed.
* source/vm/hvm.c
% w += 1 -> w++
19991011-23:54 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/fm.c
+ Newline readded to the closing //INFO message ;)

Binary file not shown.

View File

@@ -33,37 +33,6 @@
*
*/
/*
Harbour Project source code
Harbour from C caller functions
Copyright 1999 Antonio Linares <alinares@fivetech.com>
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 of the License, or
(at your option) any later version, with one exception:
The exception is that if you link the Harbour Runtime Library (HRL)
and/or the Harbour Virtual Machine (HVM) 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 HRL
and/or HVM code into it.
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 program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
their web site at http://www.gnu.org/).
*/
#ifndef HB_CTOHARB_H_
#define HB_CTOHARB_H_

View File

@@ -94,6 +94,7 @@ extern BOOL hb_fsFile ( BYTE * pFilename );
extern FHANDLE hb_fsExtOpen ( BYTE * pFilename, BYTE * pDefExt,
USHORT uiFlags, BYTE * pPaths, PHB_ITEM pError );
extern USHORT hb_fsIsDrv ( BYTE nDrive );
extern BOOL hb_fsIsDevice ( FHANDLE hFileHandle );
extern BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
ULONG ulLength, USHORT uiMode );
extern BOOL hb_fsMkDir ( BYTE * pDirName );
@@ -104,6 +105,8 @@ extern int hb_fsRename ( BYTE * pOldName, BYTE * pNewName );
extern ULONG hb_fsSeek ( FHANDLE hFileHandle, LONG lOffset, USHORT uiMode );
extern ULONG hb_fsTell ( FHANDLE hFileHandle );
extern void hb_fsSetDevMode ( FHANDLE hFileHandle, USHORT uiDevMode );
extern void hb_fsSetDevRaw ( FHANDLE hFileHandle );
extern void hb_fsSetDevText ( FHANDLE hFileHandle );
extern void hb_fsSetError ( USHORT uiError );
extern USHORT hb_fsWrite ( FHANDLE hFileHandle, BYTE * pBuff, USHORT ulCount );

View File

@@ -57,6 +57,7 @@
* hb_fsChDrv()
* hb_fsCurDrv()
* hb_fsIsDrv()
* hb_fsIsDevice()
*
* See doc/license.txt for licensing terms.
*
@@ -475,6 +476,16 @@ void hb_fsSetDevMode( FHANDLE hFileHandle, USHORT uiDevMode )
}
void hb_fsSetDevRaw( FHANDLE hFileHandle )
{
hb_fsSetDevMode( hFileHandle, FD_BINARY );
}
void hb_fsSetDevText( FHANDLE hFileHandle )
{
hb_fsSetDevMode( hFileHandle, FD_TEXT );
}
USHORT hb_fsRead( FHANDLE hFileHandle, BYTE * pBuff, USHORT uiCount )
{
USHORT uiRead;
@@ -894,6 +905,7 @@ BOOL hb_fsRmDir( BYTE * pDirname )
}
/* TODO: Make it thread safe */
/* NOTE: 0 = current drive, 1 = A, 2 = B, 3 = C, etc. */
BYTE * hb_fsCurDir( USHORT uiDrive )
{
@@ -917,8 +929,8 @@ BYTE * hb_fsCurDir( USHORT uiDrive )
return ( BYTE * ) cwd_buff;
}
/* TODO: add documentation
*/
/* NOTE: 0=A:, 1=B:, 2=C:, 3=D:, ... */
/* TODO: add documentation */
USHORT hb_fsChDrv( BYTE nDrive )
{
@@ -929,8 +941,8 @@ USHORT hb_fsChDrv( BYTE nDrive )
USHORT uiSave = _getdrive();
errno = 0;
_chdrive( nDrive );
if( nDrive == _getdrive() )
_chdrive( nDrive + 1 );
if( ( nDrive + 1 ) == _getdrive() )
{
uiResult = 0;
s_uiErrorLast = errno;
@@ -952,9 +964,9 @@ USHORT hb_fsChDrv( BYTE nDrive )
*/
_dos_getdrive( &uiSave );
_dos_setdrive( nDrive, &uiTotal );
_dos_setdrive( nDrive + 1, &uiTotal );
_dos_getdrive( &uiTotal );
if( nDrive == uiTotal )
if( ( nDrive + 1 ) == uiTotal )
{
uiResult = 0;
s_uiErrorLast = 0;
@@ -976,6 +988,9 @@ USHORT hb_fsChDrv( BYTE nDrive )
return uiResult;
}
/* NOTE: 0=A:, 1=B:, 2=C:, 3=D:, ... */
/* TODO: add documentation */
USHORT hb_fsIsDrv( BYTE nDrive )
{
USHORT uiResult;
@@ -985,8 +1000,8 @@ USHORT hb_fsIsDrv( BYTE nDrive )
USHORT uiSave = _getdrive();
errno = 0;
_chdrive( nDrive );
if( nDrive == _getdrive() )
_chdrive( nDrive + 1 );
if( ( nDrive + 1 ) == _getdrive() )
{
uiResult = 0;
s_uiErrorLast = errno;
@@ -1011,9 +1026,9 @@ USHORT hb_fsIsDrv( BYTE nDrive )
s_uiErrorLast = 0;
uiResult = 0;
_dos_setdrive( nDrive, &uiTotal );
_dos_setdrive( nDrive + 1, &uiTotal );
_dos_getdrive( &uiTotal );
if( nDrive != uiTotal )
if( ( nDrive + 1 ) != uiTotal )
{
s_uiErrorLast = FS_ERROR;
uiResult = FS_ERROR;
@@ -1030,9 +1045,29 @@ USHORT hb_fsIsDrv( BYTE nDrive )
return uiResult;
}
/* TODO: add documentation
* QUESTION: Is A: drive numbered as 0 or as 1 ?
*/
BOOL hb_fsIsDevice( FHANDLE hFileHandle )
{
BOOL bResult;
#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__)
errno = 0;
bResult = ( isatty( hFileHandle ) == 0 );
s_uiErrorLast = errno;
#else
bResult = FALSE;
s_uiErrorLast = FS_ERROR;
#endif
return bResult;
}
/* NOTE: 0=A:, 1=B:, 2=C:, 3=D:, ... */
/* TODO: add documentation */
BYTE hb_fsCurDrv( void )
{
USHORT uiResult;
@@ -1738,16 +1773,6 @@ HARBOUR HB_HB_FNAMEMERGE( void )
hb_retc( hb_fsFNameMerge( szFileName, &pFileName ) );
}
void hb_fsSetDevRaw( FHANDLE hFileHandle )
{
hb_fsSetDevMode( hFileHandle, FD_BINARY );
}
void hb_fsSetDevText( FHANDLE hFileHandle )
{
hb_fsSetDevMode( hFileHandle, FD_TEXT );
}
/* NOTE: Clipper 5.3 undocumented */
HARBOUR HB_FSETDEVMOD( void )
@@ -1755,4 +1780,3 @@ HARBOUR HB_FSETDEVMOD( void )
if( ISNUM( 1 ) && ISNUM( 2 ) )
hb_fsSetDevMode( hb_parni( 1 ), hb_parni( 2 ) );
}

View File

@@ -959,7 +959,7 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
case HB_P_NOOP:
/* Intentionally do nothing */
w += 1;
w++;
break;
default: