From f70ea27f20a975e6caf7b75867623bc726d2611e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 20 Feb 2010 10:51:51 +0000 Subject: [PATCH] 2010-02-20 11:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbextern.ch * src/rtl/browdb.prg * src/rdd/dbcmd.c * contrib/xpp/dbcmdx.c * contrib/xpp/browdbx.prg + Cleaned the way TBrowseDB() "skipper" function is defined. This means that from now on by default the faster, .c implementation will be used (now called __DBSKIPPER()). The same will be used by xpp lib (via compatibility stub called DBSKIPPER()). The .prg implementation (now moved in core) will be used when HB_CLP_STRICT is enabled. * include/hbextern.ch + Added missing HB_DYNCALL(). * contrib/xpp/xpp.ch * Do not #define HB_COMPAT_XPP. --- harbour/ChangeLog | 19 ++++++++++ harbour/contrib/xpp/browdbx.prg | 33 ----------------- harbour/contrib/xpp/dbcmdx.c | 64 ++++----------------------------- harbour/contrib/xpp/xpp.ch | 10 ++---- harbour/include/hbextern.ch | 3 ++ harbour/src/rdd/dbcmd.c | 61 +++++++++++++++++++++++++++++++ harbour/src/rtl/browdb.prg | 8 +++-- 7 files changed, 99 insertions(+), 99 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2bfb2878ba..b0fa682207 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-20 11:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * include/hbextern.ch + * src/rtl/browdb.prg + * src/rdd/dbcmd.c + * contrib/xpp/dbcmdx.c + * contrib/xpp/browdbx.prg + + Cleaned the way TBrowseDB() "skipper" function is defined. + This means that from now on by default the faster, .c + implementation will be used (now called __DBSKIPPER()). + The same will be used by xpp lib (via compatibility stub + called DBSKIPPER()). The .prg implementation (now moved + in core) will be used when HB_CLP_STRICT is enabled. + + * include/hbextern.ch + + Added missing HB_DYNCALL(). + + * contrib/xpp/xpp.ch + * Do not #define HB_COMPAT_XPP. + 2010-02-20 05:12 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + contrib/hbziparc/doc + contrib/hbziparc/doc/en-EN diff --git a/harbour/contrib/xpp/browdbx.prg b/harbour/contrib/xpp/browdbx.prg index eff23410d5..1110a5a8d9 100644 --- a/harbour/contrib/xpp/browdbx.prg +++ b/harbour/contrib/xpp/browdbx.prg @@ -64,36 +64,3 @@ FUNCTION xpp_TBrowseDB( nTop, nLeft, nBottom, nRight ) oBrowse:GoBottomBlock := { || dbGoBottom() } RETURN oBrowse - -#ifdef HB_PRG_DBSKIPPER - -FUNCTION dbSkipper( nRecs ) - - LOCAL nSkipped := 0 - - IF LastRec() != 0 - IF nRecs == 0 - dbSkip( 0 ) - ELSEIF nRecs > 0 .AND. RecNo() != LastRec() + 1 - DO WHILE nSkipped < nRecs - dbSkip( 1 ) - IF Eof() - dbSkip( -1 ) - EXIT - ENDIF - nSkipped++ - ENDDO - ELSEIF nRecs < 0 - DO WHILE nSkipped > nRecs - dbSkip( -1 ) - IF Bof() - EXIT - ENDIF - nSkipped-- - ENDDO - ENDIF - ENDIF - - RETURN nSkipped - -#endif diff --git a/harbour/contrib/xpp/dbcmdx.c b/harbour/contrib/xpp/dbcmdx.c index de85ee0c34..92cde06347 100644 --- a/harbour/contrib/xpp/dbcmdx.c +++ b/harbour/contrib/xpp/dbcmdx.c @@ -70,6 +70,13 @@ HB_FUNC( DBZAP ) HB_FUNC_EXEC( HB_DBZAP ); } +HB_FUNC_EXTERN( __DBSKIPPER ); + +HB_FUNC( DBSKIPPER ) +{ + HB_FUNC_EXEC( __DBSKIPPER ); +} + HB_FUNC( ORDWILDSEEK ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); @@ -122,60 +129,3 @@ HB_FUNC( ORDWILDSEEK ) else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME ); } - -HB_FUNC( DBSKIPPER ) -{ - AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); - - if( pArea ) - { - HB_LONG lSkipped = 0; - HB_LONG lRecs = 1; - HB_BOOL fBEof; - HB_ULONG ulRecords = 0; - - if( SELF_RECCOUNT( pArea, &ulRecords ) == HB_SUCCESS && ulRecords > 0 ) - { - if( HB_ISNUM( 1 ) ) - lRecs = hb_parnl( 1 ); - - if( lRecs == 0 ) - SELF_SKIP( pArea, 0 ); - else if( lRecs > 0 ) - { - if( SELF_EOF( pArea, &fBEof ) == HB_SUCCESS ) - { - while( lSkipped < lRecs ) - { - if( SELF_SKIP( pArea, 1 ) != HB_SUCCESS ) - break; - if( SELF_EOF( pArea, &fBEof ) != HB_SUCCESS ) - break; - if( fBEof ) - { - SELF_SKIP( pArea, -1 ); - break; - } - lSkipped++; - } - } - } - else /* if( lRecs < 0 ) */ - { - while( lSkipped > lRecs ) - { - if( SELF_SKIP( pArea, -1 ) != HB_SUCCESS ) - break; - if( SELF_BOF( pArea, &fBEof ) != HB_SUCCESS ) - break; - if( fBEof ) - break; - lSkipped--; - } - } - } - hb_retnl( lSkipped ); - } - else - hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME ); -} diff --git a/harbour/contrib/xpp/xpp.ch b/harbour/contrib/xpp/xpp.ch index d26b093292..a6f38de90b 100644 --- a/harbour/contrib/xpp/xpp.ch +++ b/harbour/contrib/xpp/xpp.ch @@ -59,10 +59,6 @@ #else #ifdef __HARBOUR__ -#ifndef HB_COMPAT_XPP -#define HB_COMPAT_XPP -#endif - /* Translations for Xbase++ programs compiled with Harbour compiler */ #include "hbclass.ch" @@ -75,6 +71,9 @@ #xtranslate TBrowse() => xpp_TBrowse() #xtranslate Get() => xpp_Get() +/* NOTE: Several other Xbase++ functions are currently implemented using + original Xbase++ names. */ + /* box.ch extensions */ #define B_THIN ( Chr( 219 ) + Chr( 223 ) + Chr( 219 ) + Chr( 219 ) + ; @@ -83,8 +82,5 @@ #define B_FAT ( Chr( 219 ) + Chr( 219 ) + Chr( 219 ) + Chr( 219 ) + ; Chr( 219 ) + Chr( 219 ) + Chr( 219 ) + Chr( 219 ) ) -/* NOTE: Several other Xbase++ function are currently implemented using - original Xbase++ names. */ - #endif #endif diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 58c7cf1a39..3469b3406b 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -450,6 +450,8 @@ EXTERNAL __XSAVESCREEN /* Harbour internal functions */ +EXTERNAL __DBSKIPPER + EXTERNAL __NATISAFFIRM EXTERNAL __NATISNEGATIVE EXTERNAL __NATMSG @@ -780,6 +782,7 @@ EXTERNAL SHOWMSG /* Harbour extensions */ +EXTERNAL HB_DYNCALL EXTERNAL HB_PROGNAME EXTERNAL HB_DIRBASE EXTERNAL HB_DIRTEMP diff --git a/harbour/src/rdd/dbcmd.c b/harbour/src/rdd/dbcmd.c index 24d817e8c3..02a222fe34 100644 --- a/harbour/src/rdd/dbcmd.c +++ b/harbour/src/rdd/dbcmd.c @@ -2245,3 +2245,64 @@ HB_FUNC( HB_WAEVAL ) else hb_errRT_DBCMD( EG_ARG, EDBCMD_USE_BADPARAMETER, NULL, HB_ERR_FUNCNAME ); } + +#ifndef HB_CLP_STRICT + +HB_FUNC( __DBSKIPPER ) +{ + AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); + + if( pArea ) + { + HB_LONG lSkipped = 0; + HB_LONG lRecs = 1; + HB_BOOL fBEof; + HB_ULONG ulRecords = 0; + + if( SELF_RECCOUNT( pArea, &ulRecords ) == HB_SUCCESS && ulRecords > 0 ) + { + if( HB_ISNUM( 1 ) ) + lRecs = hb_parnl( 1 ); + + if( lRecs == 0 ) + SELF_SKIP( pArea, 0 ); + else if( lRecs > 0 ) + { + if( SELF_EOF( pArea, &fBEof ) == HB_SUCCESS ) + { + while( lSkipped < lRecs ) + { + if( SELF_SKIP( pArea, 1 ) != HB_SUCCESS ) + break; + if( SELF_EOF( pArea, &fBEof ) != HB_SUCCESS ) + break; + if( fBEof ) + { + SELF_SKIP( pArea, -1 ); + break; + } + lSkipped++; + } + } + } + else /* if( lRecs < 0 ) */ + { + while( lSkipped > lRecs ) + { + if( SELF_SKIP( pArea, -1 ) != HB_SUCCESS ) + break; + if( SELF_BOF( pArea, &fBEof ) != HB_SUCCESS ) + break; + if( fBEof ) + break; + lSkipped--; + } + } + } + hb_retnl( lSkipped ); + } + else + hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME ); +} + +#endif diff --git a/harbour/src/rtl/browdb.prg b/harbour/src/rtl/browdb.prg index 3e087dc468..91ca8b70d6 100644 --- a/harbour/src/rtl/browdb.prg +++ b/harbour/src/rtl/browdb.prg @@ -54,13 +54,15 @@ FUNCTION TBrowseDB( nTop, nLeft, nBottom, nRight ) LOCAL oBrowse := TBrowseNew( nTop, nLeft, nBottom, nRight ) - oBrowse:SkipBlock := { | nRecs | Skipped( nRecs ) } + oBrowse:SkipBlock := { | nRecs | __dbSkipper( nRecs ) } oBrowse:GoTopBlock := { || dbGoTop() } oBrowse:GoBottomBlock := { || dbGoBottom() } RETURN oBrowse -STATIC FUNCTION Skipped( nRecs ) +#ifdef HB_CLP_STRICT + +FUNCTION __dbSkipper( nRecs ) LOCAL nSkipped := 0 @@ -88,3 +90,5 @@ STATIC FUNCTION Skipped( nRecs ) ENDIF RETURN nSkipped + +#endif