14 dim as any ptr p =
allocate(
size)
22 dim as any ptr p =
callocate(
size)
30 dim as any ptr p =
reallocate(old,
size)
39 byval list as TLIST
ptr, _
40 byval nodes
as integer, _
41 byval nodelen
as integer, _
42 byval flags
as LIST_FLAGS _
49 list->nodelen = nodelen +
len( TLISTNODE )
60 dim as TLISTTB
ptr tb =
any, nxt =
any
64 do while( tb <> NULL )
66 deallocate( tb->nodetb )
78 byval list as TLIST
ptr, _
79 byval nodes
as integer _
82 dim as TLISTNODE
ptr nodetb =
any, node =
any, prv =
any
83 dim as TLISTTB
ptr tb =
any
84 dim as integer i =
any
89 if( (
list->flags
and LIST_FLAGS_CLEARNODES) <> 0 )
then
99 if(
list->tbhead = NULL )
then
102 if(
list->tbtail <> NULL )
then
103 list->tbtail->
next = tb
116 if( (
list->flags
and LIST_FLAGS_LINKFREENODES) <> 0 )
then
122 node->
next =
cast( TLISTNODE
ptr,
cast(
byte ptr, node ) +
list->nodelen )
137 byval list as TLIST
ptr _
140 dim as TLISTNODE
ptr node =
any, tail =
any
143 if(
list->fhead = NULL )
Then
149 list->fhead = node->
next
151 if( (
list->flags
and LIST_FLAGS_LINKUSEDNODES) <> 0 )
then
155 if( tail <> NULL )
then
164 function =
cast(
byte ptr, node ) +
len( TLISTNODE )
175 byval list as TLIST
ptr, _
176 byval node_
as any ptr _
179 dim as TLISTNODE
ptr node =
any, prv =
any, nxt =
any
181 if( node_ = NULL )
then
185 if( (
list->flags
and LIST_FLAGS_LINKUSEDNODES) <> 0 )
then
186 node =
cast( TLISTNODE
ptr,
cast(
byte ptr, node_ ) -
len( TLISTNODE ) )
191 if( prv <> NULL )
then
197 if( nxt <> NULL )
then
204 node =
cast( TLISTNODE
ptr, node_ )
208 node->
next =
list->fhead
212 if( (
list->flags
and LIST_FLAGS_CLEARNODES) <> 0 )
then
213 clear(
byval node_, 0,
list->nodelen -
len( TLISTNODE ) )
221 byval list as TLIST
ptr _
224 assert( (
list->flags
and LIST_FLAGS_LINKUSEDNODES) <> 0 )
226 if(
list->head = NULL )
then
229 function =
cast(
byte ptr,
list->head ) +
len( TLISTNODE )
237 byval list as TLIST
ptr _
240 assert( (
list->flags
and LIST_FLAGS_LINKUSEDNODES) <> 0 )
242 if(
list->tail = NULL )
then
245 function =
cast(
byte ptr,
list->tail ) +
len( TLISTNODE )
253 byval node
as any ptr _
256 dim as TLISTNODE
ptr prev =
any
258 assert( node <> NULL )
260 prev =
cast( TLISTNODE
ptr, _
261 cast(
byte ptr, node ) -
len( TLISTNODE ) )->prev
263 if( prev = NULL )
then
266 function =
cast(
byte ptr, prev ) +
len( TLISTNODE )
274 byval node
as any ptr _
277 dim as TLISTNODE
ptr nxt =
any
279 assert( node <> NULL )
281 nxt =
cast( TLISTNODE
ptr, _
282 cast(
byte ptr, node ) -
len( TLISTNODE ) )->
next
284 if( nxt = NULL )
then
287 function =
cast(
byte ptr, nxt ) +
len( TLISTNODE )