#include "basetype.h"Go to the source code of this file.
Compounds | |
| struct | LinkNode |
| struct | Stack |
Defines | |
| #define | LISTCALL __fastcall |
| #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) ) ) |
| #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) ) |
| #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) |
| #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 |
Typedefs | |
| typedef List | List |
| typedef Stack | Stack |
| typedef Link | Link |
| typedef LinkNode | LinkNode |
| typedef RadixList | RadixList |
| typedef RadixLN | RadixLN |
| typedef RadixLink | RadixLink |
| typedef Hash | Hash |
| typedef HashNode | HashNode |
Functions | |
| geBoolean | List_Start (void) |
| geBoolean | List_Stop (void) |
| List *LISTCALL | List_Create (void) |
| void LISTCALL | List_Destroy (List *pList) |
| List *LISTCALL | List_AddTail (List *pList, void *Data) |
| List *LISTCALL | List_AddHead (List *pList, void *Data) |
| void *LISTCALL | List_CutHead (List *pList) |
| void *LISTCALL | List_CutTail (List *pList) |
| void *LISTCALL | List_PeekHead (List *pList) |
| void *LISTCALL | List_PeekTail (List *pList) |
| List *LISTCALL | List_Next (List *pNode) |
| List *LISTCALL | List_Prev (List *pNode) |
| void LISTCALL | List_CutNode (List *pNode) |
| void LISTCALL | List_DeleteNode (List *pNode) |
| void LISTCALL | List_FreeNode (List *pNode) |
| void *LISTCALL | List_NodeData (List *pNode) |
| List * | List_Find (List *pList, void *Data) |
| Stack *LISTCALL | Stack_Create (void) |
| void LISTCALL | Stack_Destroy (Stack *pStack) |
| void LISTCALL | Stack_Push_Func (Stack *pStack, void *Data) |
| void *LISTCALL | Stack_Pop_Func (Stack *pStack) |
| int LISTCALL | Stack_Extend (Stack *pStack) |
| Link *LISTCALL | Link_Create (void) |
| void LISTCALL | Link_Destroy (Link *pLink) |
| void LISTCALL | Link_Push (Link *pLink, void *Data) |
| void *LISTCALL | Link_Pop (Link *pLink) |
| void *LISTCALL | Link_Peek (Link *pLink) |
| RadixList * | RadixList_Create (int RadixListMax) |
| void | RadixList_Destroy (RadixList *pRadixList) |
| List * | RadixList_Add (RadixList *pRadixList, void *Data, int Key) |
| void * | RadixList_CutMax (RadixList *pRadixList, int *pMaxKey) |
| void * | RadixList_CutMin (RadixList *pRadixList, int *pMinKey) |
| void * | RadixList_CutKey (RadixList *pRadixList, int Key) |
| RadixLN * | RadixLN_Create (int RadixLNMax) |
| void | RadixLN_Destroy (RadixLN *pRadixLN) |
| void | RadixLN_AddTail (RadixLN *pRadixLN, LinkNode *LN, int Key) |
| void | RadixLN_AddHead (RadixLN *pRadixLN, LinkNode *LN, int Key) |
| LinkNode * | RadixLN_CutMax (RadixLN *pRadixLN, int *pMaxKey) |
| LinkNode * | RadixLN_CutMin (RadixLN *pRadixLN, int *pMinKey) |
| LinkNode * | RadixLN_CutKey (RadixLN *pRadixLN, int Key) |
| LinkNode * | RadixLN_PeekMax (RadixLN *pRadixLN, int *pMaxKey) |
| LinkNode * | RadixLN_PeekMin (RadixLN *pRadixLN, int *pMinKey) |
| RadixLink * | RadixLink_Create (int RadixLinkMax) |
| void | RadixLink_Destroy (RadixLink *pRadixLink) |
| void | RadixLink_Add (RadixLink *pRadixLink, void *Data, int Key) |
| void * | RadixLink_CutMax (RadixLink *pRadixLink, int *pMaxKey) |
| void * | RadixLink_CutMin (RadixLink *pRadixLink, int *pMinKey) |
| void * | RadixLink_CutKey (RadixLink *pRadixLink, int Key) |
| void | RadixLink_Grow (RadixLink *pRadixLink, int NewMax) |
| Hash * | Hash_Create (void) |
| void | Hash_Destroy (Hash *pHash) |
| HashNode *LISTCALL | Hash_Add (Hash *pHash, uint32 Key, uint32 Data) |
| void LISTCALL | Hash_DeleteNode (Hash *pHash, HashNode *pNode) |
| HashNode *LISTCALL | Hash_Get (Hash *pHash, uint32 Key, uint32 *pData) |
| HashNode *LISTCALL | Hash_WalkNext (Hash *pHash, HashNode *pCur) |
| uint32 LISTCALL | Hash_NumMembers (Hash *pHash) |
| void | HashNode_SetData (HashNode *pNode, uint32 Data) |
| void | HashNode_GetData (HashNode *pNode, uint32 *pKey, uint32 *pData) |
| uint32 | HashNode_Key (HashNode *pNode) |
| uint32 | HashNode_Data (HashNode *pNode) |
| uint32 | Hash_StringToKey (const char *String) |
| LinkNode *LISTCALL | LN_CutHead (LinkNode *pList) |
| LinkNode *LISTCALL | LN_CutTail (LinkNode *pList) |
| int | LN_ListLen (LinkNode *pList) |
|
|
Definition at line 32 of file list.h. Referenced by Hash_Add(), Hash_DeleteNode(), Hash_Get(), Hash_NumMembers(), Hash_WalkNext(), Link_Create(), Link_Destroy(), Link_Peek(), Link_Pop(), Link_Push(), List_AddHead(), List_AddTail(), List_Create(), List_CutHead(), List_CutNode(), List_CutTail(), List_DeleteNode(), List_Destroy(), List_FreeNode(), List_Next(), List_NodeData(), List_PeekHead(), List_PeekTail(), List_Prev(), LN_CutHead(), LN_CutTail(), Stack_Create(), Stack_Destroy(), Stack_Extend(), Stack_Pop_Func(), and Stack_Push_Func(). |
|
|
|
|
|
Definition at line 196 of file list.h. Referenced by Hash_Add(), and Hash_Create(). |
|
|
Definition at line 210 of file list.h. Referenced by RadixLN_AddHead(). |
|
|
Definition at line 211 of file list.h. Referenced by RadixLN_AddTail(). |
|
|
Definition at line 193 of file list.h. Referenced by Hash_DeleteNode(), LN_CutHead(), and LN_CutTail(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 201 of file list.h. Referenced by Hash_Add(), Hash_DeleteNode(), Hash_Get(), Hash_NumMembers(), and Hash_WalkNext(). |
|
|
Definition at line 203 of file list.h. Referenced by Hash_Add(), and Hash_Create(). |
|
|
Definition at line 200 of file list.h. Referenced by Hash_Add(), Hash_DeleteNode(), and Hash_WalkNext(). |
|
|
Definition at line 197 of file list.h. Referenced by LN_ListLen(). |
|
|
Definition at line 198 of file list.h. Referenced by Hash_Destroy(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basic list types *** Definition at line 43 of file list.h. Referenced by DrvList_PickDriver(), FillAreas_r(), gePuppet_DrawShadow(), gePuppet_Render(), gePuppet_RenderThroughFrustum(), GMenu_BuildDisplayModeMenus(), GMenu_Create(), ModeList_Destroy(), PickMode(), User_DestroyPolyList(), and User_DestroyPolyOnceList(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
Definition at line 1157 of file list.c. References HashNode::Data, Debug, HASH, HashNode::Hash, Hash_NumMembers(), HASH_SIZE, HashNodePool_g, HashNode::Key, LISTCALL, LN_AddBefore, LN_Next, LN_Null, LN_Prev, MemPool_GetHunk(), Hash::NodeList, and uint32. Referenced by BitmapList_Add().
01158 {
01159 uint32 H;
01160 HashNode *hn,**pTable,*Node,*Prev;
01161 Debug( int ListLen1; int ListLen2; int HashLen1; int HashLen2; int WalkLen)
01162
01163 assert(pHash);
01164 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01165
01166 hn = MemPool_GetHunk(HashNodePool_g);
01167 assert(hn);
01168 Debug( LN_Null(hn) )
01169
01170 hn->Key = Key;
01171 hn->Data = Data;
01172 hn->Hash = H = HASH(Key);
01173
01174 pTable = &(pHash->HashTable[H]);
01175 Node = *pTable;
01176
01177 assert( H > 0 );
01178 assert( pHash->NodeList->Hash == 0 );
01179 assert( ((HashNode *)LN_Prev(pHash->NodeList))->Hash == HASH_SIZE );
01180
01181 Debug(HashLen1 = Hash_NumMembers(pHash))
01182 Debug(ListLen1 = Hash_ListLen(pHash,H))
01183
01184 if ( ! Node )
01185 {
01186 Prev = pHash->NodeList;
01187 Node = LN_Next(Prev);
01188
01189 Debug(WalkLen = 0)
01190
01191 assert(Prev->Hash < H);
01192 while( Node->Hash < H )
01193 {
01194 Prev = Node;
01195 Node = LN_Next(Prev);
01196
01197 assert(WalkLen < pHash->Members );
01198 Debug( WalkLen ++)
01199
01200 assert(Prev->Hash <= Node->Hash);
01201 assert(Prev->Hash < HASH_SIZE );
01202 }
01203
01204 assert(Prev->Hash < H);
01205 assert(Node->Hash >= H);
01206 }
01207
01208 LN_AddBefore(hn,Node);
01209 *pTable = hn;
01210
01211 Debug(pHash->Members ++)
01212
01213 Debug(ListLen2 = Hash_ListLen(pHash,H))
01214 assert( ListLen2 == (ListLen1 + 1) );
01215 Debug(HashLen2 = Hash_NumMembers(pHash))
01216 assert( HashLen2 == (HashLen1 + 1) );
01217
01218 return hn;
01219 }
|
|
|
Definition at line 1082 of file list.c. References HashNode::Data, Debug, HashNode::Hash, HASH_SIZE, HashNodePool_g, HashNode::Key, LN_AddBefore, LN_Null, MemPool_GetHunk(), Hash::NodeList, and NULL. Referenced by BitmapList_Create().
01083 {
01084 Hash * pHash;
01085 HashNode *pHead,*pTail;
01086
01087 pHash = new(Hash);
01088 if ( ! pHash )
01089 return NULL;
01090
01091 //memset(pHash,0,sizeof(Hash));
01092
01093 Debug( pHash->MySelf1 = pHash )
01094 Debug( pHash->MySelf2 = pHash )
01095
01096 pTail = MemPool_GetHunk(HashNodePool_g);
01097 assert(pTail);
01098 LN_Null(pTail);
01099 pTail->Key = pTail->Data = 0;
01100 pTail->Hash = HASH_SIZE;
01101
01102 pHead = MemPool_GetHunk(HashNodePool_g);
01103 assert(pHead);
01104 LN_Null(pHead);
01105 pHead->Key = pHead->Data = 0;
01106 pHead->Hash = 0;
01107
01108 LN_AddBefore(pHead,pTail);
01109
01110 pHash->NodeList = pHead;
01111
01112 Debug(pHash->Members = 0)
01113
01114 return pHash;
01115 }
|
|
||||||||||||
|
Definition at line 1221 of file list.c. References Debug, HashNode::Hash, Hash_NumMembers(), HASH_SIZE, HashNodePool_g, LISTCALL, LN_Cut, LN_Next, LN_Prev, MemPool_FreeHunk(), NULL, and uint32. Referenced by BitmapList_Remove().
01222 {
01223 HashNode ** pHead;
01224 uint32 H;
01225 Debug( int ListLen1; int ListLen2;int HashLen1; int HashLen2)
01226
01227 assert(pNode );
01228 assert( pHash );
01229 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01230
01231 assert( pNode->Hash > 0 && pNode->Hash < HASH_SIZE );
01232
01233 H = pNode->Hash;
01234 pHead = & ( pHash->HashTable[H] );
01235
01236 Debug( HashLen1 = Hash_NumMembers(pHash) )
01237 Debug( ListLen1 = Hash_ListLen(pHash,H) )
01238 assert(pHash->Members > 0);
01239 Debug(pHash->Members --)
01240
01241 if ( *pHead == pNode )
01242 {
01243 *pHead = LN_Next(pNode);
01244 if ( (*pHead)->Hash != H )
01245 {
01246 // pNode was the head of the list
01247 assert( ((HashNode *)LN_Prev(pNode))->Hash < H );
01248 *pHead = NULL;
01249 }
01250 }
01251 assert( *pHead == NULL || (*pHead)->Hash == H );
01252
01253 LN_Cut(pNode);
01254
01255 MemPool_FreeHunk(HashNodePool_g,pNode);
01256
01257 Debug( HashLen2 = Hash_NumMembers(pHash) )
01258 Debug( ListLen2 = Hash_ListLen(pHash,H) )
01259 assert( HashLen2 == (HashLen1 - 1) );
01260
01261 }
|
|
|
Definition at line 1117 of file list.c. References Debug, destroy, HashNodePool_g, LN_Walk_Editting, MemPool_FreeHunk(), and Hash::NodeList. Referenced by BitmapList_Destroy().
01118 {
01119 if ( pHash )
01120 {
01121 HashNode *pList,*pNode,*pNext;
01122
01123 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01124
01125 Debug(pHash->Members += 2) // count Head & Tail
01126
01127 pList = pHash->NodeList;
01128 LN_Walk_Editting(pNode,pList,pNext) {
01129 MemPool_FreeHunk(HashNodePool_g,pNode);
01130 assert(pHash->Members > 1);
01131 Debug(pHash->Members --)
01132 }
01133 assert(pHash->Members == 1);
01134 MemPool_FreeHunk(HashNodePool_g,pList);
01135 destroy(pHash);
01136 }
01137 }
|
|
||||||||||||||||
|
Definition at line 1263 of file list.c. References HashNode::Data, HashNode::Hash, HASH, HASH_SIZE, HashNode::Key, LISTCALL, LN_Next, NULL, and uint32. Referenced by BitmapList_Add(), BitmapList_Has(), and BitmapList_Remove().
01264 {
01265 uint32 H;
01266 HashNode *pNode;
01267
01268 assert(pHash );
01269 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01270
01271 H = HASH(Key);
01272 assert( H > 0 && H < HASH_SIZE );
01273
01274 pNode = pHash->HashTable[H];
01275 if ( ! pNode )
01276 return NULL;
01277
01278 assert( pNode->Hash == H );
01279
01280 while( pNode->Hash == H )
01281 {
01282 if ( pNode->Key == Key )
01283 {
01284 if ( pData )
01285 *pData = pNode->Data;
01286 return pNode;
01287 }
01288 pNode = LN_Next(pNode);
01289 }
01290
01291 return NULL;
01292 }
|
|
|
Definition at line 1325 of file list.c. References HashNode::Hash, HASH_SIZE, LISTCALL, LN_Next, Hash::NodeList, and uint32. Referenced by Hash_Add(), and Hash_DeleteNode().
01326 {
01327 uint32 N;
01328 HashNode *pNode;
01329
01330 assert(pHash);
01331 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01332
01333 pNode = pHash->NodeList;
01334 assert( pNode->Hash == 0 );
01335 pNode = LN_Next(pNode);
01336 assert( pNode->Hash > 0 );
01337
01338 N = 0;
01339 while( pNode->Hash < HASH_SIZE )
01340 {
01341 assert( N < (uint32)pHash->Members );
01342 pNode = LN_Next(pNode);
01343 N ++;
01344 }
01345
01346 assert( N == (uint32)pHash->Members );
01347
01348 return N;
01349 }
|
|
|
Definition at line 1353 of file list.c. References CRC32_Array(), and uint32.
01354 {
01355 return CRC32_Array(String,strlen(String));
01356 }
|
|
||||||||||||
|
Definition at line 1294 of file list.c. References HashNode::Hash, HASH_SIZE, LISTCALL, LN_Next, LN_Prev, Hash::NodeList, and NULL. Referenced by BitmapList_AttachAll(), BitmapList_CountMembers(), BitmapList_CountMembersAttached(), BitmapList_Destroy(), BitmapList_DetachAll(), and BitmapList_SetGamma().
01295 {
01296 HashNode *pNext;
01297
01298 assert(pHash);
01299 assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash );
01300
01301 if ( ! pNode )
01302 {
01303 pNode = pHash->NodeList;
01304 assert( pNode->Hash == 0 );
01305 }
01306
01307 pNext = LN_Next(pNode);
01308 assert( pNext->Hash > 0 );
01309 assert( pNext->Hash >= pNode->Hash );
01310
01311 assert( pNext != pNode );
01312 assert( LN_Prev(pNext) == pNode );
01313
01314 if ( pNext->Hash == HASH_SIZE )
01315 {
01316 assert( ((HashNode *)LN_Next(pNext)) == pHash->NodeList );
01317 return NULL;
01318 }
01319
01320 assert(pNext->Hash < HASH_SIZE);
01321
01322 return pNext;
01323 }
|
|
|
Definition at line 1371 of file list.c. References HashNode::Data, and uint32.
01372 {
01373 assert(pNode);
01374 return pNode->Data;
01375 }
|
|
||||||||||||||||
|
Definition at line 1364 of file list.c. References HashNode::Data, and HashNode::Key. Referenced by BitmapList_CountMembersAttached(), BitmapList_Destroy(), and BitmapList_DetachAll().
|
|
|
Definition at line 1377 of file list.c. References HashNode::Key, and uint32. Referenced by BitmapList_AttachAll(), and BitmapList_SetGamma().
01378 {
01379 assert(pNode);
01380 return pNode->Key;
01381 }
|
|
||||||||||||
|
Definition at line 1358 of file list.c. References HashNode::Data. Referenced by BitmapList_Add(), and BitmapList_Remove().
01359 {
01360 assert(pNode);
01361 pNode->Data = Data;
01362 }
|
|
|
Definition at line 324 of file list.c. References Link::Data, LinkPool_g, LISTCALL, MemPool_GetHunk(), Link::Next, and NULL. Referenced by geTClip_Push().
|
|
|
Definition at line 313 of file list.c. References LinkPool_g, LISTCALL, MemPool_FreeHunk(), and Link::Next. Referenced by geTClip_Pop(), and RadixLink_Destroy().
00314 {
00315 while( pLink )
00316 {
00317 Link *Next;
00318 Next = pLink->Next;
00319 MemPool_FreeHunk(LinkPool_g,pLink);
00320 pLink = Next;
00321 }
00322 }
|
|
|
Definition at line 363 of file list.c. References Link::Data, LISTCALL, Link::Next, and NULL. Referenced by geTClip_Pop().
|
|
|
Definition at line 348 of file list.c. References Link::Data, LinkPool_g, LISTCALL, MemPool_FreeHunk(), Link::Next, and NULL. Referenced by geTClip_Pop(), RadixLink_CutKey(), RadixLink_CutMax(), and RadixLink_CutMin().
00349 {
00350 void *pData;
00351 Link * pNode;
00352 if ( ! pLink ) return NULL;
00353 // DebugWarn(geRam_IsValidPtr(pLink));
00354 pNode = pLink->Next;
00355 if ( ! pNode ) return NULL;
00356 // DebugWarn(geRam_IsValidPtr(pNode));
00357 pData = pNode->Data;
00358 pLink->Next = pNode->Next;
00359 MemPool_FreeHunk(LinkPool_g,pNode);
00360 return pData;
00361 }
|
|
||||||||||||
|
Definition at line 334 of file list.c. References Link::Data, LinkPool_g, LISTCALL, MemPool_GetHunk(), and Link::Next. Referenced by geTClip_Push(), and RadixLink_Add().
00335 {
00336 Link * pNode;
00337 assert(pLink);
00338 pNode = MemPool_GetHunk(LinkPool_g);
00339 assert(pNode);
00340 // DebugWarn(geRam_IsValidPtr(pLink));
00341 // DebugWarn(geRam_IsValidPtr(pNode));
00342 pNode->Data = Data;
00343
00344 pNode->Next = pLink->Next;
00345 pLink->Next = pNode;
00346 }
|
|
||||||||||||
|
Definition at line 193 of file list.c. References List::Data, LISTCALL, ListPool_g, MemPool_GetHunk(), List::Next, and List::Prev.
|
|
||||||||||||
|
Definition at line 177 of file list.c. References List::Data, LISTCALL, ListPool_g, MemPool_GetHunk(), List::Next, and List::Prev. Referenced by RadixList_Add().
|
|
|
Definition at line 166 of file list.c. References List::Data, LISTCALL, ListPool_g, MemPool_GetHunk(), List::Next, NULL, and List::Prev. Referenced by RadixList_Create().
|
|
|
Definition at line 208 of file list.c. References List::Data, LISTCALL, ListPool_g, MemPool_FreeHunk(), List::Next, NULL, and List::Prev. Referenced by RadixList_CutKey(), RadixList_CutMax(), and RadixList_CutMin().
|
|
|
Definition at line 257 of file list.c. References LISTCALL, List::Next, and List::Prev. Referenced by List_DeleteNode().
|
|
|
Definition at line 224 of file list.c. References List::Data, LISTCALL, ListPool_g, MemPool_FreeHunk(), List::Next, NULL, and List::Prev.
|
|
|
Definition at line 265 of file list.c. References List_CutNode(), List_FreeNode(), and LISTCALL.
00266 {
00267 List_CutNode(pNode);
00268 List_FreeNode(pNode);
00269 }
|
|
|
Definition at line 151 of file list.c. References LISTCALL, ListPool_g, MemPool_FreeHunk(), and List::Next. Referenced by RadixList_Destroy().
00152 {
00153 List * pNode;
00154 assert(pList);
00155 pNode = pList->Next;
00156 while( pNode != pList )
00157 {
00158 List *Next;
00159 Next = pNode->Next;
00160 MemPool_FreeHunk(ListPool_g,pNode);
00161 pNode = Next;
00162 }
00163 MemPool_FreeHunk(ListPool_g,pList);
00164 }
|
|
||||||||||||
|
Definition at line 292 of file list.c. References List::Data, List::Next, and NULL.
|
|
|
Definition at line 271 of file list.c. References LISTCALL, ListPool_g, and MemPool_FreeHunk(). Referenced by List_DeleteNode().
00272 {
00273 assert(pNode);
00274 MemPool_FreeHunk(ListPool_g,pNode);
00275 }
|
|
|
Definition at line 283 of file list.c. References LISTCALL, and List::Next.
00284 {
00285 return pNode->Next;
00286 }
|
|
|
Definition at line 277 of file list.c. References List::Data, and LISTCALL.
00278 {
00279 assert(pNode);
00280 return pNode->Data;
00281 }
|
|
|
Definition at line 241 of file list.c. References List::Data, LISTCALL, List::Next, and NULL.
|
|
|
Definition at line 249 of file list.c. References List::Data, LISTCALL, NULL, and List::Prev.
|
|
|
Definition at line 287 of file list.c. References LISTCALL, and List::Prev.
00288 {
00289 return pNode->Prev;
00290 }
|
|
|
you must wrap any calls to this module with these: * Definition at line 1385 of file list.c. References GE_FALSE, GE_TRUE, geBoolean, HashNodePool_g, LinkPool_g, ListPool_g, MemPool_Create(), NULL, and UsageCount. Referenced by geTClip_Push(), geWorld_Create(), and Sys_EngineCreate().
01386 {
01387 assert(UsageCount >= 0 );
01388 if ( UsageCount == 0 )
01389 {
01390 assert(ListPool_g == NULL && LinkPool_g == NULL);
01391 if ( ! (ListPool_g = MemPool_Create(sizeof(List),1024,1024) ) )
01392 return GE_FALSE;
01393 if ( ! (LinkPool_g = MemPool_Create(sizeof(Link),128,128) ) )
01394 return GE_FALSE;
01395 if ( ! (HashNodePool_g = MemPool_Create(sizeof(HashNode),128,128) ) )
01396 return GE_FALSE;
01397 // could latch ListFuncs_Stop() on atexit() , but no need, really..
01398 }
01399 UsageCount ++;
01400 return GE_TRUE;
01401 }
|
|
|
Definition at line 1403 of file list.c. References GE_TRUE, geBoolean, HashNodePool_g, LinkPool_g, ListPool_g, MemPool_Destroy(), NULL, and UsageCount. Referenced by geTClip_Pop(), geWorld_Free(), and Sys_EngineFree().
01404 {
01405 assert(UsageCount > 0 );
01406 UsageCount --;
01407 if ( UsageCount == 0 )
01408 {
01409 assert(ListPool_g && LinkPool_g );
01410 MemPool_Destroy(&ListPool_g); ListPool_g = NULL;
01411 MemPool_Destroy(&LinkPool_g); LinkPool_g = NULL;
01412 MemPool_Destroy(&HashNodePool_g); HashNodePool_g = NULL;
01413 }
01414 return GE_TRUE;
01415 }
|
|
|
Definition at line 123 of file list.c. References LISTCALL, LN_Cut, LinkNode::Next, and NULL. Referenced by RadixLN_CutKey(), RadixLN_CutMax(), and RadixLN_CutMin().
|
|
|
Definition at line 133 of file list.c. References LISTCALL, LN_Cut, NULL, and LinkNode::Prev.
|
|
|
Definition at line 111 of file list.c. References LN_Walk.
|
|
||||||||||||||||
|
Definition at line 760 of file list.c. References Link_Push(), RadixLink::Links, RadixLink::Max, RadixLink::Min, RadixLink::NumLinks, and RadixLink_Grow().
00761 {
00762 assert(pRadixLink);
00763 assert( Key >= 0 );
00764
00765 if ( Key >= pRadixLink->NumLinks )
00766 RadixLink_Grow(pRadixLink, Key + (Key>>2) );
00767
00768 Link_Push(&(pRadixLink->Links[Key]),Data);
00769
00770 if ( Key < pRadixLink->Min ) pRadixLink->Min = Key;
00771 if ( Key > pRadixLink->Max ) pRadixLink->Max = Key;
00772 }
|
|
|
Definition at line 714 of file list.c. References RadixLink::Links, RadixLink::Max, MemAlloc, RadixLink::Min, and RadixLink::NumLinks.
00715 {
00716 RadixLink * pRadixLink;
00717 pRadixLink = new(RadixLink);
00718 assert(pRadixLink);
00719 pRadixLink->NumLinks = RadixLinkMax+1;
00720 pRadixLink->Links = MemAlloc(sizeof(Link)*(pRadixLink->NumLinks));
00721 assert(pRadixLink->Links);
00722 //memset(pRadixLink->Links,0,(sizeof(Link)*(pRadixLink->NumLinks)));
00723 pRadixLink->Min = pRadixLink->NumLinks;
00724 pRadixLink->Max = - 1;
00725 return pRadixLink;
00726 }
|
|
||||||||||||
|
Definition at line 808 of file list.c. References Link_Pop(), and RadixLink::Links.
|
|
||||||||||||
|
Definition at line 774 of file list.c. References Link_Pop(), RadixLink::Links, RadixLink::Max, Link::Next, and NULL.
00775 {
00776 Link * pLink;
00777 pLink = (pRadixLink->Links) + (pRadixLink->Max);
00778 while ( pRadixLink->Max >= 0 )
00779 {
00780 if ( pLink->Next )
00781 {
00782 if ( pKey ) *pKey = pRadixLink->Max;
00783 return Link_Pop(pLink);
00784 }
00785 pRadixLink->Max --;
00786 pLink --;
00787 }
00788 return NULL;
00789 }
|
|
||||||||||||
|
Definition at line 791 of file list.c. References Link_Pop(), RadixLink::Links, RadixLink::Min, Link::Next, NULL, and RadixLink::NumLinks.
00792 {
00793 Link * pLink;
00794 pLink = (pRadixLink->Links) + (pRadixLink->Min);
00795 while ( pRadixLink->Min < pRadixLink->NumLinks )
00796 {
00797 if ( pLink->Next )
00798 {
00799 if ( pKey ) *pKey = pRadixLink->Min;
00800 return Link_Pop(pLink);
00801 }
00802 pRadixLink->Min ++;
00803 pLink ++;
00804 }
00805 return NULL;
00806 }
|
|
|
Definition at line 747 of file list.c. References Link_Destroy(), RadixLink::Links, MemFree, RadixLink::NumLinks, and r.
|
|
||||||||||||
|
Definition at line 728 of file list.c. References RadixLink::Links, MemAlloc, MemFree, and RadixLink::NumLinks. Referenced by RadixLink_Add().
00729 {
00730 Link * OldLinks;
00731 int OldNumLinks;
00732
00733 OldNumLinks = pRadixLink->NumLinks;
00734 OldLinks = pRadixLink->Links;
00735
00736 pRadixLink->NumLinks = NewMax + 1;
00737 pRadixLink->Links = MemAlloc(sizeof(Link)*(pRadixLink->NumLinks));
00738
00739 assert(pRadixLink->Links);
00740
00741 memcpy(pRadixLink->Links, OldLinks, (sizeof(Link)*OldNumLinks));
00742 //memset(pRadixLink->Links + OldNumLinks,0,(sizeof(Link)*(pRadixLink->NumLinks - OldNumLinks)));
00743
00744 MemFree(OldLinks);
00745 }
|
|
||||||||||||||||
|
Definition at line 484 of file list.c. References List_AddTail(), RadixList::Lists, RadixList::Max, and RadixList::Min.
|
|
|
Definition at line 453 of file list.c. References List_Create(), RadixList::Lists, RadixList::Max, MemAlloc, RadixList::Min, RadixList::NumLists, and r.
00454 {
00455 RadixList * pRadixList;
00456 int r;
00457 pRadixList = new(RadixList);
00458 assert(pRadixList);
00459 pRadixList->NumLists = RadixListMax+1;
00460 pRadixList->Lists = MemAlloc(sizeof(List *)*(pRadixList->NumLists));
00461 assert(pRadixList->Lists);
00462 for(r=0;r<(pRadixList->NumLists);r++)
00463 {
00464 pRadixList->Lists[r] = List_Create();
00465 assert(pRadixList->Lists[r]);
00466 }
00467 pRadixList->Min = pRadixList->NumLists;
00468 pRadixList->Max = - 1;
00469 return pRadixList;
00470 }
|
|
||||||||||||
|
Definition at line 535 of file list.c. References List_CutHead(), and RadixList::Lists.
00536 {
00537 assert(pRadixList);
00538 return List_CutHead(pRadixList->Lists[Key]);
00539 }
|
|
||||||||||||
|
Definition at line 495 of file list.c. References List_CutHead(), RadixList::Lists, RadixList::Max, and NULL.
00496 {
00497 assert(pRadixList);
00498
00499 while ( pRadixList->Max >= 0 )
00500 {
00501 void * Data;
00502
00503 if ( Data = List_CutHead(pRadixList->Lists[pRadixList->Max]) )
00504 {
00505 if ( pKey ) *pKey = pRadixList->Max;
00506 return Data;
00507 }
00508 pRadixList->Max --;
00509
00510 }
00511
00512 return NULL;
00513 }
|
|
||||||||||||
|
Definition at line 515 of file list.c. References List_CutHead(), RadixList::Lists, RadixList::Min, NULL, and RadixList::NumLists.
00516 {
00517 assert(pRadixList);
00518
00519 while ( pRadixList->Min < pRadixList->NumLists )
00520 {
00521 void * Data;
00522
00523 if ( Data = List_CutHead(pRadixList->Lists[pRadixList->Min]) )
00524 {
00525 if ( pKey ) *pKey = pRadixList->Min;
00526 return Data;
00527 }
00528 pRadixList->Min ++;
00529
00530 }
00531
00532 return NULL;
00533 }
|
|
|
Definition at line 472 of file list.c. References List_Destroy(), RadixList::Lists, MemFree, RadixList::NumLists, and r.
|
|
||||||||||||||||
|
Definition at line 584 of file list.c. References LN_AddHead, RadixLN::LNs, RadixLN::Max, and RadixLN::Min.
|
|
||||||||||||||||
|
Definition at line 593 of file list.c. References LN_AddTail, RadixLN::LNs, RadixLN::Max, and RadixLN::Min.
|
|
|
Definition at line 550 of file list.c. References RadixLN::LNs, RadixLN::Max, MemAlloc, RadixLN::Min, LinkNode::Next, RadixLN::NumLNs, LinkNode::Prev, r, TIMER_P, and TIMER_Q.
00551 {
00552 RadixLN * pRadixLN;
00553 LinkNode * LNs;
00554 int r;
00555 pRadixLN = new(RadixLN);
00556 assert(pRadixLN);
00557 pRadixLN->NumLNs = RadixLNMax+1;
00558 pRadixLN->LNs = MemAlloc(sizeof(LinkNode)*(pRadixLN->NumLNs));
00559 assert(pRadixLN->LNs);
00560
00561 TIMER_P(List_RadixInit); // not counting the allocs, tracking in List_Ram
00562
00563 LNs = pRadixLN->LNs;
00564 for(r=(pRadixLN->NumLNs);r--;LNs++)
00565 {
00566 // LN_InitList( LNs );
00567 LNs->Next = LNs->Prev = LNs;
00568 }
00569 pRadixLN->Min = RadixLNMax;
00570 pRadixLN->Max = 0;
00571
00572 TIMER_Q(List_RadixInit);
00573
00574 return pRadixLN;
00575 }
|
|
||||||||||||
|
Definition at line 646 of file list.c. References LN_CutHead(), and RadixLN::LNs.
00647 {
00648 assert(pRadixLN);
00649 return LN_CutHead(&(pRadixLN->LNs[Key]));
00650 }
|
|
||||||||||||
|
Definition at line 602 of file list.c. References LN_CutHead(), RadixLN::LNs, RadixLN::Max, NULL, TIMER_P, and TIMER_Q.
00603 {
00604 assert(pRadixLN);
00605
00606 TIMER_P(List_RadixWalk);
00607 while ( pRadixLN->Max >= 0 )
00608 {
00609 LinkNode * LN;
00610
00611 if ( LN = LN_CutHead(&(pRadixLN->LNs[pRadixLN->Max])) )
00612 {
00613 if ( pKey ) *pKey = pRadixLN->Max;
00614 TIMER_Q(List_RadixWalk);
00615 return LN;
00616 }
00617 pRadixLN->Max --;
00618 }
00619 TIMER_Q(List_RadixWalk);
00620
00621 return NULL;
00622 }
|
|
||||||||||||
|
Definition at line 624 of file list.c. References LN_CutHead(), RadixLN::LNs, RadixLN::Max, RadixLN::Min, NULL, RadixLN::NumLNs, TIMER_P, and TIMER_Q.
00625 {
00626 assert(pRadixLN);
00627
00628 TIMER_P(List_RadixWalk);
00629 while ( pRadixLN->Min < pRadixLN->NumLNs )
00630 {
00631 LinkNode * LN;
00632
00633 if ( LN = LN_CutHead(&(pRadixLN->LNs[pRadixLN->Min])) )
00634 {
00635 if ( pKey ) *pKey = pRadixLN->Max;
00636 TIMER_Q(List_RadixWalk);
00637 return LN;
00638 }
00639 pRadixLN->Min ++;
00640 }
00641 TIMER_Q(List_RadixWalk);
00642
00643 return NULL;
00644 }
|
|
|
Definition at line 577 of file list.c. References RadixLN::LNs, and MemFree.
|
|
||||||||||||
|
Definition at line 653 of file list.c. References RadixLN::LNs, RadixLN::Max, LinkNode::Next, NULL, TIMER_P, and TIMER_Q.
00654 {
00655 LinkNode * LNs;
00656 assert(pRadixLN);
00657
00658 TIMER_P(List_RadixWalk);
00659 LNs = & pRadixLN->LNs[pRadixLN->Max];
00660 while ( pRadixLN->Max >= 0 )
00661 {
00662 LinkNode * LN;
00663
00664 LN = LNs->Next;
00665 if ( LN != LNs )
00666 {
00667 if ( pKey ) *pKey = pRadixLN->Max;
00668 TIMER_Q(List_RadixWalk);
00669 return LN;
00670 }
00671 pRadixLN->Max --;
00672 LNs --;
00673 }
00674 TIMER_Q(List_RadixWalk);
00675
00676 return NULL;
00677 }
|
|
||||||||||||
|
Definition at line 679 of file list.c. References RadixLN::LNs, RadixLN::Min, LinkNode::Next, NULL, RadixLN::NumLNs, TIMER_P, and TIMER_Q.
00680 {
00681 LinkNode * LNlist;
00682 assert(pRadixLN);
00683
00684 TIMER_P(List_RadixWalk);
00685 LNlist = & pRadixLN->LNs[pRadixLN->Min];
00686 while ( pRadixLN->Min < pRadixLN->NumLNs )
00687 {
00688 LinkNode * LN;
00689
00690 LN = LNlist->Next;
00691 if ( LN != LNlist )
00692 {
00693 if ( pKey ) *pKey = pRadixLN->Min;
00694 TIMER_Q(List_RadixWalk);
00695 return LN;
00696 }
00697 pRadixLN->Min ++;
00698 LNlist ++;
00699 }
00700 TIMER_Q(List_RadixWalk);
00701
00702 return NULL;
00703 }
|
|
|
Definition at line 396 of file list.c. References Stack::Buffer, Stack::End, Stack::Head, LISTCALL, MemAlloc, and Stack::members.
00397 {
00398 Stack * pStack;
00399 pStack = new(Stack);
00400 assert(pStack);
00401 pStack->members = 4096;
00402 pStack->Buffer = MemAlloc(sizeof(void *)*(pStack->members));
00403 assert(pStack->Buffer);
00404 pStack->End = pStack->Buffer + (pStack->members);
00405 pStack->Head = pStack->Buffer;
00406 return pStack;
00407 }
|
|
|
Definition at line 387 of file list.c. References Stack::Buffer, destroy, and LISTCALL.
|
|
|
Definition at line 409 of file list.c. References Stack::Buffer, Stack::End, Stack::Head, LISTCALL, MemAlloc, Stack::members, and MemFree. Referenced by Stack_Push_Func().
00410 {
00411 void ** NewBuffer;
00412 int newmembers;
00413 // realloc
00414 newmembers = pStack->members + 4096;
00415 NewBuffer = MemAlloc(sizeof(void *)*newmembers);
00416 assert(NewBuffer);
00417 memcpy(NewBuffer,pStack->Buffer, sizeof(void *)*(pStack->members));
00418 pStack->Head = NewBuffer + pStack->members;
00419 pStack->members = newmembers;
00420 MemFree(pStack->Buffer);
00421 pStack->Buffer = NewBuffer;
00422
00423 pStack->End = pStack->Buffer + (pStack->members);
00424 return newmembers;
00425 }
|
|
|
Definition at line 435 of file list.c. References Stack::Buffer, Stack::Head, LISTCALL, and NULL.
|
|
||||||||||||
|
Definition at line 427 of file list.c. References Stack::End, Stack::Head, LISTCALL, and Stack_Extend().
00428 {
00429 assert(pStack);
00430 *(pStack->Head)++ = Data;
00431 if ( pStack->Head == pStack->End )
00432 Stack_Extend(pStack);
00433 }
|
1.3.2