From f14fbd7510ab54f62faaeb2b30a67c65849b92e8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 25 Jul 2000 11:55:27 +0000 Subject: [PATCH] 2000-07-25 13:47 UTC+0100 Victor Szakats --- harbour/ChangeLog | 44 +++++++++++++++++++++++++++++++ harbour/include/hbapierr.h | 7 ++--- harbour/source/rtl/abs.c | 7 +---- harbour/source/rtl/at.c | 7 +---- harbour/source/rtl/chrasc.c | 14 ++-------- harbour/source/rtl/datec.c | 14 ++-------- harbour/source/rtl/dateshb.c | 49 +++++------------------------------ harbour/source/rtl/do.c | 7 +---- harbour/source/rtl/errorapi.c | 24 ++++++++++------- harbour/source/rtl/left.c | 7 +---- harbour/source/rtl/len.c | 7 +---- harbour/source/rtl/math.c | 39 +++++----------------------- harbour/source/rtl/minmax.c | 14 ++-------- harbour/source/rtl/mod.c | 7 +---- harbour/source/rtl/replic.c | 14 ++-------- harbour/source/rtl/round.c | 14 ++-------- harbour/source/rtl/setkey.c | 4 --- harbour/source/rtl/space.c | 7 +---- harbour/source/rtl/str.c | 7 +---- harbour/source/rtl/strcase.c | 14 ++-------- harbour/source/rtl/strtran.c | 14 ++-------- harbour/source/rtl/strzero.c | 9 ++----- harbour/source/rtl/substr.c | 13 ++-------- harbour/source/rtl/transfrm.c | 7 +---- harbour/source/rtl/trim.c | 21 +++------------ harbour/source/rtl/type.c | 8 +----- harbour/source/rtl/val.c | 7 +---- harbour/source/vm/arrayshb.c | 7 +---- harbour/source/vm/classes.c | 16 ++---------- harbour/source/vm/eval.c | 7 +---- harbour/source/vm/hvm.c | 32 ++++++----------------- harbour/source/vm/memvars.c | 5 +--- 32 files changed, 121 insertions(+), 332 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dba12e8310..e7892fc43c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,47 @@ +2000-07-25 13:47 UTC+0100 Victor Szakats + + * source/rtl/errorapi.c + * include/hbapierr.h + + hb_errRT_BASE_SubstR() added, which will automatically return the + substituted value. + + * source/rtl/abs.c + * source/rtl/at.c + * source/rtl/chrasc.c + * source/rtl/datec.c + * source/rtl/dateshb.c + * source/rtl/do.c + * source/rtl/left.c + * source/rtl/len.c + * source/rtl/math.c + * source/rtl/minmax.c + * source/rtl/mod.c + * source/rtl/replic.c + * source/rtl/round.c + * source/rtl/space.c + * source/rtl/str.c + * source/rtl/strcase.c + * source/rtl/strtran.c + * source/rtl/strzero.c + * source/rtl/substr.c + * source/rtl/transfrm.c + * source/rtl/trim.c + * source/rtl/type.c + * source/rtl/val.c + * source/vm/arrayshb.c + * source/vm/classes.c + * source/vm/eval.c + * source/vm/hvm.c + * source/vm/memvars.c + * source/vm/runner.c + % hb_errRT_BASE_Subst() -> hb_itemReturn() -> hb_itemRelease() constructs + replaced with a simple call to hb_errRT_BASE_SubstR(), this way many + local variables were removed, the code got smaller and a bit faster. + The error handling code in the RTL functions is very simple now. + + * source/rtl/setkey.c + * Minor formatting. + 2000-07-24 18:25 UTC+0800 Ron Pinkas ! tests\test.dbf ! Recovered previous version. diff --git a/harbour/include/hbapierr.h b/harbour/include/hbapierr.h index bcc7fc87e7..e3282f7f2a 100644 --- a/harbour/include/hbapierr.h +++ b/harbour/include/hbapierr.h @@ -131,6 +131,7 @@ extern PHB_ITEM hb_errRT_New_Subst( USHORT uiSeverity, char * szSubSystem, 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 void hb_errRT_BASE_SubstR ( 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 ); @@ -141,16 +142,16 @@ extern void hb_errInternal ( ULONG ulIntCode, char * szText, char * struct HB_ERROR_INFO_; /* forward declaration */ #define HB_ERROR_HANDLE( hbfunc ) HB_ITEM_PTR hbfunc( struct HB_ERROR_INFO_ * ErrorInfo ) typedef HB_ERROR_HANDLE( HB_ERROR_HANDLER ); -typedef HB_ERROR_HANDLER *HB_ERROR_HANDLER_PTR; +typedef HB_ERROR_HANDLER * HB_ERROR_HANDLER_PTR; typedef struct HB_ERROR_INFO_ { HB_ERROR_HANDLER_PTR Func; HB_ITEM_PTR Error; void * Cargo; - struct HB_ERROR_INFO_ *Previous; + struct HB_ERROR_INFO_ * Previous; HB_ITEM_PTR ErrorBlock; -} HB_ERROR_INFO, *HB_ERROR_INFO_PTR; +} HB_ERROR_INFO, * HB_ERROR_INFO_PTR; /* set/get current error handler */ extern HB_ERROR_INFO_PTR hb_errorHandler( HB_ERROR_INFO_PTR pNewHandler ); diff --git a/harbour/source/rtl/abs.c b/harbour/source/rtl/abs.c index 5173f64064..afa15819bb 100644 --- a/harbour/source/rtl/abs.c +++ b/harbour/source/rtl/abs.c @@ -74,11 +74,6 @@ HB_FUNC( ABS ) } } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1089, NULL, "ABS" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "ABS" ); } diff --git a/harbour/source/rtl/at.c b/harbour/source/rtl/at.c index 9710fc99e7..95d2f6a513 100644 --- a/harbour/source/rtl/at.c +++ b/harbour/source/rtl/at.c @@ -50,11 +50,6 @@ HB_FUNC( AT ) hb_itemGetCPtr( pText ), hb_itemGetCLen( pText ) ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1108, NULL, "AT" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, "AT" ); } diff --git a/harbour/source/rtl/chrasc.c b/harbour/source/rtl/chrasc.c index 2ff6590ec6..9fe2270b68 100644 --- a/harbour/source/rtl/chrasc.c +++ b/harbour/source/rtl/chrasc.c @@ -58,12 +58,7 @@ HB_FUNC( CHR ) hb_retclen( szChar, 1 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1104, NULL, "CHR" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1104, NULL, "CHR" ); } /* converts a character value to an ASCII code */ @@ -79,11 +74,6 @@ HB_FUNC( ASC ) hb_retni( 0 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1107, NULL, "ASC" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1107, NULL, "ASC" ); } diff --git a/harbour/source/rtl/datec.c b/harbour/source/rtl/datec.c index daf4b63ee9..2c01735d78 100644 --- a/harbour/source/rtl/datec.c +++ b/harbour/source/rtl/datec.c @@ -65,12 +65,7 @@ HB_FUNC( CMONTH ) hb_retc( hb_dateCMonth( lMonth ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1116, NULL, "CMONTH" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1116, NULL, "CMONTH" ); } HB_FUNC( CDOW ) @@ -92,11 +87,6 @@ HB_FUNC( CDOW ) hb_retc( "" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1117, NULL, "CDOW" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1117, NULL, "CDOW" ); } diff --git a/harbour/source/rtl/dateshb.c b/harbour/source/rtl/dateshb.c index 1999b8c0ad..21de5fde50 100644 --- a/harbour/source/rtl/dateshb.c +++ b/harbour/source/rtl/dateshb.c @@ -158,12 +158,7 @@ HB_FUNC( CTOD ) hb_retds( szDateFormat ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1119, NULL, "CTOD" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1119, NULL, "CTOD" ); } HB_FUNC( DTOC ) @@ -176,12 +171,7 @@ HB_FUNC( DTOC ) hb_retc( hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, hb_set.HB_SET_DATEFORMAT ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1118, NULL, "DTOC" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1118, NULL, "DTOC" ); } HB_FUNC( DTOS ) @@ -193,12 +183,7 @@ HB_FUNC( DTOS ) hb_retc( hb_pardsbuff( szDate, 1 ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1120, NULL, "DTOS" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, "DTOS" ); } /* NOTE: Harbour extension, exactly the same as STOD(). */ @@ -221,12 +206,7 @@ HB_FUNC( YEAR ) hb_retnllen( lYear, 5 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1112, NULL, "YEAR" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1112, NULL, "YEAR" ); } HB_FUNC( MONTH ) @@ -242,12 +222,7 @@ HB_FUNC( MONTH ) hb_retnllen( lMonth, 3 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1113, NULL, "MONTH" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1113, NULL, "MONTH" ); } HB_FUNC( DAY ) @@ -263,12 +238,7 @@ HB_FUNC( DAY ) hb_retnllen( lDay, 3 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1114, NULL, "DAY" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1114, NULL, "DAY" ); } HB_FUNC( TIME ) @@ -305,11 +275,6 @@ HB_FUNC( DOW ) hb_retnllen( 0, 3 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1115, NULL, "DOW" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, "DOW" ); } diff --git a/harbour/source/rtl/do.c b/harbour/source/rtl/do.c index 20a8a953d2..beddd626b6 100644 --- a/harbour/source/rtl/do.c +++ b/harbour/source/rtl/do.c @@ -85,11 +85,6 @@ HB_FUNC( DO ) hb_vmDo( uiPCount - 1 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 3012, NULL, "DO" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "DO" ); } diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 9da2a9237e..73d2f96c09 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -323,11 +323,11 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError ) */ s_errorHandler->Error = pError; s_errorHandler->ErrorBlock = &s_errorBlock; - pResult = (s_errorHandler->Func)( s_errorHandler ); + pResult = ( s_errorHandler->Func )( s_errorHandler ); s_errorHandler->Error = NULL; } else - pResult = hb_itemDo( &s_errorBlock, 1, pError ); + pResult = hb_itemDo( &s_errorBlock, 1, pError ); hb_gcUnlockItem( pError ); s_iLaunchCount--; @@ -338,14 +338,14 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError ) if( usRequest == HB_QUIT_REQUESTED ) { if( pResult ) - hb_itemRelease( pResult ); + hb_itemRelease( pResult ); hb_errRelease( pError ); hb_vmQuit(); } else if( usRequest == HB_BREAK_REQUESTED || usRequest == HB_ENDPROC_REQUESTED ) { if( pResult ) - hb_itemRelease( pResult ); + hb_itemRelease( pResult ); pResult = NULL; } else @@ -733,11 +733,10 @@ HB_FUNC( __ERRRT_BASE ) HB_FUNC( __ERRRT_SBASE ) { - hb_itemRelease( hb_itemReturn( - hb_errRT_BASE_Subst( ( ULONG ) hb_parnl( 1 ), - ( ULONG ) hb_parnl( 2 ), - ISCHAR( 3 ) ? hb_parc( 3 ) : NULL, - hb_parc( 4 ) ) ) ); + hb_errRT_BASE_SubstR( ( ULONG ) hb_parnl( 1 ), + ( ULONG ) hb_parnl( 2 ), + ISCHAR( 3 ) ? hb_parc( 3 ) : NULL, + hb_parc( 4 ) ); } USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) @@ -779,6 +778,13 @@ PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescrip return pRetVal; } +void hb_errRT_BASE_SubstR( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +{ + PHB_ITEM pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + hb_itemRelease( hb_itemReturn( hb_errLaunchSubst( pError ) ) ); + hb_errRelease( pError ); +} + USHORT hb_errRT_TERM( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags ) { USHORT uiAction; diff --git a/harbour/source/rtl/left.c b/harbour/source/rtl/left.c index 58a8f77ab1..590ee8a43f 100644 --- a/harbour/source/rtl/left.c +++ b/harbour/source/rtl/left.c @@ -55,11 +55,6 @@ HB_FUNC( LEFT ) hb_retclen( hb_itemGetCPtr( pText ), lLen ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1124, NULL, "LEFT" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1124, NULL, "LEFT" ); } diff --git a/harbour/source/rtl/len.c b/harbour/source/rtl/len.c index cbfd58e3f7..5723afde39 100644 --- a/harbour/source/rtl/len.c +++ b/harbour/source/rtl/len.c @@ -59,10 +59,5 @@ HB_FUNC( LEN ) } } - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1111, NULL, "LEN" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, "LEN" ); } diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index 15501337b7..e1395dbfd7 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -116,12 +116,8 @@ HB_FUNC( EXP ) if( s_internal_math_error ) { - PHB_ITEM pResult = hb_errRT_BASE_Subst( s_internal_math_error, 1096, NULL, "EXP" ); - + hb_errRT_BASE_SubstR( s_internal_math_error, 1096, NULL, "EXP" ); s_internal_math_error = 0; - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); } else hb_retnd( dResult ); @@ -130,12 +126,7 @@ HB_FUNC( EXP ) #endif } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1096, NULL, "EXP" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1096, NULL, "EXP" ); } HB_FUNC( LOG ) @@ -147,12 +138,8 @@ HB_FUNC( LOG ) if( s_internal_math_error ) { - PHB_ITEM pResult = hb_errRT_BASE_Subst( s_internal_math_error, 1095, NULL, "LOG" ); - + hb_errRT_BASE_SubstR( s_internal_math_error, 1095, NULL, "LOG" ); s_internal_math_error = 0; - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); } else hb_retnd( dResult ); @@ -167,12 +154,7 @@ HB_FUNC( LOG ) #endif } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1095, NULL, "LOG" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1095, NULL, "LOG" ); } HB_FUNC( SQRT ) @@ -184,12 +166,8 @@ HB_FUNC( SQRT ) if( s_internal_math_error ) { - PHB_ITEM pResult = hb_errRT_BASE_Subst( s_internal_math_error, 1097, NULL, "SQRT" ); - + hb_errRT_BASE_SubstR( s_internal_math_error, 1097, NULL, "SQRT" ); s_internal_math_error = 0; - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); } else hb_retnd( dResult ); @@ -200,11 +178,6 @@ HB_FUNC( SQRT ) #endif } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1097, NULL, "SQRT" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1097, NULL, "SQRT" ); } diff --git a/harbour/source/rtl/minmax.c b/harbour/source/rtl/minmax.c index 043961f4ff..1581a6789f 100644 --- a/harbour/source/rtl/minmax.c +++ b/harbour/source/rtl/minmax.c @@ -86,12 +86,7 @@ HB_FUNC( MAX ) hb_retds( hb_itemGetDL( p1 ) >= hb_itemGetDL( p2 ) ? hb_pardsbuff( szDate, 1 ) : hb_pardsbuff( szDate, 2 ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1093, NULL, "MAX" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1093, NULL, "MAX" ); } /* returns the minimum of two date or numerics */ @@ -143,11 +138,6 @@ HB_FUNC( MIN ) hb_retds( hb_itemGetDL( p1 ) <= hb_itemGetDL( p2 ) ? hb_pardsbuff( szDate, 1 ) : hb_pardsbuff( szDate, 2 ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1092, NULL, "MIN" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1092, NULL, "MIN" ); } diff --git a/harbour/source/rtl/mod.c b/harbour/source/rtl/mod.c index f0143d8538..e0c9c5c87f 100644 --- a/harbour/source/rtl/mod.c +++ b/harbour/source/rtl/mod.c @@ -82,12 +82,7 @@ HB_FUNC( MOD ) } } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1085, NULL, "%" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1085, NULL, "%" ); } /* diff --git a/harbour/source/rtl/replic.c b/harbour/source/rtl/replic.c index 4871edb8d8..85daf4a52c 100644 --- a/harbour/source/rtl/replic.c +++ b/harbour/source/rtl/replic.c @@ -66,22 +66,12 @@ HB_FUNC( REPLICATE ) hb_xfree( szResult ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_STROVERFLOW, 1234, NULL, "REPLICATE" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_STROVERFLOW, 1234, NULL, "REPLICATE" ); } else hb_retc( "" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1106, NULL, "REPLICATE" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1106, NULL, "REPLICATE" ); } diff --git a/harbour/source/rtl/round.c b/harbour/source/rtl/round.c index e47d3bf6fa..adc45a2d80 100644 --- a/harbour/source/rtl/round.c +++ b/harbour/source/rtl/round.c @@ -64,12 +64,7 @@ HB_FUNC( INT ) hb_retndlen( dNumber >= 0 ? floor( dNumber ) : ceil( dNumber ), iWidth, 0 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1090, NULL, "INT" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1090, NULL, "INT" ); } double hb_numRound( double dResult, int iDec ) @@ -121,10 +116,5 @@ HB_FUNC( ROUND ) hb_retndlen( hb_numRound( hb_parnd( 1 ), iDec ), 0, HB_MAX( iDec, 0 ) ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1094, NULL, "ROUND" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1094, NULL, "ROUND" ); } diff --git a/harbour/source/rtl/setkey.c b/harbour/source/rtl/setkey.c index f59cfb548e..354ce1346f 100644 --- a/harbour/source/rtl/setkey.c +++ b/harbour/source/rtl/setkey.c @@ -187,12 +187,8 @@ HB_FUNC( SETKEY ) PHB_ITEM pIsActiveResults = sk_list_tmp->pIsActive ? hb_vmEvalBlockV( sk_list_tmp->pIsActive, 1, pKeyCode ) : NULL; if( pIsActiveResults == NULL || ! HB_IS_LOGICAL( pIsActiveResults ) || hb_itemGetL( pIsActiveResults ) ) - { #endif hb_itemReturn( sk_list_tmp->pAction ); -#if defined( HB_EXTENSION ) - } -#endif } } } diff --git a/harbour/source/rtl/space.c b/harbour/source/rtl/space.c index 28d4aa878f..6e4efd86c6 100644 --- a/harbour/source/rtl/space.c +++ b/harbour/source/rtl/space.c @@ -62,10 +62,5 @@ HB_FUNC( SPACE ) hb_retc( "" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1105, NULL, "SPACE" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1105, NULL, "SPACE" ); } diff --git a/harbour/source/rtl/str.c b/harbour/source/rtl/str.c index 7d00e01263..47bce25201 100644 --- a/harbour/source/rtl/str.c +++ b/harbour/source/rtl/str.c @@ -78,11 +78,6 @@ HB_FUNC( STR ) hb_retc( "" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1099, NULL, "STR" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR" ); } diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index aa9338f9be..78d0760b5f 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -97,12 +97,7 @@ HB_FUNC( LOWER ) hb_itemFreeC( pszBuffer ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1103, NULL, "LOWER" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1103, NULL, "LOWER" ); } /* converts string to upper case */ @@ -120,10 +115,5 @@ HB_FUNC( UPPER ) hb_itemFreeC( pszBuffer ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1102, NULL, "UPPER" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1102, NULL, "UPPER" ); } diff --git a/harbour/source/rtl/strtran.c b/harbour/source/rtl/strtran.c index 0c635b86c7..dd71b6bdb9 100644 --- a/harbour/source/rtl/strtran.c +++ b/harbour/source/rtl/strtran.c @@ -173,19 +173,9 @@ HB_FUNC( STRTRAN ) hb_retclen( szText, ulText ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ } diff --git a/harbour/source/rtl/strzero.c b/harbour/source/rtl/strzero.c index a42f81ea54..37dd281607 100644 --- a/harbour/source/rtl/strzero.c +++ b/harbour/source/rtl/strzero.c @@ -106,18 +106,13 @@ HB_FUNC( STRZERO ) hb_retc( "" ); } else - { #ifdef HB_C52_STRICT /* NOTE: In CA-Cl*pper STRZERO() is written in Clipper, and will call STR() to do the job, the error (if any) will also be thrown by STR(). [vszakats] */ - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1099, NULL, "STR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR" ); #else - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 9999, NULL, "STRZERO" ); + hb_errRT_BASE_SubstR( EG_ARG, 9999, NULL, "STRZERO" ); #endif - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } } } diff --git a/harbour/source/rtl/substr.c b/harbour/source/rtl/substr.c index 890cb218b1..cbb45a5b3d 100644 --- a/harbour/source/rtl/substr.c +++ b/harbour/source/rtl/substr.c @@ -73,11 +73,7 @@ HB_FUNC( SUBSTR ) } else { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1110, NULL, "SUBSTR" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - + hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR" ); /* NOTE: Exit from inside [vszakats] */ return; } @@ -94,10 +90,5 @@ HB_FUNC( SUBSTR ) hb_retc( "" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1110, NULL, "SUBSTR" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR" ); } diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index a672b85a36..f1edc6711c 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -605,11 +605,6 @@ HB_FUNC( TRANSFORM ) /* If there was any parameter error, launch a runtime error */ if( bError ) - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1122, NULL, "TRANSFORM" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1122, NULL, "TRANSFORM" ); } diff --git a/harbour/source/rtl/trim.c b/harbour/source/rtl/trim.c index 6778bfb9f6..d712d0e178 100644 --- a/harbour/source/rtl/trim.c +++ b/harbour/source/rtl/trim.c @@ -85,12 +85,7 @@ HB_FUNC( LTRIM ) hb_retclen( szText, ulLen ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1101, NULL, "LTRIM" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1101, NULL, "LTRIM" ); } /* trims trailing spaces from a string */ @@ -109,13 +104,8 @@ HB_FUNC( RTRIM ) ISLOG( 2 ) ? hb_parl( 2 ) : FALSE ) ); } else - { /* NOTE: "TRIM" is right here [vszakats] */ - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1100, NULL, "TRIM" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1100, NULL, "TRIM" ); } /* synonymn for RTRIM */ @@ -143,12 +133,7 @@ HB_FUNC( ALLTRIM ) } else #ifdef HB_COMPAT_C53 - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 2022, NULL, "ALLTRIM" ); /* NOTE: This appeared in CA-Cl*pper 5.3 [vszakats] */ - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM" ); /* NOTE: This appeared in CA-Cl*pper 5.3 [vszakats] */ #else hb_retc( "" ); #endif diff --git a/harbour/source/rtl/type.c b/harbour/source/rtl/type.c index 355f42068f..1e4198e099 100644 --- a/harbour/source/rtl/type.c +++ b/harbour/source/rtl/type.c @@ -34,7 +34,6 @@ */ #include "hbapi.h" -#include "hbapiitm.h" #include "hbapierr.h" HB_FUNC( TYPE ) @@ -44,11 +43,6 @@ HB_FUNC( TYPE ) if( pItem ) hb_retc( hb_macroGetType( pItem ) ); else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1121, NULL, "TYPE" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1121, NULL, "TYPE" ); } diff --git a/harbour/source/rtl/val.c b/harbour/source/rtl/val.c index b5805390da..40a95aa6a3 100644 --- a/harbour/source/rtl/val.c +++ b/harbour/source/rtl/val.c @@ -122,10 +122,5 @@ HB_FUNC( VAL ) } } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1098, NULL, "VAL" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, "VAL" ); } diff --git a/harbour/source/vm/arrayshb.c b/harbour/source/vm/arrayshb.c index 679748653f..89fc84edfa 100644 --- a/harbour/source/vm/arrayshb.c +++ b/harbour/source/vm/arrayshb.c @@ -105,12 +105,7 @@ HB_FUNC( AADD ) hb_errRT_BASE( EG_BOUND, 1187, NULL, "AADD" ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1123, NULL, "AADD" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_ARG, 1123, NULL, "AADD" ); } /* NOTE: CA-Cl*pper 5.3 and older will return NIL on bad parameter, 5.3a,b diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index 5dfa23d26f..a3a247b749 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -1825,14 +1825,7 @@ HB_FUNC( __EVAL ) hb_vmDo( ( USHORT ) hb_pcount() ); /* Self is also an argument */ } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, "EVAL" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } - - hb_itemRelease( pObject ); + hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, "EVAL" ); } /* ================================================ */ @@ -1997,12 +1990,7 @@ static HARBOUR hb___msgEval( void ) hb_vmDo( ( USHORT ) hb_pcount() ); /* Self is also an argument */ } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, "EVAL" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, "EVAL" ); } /* diff --git a/harbour/source/vm/eval.c b/harbour/source/vm/eval.c index 5e789342e6..4207c7586b 100644 --- a/harbour/source/vm/eval.c +++ b/harbour/source/vm/eval.c @@ -58,11 +58,6 @@ HB_FUNC( EVAL ) hb_vmDo( uiPCount - 1 ); } else - { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, "EVAL" ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, "EVAL" ); } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 7b77a8671d..58de8fd282 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -2780,20 +2780,12 @@ void hb_vmDo( USHORT uiParams ) if( pFunc ) pFunc(); + else if( pSym->szName[ 0 ] == '_' ) + hb_errRT_BASE_SubstR( EG_NOVARMETHOD, 1005, NULL, pSym->szName + 1 ); else - { - PHB_ITEM pResult; - - if( pSym->szName[ 0 ] == '_' ) - pResult = hb_errRT_BASE_Subst( EG_NOVARMETHOD, 1005, NULL, pSym->szName + 1 ); - else - pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, pSym->szName ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, pSym->szName ); } - else /* it is a function */ + else /* it is a function */ { pFunc = pSym->pFunPtr; @@ -2875,20 +2867,12 @@ void hb_vmSend( USHORT uiParams ) if( pFunc ) pFunc(); + else if( pSym->szName[ 0 ] == '_' ) + hb_errRT_BASE_SubstR( EG_NOVARMETHOD, 1005, NULL, pSym->szName + 1 ); else - { - PHB_ITEM pResult; - - if( pSym->szName[ 0 ] == '_' ) - pResult = hb_errRT_BASE_Subst( EG_NOVARMETHOD, 1005, NULL, pSym->szName + 1 ); - else - pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, pSym->szName ); - - if( pResult ) - hb_itemRelease( hb_itemReturn( pResult ) ); - } + hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, pSym->szName ); } - else /* it is a function */ + else /* it is a function */ { pFunc = pSym->pFunPtr; diff --git a/harbour/source/vm/memvars.c b/harbour/source/vm/memvars.c index 29a16b1c49..dd2b0ede1c 100644 --- a/harbour/source/vm/memvars.c +++ b/harbour/source/vm/memvars.c @@ -1140,10 +1140,7 @@ HB_FUNC( __MVGET ) /* TODO: This should be expanded a little to report a passed incorrect * value to the error handler */ - HB_ITEM_PTR pRetValue = hb_errRT_BASE_Subst( EG_ARG, 3009, NULL, NULL ); - - if( pRetValue ) - hb_itemRelease( hb_itemReturn( pRetValue ) ); + hb_errRT_BASE_SubstR( EG_ARG, 3009, NULL, NULL ); } }