#Ifndef __LIST_BI__
#Define __LIST_BI__

#Ifndef FALSE
	Const FALSE = 0
	Const TRUE  = (Not FALSE)
#EndIf

#Ifndef NULL
	Const NULL  = 0
#EndIf

Type TLISTNODE
	prv		As TLISTNODE Ptr
	nxt		As TLISTNODE Ptr
	'' ...
End Type

Type TLISTTB
	nxt		As TLISTTB Ptr
	nodetb	As Any Ptr
	nodes	As Integer
End Type

Type TLIST
	tbhead	As TLISTTB Ptr
	tbtail	As TLISTTB Ptr
	nodes 	As Integer
	nodelen	As Integer
	fhead	As TLISTNODE Ptr
	head	As TLISTNODE Ptr
	tail	As TLISTNODE Ptr
	clear	As Integer
End Type

Declare Function listNew			( ByVal list As TLIST Ptr, _
									  ByVal nodes As Integer, _
									  ByVal nodelen As Integer, _
									  ByVal doclear As Integer = TRUE, _
									  ByVal relink As Integer = TRUE ) As Integer

Declare Function listDel			( ByVal list As TLIST Ptr ) As Integer

Declare Function listNewNode		( ByVal list As TLIST Ptr ) As TLISTNODE Ptr

Declare Function listDelNode		( ByVal list As TLIST Ptr, _
									  ByVal node As TLISTNODE Ptr ) As Integer

Declare Function listAllocTB		( ByVal list As TLIST Ptr, _
					  			  	  ByVal nodes As Integer, _
					  			  	  ByVal relink As Integer = TRUE ) As Integer
					  			  
Declare Function listGetFirstNode	( ByVal list As TLIST Ptr ) As TLISTNODE Ptr

Declare Function listGetLastNode	( ByVal list As TLIST Ptr ) As TLISTNODE Ptr

Declare Function listGetPrevNode	( ByVal node As TLISTNODE Ptr ) As TLISTNODE Ptr

Declare Function listGetNextNode	( ByVal node As TLISTNODE Ptr ) As TLISTNODE Ptr
					  			  
#EndIf '' __LIST_BI__
