1 /***************************************************************************/
5 /* Generic list support for FreeType (specification). */
7 /* Copyright 1996-2001, 2003, 2007, 2010 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
19 /*************************************************************************/
21 /* This file implements functions relative to list processing. Its */
22 /* data structures are defined in `freetype.h'. */
24 /*************************************************************************/
32 #include FT_FREETYPE_H
35 #error "freetype.h of FreeType 1 has been loaded!"
36 #error "Please fix the directory search order for header files"
37 #error "so that freetype.h of FreeType 2 is found first."
44 /*************************************************************************/
53 /* Simple management of lists. */
56 /* This section contains various definitions related to list */
57 /* processing using doubly-linked nodes. */
71 /* FT_List_Iterator */
72 /* FT_List_Finalize */
73 /* FT_List_Destructor */
75 /*************************************************************************/
78 /*************************************************************************/
84 /* Find the list node for a given listed object. */
87 /* list :: A pointer to the parent list. */
88 /* data :: The address of the listed object. */
91 /* List node. NULL if it wasn't found. */
93 FT_EXPORT( FT_ListNode )
94 FT_List_Find( FT_List list,
98 /*************************************************************************/
104 /* Append an element to the end of a list. */
107 /* list :: A pointer to the parent list. */
108 /* node :: The node to append. */
111 FT_List_Add( FT_List list,
115 /*************************************************************************/
121 /* Insert an element at the head of a list. */
124 /* list :: A pointer to parent list. */
125 /* node :: The node to insert. */
128 FT_List_Insert( FT_List list,
132 /*************************************************************************/
138 /* Remove a node from a list. This function doesn't check whether */
139 /* the node is in the list! */
142 /* node :: The node to remove. */
145 /* list :: A pointer to the parent list. */
148 FT_List_Remove( FT_List list,
152 /*************************************************************************/
158 /* Move a node to the head/top of a list. Used to maintain LRU */
162 /* list :: A pointer to the parent list. */
163 /* node :: The node to move. */
166 FT_List_Up( FT_List list,
170 /*************************************************************************/
173 /* FT_List_Iterator */
176 /* An FT_List iterator function which is called during a list parse */
177 /* by @FT_List_Iterate. */
180 /* node :: The current iteration list node. */
182 /* user :: A typeless pointer passed to @FT_List_Iterate. */
183 /* Can be used to point to the iteration's state. */
186 (*FT_List_Iterator)( FT_ListNode node,
190 /*************************************************************************/
193 /* FT_List_Iterate */
196 /* Parse a list and calls a given iterator function on each element. */
197 /* Note that parsing is stopped as soon as one of the iterator calls */
198 /* returns a non-zero value. */
201 /* list :: A handle to the list. */
202 /* iterator :: An iterator function, called on each node of the list. */
203 /* user :: A user-supplied field which is passed as the second */
204 /* argument to the iterator. */
207 /* The result (a FreeType error code) of the last iterator call. */
209 FT_EXPORT( FT_Error )
210 FT_List_Iterate( FT_List list,
211 FT_List_Iterator iterator,
215 /*************************************************************************/
218 /* FT_List_Destructor */
221 /* An @FT_List iterator function which is called during a list */
222 /* finalization by @FT_List_Finalize to destroy all elements in a */
226 /* system :: The current system object. */
228 /* data :: The current object to destroy. */
230 /* user :: A typeless pointer passed to @FT_List_Iterate. It can */
231 /* be used to point to the iteration's state. */
234 (*FT_List_Destructor)( FT_Memory memory,
239 /*************************************************************************/
242 /* FT_List_Finalize */
245 /* Destroy all elements in the list as well as the list itself. */
248 /* list :: A handle to the list. */
250 /* destroy :: A list destructor that will be applied to each element */
253 /* memory :: The current memory object which handles deallocation. */
255 /* user :: A user-supplied field which is passed as the last */
256 /* argument to the destructor. */
259 /* This function expects that all nodes added by @FT_List_Add or */
260 /* @FT_List_Insert have been dynamically allocated. */
263 FT_List_Finalize( FT_List list,
264 FT_List_Destructor destroy,
274 #endif /* __FTLIST_H__ */