15 declare function hashNewItem (
byval list as HASHLIST
ptr )
as HASHITEM
ptr
17 byval item
as HASHITEM
ptr )
28 const INITIAL_ITEMS = 8096
45 byval hash
as THASH
ptr, _
46 byval nodes
as integer, _
47 byval delstr
as integer _
61 dim as integer i =
any
62 dim as HASHITEM
ptr item =
any, nxt =
any
63 dim as HASHLIST
ptr list =
any
68 if( hash->delstr )
then
69 for i = 0
to hash->nodes-1
71 do while( item <> NULL )
74 deallocate( item->
name )
85 for i = 0
to hash->nodes-1
87 do while( item <> NULL )
101 deallocate( hash->
list )
108 function hashHash(
byval s
as const zstring ptr)
as uinteger
109 dim as uinteger index = 0
111 index = s[0] + (index
shl 5) - index
120 byval hash
as THASH
ptr, _
121 byval symbol
as const zstring ptr, _
122 byval index
as uinteger _
125 dim as HASHITEM
ptr item =
any
126 dim as HASHLIST
ptr list =
any
130 index
mod= hash->nodes
135 if( item = NULL )
then
140 do while( item <> NULL )
141 if( *item->
name = *symbol )
then
152 byval hash
as THASH
ptr, _
153 byval symbol
as zstring ptr _
163 byval list as HASHLIST
ptr _
166 dim as HASHITEM
ptr item =
any
172 if(
list->tail <> NULL )
then
173 list->tail->
next = item
178 item->prev =
list->tail
190 byval list as HASHLIST
ptr, _
191 byval item
as HASHITEM
ptr _
194 dim as HASHITEM
ptr prv =
any, nxt =
any
197 if( item = NULL )
Then
204 if( prv <> NULL )
then
210 if( nxt <> NULL )
then
224 byval hash
as THASH
ptr, _
225 byval symbol
as const zstring ptr, _
226 byval userdata
as any ptr, _
227 byval index
as uinteger _
230 dim as HASHITEM
ptr item =
any
233 if( index =
cuint( INVALID ) )
then
237 index
mod= hash->nodes
243 if( item = NULL )
then
249 item->
data = userdata
256 byval hash
as THASH
ptr, _
257 byval item
as HASHITEM
ptr, _
258 byval index
as uinteger _
261 dim as HASHLIST
ptr list =
any
263 if( item = NULL )
then
267 index
mod= hash->nodes
273 if( hash->delstr )
then
274 deallocate( item->
name )
286 byval set
as TSTRSET
ptr, _
287 byref s
as const string, _
288 byval userdata
as integer _
291 dim as TSTRSETITEM
ptr i =
any
295 if(
len( s ) = 0 )
then
309 i->userdata = userdata
313 if(
len( i->s ) = 0 )
then
320 sub strsetCopy(
byval target
as TSTRSET
ptr,
byval source
as TSTRSET
ptr)
328 sub strsetInit(
byval set
as TSTRSET
ptr,
byval nodes
as integer)