xHarbour and hash functions

xHarbour and hash functions

Postby Otto » Fri May 29, 2020 6:38 am

Hello,
does xHarbour support hash functions?
Best regards,
Otto

Hash table
hb_Hash() Returns a hash table
hb_HAllocate() Preallocates a hash table
hb_HAutoAdd() Sets the 'auto add' flag for the hash table
hb_HBinary() Sets the 'binary' flag for the hash table
hb_HCaseMatch() Sets the 'case match' flag for the hash table
hb_HClone() Creates a copy of a hash table
hb_HCopy() Adds entries from the source hash table to the destination hash table
hb_HDefault() Returns/sets a default value for a hash table.
hb_HDel() Removes a key/value pair from a hash table
hb_HDelAt() Removes an entry from a hash table based on its index position
hb_HEval() Evaluate a code block across the contents of a hash table
hb_HFill() Fills a hash table with a value
hb_HGet() Returns a hash value
hb_HGetDef() Returns a hash value, or a default value if the key is not present
hb_HHasKey() Determines whether a hash table has an entry with a give key
hb_HKeyAt() Gets a hash table key at a given position
hb_HKeys() Returns an array of the keys of a hash table
hb_HMerge() Merges a source hash table into a destination hash table
hb_HPairAt() Returns a two-dimensional array of a hash table entry key/value pair
hb_HPos() Locates the index of a key within a hash table
hb_HScan() Scans a hash table
hb_HSet() Sets a hash value
hb_HSort() Reorganizes the internal list of the hash table to be sorted
hb_HValueAt() Gets/sets a hash value at a given position
hb_HValues() Returns an array of the values of a hash table
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6073
Joined: Fri Oct 07, 2005 7:07 pm

Re: xHarbour and hash functions

Postby nageswaragunupudi » Fri May 29, 2020 7:55 am

Both Harbour and xHarbour support all these functions but with slightly different names.
hbcompat.ch provides cross translations.

Code: Select all  Expand view

#ifdef __XHARBOUR__
   /* Hash item functions */
   #xtranslate hb_Hash( [<x,...>] )            => Hash( <x> )
   #xtranslate hb_HHasKey( [<x,...>] )         => HHasKey( <x> )
   #xtranslate hb_HPos( [<x,...>] )            => HGetPos( <x> )
   #xtranslate hb_HGet( [<x,...>] )            => HGet( <x> )
   #xtranslate hb_HSet( [<x,...>] )            => HSet( <x> )
   #xtranslate hb_HDel( [<x,...>] )            => HDel( <x> )
   #xtranslate hb_HKeyAt( [<x,...>] )          => HGetKeyAt( <x> )
   #xtranslate hb_HValueAt( [<x,...>] )        => HGetValueAt( <x> )
   #xtranslate hb_HValueAt( [<x,...>] )        => HSetValueAt( <x> )
   #xtranslate hb_HPairAt( [<x,...>] )         => HGetPairAt( <x> )
   #xtranslate hb_HDelAt( [<x,...>] )          => HDelAt( <x> )
   #xtranslate hb_HKeys( [<x,...>] )           => HGetKeys( <x> )
   #xtranslate hb_HValues( [<x,...>] )         => HGetValues( <x> )
   #xtranslate hb_HFill( [<x,...>] )           => HFill( <x> )
   #xtranslate hb_HClone( [<x,...>] )          => HClone( <x> )
   #xtranslate hb_HCopy( [<x,...>] )           => HCopy( <x> )
   #xtranslate hb_HMerge( [<x,...>] )          => HMerge( <x> )
   #xtranslate hb_HEval( [<x,...>] )           => HEval( <x> )
   #xtranslate hb_HScan( [<x,...>] )           => HScan( <x> )
   #xtranslate hb_HSetCaseMatch( [<x,...>] )   => HSetCaseMatch( <x> )
   #xtranslate hb_HCaseMatch( [<x,...>] )      => HGetCaseMatch( <x> )
   #xtranslate hb_HSetAutoAdd( [<x,...>] )     => HSetAutoAdd( <x> )
   #xtranslate hb_HAutoAdd( [<x,...>] )        => HGetAutoAdd( <x> )
   #xtranslate hb_HAllocate( [<x,...>] )       => HAllocate( <x> )
   #xtranslate hb_HDefault( [<x,...>] )        => HDefault( <x> )
#else
   /* Hash item functions */
   #xtranslate Hash( [<x,...>] )           => hb_Hash( <x> )
   #xtranslate HHasKey( [<x,...>] )        => hb_HHasKey( <x> )
   #xtranslate HGetPos( [<x,...>] )        => hb_HPos( <x> )
   #xtranslate HGet( [<x,...>] )           => hb_HGet( <x> )
   #xtranslate HSet( [<x,...>] )           => hb_HSet( <x> )
   #xtranslate HDel( [<x,...>] )           => hb_HDel( <x> )
   #xtranslate HGetKeyAt( [<x,...>] )      => hb_HKeyAt( <x> )
   #xtranslate HGetValueAt( [<x,...>] )    => hb_HValueAt( <x> )
   #xtranslate HSetValueAt( [<x,...>] )    => hb_HValueAt( <x> )
   #xtranslate HGetPairAt( [<x,...>] )     => hb_HPairAt( <x> )
   #xtranslate HDelAt( [<x,...>] )         => hb_HDelAt( <x> )
   #xtranslate HGetKeys( [<x,...>] )       => hb_HKeys( <x> )
   #xtranslate HGetValues( [<x,...>] )     => hb_HValues( <x> )
   #xtranslate HFill( [<x,...>] )          => hb_HFill( <x> )
   #xtranslate HClone( [<x,...>] )         => hb_HClone( <x> )
   #xtranslate HCopy( [<x,...>] )          => hb_HCopy( <x> )
   #xtranslate HMerge( [<x,...>] )         => hb_HMerge( <x> )
   #xtranslate HEval( [<x,...>] )          => hb_HEval( <x> )
   #xtranslate HScan( [<x,...>] )          => hb_HScan( <x> )
   #xtranslate HSetCaseMatch( [<x,...>] )  => hb_HSetCaseMatch( <x> )
   #xtranslate HGetCaseMatch( [<x,...>] )  => hb_HCaseMatch( <x> )
   #xtranslate HSetAutoAdd( [<x,...>] )    => hb_HSetAutoAdd( <x> )
   #xtranslate HGetAutoAdd( [<x,...>] )    => hb_HAutoAdd( <x> )
   #xtranslate HAllocate( [<x,...>] )      => hb_HAllocate( <x> )
   #xtranslate HDefault( [<x,...>] )       => hb_HDefault( <x> )
   #xtranslate HSetPartition( [<x,...>] )  =>

   /* Associative hash array functions */
   #xtranslate haAGetKeyAt( [<x,...>] )    => hb_HKeyAt( <x> )
   #xtranslate haAGetValueAt( [<x,...>] )  => hb_HValueAt( <x> )
   #xtranslate haADelAt( [<x,...>] )       => hb_HDelAt( <x> )
   #xtranslate haAGetPos( [<x,...>] )      => hb_HPos( <x> )
   #xtranslate haAGetRealPos( <x>, <y> )   => iif( HB_ISNUMERIC( <y> ) .AND. <y> >= 1 .AND. ;
                                                   Int( <y> ) <= Len( <x> ), Int( <y> ), 0 )
   #xtranslate HGetVaaPos( <x> )           => {| h | ;;
                                                LOCAL a := Array( Len( h ), v ;;
                                                FOR EACH v IN a ;;
                                                   v := v:__enumIndex() ;;
                                                NEXT ;;
                                                RETURN a ; }:eval( <x> )
   #xtranslate HGetAACompatibility( <x> )  => hb_HKeepOrder( <x> )
   #xtranslate HSetAACompatibility( [<x,...>] ) => {| h | ;;
                                                   hb_HKeepOrder( h ) ;;
                                                   RETURN .T. ; }:eval( <x> )

#endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xHarbour and hash functions

Postby Otto » Fri May 29, 2020 8:59 am

Dear Mr. Rao,
thank you so much.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6073
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Antonio Linares and 40 guests