Some news and fixes.

This commit is contained in:
Antonio Carlos Pantaglione
2003-07-18 00:23:06 +00:00
parent 5514ca7b0d
commit bb3ff45008
5 changed files with 182 additions and 52 deletions

View File

@@ -8,6 +8,21 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2003-07-17 23:00 UTC-0300 Antonio Carlos Pantaglione <toninho@fwi.com.br>
* source/rtl/transfrm.c
! Removed some old commented lines
* contrib/rdd_ads/adsfunc.c
! Update transaction functions
! Add AdsCacheRecords function
* source/rdd/dbcmd.c
! Modified error handling to allow retry if alias is not exist during
DBSelectArea() for Clipper compatibility. (Reported by Giovi Verrua)
* source/vm/hvm.c
! More Clipper compatible to handle FOR-NEXT loops.
Changes by Andi Jahja, borrow from xharbour
2003-07-17 17:43 UTC-0400 Alejandro de Garate <alex_degarate@hotmail.com>
* doc/en/memo.txt
+ Added MEMOREAD(), MEMOWRIT() documentation

View File

@@ -1228,7 +1228,6 @@ HB_FUNC( ADSREGCALLBACK )
}
HB_FUNC( ADSCLRCALLBACK )
{
if ( itmCobCallBack )
@@ -1283,36 +1282,6 @@ HB_FUNC( ADSGETCONNECTIONHANDLE )
hb_retni( adsConnectHandle );
}
HB_FUNC( ADSBEGINTRANSACTION )
{
hb_retnl( AdsBeginTransaction( (hb_pcount()>1)? (ADSHANDLE)hb_parnl(1) : adsConnectHandle ) );
}
HB_FUNC( ADSCOMMITTRANSACTION )
{
hb_retnl( AdsCommitTransaction( (hb_pcount()>1)? (ADSHANDLE)hb_parnl(1) : adsConnectHandle ) );
}
HB_FUNC( ADSROLLBACKTRANSACTION )
{
hb_retnl( AdsRollbackTransaction( (hb_pcount()>1)? (ADSHANDLE)hb_parnl(1) : adsConnectHandle ) );
}
HB_FUNC( ADSFAILEDTRANSACTIONRECOVERY )
{
hb_retnl( AdsFailedTransactionRecovery( (ISCHAR(1))? ( unsigned char * ) hb_parc(1) : NULL ) );
}
HB_FUNC( ADSINTRANSACTION )
{
UNSIGNED16 pbInTrans;
if( AdsInTransaction( (hb_pcount()>1)? (ADSHANDLE)hb_parnl(1) : adsConnectHandle,&pbInTrans ) )
hb_retl( (int) pbInTrans );
else
hb_retl( 0 );
}
HB_FUNC( ADSGETLASTERROR )
{
/* nLastErr := AdsGetLastError( [ @cLastErr ] ) */
@@ -1373,6 +1342,82 @@ HB_FUNC( ADSUSEDICTIONARY )
#endif
HB_FUNC( ADSBEGINTRANSACTION )
{
ADSHANDLE hConnect = ISNUM( 1 ) ? hb_parnl( 1 ) : 0;
if ( AdsBeginTransaction( hConnect ) == AE_SUCCESS )
hb_retl( TRUE );
else
hb_retl( FALSE );
}
HB_FUNC( ADSCOMMITTRANSACTION )
{
ADSHANDLE hConnect = ISNUM( 1 ) ? hb_parnl( 1 ) : 0;
if ( AdsCommitTransaction( hConnect ) == AE_SUCCESS )
hb_retl( TRUE );
else
hb_retl( FALSE );
}
HB_FUNC( ADSFAILEDTRANSACTIONRECOVERY )
{
UNSIGNED8 *pucServer = ( UNSIGNED8 *) ( ISCHAR( 1 ) ? hb_parc( 1 ) : NULL);
if ( AdsFailedTransactionRecovery( pucServer ) == AE_SUCCESS )
hb_retl( TRUE );
else
hb_retl( FALSE );
}
HB_FUNC( ADSINTRANSACTION )
{
ADSHANDLE hConnect = ISNUM( 1 ) ? hb_parnl( 1 ) : 0;
UNSIGNED16 pbInTrans ;
if ( AdsInTransaction( hConnect, &pbInTrans) == AE_SUCCESS )
hb_retl( pbInTrans );
else
hb_retl( FALSE );
}
HB_FUNC( ADSROLLBACK )
{
ADSHANDLE hConnect = ISNUM( 1 ) ? hb_parnl( 1 ) : 0;
if ( AdsRollbackTransaction( hConnect ) == AE_SUCCESS )
hb_retl( TRUE );
else
hb_retl( FALSE );
}
/*
set the number of records to read ahead, for the current work area
Call : ADSCACHERECORDS(nRecords)
Returns : True if successful
*/
HB_FUNC( ADSCACHERECORDS )
{
UNSIGNED32 ulRetVal ;
ADSAREAP pArea;
ulRetVal=FALSE;
pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
ulRetVal = AdsCacheRecords( pArea->hTable, hb_parni(1) );
if( !pArea || ulRetVal != AE_SUCCESS )
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSCACHERECORDS" );
hb_retl( ulRetVal );
}
HB_FUNC( ADSVERSION )
{
int iVersionType = ISNUM(1) ? hb_parni(1) : 0;

View File

@@ -1760,7 +1760,28 @@ HB_FUNC( DBSELECTAREA )
{
if( ( uiNewArea = hb_rddSelect( szAlias ) ) == 0 )
{
hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 );
USHORT uiAction = E_RETRY;
HB_ITEM_PTR pError;
pError = hb_errRT_New( ES_ERROR, NULL, EG_NOALIAS, EDBCMD_NOALIAS,
NULL, szAlias, 0, EF_CANRETRY );
while( uiAction == E_RETRY )
{
uiAction = hb_errLaunch( pError );
if( uiAction == E_RETRY )
{
if( ( uiNewArea = hb_rddSelect( szAlias ) ) == 0 )
{
uiNewArea = hb_rddSelect( szAlias );
uiAction = E_DEFAULT;
}
}
}
hb_errRelease( pError );
// hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 );
return;
}
}
@@ -3491,7 +3512,7 @@ HB_FUNC( DBEXISTS )
if ( !pRDDNode )
{
hb_errRT_DBCMD( EG_ARG, EDBCMD_EVAL_BADPARAMETER, NULL, "DBDROP" );
hb_errRT_DBCMD( EG_ARG, EDBCMD_EVAL_BADPARAMETER, NULL, "DBEXISTS" );
return;
}

View File

@@ -422,7 +422,6 @@ HB_FUNC( TRANSFORM )
}
/* TODO: maybe replace this 16 with something else */
//Toninho@fwi szResult = ( char * ) hb_xgrab( ulPicLen + 16 ); /* Grab enough */
szResult = ( char * ) hb_xgrab( ulPicLen + (ULONG) iOrigWidth + (ULONG) iOrigDec + 16 ); /* Grab enough */
*szResult = '\0';
@@ -472,7 +471,6 @@ HB_FUNC( TRANSFORM )
}
pNumber = hb_itemPutNDLen( NULL, dPush, -1, iDec );
//Toninho@fwi pWidth = hb_itemPutNI( NULL, iWidth + ( !ulPicLen && iDec > 0 ? iDec + 1 : 0 ) );
pWidth = hb_itemPutNI( NULL, iWidth + ( ( ulPicLen || iDec == 0 ) ? 0 : ( iDec + 1 ) ) );
pDec = hb_itemPutNI( NULL, iDec );
@@ -514,7 +512,6 @@ HB_FUNC( TRANSFORM )
if( uiPicFlags & PF_EXCHANG ) /* Exchange . and , */
{
//Toninho@fwi szResult[ i ] = '.';
szResult[ i ] = ',';
iCount++;
}
@@ -555,7 +552,6 @@ HB_FUNC( TRANSFORM )
if( i && szResult[ i - 1 ] == '*' )
szResult[ i ] = '*';
else
//Toninho@fwi szResult[ i ] = '0';
szResult[ i ] = ' ';
}
}
@@ -826,7 +822,6 @@ HB_FUNC( TRANSFORM )
hb_xfree( szStr );
}
else
//Toninho@fwi hb_retc( NULL );
hb_retc( "" );
}
else if( HB_IS_DATE( pValue ) )

View File

@@ -2589,6 +2589,10 @@ static void hb_vmForTest( void ) /* Test to check the end point of the FO
double dEnd;
double dCurrent;
BOOL lEnd;
BOOL lCurrent;
BOOL lLogicalPassed = FALSE;
HB_TRACE(HB_TR_DEBUG, ("hb_vmForTest()"));
while( ! HB_IS_NUMERIC( hb_stackItemFromTop( -1 ) ) )
@@ -2609,7 +2613,7 @@ static void hb_vmForTest( void ) /* Test to check the end point of the FO
dStep = hb_vmPopNumber();
while( ! HB_IS_NUMERIC( hb_stackItemFromTop( -1 ) ) )
while( ( ! HB_IS_NUMERIC( hb_stackItemFromTop( -1 ) ) ) && ( ! HB_IS_LOGICAL( hb_stackItemFromTop( -1 ) ) ) )
{
PHB_ITEM pItem1 = hb_stackItemFromTop( -1 );
PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1073, NULL, "<", 1, pItem1 );
@@ -2625,9 +2629,15 @@ static void hb_vmForTest( void ) /* Test to check the end point of the FO
return;
}
dEnd = hb_vmPopNumber();
if ( hb_stackItemFromTop( -1 )->type == HB_IT_LOGICAL )
{
lEnd = hb_vmPopLogical();
lLogicalPassed = TRUE;
}
else
dEnd = hb_vmPopNumber();
while( ! HB_IS_NUMERIC( hb_stackItemFromTop( -1 ) ) )
while( ( ! HB_IS_NUMERIC( hb_stackItemFromTop( -1 ) ) ) && ( ! HB_IS_LOGICAL( hb_stackItemFromTop( -1 ) ) ) )
{
PHB_ITEM pItem1 = hb_stackItemFromTop( -1 );
PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1073, NULL, "<", 1, pItem1 );
@@ -2643,12 +2653,38 @@ static void hb_vmForTest( void ) /* Test to check the end point of the FO
return;
}
dCurrent = hb_vmPopNumber();
if ( hb_stackItemFromTop( -1 )->type == HB_IT_LOGICAL )
{
lCurrent = hb_vmPopLogical();
}
else
{
lLogicalPassed = FALSE;
dCurrent = hb_vmPopNumber();
}
if( dStep >= 0 ) /* Positive loop. Use LESS */
hb_vmPushLogical( dCurrent <= dEnd );
else if( dStep < 0 ) /* Negative loop. Use GREATER */
hb_vmPushLogical( dCurrent >= dEnd );
if( lLogicalPassed )
{
if( dStep >= 0 ) /* Positive loop. Use LESS */
{
hb_vmPushLogical( lCurrent <= lEnd );
}
else if( dStep < 0 ) /* Negative loop. Use GREATER */
{
hb_vmPushLogical( lCurrent >= lEnd );
}
}
else
{
if( dStep >= 0 ) /* Positive loop. Use LESS */
{
hb_vmPushLogical( dCurrent <= dEnd );
}
else if( dStep < 0 ) /* Negative loop. Use GREATER */
{
hb_vmPushLogical( dCurrent >= dEnd );
}
}
}
/* ------------------------------- */
@@ -3082,10 +3118,18 @@ static ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias )
case HB_IT_LONG:
/* Alias was evaluated from an expression, (nWorkArea)->field
*/
hb_rddSelectWorkAreaNumber( pAlias->item.asLong.value );
hb_rddSelectWorkAreaNumber( ( int ) pAlias->item.asLong.value );
pAlias->type = HB_IT_NIL;
break;
/*
These types were added for Clipper compatibility
*/
case HB_IT_NIL:
case HB_IT_BLOCK:
case HB_IT_LOGICAL:
case HB_IT_ARRAY:
case HB_IT_DOUBLE:
/* Alias was evaluated from an expression, (nWorkArea)->field
*/
@@ -4165,12 +4209,22 @@ static void hb_vmPushAliasedField( PHB_SYMB pSym )
pAlias = hb_stackItemFromTop( -1 );
iCurrArea = hb_rddGetCurrentWorkAreaNumber();
/* NOTE: hb_vmSelecWorkarea clears passed item
*/
if( hb_vmSelectWorkarea( pAlias ) == SUCCESS )
hb_rddGetFieldValue( pAlias, pSym );
/*
This was added for Clipper compatibility
*/
if( ( pAlias->type == HB_IT_ARRAY ) || ( pAlias->type == HB_IT_LOGICAL ) || ( pAlias->type == HB_IT_NIL ) || ( pAlias->type == HB_IT_BLOCK ) )
{
hb_errRT_BASE_Subst( EG_ARG, 1065, NULL, "&", 1, pAlias );
}
else
{
/* NOTE: hb_vmSelecWorkarea clears passed item
*/
if( hb_vmSelectWorkarea( pAlias ) == SUCCESS )
hb_rddGetFieldValue( pAlias, pSym );
hb_rddSelectWorkAreaNumber( iCurrArea );
hb_rddSelectWorkAreaNumber( iCurrArea );
}
}
/* It pops the last item from the stack to use it to select a workarea