19990901-17:20 GMT+1

This commit is contained in:
Viktor Szakats
1999-09-01 15:43:27 +00:00
parent d06958a9a0
commit 19646e1ca5
10 changed files with 92 additions and 32 deletions

View File

@@ -1,3 +1,30 @@
19990901-17:20 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/set.c
funclist.txt
+ SetCancel() function added.
* source/vm/hvm.c
! hb_vmRequestCancel() now diplays correctly on DOS/DJGPP, since it's
using hb_consoleGetNewLine() to display a newline instead of '\n'.
* source/runner/runlib.c
! __HRBRUN() now handles if the error launcher returns with an E_BREAK.
* source/rtl/copyfile.c
! The error launching now also reacts to a BREAK correctly.
* source/compiler/harbour.l
! At one place BREAK was not converted to uppercase, so the generated pcode
was faulty. RTL_TEST.PRG didn't link because of that.
(Ryszard, is this the correct fix ?)
* source/rtl/errorapi.c
! szOperation now can be NULL. This caused some error launchings to GPF,
for example BADALIAS calls in HVM.C.
* IS_*() internal macros changed to hb_itemType() calls.
* source/rtl/filesys.c
+ Added runtime error 2018 to DISKSPACE().
* source/vm/hvm.c
! Fixed a variable name which went out sync between the last two CVS
sessions.
* source/rtl/inkey.c
+ Added copyright info.
19990901-15:40 GMT+1 Victor Szel <info@szelvesz.hu>
* source/compiler/harbour.y
+ It will now recognize and accept filenames specified via the

View File

@@ -210,7 +210,7 @@ SECONDS ;R;
SELECT ;R;
SET ;R;
SETBLINK ;S;
SETCANCEL ;N;
SETCANCEL ;R;
SETCOLOR ;S;
SETCURSOR ;S;
SETKEY ;R;

View File

@@ -41,8 +41,8 @@
#include "hbdefs.h"
/* Functions defined in harbour.y */
char *yy_strupr( char * );
char * yy_strdup( char *p );
char * yy_strupr( char * p );
char * yy_strdup( char * p );
extern void hb_xfree( void * pMem ); /* frees memory */
/* YACC functions */
@@ -229,7 +229,7 @@ Separator {SpaceTab}
BEGIN BREAK_;
else
{
yylval.string = yy_strdup( yytext );
yylval.string = yy_strupr( yy_strdup( yytext ) );
_iState =IDENTIFIER;
return IDENTIFIER;
}
@@ -244,7 +244,7 @@ Separator {SpaceTab}
* There are no resons to limit this use in Harbour.
*/
/*
<BREAK_>{Separator}*[\[] {
<BREAK_>{Separator}*[\[] {
if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0;
GenError( _szCErrors, 'E', ERR_SYNTAX, yytext, NULL );
}

View File

@@ -43,7 +43,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest, ULONG * pulWrittenTotal )
while( ( fhndSource = hb_fsOpen( ( BYTE * ) szSource, FO_READ ) ) == FS_ERROR )
{
if( hb_errRT_BASE_Ext1( EG_OPEN, 2012, NULL, szSource, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ) == E_DEFAULT )
WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 2012, NULL, szSource, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY );
if( wResult == E_DEFAULT || wResult == E_BREAK )
{
ulWrittenTotal = ( ULONG ) -1L;
break;
@@ -54,7 +56,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest, ULONG * pulWrittenTotal )
{
while( ( fhndDest = hb_fsCreate( ( BYTE * ) szDest, FC_NORMAL ) ) == FS_ERROR )
{
if( hb_errRT_BASE_Ext1( EG_CREATE, 2012, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ) == E_DEFAULT )
WORD wResult = hb_errRT_BASE_Ext1( EG_CREATE, 2012, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY );
if( wResult == E_DEFAULT || wResult == E_BREAK )
{
ulWrittenTotal = ( ULONG ) -2L;
break;
@@ -79,7 +83,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest, ULONG * pulWrittenTotal )
{
while( ( usWritten = hb_fsWrite( fhndDest, buffer, usRead ) ) != usRead )
{
if( hb_errRT_BASE_Ext1( EG_WRITE, 2016, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ) == E_DEFAULT )
WORD wResult = hb_errRT_BASE_Ext1( EG_WRITE, 2016, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY );
if( wResult == E_DEFAULT || wResult == E_BREAK )
{
bRetVal = FALSE;
break;

View File

@@ -114,7 +114,7 @@ WORD hb_errLaunch( PHB_ITEM pError )
/* Check if we have a valid error handler */
if( ! IS_BLOCK( &s_errorBlock ) )
if( hb_itemType( &s_errorBlock ) != IT_BLOCK )
hb_errInternal( 9999, "No ERRORBLOCK() for error", NULL, NULL );
/* Check if the error launcher was called too many times recursively */
@@ -161,7 +161,7 @@ WORD hb_errLaunch( PHB_ITEM pError )
/* If the error block didn't return a logical value, */
/* or the canSubstitute flag has been set, consider it as a failure */
if( ! IS_LOGICAL( pResult ) || ( uiFlags & EF_CANSUBSTITUTE ) )
if( hb_itemType( pResult ) != IT_LOGICAL || ( uiFlags & EF_CANSUBSTITUTE ) )
bFailure = TRUE;
else
{
@@ -206,7 +206,7 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError )
/* Check if we have a valid error handler */
if( ! IS_BLOCK( &s_errorBlock ) )
if( hb_itemType( &s_errorBlock ) != IT_BLOCK )
hb_errInternal( 9999, "No ERRORBLOCK() for error", NULL, NULL );
/* Check if the error launcher was called too many times recursively */
@@ -495,13 +495,12 @@ static WORD hb_errRT_New(
{
PHB_ITEM pError = hb_errNew();
WORD wRetVal;
hb_errPutSeverity( pError, uiSeverity );
hb_errPutSubSystem( pError, szSubSystem );
hb_errPutGenCode( pError, ulGenCode );
hb_errPutSubCode( pError, ulSubCode );
hb_errPutDescription( pError, szDescription ? szDescription : hb_langDGetErrorDesc( ulGenCode ) );
hb_errPutOperation( pError, szOperation );
hb_errPutOperation( pError, szOperation ? szOperation : "" );
hb_errPutOsCode( pError, uiOsCode );
hb_errPutFlags( pError, uiFlags );
@@ -530,7 +529,7 @@ static PHB_ITEM hb_errRT_New_Subst(
hb_errPutGenCode( pError, ulGenCode );
hb_errPutSubCode( pError, ulSubCode );
hb_errPutDescription( pError, szDescription ? szDescription : hb_langDGetErrorDesc( ulGenCode ) );
hb_errPutOperation( pError, szOperation );
hb_errPutOperation( pError, szOperation ? szOperation : "" );
hb_errPutOsCode( pError, uiOsCode );
hb_errPutFlags( pError, uiFlags | EF_CANSUBSTITUTE );

View File

@@ -1007,24 +1007,33 @@ HARBOUR HB_DIRREMOVE( void )
HARBOUR HB_DISKSPACE( void )
{
USHORT nDrive = ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ?
( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' + 1 ) : 0;
ULONG ulSpaceFree = 0;
USHORT uiDrive = ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ?
( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' + 1 ) : 0;
#ifdef DOS
struct diskfree_t disk;
unsigned uiResult;
_dos_getdiskfree( nDrive, &disk );
while( ( uiResult = _dos_getdiskfree( uiDrive, &disk ) ) != 0 )
{
WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT )
hb_retnl( ( LONG ) ( ( ULONG ) disk.avail_clusters *
( ULONG ) disk.sectors_per_cluster *
( ULONG ) disk.bytes_per_sector ) );
if( wResult == E_DEFAULT || wResult == E_BREAK )
break;
}
if( uiResult != 0 )
ulSpaceFree = ( ( ULONG ) disk.avail_clusters *
( ULONG ) disk.sectors_per_cluster *
( ULONG ) disk.bytes_per_sector );
#else
HB_SYMBOL_UNUSED( nDrive );
hb_retnl( 0 );
HB_SYMBOL_UNUSED( uiDrive );
#endif
hb_retnl( ( LONG ) ulSpaceFree );
}
HARBOUR HB_DISKCHANGE( void )

View File

@@ -38,6 +38,14 @@
V 1.1 David G. Holm Committed to CVS.
V 1.0 David G. Holm Initial version.
*/
/* Harbour Project source code
http://www.Harbour-Project.org/
The following functions are Copyright 1999 Victor Szel <info@szelvesz.hu>:
HB___KEYPUT()
See doc/hdr_tpl.txt, Version 1.2 or later, for licensing terms.
*/
/* Note: The following #ifdef block for __IBMCPP__ must be ahead
of any and all #include statements and requires that
Harbour includes are ahead of platform includes.
@@ -400,7 +408,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
#endif
if( ch )
{
if( ch == 302 )
if( ch == 302 ) /* K_ALT_C */
hb_vmRequestCancel( ); /* Alt-C was pressed */
hb_inkeyPut( ch );
}
@@ -605,8 +613,8 @@ HARBOUR HB___KEYBOARD( void )
}
while( size-- )
{
if( *fPtr )
{
if( *fPtr )
hb_inkeyPut( *fPtr );
++fPtr;
}

View File

@@ -326,6 +326,14 @@ static int open_handle( char * file_name, BOOL bMode, char * def_ext, HB_set_enu
#endif
}
HARBOUR HB_SETCANCEL( void )
{
hb_retl( hb_set.HB_SET_CANCEL );
if( ISLOG( 1 ) )
hb_set.HB_SET_CANCEL = hb_parl( 1 );
}
/* $DOC$
* $FUNCNAME$ __SETCENTURY( [<lFlag> | <cOnOff> ] ) --> lPreviousValue
* $ARGUMENTS$ optional <lFlag> or <cOnOff> (not case sensitive)

View File

@@ -109,17 +109,17 @@ HARBOUR HB___HRBRUN( void )
}
else
{
char *szFileName = hb_parc( 1 );
FILE *file;
char * szFileName = hb_parc( 1 );
FILE * file;
/* Open as binary */
while ( ( file = hb_hrbFileOpen( szFileName ) ) == NULL )
{
if( hb_errRT_BASE_Ext1( EG_OPEN, 9999, NULL, szFileName, 0, EF_CANDEFAULT | EF_CANRETRY ) == E_DEFAULT )
{
WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 9999, NULL, szFileName, 0, EF_CANDEFAULT | EF_CANRETRY );
if( wResult == E_DEFAULT && wResult == E_BREAK )
break;
}
}
if( file )
@@ -191,6 +191,7 @@ HARBOUR HB___HRBRUN( void )
if( !pDynSym )
{
hb_errRT_BASE( EG_ARG, 9999, "Unknown or unregistered symbol", pSymRead[ ul ].szName );
return;
}
pSymRead[ ul ].pFunPtr = pDynSym->pFunPtr;
}

View File

@@ -2973,7 +2973,9 @@ void hb_vmRequestCancel( void )
{
if( hb_set.HB_SET_CANCEL )
{
printf( "\nCancelled at: %s (%i)\n", stack.pBase->item.asSymbol.value->szName, stack.pBase->item.asSymbol.lineno );
printf( hb_consoleGetNewLine() );
printf( "Cancelled at: %s (%i)", stack.pBase->item.asSymbol.value->szName, stack.pBase->item.asSymbol.lineno );
printf( hb_consoleGetNewLine() );
s_wActionRequest = HB_QUIT_REQUESTED;
}
}