ReactOS 0.4.16-dev-125-g798ea90
ftcmru.h File Reference
#include <ft2build.h>
Include dependency graph for ftcmru.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FTC_MruNodeRec_
 
struct  FTC_MruListClassRec_
 
struct  FTC_MruListRec_
 

Macros

#define xxFT_DEBUG_ERROR
 
#define FTC_INLINE
 
#define FTC_MRULIST_LOOKUP_CMP(list, key, compare, node, error)
 
#define FTC_MRULIST_LOOKUP(list, key, node, error)    FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )
 
#define FTC_MRULIST_LOOP(list, node)
 
#define FTC_MRULIST_LOOP_END()
 

Typedefs

typedef typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_FTC_MruNode
 
typedef struct FTC_MruNodeRec_ FTC_MruNodeRec
 
typedef struct FTC_MruListRec_FTC_MruList
 
typedef struct FTC_MruListClassRec_ constFTC_MruListClass
 
typedef FT_Bool(* FTC_MruNode_CompareFunc) (FTC_MruNode node, FT_Pointer key)
 
typedef FT_Error(* FTC_MruNode_InitFunc) (FTC_MruNode node, FT_Pointer key, FT_Pointer data)
 
typedef FT_Error(* FTC_MruNode_ResetFunc) (FTC_MruNode node, FT_Pointer key, FT_Pointer data)
 
typedef void(* FTC_MruNode_DoneFunc) (FTC_MruNode node, FT_Pointer data)
 
typedef struct FTC_MruListClassRec_ FTC_MruListClassRec
 
typedef struct FTC_MruListRec_ FTC_MruListRec
 

Functions

 FTC_MruNode_Prepend (FTC_MruNode *plist, FTC_MruNode node)
 
 FTC_MruNode_Up (FTC_MruNode *plist, FTC_MruNode node)
 
 FTC_MruNode_Remove (FTC_MruNode *plist, FTC_MruNode node)
 
 FTC_MruList_Init (FTC_MruList list, FTC_MruListClass clazz, FT_UInt max_nodes, FT_Pointer data, FT_Memory memory)
 
 FTC_MruList_Reset (FTC_MruList list)
 
 FTC_MruList_Done (FTC_MruList list)
 
 FTC_MruList_New (FTC_MruList list, FT_Pointer key, FTC_MruNode *anode)
 
 FTC_MruList_Remove (FTC_MruList list, FTC_MruNode node)
 
 FTC_MruList_RemoveSelection (FTC_MruList list, FTC_MruNode_CompareFunc selection, FT_Pointer key)
 

Macro Definition Documentation

◆ FTC_INLINE

#define FTC_INLINE

Definition at line 57 of file ftcmru.h.

◆ FTC_MRULIST_LOOKUP

#define FTC_MRULIST_LOOKUP (   list,
  key,
  node,
  error 
)     FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )

Definition at line 198 of file ftcmru.h.

◆ FTC_MRULIST_LOOKUP_CMP

#define FTC_MRULIST_LOOKUP_CMP (   list,
  key,
  compare,
  node,
  error 
)

Definition at line 164 of file ftcmru.h.

◆ FTC_MRULIST_LOOP

#define FTC_MRULIST_LOOP (   list,
  node 
)
Value:
FT_BEGIN_STMNT \
FTC_MruNode _first = (list)->nodes; \
\
\
if ( _first ) \
{ \
FTC_MruNode _node = _first; \
\
\
do \
{ \
*(FTC_MruNode*)&(node) = _node;
typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_ * FTC_MruNode
Definition: ftcmru.h:61
#define list
Definition: rosglue.h:35
Definition: dlist.c:348

Definition at line 218 of file ftcmru.h.

◆ FTC_MRULIST_LOOP_END

#define FTC_MRULIST_LOOP_END ( )
Value:
_node = _node->next; \
\
} while ( _node != _first ); \
} \
#define FT_END_STMNT
Definition: ftconfig.h:353

Definition at line 233 of file ftcmru.h.

◆ xxFT_DEBUG_ERROR

#define xxFT_DEBUG_ERROR

Definition at line 56 of file ftcmru.h.

Typedef Documentation

◆ FTC_MruList

Definition at line 84 of file ftcmru.h.

◆ FTC_MruListClass

Definition at line 86 of file ftcmru.h.

◆ FTC_MruListClassRec

◆ FTC_MruListRec

◆ FTC_MruNode

typedef typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_* FTC_MruNode

Definition at line 61 of file ftcmru.h.

◆ FTC_MruNode_CompareFunc

typedef FT_Bool(* FTC_MruNode_CompareFunc) (FTC_MruNode node, FT_Pointer key)

Definition at line 89 of file ftcmru.h.

◆ FTC_MruNode_DoneFunc

typedef void(* FTC_MruNode_DoneFunc) (FTC_MruNode node, FT_Pointer data)

Definition at line 103 of file ftcmru.h.

◆ FTC_MruNode_InitFunc

typedef FT_Error(* FTC_MruNode_InitFunc) (FTC_MruNode node, FT_Pointer key, FT_Pointer data)

Definition at line 93 of file ftcmru.h.

◆ FTC_MruNode_ResetFunc

typedef FT_Error(* FTC_MruNode_ResetFunc) (FTC_MruNode node, FT_Pointer key, FT_Pointer data)

Definition at line 98 of file ftcmru.h.

◆ FTC_MruNodeRec

Function Documentation

◆ FTC_MruList_Done()

FTC_MruList_Done ( FTC_MruList  list)

Definition at line 195 of file ftcmru.c.

196 {
198 }
Definition: list.h:37
FTC_MruList_Reset(FTC_MruList list)
Definition: ftcmru.c:185

Referenced by ftc_gcache_done(), and FTC_Manager_Done().

◆ FTC_MruList_Init()

FTC_MruList_Init ( FTC_MruList  list,
FTC_MruListClass  clazz,
FT_UInt  max_nodes,
FT_Pointer  data,
FT_Memory  memory 
)

Definition at line 169 of file ftcmru.c.

174 {
175 list->num_nodes = 0;
176 list->max_nodes = max_nodes;
177 list->nodes = NULL;
178 list->clazz = *clazz;
179 list->data = data;
180 list->memory = memory;
181 }
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static char memory[1024 *256]
Definition: process.c:116

Referenced by ftc_gcache_init(), and FTC_Manager_New().

◆ FTC_MruList_New()

FTC_MruList_New ( FTC_MruList  list,
FT_Pointer  key,
FTC_MruNode anode 
)

Definition at line 236 of file ftcmru.c.

239 {
242 FT_Memory memory = list->memory;
243
244
245 if ( list->num_nodes >= list->max_nodes && list->max_nodes > 0 )
246 {
247 node = list->nodes->prev;
248
249 FT_ASSERT( node );
250
251 if ( list->clazz.node_reset )
252 {
253 FTC_MruNode_Up( &list->nodes, node );
254
255 error = list->clazz.node_reset( node, key, list->data );
256 if ( !error )
257 goto Exit;
258 }
259
260 FTC_MruNode_Remove( &list->nodes, node );
261 list->num_nodes--;
262
263 if ( list->clazz.node_done )
264 list->clazz.node_done( node, list->data );
265 }
266 else if ( FT_ALLOC( node, list->clazz.node_size ) )
267 goto Exit;
268
269 error = list->clazz.node_init( node, key, list->data );
270 if ( error )
271 goto Fail;
272
273 FTC_MruNode_Prepend( &list->nodes, node );
274 list->num_nodes++;
275
276 Exit:
277 *anode = node;
278 return error;
279
280 Fail:
281 if ( list->clazz.node_done )
282 list->clazz.node_done( node, list->data );
283
284 FT_FREE( node );
285 goto Exit;
286 }
struct list * prev
Definition: list.h:39
int Fail
Definition: ehthrow.cxx:24
FTC_MruNode_Up(FTC_MruNode *plist, FTC_MruNode node)
Definition: ftcmru.c:73
FTC_MruNode_Prepend(FTC_MruNode *plist, FTC_MruNode node)
Definition: ftcmru.c:29
FTC_MruNode_Remove(FTC_MruNode *plist, FTC_MruNode node)
Definition: ftcmru.c:122
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
Definition: copy.c:22

◆ FTC_MruList_Remove()

FTC_MruList_Remove ( FTC_MruList  list,
FTC_MruNode  node 
)

Definition at line 308 of file ftcmru.c.

310 {
311 FTC_MruNode_Remove( &list->nodes, node );
312 list->num_nodes--;
313
314 {
315 FT_Memory memory = list->memory;
316
317
318 if ( list->clazz.node_done )
319 list->clazz.node_done( node, list->data );
320
321 FT_FREE( node );
322 }
323 }

Referenced by FTC_MruList_RemoveSelection(), and FTC_MruList_Reset().

◆ FTC_MruList_RemoveSelection()

FTC_MruList_RemoveSelection ( FTC_MruList  list,
FTC_MruNode_CompareFunc  selection,
FT_Pointer  key 
)

Definition at line 327 of file ftcmru.c.

330 {
332
333
334 first = list->nodes;
335 while ( first && ( !selection || selection( first, key ) ) )
336 {
338 first = list->nodes;
339 }
340
341 if ( first )
342 {
343 node = first->next;
344 while ( node != first )
345 {
346 next = node->next;
347
348 if ( selection( node, key ) )
350
351 node = next;
352 }
353 }
354 }
int selection
Definition: ctm.c:92
FTC_MruList_Remove(FTC_MruList list, FTC_MruNode node)
Definition: ftcmru.c:308
const GLint * first
Definition: glext.h:5794
static unsigned __int64 next
Definition: rand_nt.c:6
void * next
Definition: dlist.c:360

Referenced by ftc_face_node_done(), and FTC_Manager_RemoveFaceID().

◆ FTC_MruList_Reset()

FTC_MruList_Reset ( FTC_MruList  list)

Definition at line 185 of file ftcmru.c.

186 {
187 while ( list->nodes )
188 FTC_MruList_Remove( list, list->nodes );
189
190 FT_ASSERT( list->num_nodes == 0 );
191 }

Referenced by FTC_Manager_Reset(), and FTC_MruList_Done().

◆ FTC_MruNode_Prepend()

FTC_MruNode_Prepend ( FTC_MruNode plist,
FTC_MruNode  node 
)

Definition at line 29 of file ftcmru.c.

31 {
33
34
35 if ( first )
36 {
37 FTC_MruNode last = first->prev;
38
39
40#ifdef FT_DEBUG_ERROR
41 {
42 FTC_MruNode cnode = first;
43
44
45 do
46 {
47 if ( cnode == node )
48 {
49 fprintf( stderr, "FTC_MruNode_Prepend: invalid action\n" );
50 exit( 2 );
51 }
52 cnode = cnode->next;
53
54 } while ( cnode != first );
55 }
56#endif
57
58 first->prev = node;
59 last->next = node;
60 node->next = first;
61 node->prev = last;
62 }
63 else
64 {
65 node->next = node;
66 node->prev = node;
67 }
68 *plist = node;
69 }
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static UINT UINT last
Definition: font.c:45
static Parse plist[]
Definition: dwarfinfo.c:339
#define exit(n)
Definition: config.h:202

Referenced by FTC_MruList_New(), and ftc_node_mru_link().

◆ FTC_MruNode_Remove()

FTC_MruNode_Remove ( FTC_MruNode plist,
FTC_MruNode  node 
)

Definition at line 122 of file ftcmru.c.

124 {
126 FTC_MruNode prev, next;
127
128
129 FT_ASSERT( first );
130
131#ifdef FT_DEBUG_ERROR
132 {
133 FTC_MruNode cnode = first;
134
135
136 do
137 {
138 if ( cnode == node )
139 goto Ok;
140 cnode = cnode->next;
141
142 } while ( cnode != first );
143
144 fprintf( stderr, "FTC_MruNode_Remove: invalid action\n" );
145 exit( 2 );
146 Ok:
147 }
148#endif
149
150 prev = node->prev;
151 next = node->next;
152
153 prev->next = next;
154 next->prev = prev;
155
156 if ( node == next )
157 {
158 FT_ASSERT( first == node );
159 FT_ASSERT( prev == node );
160
161 *plist = NULL;
162 }
163 else if ( node == first )
164 *plist = next;
165 }
@ Ok
Definition: gdiplustypes.h:26

Referenced by FTC_MruList_New(), FTC_MruList_Remove(), and ftc_node_mru_unlink().

◆ FTC_MruNode_Up()

FTC_MruNode_Up ( FTC_MruNode plist,
FTC_MruNode  node 
)

Definition at line 73 of file ftcmru.c.

75 {
77
78
80
81 if ( first != node )
82 {
83 FTC_MruNode prev, next, last;
84
85
86#ifdef FT_DEBUG_ERROR
87 {
88 FTC_MruNode cnode = first;
89 do
90 {
91 if ( cnode == node )
92 goto Ok;
93 cnode = cnode->next;
94
95 } while ( cnode != first );
96
97 fprintf( stderr, "FTC_MruNode_Up: invalid action\n" );
98 exit( 2 );
99 Ok:
100 }
101#endif
102 prev = node->prev;
103 next = node->next;
104
105 prev->next = next;
106 next->prev = prev;
107
108 last = first->prev;
109
110 last->next = node;
111 first->prev = node;
112
113 node->next = first;
114 node->prev = last;
115
116 *plist = node;
117 }
118 }

Referenced by FTC_MruList_New().