2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Contains: interface to generic linked lists.
30 Change History (most recent first):
32 $Log: GenLinkedList.h,v $
33 Revision 1.2 2004/02/05 07:41:08 cheshire
38 #ifndef __GenLinkedList__
39 #define __GenLinkedList__
51 typedef struct GenLinkedList GenLinkedList
;
54 void InitLinkedList( GenLinkedList
*pList
, size_t linkOffset
);
56 void AddToHead( GenLinkedList
*pList
, void *elem
);
57 void AddToTail( GenLinkedList
*pList
, void *elem
);
59 int RemoveFromList( GenLinkedList
*pList
, void *elem
);
61 int ReplaceElem( GenLinkedList
*pList
, void *elemInList
, void *newElem
);
65 struct GenDoubleLinkedList
72 typedef struct GenDoubleLinkedList GenDoubleLinkedList
;
75 void InitDoubleLinkedList( GenDoubleLinkedList
*pList
, size_t fwdLinkOffset
,
76 size_t backLinkOffset
);
78 void DLLAddToHead( GenDoubleLinkedList
*pList
, void *elem
);
80 void DLLRemoveFromList( GenDoubleLinkedList
*pList
, void *elem
);
84 /* A GenLinkedOffsetList is like a GenLinkedList that stores the *Next field as a signed */
85 /* offset from the address of the beginning of the element, rather than as a pointer. */
87 struct GenLinkedOffsetList
93 typedef struct GenLinkedOffsetList GenLinkedOffsetList
;
96 void InitLinkedOffsetList( GenLinkedOffsetList
*pList
, size_t linkOffset
);
98 void *GetHeadPtr( GenLinkedOffsetList
*pList
);
99 void *GetTailPtr( GenLinkedOffsetList
*pList
);
100 void *GetOffsetLink( GenLinkedOffsetList
*pList
, void *elem
);
102 void OffsetAddToHead( GenLinkedOffsetList
*pList
, void *elem
);
103 void OffsetAddToTail( GenLinkedOffsetList
*pList
, void *elem
);
105 int OffsetRemoveFromList( GenLinkedOffsetList
*pList
, void *elem
);
107 int OffsetReplaceElem( GenLinkedOffsetList
*pList
, void *elemInList
, void *newElem
);
110 #endif // __GenLinkedList__