Diff for /gforth/hash.fs between versions 1.24 and 1.28

version 1.24, 2000/04/02 21:48:54 version 1.28, 2001/09/04 09:17:02
Line 1 Line 1
 \ Hashed dictionaries                                  15jul94py  \ Hashed dictionaries                                  15jul94py
   
 \ Copyright (C) 1995,1998 Free Software Foundation, Inc.  \ Copyright (C) 1995,1998,2000 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 16 Line 16
   
 \ You should have received a copy of the GNU General Public License  \ You should have received a copy of the GNU General Public License
 \ along with this program; if not, write to the Free Software  \ along with this program; if not, write to the Free Software
 \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
   
   [IFUNDEF] erase
   : erase ( addr len -- ) 0 fill ;
   [THEN]
   
 [IFUNDEF] allocate  [IFUNDEF] allocate
 : reserve-mem here swap allot ;  : reserve-mem here swap allot ;
Line 32 Line 36
   
 \ compute hash key                                     15jul94py  \ compute hash key                                     15jul94py
   
   has? ec [IF] [IFUNDEF] hash
   : hash ( addr len -- key )
     over c@ swap 1- IF swap char+ c@ + ELSE nip THEN
     [ Hashlen 1- ] literal and ;
   [THEN] [THEN]
   
 [IFUNDEF] hash  [IFUNDEF] hash
 : hash ( addr len -- key )  : hash ( addr len -- key )
     hashbits (hashkey1) ;      hashbits (hashkey1) ;
Line 42  Variable revealed Line 52  Variable revealed
   
 \ Memory handling                                      10oct94py  \ Memory handling                                      10oct94py
   
 Variable HashPointer  AVariable HashPointer
 Variable HashIndex  Variable HashIndex
 0 Value HashTable  0 AValue HashTable
   
 \ forward declarations  \ forward declarations
 0 Value hashsearch-map  0 AValue hashsearch-map
 Defer hash-alloc ( addr -- addr )  Defer hash-alloc ( addr -- addr )
   
 \ DelFix and NewFix are from bigFORTH                  15jul94py  \ DelFix and NewFix are from bigFORTH                  15jul94py
Line 65  Defer hash-alloc ( addr -- addr ) Line 75  Defer hash-alloc ( addr -- addr )
     cells HashTable + ;      cells HashTable + ;
   
 : hash-find ( addr len wordlist -- nfa / false )  : hash-find ( addr len wordlist -- nfa / false )
     >r 2dup r> bucket @ (hashfind) ;      >r 2dup r> bucket @ (hashlfind) ;
   
 \ hash vocabularies                                    16jul94py  \ hash vocabularies                                    16jul94py
   
Line 134  Defer hash-alloc ( addr -- addr ) Line 144  Defer hash-alloc ( addr -- addr )
   IF   inithash    IF   inithash
   ELSE rehashall THEN ;    ELSE rehashall THEN ;
   
 \ >rom ?!  const Create (hashsearch-map)
 align here    ' hash-find A, ' hash-reveal A, ' (rehash) A, ' (rehash) A,  ' hash-find A, ' hash-reveal A, ' (rehash) A, ' (rehash) A,
 to hashsearch-map  (hashsearch-map) to hashsearch-map
   
 \ hash allocate and vocabulary initialization          10oct94py  \ hash allocate and vocabulary initialization          10oct94py
   

Removed from v.1.24  
changed lines
  Added in v.1.28


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>