From 225b354eb80de63e46ed56a60d1bb2a180a5517f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 17 Sep 1999 02:17:30 +0000 Subject: [PATCH] 19990917-03:15 GMT+1 --- harbour/ChangeLog | 19 ++++++- harbour/include/errorapi.h | 12 ++--- harbour/source/rdd/dbcmd.c | 40 +++++++-------- harbour/source/rtl/copyfile.c | 12 ++--- harbour/source/rtl/errorapi.c | 58 ++++++++++----------- harbour/source/rtl/filesys.c | 4 +- harbour/source/rtl/memvars.c | 38 +++++++------- harbour/source/rtl/set.c | 13 ++--- harbour/source/rtl/transfrm.c | 82 +++++++++++++++--------------- harbour/source/runner/runlib.c | 4 +- harbour/tests/working/rtl_test.prg | 5 +- 11 files changed, 154 insertions(+), 133 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 18021992d1..389176a894 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,20 @@ +19990917-03:15 GMT+1 Victor Szel + + * source/rtl/transfrm.c + * WORD -> USHORT + * include/errorapi.h + source/rtl/errorapi.c + source/rtl/copyfile.c + source/rtl/filesys.c + source/rtl/memvars.c + source/rtl/set.c + source/runner/runlib.c + source/rdd/dbcmd.c + * Changed WORD to USHORT in all Error handling stuff. + * tests/working/rtl_test.prg + * Version() -> Version( 0 ) (xBase++ likes the numeric value better here, + but I could not test it) + 19990917-03:15 GMT+1 Victor Szel * source/rtl/console.c (mainly) @@ -14,7 +31,7 @@ it may be needed to place more explicit flush calls. This may have been an issue already since printf() is only flushing on \n chars, at least in MINGW32. - ! s_szAcceptResult is now initialized on startup to an empty string. + ! s_szAcceptResult is now initialized on startup as an empty string. ! One cast added to hb_retc()/SAVESCREEN(). * include/inkey.h + NOTE that is's used from C, too. diff --git a/harbour/include/errorapi.h b/harbour/include/errorapi.h index d3e8ae5f02..3f320f160f 100644 --- a/harbour/include/errorapi.h +++ b/harbour/include/errorapi.h @@ -86,7 +86,7 @@ extern USHORT hb_errGetSeverity ( PHB_ITEM pError ); extern USHORT hb_errGetSubCode ( PHB_ITEM pError ); extern char * hb_errGetSubSystem ( PHB_ITEM pError ); extern USHORT hb_errGetTries ( PHB_ITEM pError ); -extern WORD hb_errLaunch ( PHB_ITEM pError ); +extern USHORT hb_errLaunch ( PHB_ITEM pError ); extern PHB_ITEM hb_errNew ( void ); extern PHB_ITEM hb_errPutArgs ( PHB_ITEM pError, USHORT uiArgCount, ... ); extern PHB_ITEM hb_errPutDescription ( PHB_ITEM pError, char * szDescription ); @@ -124,12 +124,12 @@ extern PHB_ITEM hb_errRT_New_Subst( USHORT uiSeverity, char * szSubSystem, USHORT uiOsCode, USHORT uiFlags ); -extern WORD hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -extern WORD hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ); +extern USHORT hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern USHORT hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ); extern PHB_ITEM hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -extern WORD hb_errRT_TERM ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags ); -extern WORD hb_errRT_DBCMD ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -extern WORD hb_errRT_TOOLS ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern USHORT hb_errRT_TERM ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags ); +extern USHORT hb_errRT_DBCMD ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern USHORT hb_errRT_TOOLS ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); extern void hb_errInternal ( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 ); diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 006ae66b05..022998c674 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -688,21 +688,21 @@ ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias ) /* generate an error with retry possibility * (user created error handler can open a missing database) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOALIAS, 1002, NULL, pSymAlias->szName, 0, EF_CANRETRY ); bResult = FAILURE; - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) if( pSymAlias->pDynSym->hArea ) { bResult = hb_rddSelectWorkAreaNumber( pSymAlias->pDynSym->hArea ); - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } hb_errRelease( pError ); @@ -723,23 +723,23 @@ ERRCODE hb_rddSelectWorkAreaAlias( char * szName ) /* generate an error with retry possibility * (user created error handler can open a missing database) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOALIAS, 1002, NULL, szName, 0, EF_CANRETRY ); bResult = FAILURE; - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { pSymArea = hb_dynsymFindName( szName ); if( pSymArea && pSymArea->hArea ) { bResult = hb_rddSelectWorkAreaNumber( pSymArea->hArea ); - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } } @@ -758,20 +758,20 @@ ERRCODE hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ) /* generate an error with retry possibility * (user created error handler can make this field accessible) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pFieldSymbol->szName, 0, EF_CANRETRY ); - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { bSuccess = hb_rddFieldGet( pItem, pFieldSymbol ); if( bSuccess == SUCCESS ) - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } hb_errRelease( pError ); @@ -788,20 +788,20 @@ ERRCODE hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ) /* generate an error with retry possibility * (user created error handler can make this field accessible) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pFieldSymbol->szName, 0, EF_CANRETRY ); - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { bSuccess = hb_rddFieldPut( pItem, pFieldSymbol ); if( bSuccess == SUCCESS ) - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } hb_errRelease( pError ); diff --git a/harbour/source/rtl/copyfile.c b/harbour/source/rtl/copyfile.c index fbeb1a9f5f..4a73fdb56a 100644 --- a/harbour/source/rtl/copyfile.c +++ b/harbour/source/rtl/copyfile.c @@ -53,9 +53,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) while( ( fhndSource = hb_fsOpen( ( BYTE * ) szSource, FO_READ ) ) == FS_ERROR ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 2012, NULL, szSource, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2012, NULL, szSource, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } @@ -63,9 +63,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) { while( ( fhndDest = hb_fsCreate( ( BYTE * ) szDest, FC_NORMAL ) ) == FS_ERROR ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_CREATE, 2012, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_CREATE, 2012, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } @@ -87,9 +87,9 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) { while( ( usWritten = hb_fsWrite( fhndDest, buffer, usRead ) ) != usRead ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_WRITE, 2016, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_WRITE, 2016, NULL, szDest, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) { bRetVal = FALSE; break; diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 9e35b174b7..af175e3e20 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -128,9 +128,9 @@ PHB_ITEM hb_errNew( void ) return pReturn; } -WORD hb_errLaunch( PHB_ITEM pError ) +USHORT hb_errLaunch( PHB_ITEM pError ) { - WORD wRetVal; + USHORT uiAction; if( pError ) { @@ -165,7 +165,7 @@ WORD hb_errLaunch( PHB_ITEM pError ) else if( hb_vmRequestQuery() == HB_BREAK_REQUESTED ) { hb_itemRelease( pResult ); - wRetVal = E_BREAK; + uiAction = E_BREAK; } else { @@ -179,10 +179,10 @@ WORD hb_errLaunch( PHB_ITEM pError ) bFailure = TRUE; else { - wRetVal = hb_itemGetL( pResult ) ? E_RETRY : E_DEFAULT; + uiAction = hb_itemGetL( pResult ) ? E_RETRY : E_DEFAULT; - if( ( wRetVal == E_DEFAULT && !( uiFlags & EF_CANDEFAULT ) ) || - ( wRetVal == E_RETRY && !( uiFlags & EF_CANRETRY ) ) ) + if( ( uiAction == E_DEFAULT && !( uiFlags & EF_CANDEFAULT ) ) || + ( uiAction == E_RETRY && !( uiFlags & EF_CANRETRY ) ) ) bFailure = TRUE; } @@ -193,14 +193,14 @@ WORD hb_errLaunch( PHB_ITEM pError ) /* Add one try to the counter. */ - if( wRetVal == E_RETRY ) + if( uiAction == E_RETRY ) hb_errPutTries( pError, hb_errGetTries( pError ) + 1 ); } } else - wRetVal = E_RETRY; /* Clipper does this, undocumented */ + uiAction = E_RETRY; /* Clipper does this, undocumented */ - return wRetVal; + return uiAction; } /* This error launcher should be used in those situations, where the error @@ -587,30 +587,30 @@ HARBOUR HB___ERRRT_BASE( void ) hb_parc( 4 ) ); } -WORD hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) { - WORD wRetVal; + USHORT uiAction; PHB_ITEM pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); - wRetVal = hb_errLaunch( pError ); + uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); - return wRetVal; + return uiAction; } -WORD hb_errRT_BASE_Ext1( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ) +USHORT hb_errRT_BASE_Ext1( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ) { - WORD wRetVal; + USHORT uiAction; PHB_ITEM pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags ); - wRetVal = hb_errLaunch( pError ); + uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); - return wRetVal; + return uiAction; } PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) @@ -626,43 +626,43 @@ PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescrip return pRetVal; } -WORD hb_errRT_TERM( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags ) +USHORT hb_errRT_TERM( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags ) { - WORD wRetVal; + USHORT uiAction; PHB_ITEM pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_TERMINAL, ulGenCode, ulSubCode, szDescription, szOperation, uiOSCode, uiFlags ); - wRetVal = hb_errLaunch( pError ); + uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); - return wRetVal; + return uiAction; } -WORD hb_errRT_DBCMD( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +USHORT hb_errRT_DBCMD( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) { - WORD wRetVal; + USHORT uiAction; PHB_ITEM pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_DBCMD, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); - wRetVal = hb_errLaunch( pError ); + uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); - return wRetVal; + return uiAction; } -WORD hb_errRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +USHORT hb_errRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) { - WORD wRetVal; + USHORT uiAction; PHB_ITEM pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); - wRetVal = hb_errLaunch( pError ); + uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); - return wRetVal; + return uiAction; } /* NOTE: Use as minimal calls from here, as possible. */ diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 99c80c500b..57981513e5 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1259,9 +1259,9 @@ HARBOUR HB_DISKSPACE( void ) while( ( uiResult = _dos_getdiskfree( uiDrive, &disk ) ) != 0 ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index 124c7b207e..9e76ab887f 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -414,16 +414,16 @@ void hb_memvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) /* Generate an error with retry possibility * (user created error handler can create this variable) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pMemvarSymb->szName, 0, EF_CANRETRY ); - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { if( pDyn->hMemvar ) { @@ -434,7 +434,7 @@ void hb_memvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) hb_itemCopy( pItem, hb_itemUnRef( pGetItem ) ); else hb_itemCopy( pItem, pGetItem ); - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } } @@ -468,16 +468,16 @@ void hb_memvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) /* Generate an error with retry possibility * (user created error handler can make this variable accessible) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pMemvarSymb->szName, 0, EF_CANRETRY ); - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { if( pDyn->hMemvar ) { @@ -487,7 +487,7 @@ void hb_memvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) pItem->item.asMemvar.value = pDyn->hMemvar; pItem->item.asMemvar.itemsbase = &s_globalTable; ++s_globalTable[ pDyn->hMemvar ].counter; - wAction = E_DEFAULT; + uiAction = E_DEFAULT; } } } @@ -1449,16 +1449,16 @@ HARBOUR HB___MVGET( void ) /* Generate an error with retry possibility * (user created error handler can create this variable) */ - WORD wAction = E_RETRY; + USHORT uiAction = E_RETRY; HB_ITEM_PTR pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pName->item.asString.value, 0, EF_CANRETRY ); - while( wAction == E_RETRY ) + while( uiAction == E_RETRY ) { - wAction = hb_errLaunch( pError ); - if( wAction == E_RETRY ) + uiAction = hb_errLaunch( pError ); + if( uiAction == E_RETRY ) { pDynVar = hb_memvarFindSymbol( pName ); if( pDynVar ) @@ -1467,7 +1467,7 @@ HARBOUR HB___MVGET( void ) hb_memvarGetValue( &retValue, pDynVar->pSymbol ); hb_itemReturn( &retValue ); hb_itemClear( &retValue ); - wAction =E_DEFAULT; + uiAction = E_DEFAULT; } } } @@ -1600,9 +1600,9 @@ HARBOUR HB___MVSAVE( void ) while( ( fhnd = hb_fsCreate( ( BYTE * ) szFileName, FC_NORMAL ) ) == FS_ERROR ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_CREATE, 2006, NULL, szFileName, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_CREATE, 2006, NULL, szFileName, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } @@ -1744,9 +1744,9 @@ HARBOUR HB___MVRESTORE( void ) while( ( fhnd = hb_fsOpen( ( BYTE * ) szFileName, FO_READ | FO_SHARED ) ) == FS_ERROR ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 2005, NULL, szFileName, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2005, NULL, szFileName, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index 18ed373973..3b5043cea6 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -296,7 +296,6 @@ static FHANDLE open_handle( char * file_name, BOOL bAppend, char * def_ext, HB_s while( handle == FS_ERROR ) { BOOL bCreate = FALSE; - WORD wResult; if( bAppend ) { /* Append mode */ @@ -335,17 +334,19 @@ static FHANDLE open_handle( char * file_name, BOOL bAppend, char * def_ext, HB_s if( handle == FS_ERROR ) { + USHORT uiAction; + /* NOTE: using switch() here will result in a compiler warning */ if( set_specifier == HB_SET_ALTFILE ) - wResult = hb_errRT_TERM( EG_CREATE, 2013, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + uiAction = hb_errRT_TERM( EG_CREATE, 2013, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); else if( set_specifier == HB_SET_PRINTFILE ) - wResult = hb_errRT_TERM( EG_CREATE, 2014, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + uiAction = hb_errRT_TERM( EG_CREATE, 2014, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); else if( set_specifier == HB_SET_EXTRAFILE ) - wResult = hb_errRT_TERM( EG_CREATE, 2015, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); + uiAction = hb_errRT_TERM( EG_CREATE, 2015, NULL, path, hb_fsError(), EF_CANDEFAULT | EF_CANRETRY ); else - wResult = E_DEFAULT; + uiAction = E_DEFAULT; - if( wResult == E_DEFAULT || wResult == E_BREAK ) + if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; } } diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index 6ee375e881..b0851f8962 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -46,7 +46,7 @@ /* TODO: Getting rid of calling back HARBOUR HB_STR() function */ /* and #include "ctoharb.h" */ -/* TOFIX: TRANSFORM() is directly modifying an item string buffer. +/* TOFIX: TRANSFORM() is directly modifying an item string buffer. This is dangerous, and should be fixed. */ #include @@ -106,10 +106,10 @@ void hb_transformForceLink() szPict : Pointer to the picture ulPicLen : Pointer to the length. Changed during execution. */ -static WORD PictFunc( char **szPict, ULONG *pulPicLen ) +static USHORT PictFunc( char **szPict, ULONG *pulPicLen ) { - BOOL bDone = FALSE; - WORD wPicFlags = 0; + BOOL bDone = FALSE; + USHORT uiPicFlags = 0; char *szPic = *szPict; @@ -123,42 +123,42 @@ static WORD PictFunc( char **szPict, ULONG *pulPicLen ) bDone = TRUE; break; case '!': - wPicFlags |= PF_UPPER; + uiPicFlags |= PF_UPPER; break; case '(': - wPicFlags |= PF_PARNEG; + uiPicFlags |= PF_PARNEG; break; #ifndef HARBOUR_STRICT_CLIPPER_COMPATIBILITY case '0': - wPicFlags |= PF_ZERO; + uiPicFlags |= PF_ZERO; break; #endif case 'B': - wPicFlags |= PF_LEFT; + uiPicFlags |= PF_LEFT; break; case 'C': - wPicFlags |= PF_CREDIT; + uiPicFlags |= PF_CREDIT; break; case 'D': - wPicFlags |= PF_DATE; + uiPicFlags |= PF_DATE; break; case 'E': - wPicFlags |= PF_BRITISH; + uiPicFlags |= PF_BRITISH; break; case 'R': - wPicFlags |= PF_REMAIN; + uiPicFlags |= PF_REMAIN; break; case 'X': - wPicFlags |= PF_DEBIT; + uiPicFlags |= PF_DEBIT; break; case 'Z': - wPicFlags |= PF_EMPTY; + uiPicFlags |= PF_EMPTY; break; } szPic++; ( *pulPicLen )--; } - return wPicFlags; + return uiPicFlags; } /* @@ -166,13 +166,13 @@ static WORD PictFunc( char **szPict, ULONG *pulPicLen ) szPic : Picture lPic : Length of picture - wPicFlags : Function flags. NUM_DATE tells whether its a number or date + uiPicFlags : Function flags. NUM_DATE tells whether its a number or date dValue : Number to picture lRetSize : The size of the returned string is passed here ! iOrigWidth : Original width iOrigDec : Original decimals */ -static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValue, +static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dValue, ULONG *pulRetSize, int iOrigWidth, int iOrigDec ) { int iWidth; /* Width of string */ @@ -196,7 +196,7 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu for( i = 0; i < ulPic && !bFound; i++ ) /* Count number in front */ { if( szPic[ i ] == '.' ) - bFound = !( wPicFlags & PF_NUMDATE ); /* Exit when numeric */ + bFound = !( uiPicFlags & PF_NUMDATE ); /* Exit when numeric */ else if( szPic[ i ] == '9' || szPic[ i ] == '#' || szPic[ i ] == '$' || szPic[ i ] == '*' ) iCount++; @@ -220,12 +220,12 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu else iDecimals = 0; - if( ( wPicFlags & ( PF_DEBIT + PF_PARNEG ) ) && ( dValue < 0 ) ) + if( ( uiPicFlags & ( PF_DEBIT + PF_PARNEG ) ) && ( dValue < 0 ) ) dPush = -dValue; /* Always push absolute val */ else dPush = dValue; - bEmpty = !dPush && ( wPicFlags & PF_EMPTY ); /* Suppress 0 */ + bEmpty = !dPush && ( uiPicFlags & PF_EMPTY ); /* Suppress 0 */ hb_vmPushSymbol ( hb_dynsymGet( "STR" )->pSymbol ); /* Push STR function */ hb_vmPushNil (); /* Function call. No object */ @@ -246,7 +246,7 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu #ifndef HARBOUR_STRICT_CLIPPER_COMPATIBILITY /* Pad with Zero's */ - if( wPicFlags & PF_ZERO ) + if( uiPicFlags & PF_ZERO ) { for( i = 0; szStr[ i ] == ' ' && i < iWidth; i++ ) szStr[ i ] = '0'; @@ -260,7 +260,7 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu } /* Left align */ - if( wPicFlags & PF_LEFT ) + if( uiPicFlags & PF_LEFT ) { for( i = 0; szStr[ i ] == ' ' && i <= iWidth; i++ ); /* Find first non-space */ @@ -294,11 +294,11 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu szRet[ i ] = szStr[ iCount++ ]; /* Just copy */ else if( cPic == '.' ) { - if( wPicFlags & PF_NUMDATE ) /* Dot in date */ + if( uiPicFlags & PF_NUMDATE ) /* Dot in date */ szRet[ i ] = cPic; else /* Dot in number */ { - if( wPicFlags & PF_EXCHANG ) /* Exchange . and , */ + if( uiPicFlags & PF_EXCHANG ) /* Exchange . and , */ { szRet[ i ] = ','; iCount++; @@ -321,7 +321,7 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu { if( iCount && isdigit( szStr[ iCount - 1 ] ) ) { /* May we place it */ - if( wPicFlags & PF_EXCHANG ) + if( uiPicFlags & PF_EXCHANG ) szRet[ i ] = '.'; else szRet[ i ] = ','; @@ -335,21 +335,21 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu #if 0 } #endif - if( ( wPicFlags & PF_CREDIT ) && ( dValue >= 0 ) ) + if( ( uiPicFlags & PF_CREDIT ) && ( dValue >= 0 ) ) { szRet[ i++ ] = ' '; szRet[ i++ ] = 'C'; szRet[ i++ ] = 'R'; } - if( ( wPicFlags & PF_DEBIT ) && ( dValue < 0 ) ) + if( ( uiPicFlags & PF_DEBIT ) && ( dValue < 0 ) ) { szRet[ i++ ] = ' '; szRet[ i++ ] = 'D'; szRet[ i++ ] = 'B'; } - if( ( wPicFlags & PF_PARNEG ) && ( dValue < 0 ) ) + if( ( uiPicFlags & PF_PARNEG ) && ( dValue < 0 ) ) { if( isdigit( *szRet ) ) /* Overflow */ { @@ -376,12 +376,12 @@ static char * NumPicture( char *szPic, ULONG ulPic, WORD wPicFlags, double dValu DatePicture -> Handle dates. szDate : Date to handle - wPicFlags : Function flags + uiPicFlags : Function flags szResult : Buffer of at least size 11 to hold formatted date */ -static char * DatePicture( char * szDate, WORD wPicFlags, char * szResult ) +static char * DatePicture( char * szDate, USHORT uiPicFlags, char * szResult ) { - if( wPicFlags & PF_BRITISH ) + if( uiPicFlags & PF_BRITISH ) hb_dtoc( szDate, szResult, hb_set_century ? "DD/MM/YYYY" : "DD/MM/YY" ); else hb_dtoc( szDate, szResult, hb_set.HB_SET_DATEFORMAT ); @@ -411,11 +411,11 @@ HARBOUR HB_TRANSFORM( void ) ULONG ulResultPos = 0; ULONG n; - WORD wPicFlags = 0; /* Function flags */ + USHORT uiPicFlags = 0; /* Function flags */ if( *szPic == '@' ) /* Function marker found */ { - wPicFlags = PictFunc( &szPic, &ulPic ); /* Get length of function */ + uiPicFlags = PictFunc( &szPic, &ulPic ); /* Get length of function */ ulPicStart = pPic->item.asString.length - ulPic; /* Get start of template */ } @@ -431,7 +431,7 @@ HARBOUR HB_TRANSFORM( void ) /* Grab enough */ szPic += ulPicStart; /* Skip functions */ - if( wPicFlags & PF_UPPER ) /* Function : @! */ + if( uiPicFlags & PF_UPPER ) /* Function : @! */ { szTemp = szExp; /* Convert to upper */ for( n = pExp->item.asString.length; n != 0; n-- ) @@ -481,13 +481,13 @@ HARBOUR HB_TRANSFORM( void ) ulPic--; } } - else if( wPicFlags & ( PF_UPPER + PF_REMAIN ) ) + else if( uiPicFlags & ( PF_UPPER + PF_REMAIN ) ) { /* Without template */ for( n = pExp->item.asString.length; n != 0; n-- ) szResult[ ulResultPos++ ] = *szExp++; } - if( ( wPicFlags & PF_REMAIN ) && ulPic ) + if( ( uiPicFlags & PF_REMAIN ) && ulPic ) { /* Any chars left */ for( n = ulPic; n != 0; n-- ) szResult[ ulResultPos++ ] = *szPic; @@ -537,7 +537,7 @@ HARBOUR HB_TRANSFORM( void ) } } } - if( ( wPicFlags & PF_REMAIN ) && ulPic ) + if( ( uiPicFlags & PF_REMAIN ) && ulPic ) { /* Any chars left */ for( n = ulPic; n; n--) /* Copy remainder */ szResult[ ulResultPos++ ] = *szPic++; @@ -550,7 +550,7 @@ HARBOUR HB_TRANSFORM( void ) } case IT_INTEGER: { - szResult = NumPicture( szPic + ulPicStart, ulPic, wPicFlags, + szResult = NumPicture( szPic + ulPicStart, ulPic, uiPicFlags, ( double ) pExp->item.asInteger.value, &ulResultPos, pExp->item.asInteger.length, 0 ); hb_retclen( szResult, ulResultPos ); @@ -559,7 +559,7 @@ HARBOUR HB_TRANSFORM( void ) } case IT_LONG: { - szResult = NumPicture( szPic + ulPicStart, ulPic, wPicFlags, + szResult = NumPicture( szPic + ulPicStart, ulPic, uiPicFlags, ( double ) pExp->item.asLong.value, &ulResultPos, pExp->item.asLong.length, 0 ); hb_retclen( szResult, ulResultPos ); @@ -568,7 +568,7 @@ HARBOUR HB_TRANSFORM( void ) } case IT_DOUBLE: { - szResult = NumPicture( szPic + ulPicStart, ulPic, wPicFlags, + szResult = NumPicture( szPic + ulPicStart, ulPic, uiPicFlags, ( double ) pExp->item.asDouble.value, &ulResultPos, pExp->item.asDouble.length, pExp->item.asDouble.decimal ); hb_retclen( szResult, ulResultPos ); @@ -578,7 +578,7 @@ HARBOUR HB_TRANSFORM( void ) case IT_DATE: { char szResult[ 11 ]; - DatePicture( hb_pards( 1 ), wPicFlags, szResult ); + DatePicture( hb_pards( 1 ), uiPicFlags, szResult ); hb_retc( szResult ); break; } diff --git a/harbour/source/runner/runlib.c b/harbour/source/runner/runlib.c index fb4f48a321..ae03cef6b8 100644 --- a/harbour/source/runner/runlib.c +++ b/harbour/source/runner/runlib.c @@ -149,9 +149,9 @@ HARBOUR HB___HRBRUN( void ) while ( ( file = hb_hrbFileOpen( szFileName ) ) == NULL ) { - WORD wResult = hb_errRT_BASE_Ext1( EG_OPEN, 9999, NULL, szFileName, 0, EF_CANDEFAULT | EF_CANRETRY ); + USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 9999, NULL, szFileName, 0, EF_CANDEFAULT | EF_CANRETRY ); - if( wResult == E_DEFAULT && wResult == E_BREAK ) + if( uiAction == E_DEFAULT && uiAction == E_BREAK ) break; } diff --git a/harbour/tests/working/rtl_test.prg b/harbour/tests/working/rtl_test.prg index c736396627..8ad0abce07 100644 --- a/harbour/tests/working/rtl_test.prg +++ b/harbour/tests/working/rtl_test.prg @@ -2077,7 +2077,10 @@ STATIC FUNCTION TEST_BEGIN( cParam ) /* Feedback */ - fWrite( s_nFhnd, " Version: " + Version() + s_cNewLine +; + /* NOTE: The 0 parameter of Version() will force Harbour to include the + compiler version in the version string. */ + + fWrite( s_nFhnd, " Version: " + Version( 0 ) + s_cNewLine +; " OS: " + OS() + s_cNewLine +; " Date, Time: " + DToS( Date() ) + " " + Time() + s_cNewLine +; " Output: " + s_cFileName + s_cNewLine +;