diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5bc296899f..75743be5f7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,89 @@ +2001-03-22 11:00 UTC-0800 Ron Pinkas + + * hb_slex.vc + * Minor corrections. + + * include/hbapi.h + + extern PHB_ITEM hb_paramError( int iParam ); /* Returns either the generic parameter or a NIL item if param not provided */ + + extern PHB_ITEM hb_arrayFromStack( USHORT uiLen ); /* Creates and returns an Array of n Elements from the Eval Stack - Does NOT pop the items. */ + + extern PHB_ITEM hb_arrayFromParams( void ); /* Creates and returns an Array of current Generic Parameters. */ + + * include/hbapierr.h + * extern USHORT hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + * extern USHORT hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags, USHORT uiArgCount, ... ); + * extern PHB_ITEM hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + * extern void hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + + Added support for variable number of Error Arguments. + + * source/rtl/errorapi.c + * hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + * hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags, USHORT uiArgCount, ... ); + * hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + * hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); + + Added support for variable number of Error Arguments. + + * source/vm/arrays.c + + PHB_ITEM hb_arrayFromStack( USHORT uiLen ) + + PHB_ITEM hb_arrayFromParams( void ) + + * source/vm/extend.c + + PHB_ITEM hb_paramError( int iParam ) + + * source/rdd/dbcmd.c + * Added the Error Arguments as parameters to hb_errRT_BASE*(). + + * source/rtl/abs.c + * source/rtl/at.c + * source/rtl/chrasc.c + * source/rtl/copyfile.c + * source/rtl/datec.c + * source/rtl/dateshb.c + * source/rtl/diskspac.c + * source/rtl/disksphb.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/philes.c + * source/rtl/philesx.c + * source/rtl/replic.c + * source/rtl/round.c + * source/rtl/set.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/rtl/word.c + * Added the Error Arguments as parameters to hb_errRT_BASE*(). + + * source/vm/arrayshb.c + * source/vm/eval.c + * source/vm/hvm.c + * source/vm/macro.c + * source/vm/memvars.c + * source/vm/runner.c + * Added the Error Arguments as parameters to hb_errRT_BASE*(). + + * source/vm/classes.c + + Added 0 arguments (J.F. can you please decide what should be the arguments! ) + + /* HBTEST now reports 173 failures ( down from 376 ) many of the failures are justified. + + I have tested this as much as I could, but since it invloved lots of "Cust & Pasets" more testing should be done. + + It would be great if someone could review each of HBTEST Reported Failures on a one-by-one basis. + + BTW, HBTEST reports 1 UN-RELEASED Memory Block (from before my changes)! + */ + 2001-21-03 23:10 GMT+1 JFL (Mafact) *source/rdd/dbcmd.c *source/rdd/dbf1.c diff --git a/harbour/hb_slex.vc b/harbour/hb_slex.vc index fb49e6ce4e..e21ed9d293 100644 --- a/harbour/hb_slex.vc +++ b/harbour/hb_slex.vc @@ -83,7 +83,7 @@ HBPDF_DIR = contrib\pdflib # C compiler definition and C flags. These should never have to change. # -AS = masm +AS = ml CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS) CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) -DSIMPLEX CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS) @@ -546,7 +546,7 @@ COMMON_LIB_OBJS = \ {$(VM_DIR)}.asm{$(OBJ_DIR)}.obj: rem lib /extract:$(OBJ_DIR)\symbols.obj /out:$(OBJ_DIR)\symbols.obj \harb35\lib\vm.lib - $(AS) $< $@ nul nul + $(AS) /c /Fo$@ $< {$(VM_DIR)}.c{$(OBJ_DIR)}.obj: $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 283d10721c..946d5f3a00 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -259,6 +259,7 @@ extern double hb_parnd( int iParam, ... ); /* retrieve a numeric parameter as extern int hb_parni( int iParam, ... ); /* retrieve a numeric parameter as a integer */ extern long hb_parnl( int iParam, ... ); /* retrieve a numeric parameter as a long */ extern PHB_ITEM hb_param( int iParam, int iMask ); /* retrieve a generic parameter */ +extern PHB_ITEM hb_paramError( int iParam ); /* Returns either the generic parameter or a NIL item if param not provided */ #ifdef HB_API_MACROS @@ -362,6 +363,8 @@ extern BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG * pulStart extern BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, ULONG * pulStart, ULONG * pulCount, ULONG * pulTarget ); /* copy items from one array to another */ extern PHB_ITEM hb_arrayClone( PHB_ITEM pArray ); /* returns a duplicate of an existing array, including all nested items */ extern BOOL hb_arraySort( PHB_ITEM pArray, ULONG * pulStart, ULONG * pulCount, PHB_ITEM pBlock ); /* sorts an array item */ +extern PHB_ITEM hb_arrayFromStack( USHORT uiLen ); /* Creates and returns an Array of n Elements from the Eval Stack - Does NOT pop the items. */ +extern PHB_ITEM hb_arrayFromParams( void ); /* Creates and returns an Array of current Generic Parameters. */ /* string management */ diff --git a/harbour/include/hbapierr.h b/harbour/include/hbapierr.h index e3282f7f2a..115daf5852 100644 --- a/harbour/include/hbapierr.h +++ b/harbour/include/hbapierr.h @@ -128,10 +128,10 @@ extern PHB_ITEM hb_errRT_New_Subst( USHORT uiSeverity, char * szSubSystem, 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 void hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern USHORT hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); +extern USHORT hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags, USHORT uiArgCount, ... ); +extern PHB_ITEM hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); +extern void hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ); 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 ); diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 5e98da9077..d8feceae52 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -1647,7 +1647,7 @@ HB_FUNC( DBSELECTAREA ) { if( ( uiNewArea = hb_rddSelect( szAlias ) ) == 0 ) { - hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias ); + hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 ); return; } } @@ -2809,7 +2809,7 @@ HB_FUNC( DBSETRELATION ) szAlias = hb_parc( 1 ); if( ( uiChildArea = hb_rddSelect( szAlias ) ) == 0 ) { - hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias ); + hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 ); return; } } @@ -2826,7 +2826,7 @@ HB_FUNC( DBSETRELATION ) } if( !s_pArea ) { - hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias ); + hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 ); return; } diff --git a/harbour/source/rtl/abs.c b/harbour/source/rtl/abs.c index afa15819bb..34c8a61488 100644 --- a/harbour/source/rtl/abs.c +++ b/harbour/source/rtl/abs.c @@ -74,6 +74,6 @@ HB_FUNC( ABS ) } } else - hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "ABS" ); + hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "ABS", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/at.c b/harbour/source/rtl/at.c index 95d2f6a513..82cc43abe8 100644 --- a/harbour/source/rtl/at.c +++ b/harbour/source/rtl/at.c @@ -50,6 +50,6 @@ HB_FUNC( AT ) hb_itemGetCPtr( pText ), hb_itemGetCLen( pText ) ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, "AT" ); + hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, "AT", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } diff --git a/harbour/source/rtl/chrasc.c b/harbour/source/rtl/chrasc.c index 9fe2270b68..5ae523ae9c 100644 --- a/harbour/source/rtl/chrasc.c +++ b/harbour/source/rtl/chrasc.c @@ -58,7 +58,7 @@ HB_FUNC( CHR ) hb_retclen( szChar, 1 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1104, NULL, "CHR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1104, NULL, "CHR", 1, hb_paramError( 1 ) ); } /* converts a character value to an ASCII code */ @@ -74,6 +74,6 @@ HB_FUNC( ASC ) hb_retni( 0 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1107, NULL, "ASC" ); + hb_errRT_BASE_SubstR( EG_ARG, 1107, NULL, "ASC", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/copyfile.c b/harbour/source/rtl/copyfile.c index 6433bb0a16..0e56ae9e79 100644 --- a/harbour/source/rtl/copyfile.c +++ b/harbour/source/rtl/copyfile.c @@ -53,7 +53,7 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) while( ( fhndSource = hb_fsOpen( ( BYTE * ) szSource, FO_READ | FO_SHARED | FO_PRIVATE ) ) == FS_ERROR ) { - USHORT uiAction = 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, 0 ); if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; @@ -65,7 +65,7 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) while( ( fhndDest = hb_fsCreate( ( BYTE * ) szDest, FC_NORMAL ) ) == FS_ERROR ) { - USHORT uiAction = 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, 0 ); if( uiAction == E_DEFAULT || uiAction == E_BREAK ) break; @@ -88,7 +88,7 @@ static BOOL hb_fsCopy( char * szSource, char * szDest ) { while( hb_fsWrite( fhndDest, buffer, usRead ) != usRead ) { - USHORT uiAction = 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, 0 ); if( uiAction == E_DEFAULT || uiAction == E_BREAK ) { @@ -124,5 +124,5 @@ HB_FUNC( __COPYFILE ) hb_retl( FALSE ); } else - hb_errRT_BASE( EG_ARG, 2010, NULL, "__COPYFILE" ); /* NOTE: Undocumented but existing Clipper Run-time error */ + hb_errRT_BASE( EG_ARG, 2010, NULL, "__COPYFILE", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); /* NOTE: Undocumented but existing Clipper Run-time error */ } diff --git a/harbour/source/rtl/datec.c b/harbour/source/rtl/datec.c index 2c01735d78..d27392f4f7 100644 --- a/harbour/source/rtl/datec.c +++ b/harbour/source/rtl/datec.c @@ -65,7 +65,7 @@ HB_FUNC( CMONTH ) hb_retc( hb_dateCMonth( lMonth ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1116, NULL, "CMONTH" ); + hb_errRT_BASE_SubstR( EG_ARG, 1116, NULL, "CMONTH", 1, hb_paramError( 1 ) ); } HB_FUNC( CDOW ) @@ -87,6 +87,6 @@ HB_FUNC( CDOW ) hb_retc( "" ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1117, NULL, "CDOW" ); + hb_errRT_BASE_SubstR( EG_ARG, 1117, NULL, "CDOW", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/dateshb.c b/harbour/source/rtl/dateshb.c index 03c953b045..d665b6434f 100644 --- a/harbour/source/rtl/dateshb.c +++ b/harbour/source/rtl/dateshb.c @@ -158,7 +158,7 @@ HB_FUNC( CTOD ) hb_retds( szDateFormat ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1119, NULL, "CTOD" ); + hb_errRT_BASE_SubstR( EG_ARG, 1119, NULL, "CTOD", 1, hb_paramError( 1 ) ); } HB_FUNC( DTOC ) @@ -171,7 +171,7 @@ HB_FUNC( DTOC ) hb_retc( hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, hb_set.HB_SET_DATEFORMAT ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1118, NULL, "DTOC" ); + hb_errRT_BASE_SubstR( EG_ARG, 1118, NULL, "DTOC", 1, hb_paramError( 1 ) ); } HB_FUNC( DTOS ) @@ -183,7 +183,7 @@ HB_FUNC( DTOS ) hb_retc( hb_pardsbuff( szDate, 1 ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, "DTOS" ); + hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, "DTOS", 1, hb_paramError( 1 ) ); } /* NOTE: Harbour extension, exactly the same as STOD(). */ @@ -210,7 +210,7 @@ HB_FUNC( YEAR ) hb_retnllen( lYear, 5 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1112, NULL, "YEAR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1112, NULL, "YEAR", 1, hb_paramError( 1 ) ); } HB_FUNC( MONTH ) @@ -226,7 +226,7 @@ HB_FUNC( MONTH ) hb_retnllen( lMonth, 3 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1113, NULL, "MONTH" ); + hb_errRT_BASE_SubstR( EG_ARG, 1113, NULL, "MONTH", 1, hb_paramError( 1 ) ); } HB_FUNC( DAY ) @@ -242,7 +242,7 @@ HB_FUNC( DAY ) hb_retnllen( lDay, 3 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1114, NULL, "DAY" ); + hb_errRT_BASE_SubstR( EG_ARG, 1114, NULL, "DAY", 1, hb_paramError( 1 ) ); } HB_FUNC( TIME ) @@ -279,6 +279,6 @@ HB_FUNC( DOW ) hb_retnllen( 0, 3 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, "DOW" ); + hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, "DOW", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/diskspac.c b/harbour/source/rtl/diskspac.c index 010e2b81b8..6ba79617ec 100644 --- a/harbour/source/rtl/diskspac.c +++ b/harbour/source/rtl/diskspac.c @@ -192,7 +192,7 @@ HB_FUNC( DISKSPACE ) #endif if( bError ) - hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); + hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT, 1, hb_paramError( 1 ) ); hb_retnlen( dSpace, -1, 0 ); } diff --git a/harbour/source/rtl/disksphb.c b/harbour/source/rtl/disksphb.c index 0f8c02fc7a..a63d114b52 100644 --- a/harbour/source/rtl/disksphb.c +++ b/harbour/source/rtl/disksphb.c @@ -104,7 +104,7 @@ HB_FUNC( HB_DISKSPACE ) } else { - if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY ) == E_RETRY ) + if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY ) == E_RETRY, 2, hb_paramError( 1 ), hb_paramError( 2 ) ) continue; } break; @@ -237,7 +237,7 @@ HB_FUNC( HB_DISKSPACE ) if( GetLastError() != 0 ) { - if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY ) == E_RETRY ) + if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY, 2, hb_paramError( 1 ), hb_paramError( 2 ) ) == E_RETRY ) continue; } break; @@ -254,7 +254,7 @@ HB_FUNC( HB_DISKSPACE ) /* Query level 1 info from filesystem */ while( ( rc = DosQueryFSInfo( uiDrive, 1, &fsa, sizeof( fsa ) ) ) != 0 ) { - if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY ) != E_RETRY ) + if( hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT | EF_CANRETRY, 2, hb_paramError( 1 ), hb_paramError( 2 ) ) != E_RETRY ) break; } diff --git a/harbour/source/rtl/do.c b/harbour/source/rtl/do.c index beddd626b6..79fbf10538 100644 --- a/harbour/source/rtl/do.c +++ b/harbour/source/rtl/do.c @@ -60,7 +60,11 @@ HB_FUNC( DO ) hb_vmDo( uiPCount - 1 ); } else - hb_errRT_BASE( EG_NOFUNC, 1001, NULL, hb_itemGetCPtr( pItem ) ); + { + PHB_ITEM pArgsArray = hb_arrayFromParams(); + hb_errRT_BASE( EG_NOFUNC, 1001, NULL, hb_itemGetCPtr( pItem ), 1, pArgsArray ); + hb_itemRelease( pArgsArray ); + } } else if( HB_IS_BLOCK( pItem ) ) { @@ -85,6 +89,10 @@ HB_FUNC( DO ) hb_vmDo( uiPCount - 1 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "DO" ); + { + PHB_ITEM pArgsArray = hb_arrayFromParams(); + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "DO", 1, pArgsArray ); + hb_itemRelease( pArgsArray ); + } } diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index be006f0951..39b9047932 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -78,7 +78,7 @@ static USHORT s_uiErrorDOS = 0; /* The value of DOSERROR() */ extern HB_FUNC( ERRORNEW ); /* NOTE: This is called via its symbol name, so we should make sure - that it gets linked. WARNING ! DON'T make this function static. + that it gets linked. WARNING ! DON'T make this function static. [vszakats] */ void hb_errForceLink() { @@ -100,8 +100,8 @@ HB_FUNC( ERRORBLOCK ) HB_ITEM oldError; PHB_ITEM pNewErrorBlock = hb_param( 1, HB_IT_BLOCK ); - /* initialize an item - * NOTE: hb_itemClear() cannot be used to initialize an item because + /* initialize an item + * NOTE: hb_itemClear() cannot be used to initialize an item because * memory occupied by the item can contain garbage bits */ hb_itemInit( &oldError ); @@ -144,8 +144,8 @@ void hb_errInit( void ) { HB_TRACE(HB_TR_DEBUG, ("hb_errInit()")); - /* initialize an item - * NOTE: hb_itemClear() cannot be used to initialize an item because + /* initialize an item + * NOTE: hb_itemClear() cannot be used to initialize an item because * memory occupied by the item can contain garbage bits */ s_errorBlock = hb_itemNew( NULL ); @@ -714,7 +714,9 @@ HB_FUNC( __ERRRT_BASE ) hb_errRT_BASE( ( ULONG ) hb_parnl( 1 ), ( ULONG ) hb_parnl( 2 ), ISCHAR( 3 ) ? hb_parc( 3 ) : NULL, - hb_parc( 4 ) ); + hb_parc( 4 ), + ( USHORT ) hb_parni( 5 ), + hb_param( 6, HB_IT_ANY ) ); } HB_FUNC( __ERRRT_SBASE ) @@ -722,15 +724,101 @@ HB_FUNC( __ERRRT_SBASE ) hb_errRT_BASE_SubstR( ( ULONG ) hb_parnl( 1 ), ( ULONG ) hb_parnl( 2 ), ISCHAR( 3 ) ? hb_parc( 3 ) : NULL, - hb_parc( 4 ) ); + hb_parc( 4 ), + ( USHORT ) hb_parni( 5 ), + hb_param( 6, HB_IT_ANY ) ); } -USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ) { USHORT uiAction; - PHB_ITEM pError = - hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + PHB_ITEM pError; + PHB_ITEM pArray, pArg; + va_list va; + USHORT uiArgPos; + BOOL bRelease = TRUE; + + /* Build the array from the passed arguments. */ + va_start( va, uiArgCount ); + if( ( ulSubCode == 1001 || ulSubCode == 1004 || ulSubCode == 1005 ) && uiArgCount == 1 ) + { + pArray = va_arg( va, PHB_ITEM ); + + if( HB_IS_ARRAY( pArray ) ) + { + bRelease = FALSE; + } + else + { + pArg = pArray; + pArray = hb_itemArrayNew( 1 ); + hb_itemArrayPut( pArray, 1, pArg ); + } + } + else + { + pArray = hb_itemArrayNew( uiArgCount ); + + for( uiArgPos = 1; uiArgPos <= uiArgCount; uiArgPos++ ) + { + hb_itemArrayPut( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); + } + } + va_end( va ); + + pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + + /* Assign the new array to the object data item. */ + hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPush( pArray ); + hb_vmDo( 1 ); + + /* Release the Array. */ + if( bRelease ) + { + hb_itemRelease( pArray ); + } + + /* Ok, launch... */ + uiAction = hb_errLaunch( pError ); + + /* Release. */ + hb_errRelease( pError ); + + return uiAction; +} + +USHORT hb_errRT_BASE_Ext1( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags, USHORT uiArgCount, ... ) +{ + USHORT uiAction; + PHB_ITEM pError; + + PHB_ITEM pArray, pArg; + va_list va; + USHORT uiArgPos; + + pArray = hb_itemArrayNew( uiArgCount ); + + /* Build the array from the passed arguments. */ + va_start( va, uiArgCount ); + for( uiArgPos = 1; uiArgPos <= uiArgCount; uiArgPos++ ) + hb_itemArrayPut( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); + va_end( va ); + + pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags ); + + /* Assign the new array to the object data item. */ + hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPush( pArray ); + hb_vmDo( 1 ); + + /* Release the Array. */ + hb_itemRelease( pArray ); + + /* Ok, launch... */ uiAction = hb_errLaunch( pError ); hb_errRelease( pError ); @@ -738,25 +826,35 @@ USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, ch return uiAction; } -USHORT hb_errRT_BASE_Ext1( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ) -{ - USHORT uiAction; - PHB_ITEM pError = - hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags ); - - uiAction = hb_errLaunch( pError ); - - hb_errRelease( pError ); - - return uiAction; -} - -PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ) +PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ) { PHB_ITEM pRetVal; - PHB_ITEM pError = - hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + PHB_ITEM pError; + PHB_ITEM pArray; + va_list va; + USHORT uiArgPos; + + pArray = hb_itemArrayNew( uiArgCount ); + + /* Build the array from the passed arguments. */ + va_start( va, uiArgCount ); + for( uiArgPos = 1; uiArgPos <= uiArgCount; uiArgPos++ ) + hb_itemArrayPut( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); + va_end( va ); + + pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + + /* Assign the new array to the object data item. */ + hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPush( pArray ); + hb_vmDo( 1 ); + + /* Release the Array. */ + hb_itemRelease( pArray ); + + /* Ok, launch... */ pRetVal = hb_errLaunchSubst( pError ); hb_errRelease( pError ); @@ -764,9 +862,58 @@ 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 ) +void hb_errRT_BASE_SubstR( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiArgCount, ... ) { - PHB_ITEM pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + PHB_ITEM pError; + + PHB_ITEM pArray, pArg; + va_list va; + USHORT uiArgPos; + BOOL bRelease = TRUE; + + /* Build the array from the passed arguments. */ + va_start( va, uiArgCount ); + if( ( ulSubCode == 1001 || ulSubCode == 1004 || ulSubCode == 1005 ) && uiArgCount == 1 ) + { + pArray = va_arg( va, PHB_ITEM ); + + if( HB_IS_ARRAY( pArray ) ) + { + bRelease = FALSE; + } + else + { + pArg = pArray; + pArray = hb_itemArrayNew( 1 ); + hb_itemArrayPut( pArray, 1, pArg ); + } + } + else + { + pArray = hb_itemArrayNew( uiArgCount ); + + for( uiArgPos = 1; uiArgPos <= uiArgCount; uiArgPos++ ) + { + hb_itemArrayPut( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); + } + } + va_end( va ); + + pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE ); + + /* Assign the new array to the object data item. */ + hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPush( pArray ); + hb_vmDo( 1 ); + + /* Release the Array. */ + if( bRelease ) + { + hb_itemRelease( pArray ); + } + + /* Ok, launch... */ hb_itemRelease( hb_itemReturn( hb_errLaunchSubst( pError ) ) ); hb_errRelease( pError ); } diff --git a/harbour/source/rtl/left.c b/harbour/source/rtl/left.c index 590ee8a43f..cdc3509bbc 100644 --- a/harbour/source/rtl/left.c +++ b/harbour/source/rtl/left.c @@ -55,6 +55,6 @@ HB_FUNC( LEFT ) hb_retclen( hb_itemGetCPtr( pText ), lLen ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1124, NULL, "LEFT" ); + hb_errRT_BASE_SubstR( EG_ARG, 1124, NULL, "LEFT", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } diff --git a/harbour/source/rtl/len.c b/harbour/source/rtl/len.c index 5723afde39..f04a618187 100644 --- a/harbour/source/rtl/len.c +++ b/harbour/source/rtl/len.c @@ -59,5 +59,5 @@ HB_FUNC( LEN ) } } - hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, "LEN" ); + hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, "LEN", 1, pItem ); } diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index 4dda4739e4..fc5ef33ff8 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -45,7 +45,7 @@ #elif defined(__BORLANDC__) #if (__BORLANDC__ == 1328) && defined(__cplusplus) /* NOTE: There seem to be a bug in Borland C++ 5.3 C++ mode which prevents - the redefinition of matherr, because nor "_exception" neither + the redefinition of matherr, because nor "_exception" neither "exception" will work. [vszakats] */ #else #define HB_MATH_HANDLER @@ -117,7 +117,7 @@ HB_FUNC( EXP ) if( s_internal_math_error ) { - hb_errRT_BASE_SubstR( s_internal_math_error, 1096, NULL, "EXP" ); + hb_errRT_BASE_SubstR( s_internal_math_error, 1096, NULL, "EXP", 1, hb_paramError( 1 ) ); s_internal_math_error = 0; } else @@ -127,7 +127,7 @@ HB_FUNC( EXP ) #endif } else - hb_errRT_BASE_SubstR( EG_ARG, 1096, NULL, "EXP" ); + hb_errRT_BASE_SubstR( EG_ARG, 1096, NULL, "EXP", 1, hb_paramError( 1 ) ); } HB_FUNC( LOG ) @@ -139,7 +139,7 @@ HB_FUNC( LOG ) if( s_internal_math_error ) { - hb_errRT_BASE_SubstR( s_internal_math_error, 1095, NULL, "LOG" ); + hb_errRT_BASE_SubstR( s_internal_math_error, 1095, NULL, "LOG", 1, hb_paramError( 1 ) ); s_internal_math_error = 0; } else @@ -155,7 +155,7 @@ HB_FUNC( LOG ) #endif } else - hb_errRT_BASE_SubstR( EG_ARG, 1095, NULL, "LOG" ); + hb_errRT_BASE_SubstR( EG_ARG, 1095, NULL, "LOG", 1, hb_paramError( 1 ) ); } HB_FUNC( SQRT ) @@ -167,7 +167,7 @@ HB_FUNC( SQRT ) if( s_internal_math_error ) { - hb_errRT_BASE_SubstR( s_internal_math_error, 1097, NULL, "SQRT" ); + hb_errRT_BASE_SubstR( s_internal_math_error, 1097, NULL, "SQRT", 1, hb_paramError( 1 ) ); s_internal_math_error = 0; } else @@ -179,6 +179,6 @@ HB_FUNC( SQRT ) #endif } else - hb_errRT_BASE_SubstR( EG_ARG, 1097, NULL, "SQRT" ); + hb_errRT_BASE_SubstR( EG_ARG, 1097, NULL, "SQRT", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/minmax.c b/harbour/source/rtl/minmax.c index 1581a6789f..7a6033683a 100644 --- a/harbour/source/rtl/minmax.c +++ b/harbour/source/rtl/minmax.c @@ -86,7 +86,7 @@ HB_FUNC( MAX ) hb_retds( hb_itemGetDL( p1 ) >= hb_itemGetDL( p2 ) ? hb_pardsbuff( szDate, 1 ) : hb_pardsbuff( szDate, 2 ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1093, NULL, "MAX" ); + hb_errRT_BASE_SubstR( EG_ARG, 1093, NULL, "MAX", 2, p1, p2 ); } /* returns the minimum of two date or numerics */ @@ -138,6 +138,6 @@ HB_FUNC( MIN ) hb_retds( hb_itemGetDL( p1 ) <= hb_itemGetDL( p2 ) ? hb_pardsbuff( szDate, 1 ) : hb_pardsbuff( szDate, 2 ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1092, NULL, "MIN" ); + hb_errRT_BASE_SubstR( EG_ARG, 1092, NULL, "MIN", 2, p1, p2 ); } diff --git a/harbour/source/rtl/mod.c b/harbour/source/rtl/mod.c index e0c9c5c87f..6a74360919 100644 --- a/harbour/source/rtl/mod.c +++ b/harbour/source/rtl/mod.c @@ -67,7 +67,7 @@ HB_FUNC( MOD ) } else { - PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ZERODIV, 1341, NULL, "%" ); + PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ZERODIV, 1341, NULL, "%", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); if( pResult ) { @@ -76,13 +76,13 @@ HB_FUNC( MOD ) hb_itemRelease( pResult ); hb_itemGetNLen( pNumber, NULL, &iDec ); - + hb_retndlen( dNumber, 0, iDec ); } } } else - hb_errRT_BASE_SubstR( EG_ARG, 1085, NULL, "%" ); + hb_errRT_BASE_SubstR( EG_ARG, 1085, NULL, "%", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } /* diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index 52bc4a5313..3a6fd7bb77 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -59,7 +59,7 @@ HB_FUNC( FOPEN ) hb_retni( hb_fsOpen( ( BYTE * ) hb_parc( 1 ), ISNUM( 2 ) ? hb_parni( 2 ) : FO_READ | FO_COMPAT ) ); else - hb_errRT_BASE( EG_ARG, 2021, NULL, "FOPEN" ); /* NOTE: Undocumented but existing Clipper Run-time error */ + hb_errRT_BASE( EG_ARG, 2021, NULL, "FOPEN", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); /* NOTE: Undocumented but existing Clipper Run-time error */ } HB_FUNC( FCREATE ) diff --git a/harbour/source/rtl/philesx.c b/harbour/source/rtl/philesx.c index 7805a69357..282da043e4 100644 --- a/harbour/source/rtl/philesx.c +++ b/harbour/source/rtl/philesx.c @@ -55,8 +55,8 @@ HB_FUNC( CURDRIVE ) { while( hb_fsChDrv( ( BYTE )( toupper( *hb_parc( 1 ) ) - 'A' ) ) != 0 ) { - USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 9999, "Operating system error", "CURDRIVE", 0, EF_CANDEFAULT | EF_CANRETRY ); - + USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 9999, "Operating system error", "CURDRIVE", 0, EF_CANDEFAULT | EF_CANRETRY, 1, hb_paramError( 1 ) ); + if( uiAction != E_RETRY ) break; } diff --git a/harbour/source/rtl/replic.c b/harbour/source/rtl/replic.c index 85daf4a52c..dee396ab99 100644 --- a/harbour/source/rtl/replic.c +++ b/harbour/source/rtl/replic.c @@ -66,12 +66,12 @@ HB_FUNC( REPLICATE ) hb_xfree( szResult ); } else - hb_errRT_BASE_SubstR( EG_STROVERFLOW, 1234, NULL, "REPLICATE" ); + hb_errRT_BASE_SubstR( EG_STROVERFLOW, 1234, NULL, "REPLICATE", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } else hb_retc( "" ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1106, NULL, "REPLICATE" ); + hb_errRT_BASE_SubstR( EG_ARG, 1106, NULL, "REPLICATE", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } diff --git a/harbour/source/rtl/round.c b/harbour/source/rtl/round.c index adc45a2d80..5a06bf74fd 100644 --- a/harbour/source/rtl/round.c +++ b/harbour/source/rtl/round.c @@ -64,7 +64,7 @@ HB_FUNC( INT ) hb_retndlen( dNumber >= 0 ? floor( dNumber ) : ceil( dNumber ), iWidth, 0 ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1090, NULL, "INT" ); + hb_errRT_BASE_SubstR( EG_ARG, 1090, NULL, "INT", 1, hb_paramError( 1 ) ); } double hb_numRound( double dResult, int iDec ) @@ -116,5 +116,5 @@ HB_FUNC( ROUND ) hb_retndlen( hb_numRound( hb_parnd( 1 ), iDec ), 0, HB_MAX( iDec, 0 ) ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1094, NULL, "ROUND" ); + hb_errRT_BASE_SubstR( EG_ARG, 1094, NULL, "ROUND", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index bf07d359f3..cd9cba5bc4 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -359,7 +359,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_AUTOSHARE ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_MARGIN = set_number( pArg2, hb_set.HB_SET_AUTOSHARE ); } @@ -403,7 +403,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_DECIMALS ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_DECIMALS = set_number( pArg2, hb_set.HB_SET_DECIMALS ); } @@ -443,7 +443,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_EPOCH ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_EPOCH = set_number( pArg2, hb_set.HB_SET_EPOCH ); } @@ -502,7 +502,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_MARGIN ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_MARGIN = set_number( pArg2, hb_set.HB_SET_MARGIN ); } @@ -512,7 +512,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_MBLOCKSIZE ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_MBLOCKSIZE = set_number( pArg2, hb_set.HB_SET_MBLOCKSIZE ); } @@ -526,7 +526,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_MESSAGE ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_MESSAGE = set_number( pArg2, hb_set.HB_SET_MESSAGE ); } @@ -601,7 +601,7 @@ HB_FUNC( SET ) if( args > 1 ) { if( set_number( pArg2, hb_set.HB_SET_VIDEOMODE ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, "SET" ); + hb_errRT_BASE( EG_ARG, 2020, NULL, "SET", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); else hb_set.HB_SET_VIDEOMODE = set_number( pArg2, hb_set.HB_SET_VIDEOMODE ); } diff --git a/harbour/source/rtl/space.c b/harbour/source/rtl/space.c index 6e4efd86c6..a33efd2e78 100644 --- a/harbour/source/rtl/space.c +++ b/harbour/source/rtl/space.c @@ -62,5 +62,5 @@ HB_FUNC( SPACE ) hb_retc( "" ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1105, NULL, "SPACE" ); + hb_errRT_BASE_SubstR( EG_ARG, 1105, NULL, "SPACE", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/str.c b/harbour/source/rtl/str.c index 47bce25201..c431d85a0a 100644 --- a/harbour/source/rtl/str.c +++ b/harbour/source/rtl/str.c @@ -78,6 +78,6 @@ HB_FUNC( STR ) hb_retc( "" ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); } diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index 78d0760b5f..3f16d1dcb0 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -97,7 +97,7 @@ HB_FUNC( LOWER ) hb_itemFreeC( pszBuffer ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1103, NULL, "LOWER" ); + hb_errRT_BASE_SubstR( EG_ARG, 1103, NULL, "LOWER", 1, hb_paramError( 1 ) ); } /* converts string to upper case */ @@ -115,5 +115,5 @@ HB_FUNC( UPPER ) hb_itemFreeC( pszBuffer ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1102, NULL, "UPPER" ); + hb_errRT_BASE_SubstR( EG_ARG, 1102, NULL, "UPPER", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/strtran.c b/harbour/source/rtl/strtran.c index dd71b6bdb9..5a2ff50400 100644 --- a/harbour/source/rtl/strtran.c +++ b/harbour/source/rtl/strtran.c @@ -173,9 +173,9 @@ HB_FUNC( STRTRAN ) hb_retclen( szText, ulText ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ } else - hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN" ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ } diff --git a/harbour/source/rtl/strzero.c b/harbour/source/rtl/strzero.c index 37dd281607..2716559e21 100644 --- a/harbour/source/rtl/strzero.c +++ b/harbour/source/rtl/strzero.c @@ -110,9 +110,9 @@ HB_FUNC( STRZERO ) /* 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] */ - hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); #else - hb_errRT_BASE_SubstR( EG_ARG, 9999, NULL, "STRZERO" ); + hb_errRT_BASE_SubstR( EG_ARG, 9999, NULL, "STRZERO", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); #endif } } diff --git a/harbour/source/rtl/substr.c b/harbour/source/rtl/substr.c index cbb45a5b3d..367a40b11b 100644 --- a/harbour/source/rtl/substr.c +++ b/harbour/source/rtl/substr.c @@ -73,7 +73,7 @@ HB_FUNC( SUBSTR ) } else { - hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); /* NOTE: Exit from inside [vszakats] */ return; } @@ -90,5 +90,5 @@ HB_FUNC( SUBSTR ) hb_retc( "" ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR" ); + hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); } diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index 25e0bb1012..c1e9413f4e 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -89,7 +89,7 @@ HB_FUNC( TRANSFORM ) /* ======================================================= */ /* Analyze picture functions */ /* ======================================================= */ - + uiPicFlags = 0; /* If an "@" char is at the first pos, we have picture function */ @@ -97,15 +97,15 @@ HB_FUNC( TRANSFORM ) if( *szPic == '@' ) { BOOL bDone = FALSE; - + /* Skip the "@" char */ szPic++; ulPicLen--; - + /* Go through all function chars, until the end of the picture string or any whitespace found. */ - + while( ulPicLen && ! bDone ) { switch( toupper( *szPic ) ) @@ -141,16 +141,16 @@ HB_FUNC( TRANSFORM ) break; case 'S': uiPicFlags |= PF_WIDTH; - + ulParamS = 0; while( ulPicLen > 1 && *( szPic + 1 ) >= '0' && *( szPic + 1 ) <= '9' ) { szPic++; ulPicLen--; - + ulParamS = ( ulParamS * 10 ) + ( ( ULONG ) ( *szPic - '0' ) ); } - + break; case 'X': uiPicFlags |= PF_DEBIT; @@ -159,7 +159,7 @@ HB_FUNC( TRANSFORM ) uiPicFlags |= PF_EMPTY; break; } - + szPic++; ulPicLen--; } @@ -297,19 +297,19 @@ HB_FUNC( TRANSFORM ) int iDec; /* Number of decimals */ ULONG i; int iCount = 0; - + char * szStr; char cPic; - + PHB_ITEM pNumber; PHB_ITEM pWidth; PHB_ITEM pDec; - + BOOL bFound = FALSE; hb_itemGetNLen( pValue, &iOrigWidth, &iOrigDec ); - /* TODO: maybe replace this 16 with something else */ + /* TODO: maybe replace this 16 with something else */ szResult = ( char * ) hb_xgrab( ulPicLen + 16 ); /* Grab enough */ *szResult = '\0'; @@ -322,7 +322,7 @@ HB_FUNC( TRANSFORM ) iCount++; } iWidth = iCount; - + if( bFound ) /* Did we find a dot */ { iDec = 0; @@ -341,43 +341,43 @@ HB_FUNC( TRANSFORM ) } else iDec = 0; - + if( ( uiPicFlags & ( PF_DEBIT + PF_PARNEG ) ) && dValue < 0 ) dPush = -dValue; /* Always push absolute val */ else dPush = dValue; - + /* Don't empty the result if the number is not zero */ if( dPush != 0 && ( uiPicFlags & PF_EMPTY ) ) uiPicFlags &= ~uiPicFlags; - + if( iWidth == 0 ) /* Width calculated ?? */ { iWidth = iOrigWidth; /* Push original width */ iDec = iOrigDec; /* Push original decimals */ } - + pNumber = hb_itemPutNDLen( NULL, dPush, -1, iDec ); pWidth = hb_itemPutNI( NULL, iWidth ); pDec = hb_itemPutNI( NULL, iDec ); - + szStr = hb_itemStr( pNumber, pWidth, pDec ); - + hb_itemRelease( pNumber ); hb_itemRelease( pWidth ); hb_itemRelease( pDec ); - + if( szStr ) { iCount = 0; - + /* Pad with Zero's */ if( uiPicFlags & PF_PADL ) { for( i = 0; szStr[ i ] == ' ' && i < ( ULONG ) iWidth; i++ ) szStr[ i ] = byParamL; } - + for( i = 0; i < ulPicLen; i++ ) { cPic = szPic[ i ]; @@ -423,7 +423,7 @@ HB_FUNC( TRANSFORM ) else szResult[ i ] = cPic; } - + if( ( uiPicFlags & PF_PARNEG ) && dValue < 0 ) { if( isdigit( ( int ) *szResult ) ) /* Overflow */ @@ -437,24 +437,24 @@ HB_FUNC( TRANSFORM ) *szResult = '('; szResult[ i++ ] = ')'; } - + if( ( uiPicFlags & PF_CREDIT ) && dValue >= 0 ) { szResult[ i++ ] = ' '; szResult[ i++ ] = 'C'; szResult[ i++ ] = 'R'; } - + if( ( uiPicFlags & PF_DEBIT ) && dValue < 0 ) { szResult[ i++ ] = ' '; szResult[ i++ ] = 'D'; szResult[ i++ ] = 'B'; } - + ulResultPos = i; szResult[ i ] = '\0'; - + hb_xfree( szStr ); } else @@ -606,6 +606,6 @@ HB_FUNC( TRANSFORM ) /* If there was any parameter error, launch a runtime error */ if( bError ) - hb_errRT_BASE_SubstR( EG_ARG, 1122, NULL, "TRANSFORM" ); + hb_errRT_BASE_SubstR( EG_ARG, 1122, NULL, "TRANSFORM", 2, pValue, hb_paramError( 2 ) ); } diff --git a/harbour/source/rtl/trim.c b/harbour/source/rtl/trim.c index d712d0e178..c5cbc01270 100644 --- a/harbour/source/rtl/trim.c +++ b/harbour/source/rtl/trim.c @@ -85,7 +85,7 @@ HB_FUNC( LTRIM ) hb_retclen( szText, ulLen ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1101, NULL, "LTRIM" ); + hb_errRT_BASE_SubstR( EG_ARG, 1101, NULL, "LTRIM", 1, hb_paramError( 1 ) ); } /* trims trailing spaces from a string */ @@ -105,7 +105,7 @@ HB_FUNC( RTRIM ) } else /* NOTE: "TRIM" is right here [vszakats] */ - hb_errRT_BASE_SubstR( EG_ARG, 1100, NULL, "TRIM" ); + hb_errRT_BASE_SubstR( EG_ARG, 1100, NULL, "TRIM", 1, hb_paramError( 1 ) ); } /* synonymn for RTRIM */ @@ -133,7 +133,7 @@ HB_FUNC( ALLTRIM ) } else #ifdef HB_COMPAT_C53 - hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM" ); /* NOTE: This appeared in CA-Cl*pper 5.3 [vszakats] */ + hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM", 1, hb_paramError( 1 ) ); /* 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 1e4198e099..f6d44fefd0 100644 --- a/harbour/source/rtl/type.c +++ b/harbour/source/rtl/type.c @@ -43,6 +43,6 @@ HB_FUNC( TYPE ) if( pItem ) hb_retc( hb_macroGetType( pItem ) ); else - hb_errRT_BASE_SubstR( EG_ARG, 1121, NULL, "TYPE" ); + hb_errRT_BASE_SubstR( EG_ARG, 1121, NULL, "TYPE", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/val.c b/harbour/source/rtl/val.c index 40a95aa6a3..73cc49aebd 100644 --- a/harbour/source/rtl/val.c +++ b/harbour/source/rtl/val.c @@ -109,12 +109,12 @@ HB_FUNC( VAL ) else { /* NOTE: Kludge Warning! This condition: - "|| ( iDec == 1 && szText[ 0 ] == '-' && dValue != 0.0 )" - may not be the generic way to handle the width of this "-.1" + "|| ( iDec == 1 && szText[ 0 ] == '-' && dValue != 0.0 )" + may not be the generic way to handle the width of this "-.1" string. I could not find a matching case which fails for the same reason, nor a better way to handle it. - The problem is that in this case only, the width is - calculated upon conditions which can only be discovered by + The problem is that in this case only, the width is + calculated upon conditions which can only be discovered by parsing the string, but the parsing is made by a lower level generic function. [vszakats] */ @@ -122,5 +122,5 @@ HB_FUNC( VAL ) } } else - hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, "VAL" ); + hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, "VAL", 1, hb_paramError( 1 ) ); } diff --git a/harbour/source/rtl/word.c b/harbour/source/rtl/word.c index bb9d0b92cc..a79b98386f 100644 --- a/harbour/source/rtl/word.c +++ b/harbour/source/rtl/word.c @@ -45,5 +45,5 @@ HB_FUNC( WORD ) if( ISNUM( 1 ) ) hb_retni( hb_parni( 1 ) ); else - hb_errRT_BASE( EG_ARG, 1091, NULL, "WORD" ); + hb_errRT_BASE( EG_ARG, 1091, NULL, "WORD", 1, hb_paramError( 1 ) ); }