2007-09-25 18:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* include/hbcompat.ch
   * source/vm/arrayshb.c
   * contrib/xhb/xhb.ch
   * contrib/xhb/xhbfunc.c
     + Added HB_ASCAN() to Harbour, which does the same as 
       the plain AScan() in xhb. I decided to do this 
       because we already had hb_RAscan() implemented, and 
       having hb_Ascan() is good to keep symetry.
     * Modified xhb lib to use the Harbour one.
     * Translations moved to hbcompat.ch.
     - Removed HB_COMPAT_XHB from Harbour level array functions.
This commit is contained in:
Viktor Szakats
2007-09-25 16:52:16 +00:00
parent 8d8d012bdf
commit a3c5433fa3
5 changed files with 38 additions and 49 deletions

View File

@@ -8,6 +8,19 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-09-25 18:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbcompat.ch
* source/vm/arrayshb.c
* contrib/xhb/xhb.ch
* contrib/xhb/xhbfunc.c
+ Added HB_ASCAN() to Harbour, which does the same as
the plain AScan() in xhb. I decided to do this
because we already had hb_RAscan() implemented, and
having hb_Ascan() is good to keep symetry.
* Modified xhb lib to use the Harbour one.
* Translations moved to hbcompat.ch.
- Removed HB_COMPAT_XHB from Harbour level array functions.
2007-09-25 13:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rdd/wafunc.c
! fixed typo which broke array returned by dbStrunct()

View File

@@ -58,6 +58,5 @@
#xtranslate AIns(<a>,<n>,<x>) => xhb_AIns(<a>,<n>,<x>)
#xtranslate ADel(<a>,<n>,<l>) => xhb_ADel(<a>,<n>,<l>)
#xtranslate AScan(<a>,<b>,[<c>],[<d>],<e>) => xhb_AScan(<a>,<b>,<c>,<d>,<e>)
#endif

View File

@@ -53,25 +53,6 @@
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( XHB_ASCAN )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
PHB_ITEM pValue = hb_param( 2, HB_IT_ANY );
if( pArray && pValue )
{
ULONG ulStart = hb_parnl( 3 );
ULONG ulCount = hb_parnl( 4 );
hb_retnint( hb_arrayScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,
hb_parl( 5 ) ) );
}
else
hb_retni( 0 );
}
HB_FUNC_EXTERN( HB_DESERIALIZE );
HB_FUNC( HB_DESERIALBEGIN )

View File

@@ -81,7 +81,8 @@
#xtranslate hb_HexToStr([<c,...>]) => HexToStr(<c>)
#xtranslate hb_StrToHex([<c,...>]) => StrToHex(<c>)
#xtranslate hb_RAScan([<x,...>]) => RAScan(<x>)
#xtranslate hb_AScan(<a>,<b>,[<c>],[<d>],<e>) => AScan(<a>,<b>,<c>,<d>,<e>)
#xtranslate hb_RAScan([<x,...>]) => RAScan(<x>)
#xtranslate hb_ISPOINTER( <xValue> )=> ISPOINTER( <xValue> )
@@ -125,7 +126,8 @@
#xtranslate HexToStr([<c,...>]) => hb_HexToStr(<c>)
#xtranslate StrToHex([<c,...>]) => hb_StrToHex(<c>)
#xtranslate RAScan([<x,...>]) => hb_RAScan(<x>)
#xtranslate AScan(<a>,<b>,[<c>],[<d>],<e>) => hb_AScan(<a>,<b>,<c>,<d>,<e>)
#xtranslate RAScan([<x,...>]) => hb_RAScan(<x>)
#xtranslate ISPOINTER( <xValue> ) => hb_ISPOINTER( <xValue> )

View File

@@ -180,19 +180,7 @@ HB_FUNC( AINS )
if( lPos == 0 )
lPos = 1;
#if defined( HB_COMPAT_XHB )
if( hb_pcount() >= 4 && ISLOG( 4 ) && hb_parl( 4 ) &&
lPos >= 1 && ( ULONG ) lPos <= pArray->item.asArray.value->ulLen + 1 )
hb_arraySize( pArray, pArray->item.asArray.value->ulLen + 1 );
if( hb_arrayIns( pArray, lPos ) )
{
if( hb_pcount() >= 3 && !ISNIL( 3 ) )
hb_arraySet( pArray, lPos, hb_param( 3, HB_IT_ANY ) );
}
#else
hb_arrayIns( pArray, lPos );
#endif
hb_itemReturn( pArray ); /* AIns() returns the array itself */
}
@@ -209,15 +197,7 @@ HB_FUNC( ADEL )
if( lPos == 0 )
lPos = 1;
#if defined( HB_COMPAT_XHB )
if( hb_arrayDel( pArray, lPos ) )
{
if( hb_pcount() >= 3 && ISLOG( 3 ) && hb_parl( 3 ) )
hb_arraySize( pArray, pArray->item.asArray.value->ulLen - 1 );
}
#else
hb_arrayDel( pArray, lPos );
#endif
hb_itemReturn( pArray ); /* ADel() returns the array itself */
}
@@ -285,17 +265,30 @@ HB_FUNC( ASCAN )
ULONG ulStart = hb_parnl( 3 );
ULONG ulCount = hb_parnl( 4 );
#if defined( HB_COMPAT_XHB )
hb_retnint( hb_arrayScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,
hb_parl( 5 ) ) );
#else
hb_retnint( hb_arrayScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,
FALSE ) );
#endif
}
else
hb_retni( 0 );
}
/* Same as ASCAN() but has an additional parameter to force exact comparison. */
HB_FUNC( HB_ASCAN )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
PHB_ITEM pValue = hb_param( 2, HB_IT_ANY );
if( pArray && pValue )
{
ULONG ulStart = hb_parnl( 3 );
ULONG ulCount = hb_parnl( 4 );
hb_retnint( hb_arrayScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,
hb_parl( 5 ) ) );
}
else
hb_retni( 0 );
@@ -310,6 +303,7 @@ HB_FUNC( HB_RASCAN )
{
ULONG ulStart = hb_parnl( 3 );
ULONG ulCount = hb_parnl( 4 );
hb_retnint( hb_arrayRevScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,