From cbd4d2ce9f7bb948703b3c7ff385f657ab4350ad Mon Sep 17 00:00:00 2001 From: Bruno Cantero Date: Thu, 2 Dec 1999 17:13:57 +0000 Subject: [PATCH] ChangeLogTag:19991202-18:00 GMT+1 Bruno Cantero --- harbour/ChangeLog | 10 ++ harbour/doc/funclist.txt | 2 +- harbour/include/rddapi.h | 5 +- harbour/source/rdd/dbcmd.c | 161 ++++++++++++++++++++++++++++ harbour/source/rdd/dbeval.prg | 2 +- harbour/source/rdd/dbf1.c | 2 + harbour/source/rdd/dbfcdx/dbfcdx1.c | 2 + 7 files changed, 179 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5174294f6f..0b34f91a08 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +19991202-18:00 GMT+1 Bruno Cantero + * source/rdd/dbeval.prg + * Function dbEval() renamed to Bad_dbEval() + * include/rddapi.h + source/rdd/dbcmd.c + source/rdd/dbf1.c + source/rdd/dbfcdx/dbfcdx1.c + doc/funclist.txt + + Added dbEval() function. + 19991202-01:45 EST Paul Tucker * makefile.vc + source/rtl/break.c diff --git a/harbour/doc/funclist.txt b/harbour/doc/funclist.txt index 52f6672c63..7a09a4f53b 100644 --- a/harbour/doc/funclist.txt +++ b/harbour/doc/funclist.txt @@ -77,7 +77,7 @@ DBCREATE ;R; DBCREATEIND ;S; DBDELETE ;R; DBEDIT ;R; -DBEVAL ;S; +DBEVAL ;R; DBF ;R; DBFILTER ;R; DBGOBOTTOM ;R; diff --git a/harbour/include/rddapi.h b/harbour/include/rddapi.h index c27b56a0b5..66272dcfa8 100644 --- a/harbour/include/rddapi.h +++ b/harbour/include/rddapi.h @@ -583,6 +583,7 @@ typedef USHORT ( * DBENTRYP_VP )( AREAP area, LPDBOPENINFO param ); typedef USHORT ( * DBENTRYP_VF )( AREAP area, LPDBFIELDINFO param ); typedef USHORT ( * DBENTRYP_VL )( AREAP area, LPDBLOCKINFO param ); typedef USHORT ( * DBENTRYP_VFI )( AREAP area, LPDBFILTERINFO param ); +typedef USHORT ( * DBENTRYP_VEI )( AREAP area, LPDBEVALINFO param ); typedef USHORT ( * DBENTRYP_VLO )( AREAP area, LPDBSCOPEINFO param ); typedef USHORT ( * DBENTRYP_SP )( AREAP area, USHORT * param ); typedef USHORT ( * DBENTRYP_P )( AREAP area, BYTE * param ); @@ -662,9 +663,7 @@ typedef struct _RDDFUNCS DBENTRYP_V release; DBENTRYP_SP structSize; DBENTRYP_P sysName; -#if 0 - DBENTRYP_VP dbEval; -#endif + DBENTRYP_VEI dbEval; DBENTRYP_V pack; #if 0 DBENTRYP_LSP packRec; diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index b82194ae24..f9312956b8 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -85,6 +85,7 @@ HARBOUR HB_DBCOMMITALL( void ); HARBOUR HB___DBCONTINUE( void ); HARBOUR HB_DBCREATE( void ); HARBOUR HB_DBDELETE( void ); +HARBOUR HB_DBEVAL( void ); HARBOUR HB_DBF( void ); HARBOUR HB_DBFILTER( void ); HARBOUR HB_DBGOBOTTOM( void ); @@ -319,6 +320,96 @@ static ERRCODE defError( AREAP pArea, PHB_ITEM pError ) return hb_errLaunch( pError ); } +static ERRCODE defEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) +{ + BOOL bEof, bFor, bWhile; + ULONG ulNext; + + HB_TRACE(HB_TR_DEBUG, ("defEval(%p, %p)", pArea, pEvalInfo)); + + if( pEvalInfo->dbsci.itmRecID ) + { + SELF_GOTOID( ( AREAP ) pCurrArea->pArea, pEvalInfo->dbsci.itmRecID ); + SELF_EOF( ( AREAP ) pCurrArea->pArea, &bEof ); + if( !bEof ) + { + if( pEvalInfo->dbsci.itmCobWhile ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->dbsci.itmCobWhile ); + hb_vmDo( 0 ); + bWhile = hb_itemGetL( &hb_stack.Return ); + } + else + bWhile = TRUE; + + if( pEvalInfo->dbsci.itmCobFor ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->dbsci.itmCobFor ); + hb_vmDo( 0 ); + bFor = hb_itemGetL( &hb_stack.Return ); + } + else + bFor = TRUE; + + if( bWhile && bFor ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->itmBlock ); + hb_vmDo( 0 ); + } + } + return SUCCESS; + } + + if( !pEvalInfo->dbsci.fRest || !hb_itemGetL( pEvalInfo->dbsci.fRest ) ) + SELF_GOTOP( ( AREAP ) pCurrArea->pArea ); + + if( pEvalInfo->dbsci.lNext ) + ulNext = hb_itemGetNL( pEvalInfo->dbsci.lNext ); + + SELF_EOF( ( AREAP ) pCurrArea->pArea, &bEof ); + while( !bEof ) + { + if( pEvalInfo->dbsci.lNext && ulNext-- < 1 ) + break; + + if( pEvalInfo->dbsci.itmCobWhile ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->dbsci.itmCobWhile ); + hb_vmDo( 0 ); + bWhile = hb_itemGetL( &hb_stack.Return ); + if( !bWhile ) + break; + } + else + bWhile = TRUE; + + if( pEvalInfo->dbsci.itmCobFor ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->dbsci.itmCobFor ); + hb_vmDo( 0 ); + bFor = hb_itemGetL( &hb_stack.Return ); + } + else + bFor = TRUE; + + if( bFor && bWhile ) + { + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pEvalInfo->itmBlock ); + hb_vmDo( 0 ); + } + SELF_SKIP( ( AREAP ) pCurrArea->pArea, 1 ); + SELF_EOF( ( AREAP ) pCurrArea->pArea, &bEof ); + } + + return SUCCESS; +} + static ERRCODE defFieldCount( AREAP pArea, USHORT * uiFields ) { HB_TRACE(HB_TR_DEBUG, ("defFieldCount(%p, %p)", pArea, uiFields)); @@ -728,6 +819,7 @@ static RDDFUNCS defTable = { defBof, defRelease, defStructSize, defSysName, + defEval, defUnSupported, defUnSupported, defClearFilter, @@ -1304,6 +1396,75 @@ HARBOUR HB_ALIAS( void ) hb_retc( "" ); } +HARBOUR HB_DBEVAL( void ) +{ + DBEVALINFO pEvalInfo; + + if( !pCurrArea ) + hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "DBEVAL" ); + else + { + pEvalInfo.itmBlock = hb_param( 1, IT_BLOCK ); + if( !pEvalInfo.itmBlock ) + { + hb_errRT_DBCMD( EG_ARG, 12019, NULL, "DBEVAL" ); + return; + } + + pEvalInfo.dbsci.itmCobFor = hb_param( 2, IT_BLOCK ); + if( !pEvalInfo.dbsci.itmCobFor ) + { + if( !ISNIL( 2 ) ) + { + hb_errRT_DBCMD( EG_ARG, 22019, NULL, "DBEVAL" ); + return; + } + } + + pEvalInfo.dbsci.itmCobWhile = hb_param( 3, IT_BLOCK ); + if( !pEvalInfo.dbsci.itmCobWhile ) + { + if( !ISNIL( 3 ) ) + { + hb_errRT_DBCMD( EG_ARG, 32019, NULL, "DBEVAL" ); + return; + } + } + + pEvalInfo.dbsci.lNext = hb_param( 4, IT_NUMERIC ); + if( !pEvalInfo.dbsci.lNext ) + { + if( !ISNIL( 4 ) ) + { + hb_errRT_DBCMD( EG_ARG, 42019, NULL, "DBEVAL" ); + return; + } + } + + pEvalInfo.dbsci.itmRecID = hb_param( 5, IT_NUMERIC ); + if( !pEvalInfo.dbsci.itmRecID ) + { + if( !ISNIL( 5 ) ) + { + hb_errRT_DBCMD( EG_ARG, 52019, NULL, "DBEVAL" ); + return; + } + } + + pEvalInfo.dbsci.fRest = hb_param( 6, IT_LOGICAL ); + if( !pEvalInfo.dbsci.fRest ) + { + if( !ISNIL( 6 ) ) + { + hb_errRT_DBCMD( EG_ARG, 62019, NULL, "DBEVAL" ); + return; + } + } + + SELF_DBEVAL( ( AREAP ) pCurrArea->pArea, &pEvalInfo ); + } +} + HARBOUR HB_DBF( void ) { LPAREANODE pAreaNode = pWorkAreas; diff --git a/harbour/source/rdd/dbeval.prg b/harbour/source/rdd/dbeval.prg index a7657da562..9cb55b16ce 100644 --- a/harbour/source/rdd/dbeval.prg +++ b/harbour/source/rdd/dbeval.prg @@ -80,7 +80,7 @@ * $END$ */ -FUNCTION dbEval( bBlock, bFor, bWhile, nNext, nRecord, lRest ) +FUNCTION Bad_dbEval( bBlock, bFor, bWhile, nNext, nRecord, lRest ) LOCAL oError LOCAL nCounter diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index 242481ae37..c013deb564 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -652,6 +652,7 @@ static RDDFUNCS dbfSuper = { 0 }; #define dbfNewArea NULL #define dbfStructSize NULL #define dbfSysName NULL +#define dbfEval NULL #define dbfClearFilter NULL #define dbfClearLocate NULL #define dbfFilterText NULL @@ -2038,6 +2039,7 @@ static RDDFUNCS dbfTable = { dbfBof, dbfRelease, dbfStructSize, dbfSysName, + dbfEval, dbfPack, dbfZap, dbfClearFilter, diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index b2601f313b..a0c19ab771 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -303,6 +303,7 @@ static BOOL hb_cdxWriteMemo( AREAP pArea, LPDBFMEMO pMemo, ULONG * lNewRecNo ) #define cdxRelease NULL #define cdxStructSize NULL #define cdxSysName NULL +#define cdxEval NULL #define cdxPack NULL #define cdxZap NULL #define cdxClearFilter NULL @@ -627,6 +628,7 @@ static RDDFUNCS cdxTable = { cdxBof, cdxRelease, cdxStructSize, cdxSysName, + cdxEval, cdxPack, cdxZap, cdxClearFilter,