19 #ifndef __FTCCACHE_H__ 20 #define __FTCCACHE_H__ 27 #define _FTC_FACE_ID_HASH( i ) \ 28 ((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 ))) 69 #define FTC_NODE( x ) ( (FTC_Node)(x) ) 70 #define FTC_NODE_P( x ) ( (FTC_Node*)(x) ) 72 #define FTC_NODE__NEXT( x ) FTC_NODE( (x)->mru.next ) 73 #define FTC_NODE__PREV( x ) FTC_NODE( (x)->mru.prev ) 76 #define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ 77 ( ( cache )->buckets + \ 78 ( ( ( ( hash ) & ( cache )->mask ) < ( cache )->p ) \ 79 ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) ) \ 80 : ( ( hash ) & ( cache )->mask ) ) ) 83 ftc_get_top_node_for_hash( FTC_Cache cache,
85 #define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ 86 ftc_get_top_node_for_hash( ( cache ), ( hash ) ) 89 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 167 #define FTC_CACHE( x ) ( (FTC_Cache)(x) ) 168 #define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) ) 187 FTC_Cache_Lookup( FTC_Cache cache,
216 #define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \ 218 FTC_Node *_bucket, *_pnode, _node; \ 219 FTC_Cache _cache = FTC_CACHE(cache); \ 220 FT_PtrDist _hash = (FT_PtrDist)(hash); \ 221 FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \ 222 FT_Bool _list_changed = FALSE; \ 229 _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ 236 if ( _node == NULL ) \ 239 if ( _node->hash == _hash && \ 240 _nodcomp( _node, query, _cache, &_list_changed ) ) \ 243 _pnode = &_node->link; \ 246 if ( _list_changed ) \ 249 _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ 252 while ( *_pnode != _node ) \ 254 if ( *_pnode == NULL ) \ 256 FT_ERROR(( "FTC_CACHE_LOOKUP_CMP: oops!!! node missing\n" )); \ 260 _pnode = &((*_pnode)->link); \ 265 if ( _node != *_bucket ) \ 267 *_pnode = _node->link; \ 268 _node->link = *_bucket; \ 274 FTC_Manager _manager = _cache->manager; \ 275 void* _nl = &_manager->nodes_list; \ 278 if ( _node != _manager->nodes_list ) \ 279 FTC_MruNode_Up( (FTC_MruNode*)_nl, \ 280 (FTC_MruNode)_node ); \ 285 error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \ 293 #define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \ 295 error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, \ 296 (FTC_Node*)&(node) ); \ 318 #define FTC_CACHE_TRYLOOP( cache ) \ 320 FTC_Manager _try_manager = FTC_CACHE( cache )->manager; \ 321 FT_UInt _try_count = 4; \ 329 #define FTC_CACHE_TRYLOOP_END( list_changed ) \ 330 if ( !error || FT_ERR_NEQ( error, Out_Of_Memory ) ) \ 333 _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ 334 if ( _try_done > 0 && ( list_changed ) ) \ 335 *(FT_Bool*)( list_changed ) = TRUE; \ 337 if ( _try_done == 0 ) \ 340 if ( _try_done == _try_count ) \ 343 if ( _try_count < _try_done || \ 344 _try_count > _try_manager->num_nodes ) \ 345 _try_count = _try_manager->num_nodes; \
FT_Bool(* FTC_Node_CompareFunc)(FTC_Node node, FT_Pointer key, FTC_Cache cache, FT_Bool *list_changed)
FT_Error(* FTC_Cache_InitFunc)(FTC_Cache cache)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
FTC_Cache_DoneFunc cache_done
FT_BEGIN_HEADER typedef unsigned char FT_Bool
FT_Offset(* FTC_Node_WeightFunc)(FTC_Node node, FTC_Cache cache)
FTC_Node_FreeFunc node_free
FTC_Node_CompareFunc node_compare
void(* FTC_Cache_DoneFunc)(FTC_Cache cache)
FTC_Node_WeightFunc node_weight
struct FTC_CacheClassRec_ FTC_CacheClassRec
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
struct FTC_CacheRec_ * FTC_Cache
FTC_Cache_Init(FTC_Cache cache)
FTC_Cache_NewNode(FTC_Cache cache, FT_PtrDist hash, FT_Pointer query, FTC_Node *anode)
FT_Error(* FTC_Node_NewFunc)(FTC_Node *pnode, FT_Pointer query, FTC_Cache cache)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
struct FTC_CacheRec_ FTC_CacheRec
FTC_Cache_RemoveFaceID(FTC_Cache cache, FTC_FaceID face_id)
FTC_Node_NewFunc node_new
FTC_Cache_Done(FTC_Cache cache)
FTC_Node_CompareFunc node_remove_faceid
void(* FTC_Node_FreeFunc)(FTC_Node node, FTC_Cache cache)
FTC_Cache_InitFunc cache_init
const struct FTC_CacheClassRec_ * FTC_CacheClass
struct FTC_NodeRec_ FTC_NodeRec