X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/fd34612bda96990b8a77d39fb939ba2703c85f3e..e27ef2c6aab3a2a8051314bd37bb3b2386775f36:/bsearchtree.pas diff --git a/bsearchtree.pas b/bsearchtree.pas index ad61751..d9e3ea2 100644 --- a/bsearchtree.pas +++ b/bsearchtree.pas @@ -17,24 +17,24 @@ const type thashitem=class(tlinklist) hash:integer; - s:string; + s:ansistring; p:pointer; end; thashtable=array[0..hashtable_size-1] of thashitem; phashtable=^thashtable; {adds "item" to the tree for name "s". the name must not exist (no checking done)} -procedure addtree(t:phashtable;s:string;item:pointer); +procedure addtree(t:phashtable;s:ansistring;item:pointer); {removes name "s" from the tree. the name must exist (no checking done)} -procedure deltree(t:phashtable;s:string); +procedure deltree(t:phashtable;s:ansistring); {returns the item pointer for s, or nil if not found} -function findtree(t:phashtable;s:string):pointer; +function findtree(t:phashtable;s:ansistring):pointer; implementation -function makehash(s:string):integer; +function makehash(s:ansistring):integer; const shifter=6; var @@ -48,7 +48,7 @@ begin result := (result xor result shr 16) and (hashtable_size-1); end; -procedure addtree(t:phashtable;s:string;item:pointer); +procedure addtree(t:phashtable;s:ansistring;item:pointer); var hash:integer; p:thashitem; @@ -61,7 +61,7 @@ begin linklistadd(tlinklist(t[hash]),tlinklist(p)); end; -procedure deltree(t:phashtable;s:string); +procedure deltree(t:phashtable;s:ansistring); var p,p2:thashitem; hash:integer; @@ -81,7 +81,7 @@ begin end; -function findtree(t:phashtable;s:string):pointer; +function findtree(t:phashtable;s:ansistring):pointer; var p:thashitem; hash:integer;