sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftlist.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftlist.h
4 *
5 * Generic list support for FreeType (specification).
6 *
7 * Copyright (C) 1996-2025 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
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.
15 *
16 */
17
18
19 /**************************************************************************
20 *
21 * This file implements functions relative to list processing. Its data
22 * structures are defined in `freetype.h`.
23 *
24 */
25
26
31#ifndef FTLIST_H_
32#define FTLIST_H_
33
34
35#include <freetype/freetype.h>
36
37#ifdef FREETYPE_H
38#error "freetype.h of FreeType 1 has been loaded!"
39#error "Please fix the directory search order for header files"
40#error "so that freetype.h of FreeType 2 is found first."
41#endif
42
43
44FT_BEGIN_HEADER
45
46
47 /**************************************************************************
48 *
49 * @section:
50 * list_processing
51 *
52 * @title:
53 * List Processing
54 *
55 * @abstract:
56 * Simple management of lists.
57 *
58 * @description:
59 * This section contains various definitions related to list processing
60 * using doubly-linked nodes.
61 *
62 * @order:
63 * FT_List
64 * FT_ListNode
65 * FT_ListRec
66 * FT_ListNodeRec
67 *
68 * FT_List_Add
69 * FT_List_Insert
70 * FT_List_Find
71 * FT_List_Remove
72 * FT_List_Up
73 * FT_List_Iterate
74 * FT_List_Iterator
75 * FT_List_Finalize
76 * FT_List_Destructor
77 *
78 */
79
80
81 /**************************************************************************
82 *
83 * @function:
84 * FT_List_Find
85 *
86 * @description:
87 * Find the list node for a given listed object.
88 *
89 * @input:
90 * list ::
91 * A pointer to the parent list.
92 * data ::
93 * The address of the listed object.
94 *
95 * @return:
96 * List node. `NULL` if it wasn't found.
97 */
98 FT_EXPORT( FT_ListNode )
99 FT_List_Find( FT_List list,
100 void* data );
101
102
103 /**************************************************************************
104 *
105 * @function:
106 * FT_List_Add
107 *
108 * @description:
109 * Append an element to the end of a list.
110 *
111 * @inout:
112 * list ::
113 * A pointer to the parent list.
114 * node ::
115 * The node to append.
116 */
117 FT_EXPORT( void )
118 FT_List_Add( FT_List list,
119 FT_ListNode node );
120
121
122 /**************************************************************************
123 *
124 * @function:
125 * FT_List_Insert
126 *
127 * @description:
128 * Insert an element at the head of a list.
129 *
130 * @inout:
131 * list ::
132 * A pointer to parent list.
133 * node ::
134 * The node to insert.
135 */
136 FT_EXPORT( void )
137 FT_List_Insert( FT_List list,
138 FT_ListNode node );
139
140
141 /**************************************************************************
142 *
143 * @function:
144 * FT_List_Remove
145 *
146 * @description:
147 * Remove a node from a list. This function doesn't check whether the
148 * node is in the list!
149 *
150 * @input:
151 * node ::
152 * The node to remove.
153 *
154 * @inout:
155 * list ::
156 * A pointer to the parent list.
157 */
158 FT_EXPORT( void )
159 FT_List_Remove( FT_List list,
160 FT_ListNode node );
161
162
163 /**************************************************************************
164 *
165 * @function:
166 * FT_List_Up
167 *
168 * @description:
169 * Move a node to the head/top of a list. Used to maintain LRU lists.
170 *
171 * @inout:
172 * list ::
173 * A pointer to the parent list.
174 * node ::
175 * The node to move.
176 */
177 FT_EXPORT( void )
178 FT_List_Up( FT_List list,
179 FT_ListNode node );
180
181
182 /**************************************************************************
183 *
184 * @functype:
185 * FT_List_Iterator
186 *
187 * @description:
188 * An FT_List iterator function that is called during a list parse by
189 * @FT_List_Iterate.
190 *
191 * @input:
192 * node ::
193 * The current iteration list node.
194 *
195 * user ::
196 * A typeless pointer passed to @FT_List_Iterate. Can be used to point
197 * to the iteration's state.
198 */
199 typedef FT_Error
200 (*FT_List_Iterator)( FT_ListNode node,
201 void* user );
202
203
204 /**************************************************************************
205 *
206 * @function:
207 * FT_List_Iterate
208 *
209 * @description:
210 * Parse a list and calls a given iterator function on each element.
211 * Note that parsing is stopped as soon as one of the iterator calls
212 * returns a non-zero value.
213 *
214 * @input:
215 * list ::
216 * A handle to the list.
217 * iterator ::
218 * An iterator function, called on each node of the list.
219 * user ::
220 * A user-supplied field that is passed as the second argument to the
221 * iterator.
222 *
223 * @return:
224 * The result (a FreeType error code) of the last iterator call.
225 */
226 FT_EXPORT( FT_Error )
227 FT_List_Iterate( FT_List list,
228 FT_List_Iterator iterator,
229 void* user );
230
231
232 /**************************************************************************
233 *
234 * @functype:
235 * FT_List_Destructor
236 *
237 * @description:
238 * An @FT_List iterator function that is called during a list
239 * finalization by @FT_List_Finalize to destroy all elements in a given
240 * list.
241 *
242 * @input:
243 * system ::
244 * The current system object.
245 *
246 * data ::
247 * The current object to destroy.
248 *
249 * user ::
250 * A typeless pointer passed to @FT_List_Iterate. It can be used to
251 * point to the iteration's state.
252 */
253 typedef void
254 (*FT_List_Destructor)( FT_Memory memory,
255 void* data,
256 void* user );
257
258
259 /**************************************************************************
260 *
261 * @function:
262 * FT_List_Finalize
263 *
264 * @description:
265 * Destroy all elements in the list as well as the list itself.
266 *
267 * @input:
268 * list ::
269 * A handle to the list.
270 *
271 * destroy ::
272 * A list destructor that will be applied to each element of the list.
273 * Set this to `NULL` if not needed.
274 *
275 * memory ::
276 * The current memory object that handles deallocation.
277 *
278 * user ::
279 * A user-supplied field that is passed as the last argument to the
280 * destructor.
281 *
282 * @note:
283 * This function expects that all nodes added by @FT_List_Add or
284 * @FT_List_Insert have been dynamically allocated.
285 */
286 FT_EXPORT( void )
287 FT_List_Finalize( FT_List list,
288 FT_List_Destructor destroy,
289 FT_Memory memory,
290 void* user );
291
292 /* */
293
294
295FT_END_HEADER
296
297#endif /* FTLIST_H_ */
298
299
300/* END */