2018-01-05 14:12 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbapiitm.h
  * src/rtl/hbdef.c
  * src/vm/itemapi.c
  * src/harbour.def
    + added new public C function
         HB_BOOL hb_itemTypeCmp( PHB_ITEM pItem1, PHB_ITEM pItem2 );
      which uses low level item type comparison code taken from hb_default()
      and hb_defaultValue() PRG functions

  * include/harbour.hbx
  * src/harbour.def
  * src/vm/hashfunc.c
    + added new PRG function
         hb_HSetDef( <hVal>, <xKey> [, <xDefVal> ] )
      it checks if <xKey> exists and if not then adds it to hash array
      and optionally sets key value to <xDefVal> otherwise (the key
      exists in hash array) and <xDefVal> is given then it checks if
      the type of key's value is compatible with <xDefVal> and if not
      then replaces key's value with <xDefVal>.
      In other words it's combination of hb_HGetDef() and hb_default()
      and works like this PRG code:
            FUNCTION hb_HSetDef( hVal, xKey, xDefVal )
               IF xKey $ hVal
                  hb_default( @hVal[ xKey ], xDefVal )
               ELSE
                  hVal[ xKey ] := xDefVal
               ENDIF
            RETURN hVal
      but much faster.

  * src/rtl/dirscan.prg
    * remove READONLY attribute from deleted directories.
      Be careful. Now this function allows to recursively remove
      all directories even if they have READONLY attribute.
This commit is contained in:
Przemysław Czerpak
2018-01-05 14:12:06 +01:00
parent 06725f4212
commit 12880a1b7f
8 changed files with 139 additions and 62 deletions

View File

@@ -548,6 +548,7 @@ DYNAMIC hb_HSet
DYNAMIC hb_HSetAutoAdd
DYNAMIC hb_HSetBinary
DYNAMIC hb_HSetCaseMatch
DYNAMIC hb_HSetDef
DYNAMIC hb_HSetOrder
DYNAMIC hb_HSort
DYNAMIC hb_HValueAt

View File

@@ -138,7 +138,8 @@ extern HB_EXPORT PHB_ITEM hb_itemReturnForward( PHB_ITEM pItem );
extern HB_EXPORT void hb_itemReturnRelease( PHB_ITEM pItem );
extern HB_EXPORT HB_SIZE hb_itemSize ( PHB_ITEM pItem );
extern HB_EXPORT HB_TYPE hb_itemType ( PHB_ITEM pItem );
extern HB_EXPORT const char * hb_itemTypeStr ( PHB_ITEM pItem );
extern HB_EXPORT const char * hb_itemTypeStr ( PHB_ITEM pItem );
extern HB_EXPORT HB_BOOL hb_itemTypeCmp ( PHB_ITEM pItem1, PHB_ITEM pItem2 );
#ifndef HB_LONG_LONG_OFF
extern HB_EXPORT HB_LONGLONG hb_itemGetNLL ( PHB_ITEM pItem );
extern HB_EXPORT PHB_ITEM hb_itemPutNLL ( PHB_ITEM pItem, HB_LONGLONG lNumber );