1
/***************************************************************************/
5
/* Generic list support for FreeType (specification). */
7
/* Copyright 1996-2001 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
38
/*************************************************************************/
47
/* Simple management of lists. */
50
/* This section contains various definitions related to list */
51
/* processing using doubly-linked nodes. */
65
/* FT_List_Iterator */
66
/* FT_List_Finalize */
67
/* FT_List_Destructor */
69
/*************************************************************************/
72
/*************************************************************************/
78
/* Finds the list node for a given listed object. */
81
/* list :: A pointer to the parent list. */
82
/* data :: The address of the listed object. */
85
/* List node. NULL if it wasn't found. */
87
FT_EXPORT( FT_ListNode )
88
FT_List_Find( FT_List list,
92
/*************************************************************************/
98
/* Appends an element to the end of a list. */
101
/* list :: A pointer to the parent list. */
102
/* node :: The node to append. */
105
FT_List_Add( FT_List list,
109
/*************************************************************************/
115
/* Inserts an element at the head of a list. */
118
/* list :: A pointer to parent list. */
119
/* node :: The node to insert. */
122
FT_List_Insert( FT_List list,
126
/*************************************************************************/
132
/* Removes a node from a list. This function doesn't check whether */
133
/* the node is in the list! */
136
/* node :: The node to remove. */
139
/* list :: A pointer to the parent list. */
142
FT_List_Remove( FT_List list,
146
/*************************************************************************/
152
/* Moves a node to the head/top of a list. Used to maintain LRU */
156
/* list :: A pointer to the parent list. */
157
/* node :: The node to move. */
160
FT_List_Up( FT_List list,
164
/*************************************************************************/
167
/* FT_List_Iterator */
170
/* An FT_List iterator function which is called during a list parse */
171
/* by FT_List_Iterate(). */
174
/* node :: The current iteration list node. */
176
/* user :: A typeless pointer passed to FT_List_Iterate(). */
177
/* Can be used to point to the iteration's state. */
180
(*FT_List_Iterator)( FT_ListNode node,
184
/*************************************************************************/
187
/* FT_List_Iterate */
190
/* Parses a list and calls a given iterator function on each element. */
191
/* Note that parsing is stopped as soon as one of the iterator calls */
192
/* returns a non-zero value. */
195
/* list :: A handle to the list. */
196
/* iterator :: An interator function, called on each node of the */
198
/* user :: A user-supplied field which is passed as the second */
199
/* argument to the iterator. */
202
/* The result (a FreeType error code) of the last iterator call. */
204
FT_EXPORT( FT_Error )
205
FT_List_Iterate( FT_List list,
206
FT_List_Iterator iterator,
210
/*************************************************************************/
213
/* FT_List_Destructor */
216
/* An FT_List iterator function which is called during a list */
217
/* finalization by FT_List_Finalize() to destroy all elements in a */
221
/* system :: The current system object. */
223
/* data :: The current object to destroy. */
225
/* user :: A typeless pointer passed to FT_List_Iterate(). It can */
226
/* be used to point to the iteration's state. */
229
(*FT_List_Destructor)( FT_Memory memory,
234
/*************************************************************************/
237
/* FT_List_Finalize */
240
/* Destroys all elements in the list as well as the list itself. */
243
/* list :: A handle to the list. */
245
/* destroy :: A list destructor that will be applied to each element */
248
/* memory :: The current memory object which handles deallocation. */
250
/* user :: A user-supplied field which is passed as the last */
251
/* argument to the destructor. */
254
FT_List_Finalize( FT_List list,
255
FT_List_Destructor destroy,
265
#endif /* __FTLIST_H__ */