2007-10-06 13:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/hashes.c
    * set AUTOADD for assign operation by default in new arrays
    * removed last HB_COMPAT_XHB

  * harbour/source/vm/hashfunc.c
    * change HB_HAUTOADD( hHash, .T. ) to set AUTOADD for assign only
      when no default value is set

   Above are minimal modifications to make default Harbour behavior
   more similar to other languages f.e. PHP or xHarbour. Other
   modifications will depend on group decision.
This commit is contained in:
Przemyslaw Czerpak
2007-10-06 11:56:02 +00:00
parent 053e67ddeb
commit dafaea3cbe
3 changed files with 15 additions and 5 deletions

View File

@@ -8,6 +8,19 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-10-06 13:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/hashes.c
* set AUTOADD for assign operation by default in new arrays
* removed last HB_COMPAT_XHB
* harbour/source/vm/hashfunc.c
* change HB_HAUTOADD( hHash, .T. ) to set AUTOADD for assign only
when no default value is set
Above are minimal modifications to make default Harbour behavior
more similar to other languages f.e. PHP or xHarbour. Other
modifications will depend on group decision.
2007-10-06 12:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbsetup.h
* harbour/source/rtl/hbffind.c

View File

@@ -318,11 +318,7 @@ HB_EXPORT PHB_ITEM hb_hashNew( PHB_ITEM pItem )
pBaseHash->pPairs = NULL;
pBaseHash->ulSize = 0;
pBaseHash->ulLen = 0;
#ifdef HB_COMPAT_XHB
pBaseHash->iFlags = HB_HASH_AUTOADD_ASSIGN;
#else
pBaseHash->iFlags = HB_HASH_AUTOADD_NEVER;
#endif
pBaseHash->pDefault = NULL;
pItem->type = HB_IT_HASH;

View File

@@ -631,7 +631,8 @@ HB_FUNC( HB_HAUTOADD )
if( HB_IS_LOGICAL( pValue ) )
{
if( hb_itemGetL( pValue ) )
hb_hashSetFlags( pHash, HB_HASH_AUTOADD_ALWAYS );
hb_hashSetFlags( pHash, hb_hashGetDefault( pHash ) ?
HB_HASH_AUTOADD_ALWAYS : HB_HASH_AUTOADD_ASSIGN );
else if( iOldFlags )
hb_hashClearFlags( pHash, iOldFlags );
}