![]()
List
Description: List/Link/Node Primitives
Source file: …\genesis3d\OpenSource\Source\list.h
Functions:
Start, Stop, Create, Destroy, Push, Pop, Peek, Create, Destroy, AddTail, AddHead, CutHead, CutTail, PeekHead, PeekTail, Next, Prev, CutNode, DeleteNode, FreeNode, NodeData, Find, Create, Destroy, Func, Func, Extend, Create, Destroy, Add, CutMax, CutMin, CutKey, Create, Destroy, AddTail, AddHead, CutMax, CutMin, CutKey, PeekMax, PeekMin, Create, Destroy, Add, CutMax, CutMin, CutKey, Grow, Create, Destroy, Add, DeleteNode, Get, WalkNext, NumMembers, SetData, GetData, Key, Data, StringToKey, CutHead, CutTail, ListLen List, Link, RadixList, RadixLN, RadixLink, Hash, HashNode, LinkNode, StackMacros:
viewOverview:
viewAdditions to Genesis3D v1.6: None
![]()
Note: you must wrap any calls to this module with List_Start() and List_Stop()
Example--Iterate on a list via :
List* pNode;
List* pList;
for( pNode = List_Next(pList); pNode != pList; pNode = List_Next(pNode) )
{
//do stuff to pNode
}
Return to Contents
Example of LN_Walk use:
void
doStuffOnAllNodes(LinkNode* pList)
{
LinkNode* pNode;
LN_Walk(pNode,pList) {
doStuff(pNode);
}
}
Return to Contents
![]()
#define LISTCALL __fastcall
#define zLN_InitList(List) do { (List)->Next = List; (List)->Prev = List; } while(0)
#define zLN_Cut(Node) do { (Node)->Prev->Next = (Node)->Next; (Node)->Next->Prev = (Node)->Prev; zLN_InitList(Node); } while(0)
#define zLN_Fix(Node) do { (Node)->Prev->Next = Node; (Node)->Next->Prev = Node; } while(0)
#define zLN_AddAfter(Node,List) do { (Node)->Prev = List; (Node)->Next = (List)->Next; LN_Fix(Node); } while(0)
#define zLN_AddBefore(Node,List) do { (Node)->Next = List; (Node)->Prev = (List)->Prev; LN_Fix(Node); } while(0)
#define zLN_Walk_Editting(Node,List,Holder) for( Node = (List)->Next; (Node) != (List) && ((Holder) = (Node)->Next) != NULL ; Node = Holder )
#define zLN_Walk(Node,List) for( Node = (List)->Next; (Node) != (List) ; Node = (Node)->Next )
#define zLN_EmptyList(List) ( (List)->Next == (List) )
Return to Contents
#define LN_InitList(List) zLN_InitList((LinkNode* )List)
#define LN_Cut(Node) zLN_Cut((LinkNode* )Node)
#define LN_Fix(Node) zLN_Fix((LinkNode* )Node)
#define LN_AddAfter(Node,List) zLN_AddAfter((LinkNode* )Node,(LinkNode* )List)
#define LN_AddBefore(Node,List) zLN_AddBefore((LinkNode* )Node,(LinkNode* )List)
#define LN_Walk(Node,List) zLN_Walk((LinkNode* )Node,(LinkNode* )List)
#define LN_Walk_Editting(Node,List,Holder) zLN_Walk_Editting((LinkNode* )Node,(LinkNode* )List,((LinkNode* )Holder))
#define LN_EmptyList(List) zLN_EmptyList((LinkNode* )List)
#define LN_Prev(Node) (void * )(((LinkNode* )Node)->Prev)
#define LN_Next(Node) (void * )(((LinkNode* )Node)->Next)
Return to Contents
#define LN_Null(node) LN_InitList(node)
#define LN_AddHead(list,node) LN_AddAfter(node,list)
#define LN_AddTail(list,node) LN_AddBefore(node,list)
#define LN_IsEmpty LN_EmptyList
#ifdef _DEBUG
#define Stack_Push Stack_Push_Func
#define Stack_Pop Stack_Pop_Func
#else
#define Stack_Push(pStack,Data) *((pStack)->Head)++ = (void * )(Data), ( (pStack)->Head != (pStack)->End ) || Stack_Extend(pStack)
#define Stack_Pop(pStack) ( ((pStack)->Head == (pStack)->Buffer) ? NULL :* ( -- ((pStack)->Head) ) )
#endif
Return to Contents
![]()
Types:
NOTE: For most of the types below, the contents of these structures have been intentionally left out of the interface, by the designers of this module. Think of them as a handle only.
List;Return to Contents
typedef struct Stack
Stack;Return to ContentsLink;
Return to Contents
typedef struct LinkNode
LinkNode;Return to ContentsRadixList;
Return to ContentsRadixLN;
Return to ContentsRadixLink;
Return to ContentsHash;
Return to ContentsHashNode;
Return to Contents
Return to Contents
//Note: this struct is exposed only in release mode! Don't look into it! Only defined if: #ifndef _DEBUG
Return to Contents
![]()
Functions:
![]()
You must call this before calling any other function in this module
Return to Contents
![]()
geBoolean List_Stop(void);
After working with functions in this module, you must end with a call to this.
Return to Contents
![]()
extern Link* LISTCALL
Link_Create(void);
Return to Contents
![]()
extern
void LISTCALL Link_Destroy(Link* pLink);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
extern List* LISTCALL
List_Create(void);
Return to Contents
![]()
extern
void LISTCALL List_Destroy(List* pList);
Return to Contents
![]()
extern List* LISTCALL
List_AddTail(List* pList, void * Data);
Return to Contents
![]()
extern List* LISTCALL
List_AddHead(List* pList, void * Data);
Return to Contents
![]()
extern
void * LISTCALL List_CutHead(List* pList);Returns a pointer to the node created(?)
Return to Contents
![]()
extern
void * LISTCALL List_CutTail(List* pList);Returns a pointer to the node created(?)
Return to Contents
![]()
Returns a pointer to the node created (?)
Return to Contents
![]()
Returns a pointer to the node created(?)
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
extern
void LISTCALL List_DeleteNode(List* pNode);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
extern Stack* LISTCALL
Stack_Create(void);
Return to Contents
![]()
extern
void LISTCALL Stack_Destroy(Stack* pStack);
Return to Contents
![]()
extern
void LISTCALL Stack_Push_Func(Stack* pStack, void * Data);
Return to Contents
![]()
Return to Contents
![]()
Returns new length
Return to Contents
![]()
extern RadixList*
RadixList_Create(int RadixListMax);
Return to Contents
![]()
extern
void RadixList_Destroy(RadixList* pRadixList);
Return to Contents
![]()
extern List*
RadixList_Add(RadixList* pRadixList, void * Data, int Key);Returns a pointer to the node created
Return to Contents
![]()
extern
void * RadixList_CutMax(RadixList* pRadixList, int * pMaxKey);
Return to Contents
![]()
extern
void * RadixList_CutMin(RadixList* pRadixList, int * pMinKey);
Return to Contents
![]()
extern
void * RadixList_CutKey(RadixList* pRadixList, int Key);
Return to Contents
![]()
extern RadixLN*
RadixLN_Create(int RadixLNMax);
Return to Contents
![]()
extern
void RadixLN_Destroy(RadixLN* pRadixLN);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
extern LinkNode*
RadixLN_CutMax(RadixLN* pRadixLN, int * pMaxKey);Return to Contents
![]()
extern LinkNode*
RadixLN_CutMin(RadixLN* pRadixLN, int * pMinKey);
Return to Contents
![]()
extern LinkNode*
RadixLN_CutKey(RadixLN* pRadixLN, int Key);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
extern RadixLink*
RadixLink_Create(int RadixLinkMax);
Return to Contents
![]()
extern
void RadixLink_Destroy(RadixLink* pRadixLink);
Return to Contents
![]()
extern
void RadixLink_Add(RadixLink* pRadixLink, void * Data, int Key);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
// pdata is optional
Return to Contents
![]()
//use pCur ==
NULL to start walking
Return to Contents
![]()
uint32 LISTCALL Hash_NumMembers(Hash* pHash);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
uint32 HashNode_Key(HashNode* pNode);
Return to Contents
![]()
uint32 HashNode_Data(HashNode* pNode);
Return to Contents
![]()
uint32 Hash_StringToKey(const char * String);
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()
Return to Contents
![]()