21 #include FT_INTERNAL_OBJECTS_H 22 #include FT_INTERNAL_DEBUG_H 28 #define FT_COMPONENT trace_cache 31 #define FTC_HASH_MAX_LOAD 2 32 #define FTC_HASH_MIN_LOAD 1 33 #define FTC_HASH_SUB_LOAD ( FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD ) 36 #define FTC_HASH_INITIAL_SIZE 8 91 ftc_get_top_node_for_hash(
FTC_Cache cache,
124 if ( cache->
slack < 0 )
140 ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) )
153 if ( node->
hash & ( mask + 1 ) )
156 node->
link = new_list;
163 cache->
buckets[p + mask + 1] = new_list;
169 cache->
mask = 2 * mask + 1;
194 ( mask + 1 ) * 2, mask + 1 ) )
205 pnode = &(*pnode)->
link;
207 pold = cache->
buckets + old_index;
224 ftc_node_hash_unlink(
FTC_Node node0,
237 FT_TRACE0((
"ftc_node_hash_unlink: unknown node\n" ));
244 pnode = &(*pnode)->
link;
247 *pnode = node0->
link;
251 ftc_cache_resize( cache );
267 ftc_cache_resize( cache );
272 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 283 #ifdef FT_DEBUG_ERROR 287 FT_TRACE0((
"ftc_node_destroy: invalid node handle\n" ));
294 #ifdef FT_DEBUG_ERROR 297 FT_TRACE0((
"ftc_node_destroy: invalid node handle\n" ));
305 ftc_node_mru_unlink( node, manager );
308 ftc_node_hash_unlink( node, cache );
316 FT_TRACE0((
"ftc_node_destroy: invalid cache node count (%d)\n",
364 count = cache->
p + cache->
mask + 1;
366 for ( i = 0; i <
count; i++ )
377 ftc_node_mru_unlink( node, manager );
387 ftc_cache_resize( cache );
400 FTC_Cache_Clear( cache );
428 ftc_node_hash_link( node, cache );
429 ftc_node_mru_link( node, cache->
manager );
476 ftc_cache_add( cache, hash, node );
501 if ( cache ==
NULL || anode ==
NULL )
502 return FT_THROW( Invalid_Argument );
515 if ( node->
hash == hash &&
516 compare( node,
query, cache, &list_changed ) )
528 while ( *pnode != node )
530 if ( *pnode ==
NULL )
532 FT_ERROR((
"FTC_Cache_Lookup: oops!!! node missing\n" ));
536 pnode = &((*pnode)->link);
541 if ( node != *bucket )
544 node->
link = *bucket;
554 ftc_node_mru_up( node, manager );
593 cache, &list_changed ) )
614 ftc_node_mru_unlink( node, manager );
621 ftc_cache_resize( cache );
FT_Bool(* FTC_Node_CompareFunc)(FTC_Node node, FT_Pointer key, FTC_Cache cache, FT_Bool *list_changed)
#define FTC_CACHE_TRYLOOP_END(list_changed)
FTC_Manager_Compress(FTC_Manager manager)
return FT_THROW(Missing_Property)
typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_ * FTC_MruNode
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
FTC_MruNode_Remove(FTC_MruNode *plist, FTC_MruNode node)
#define FTC_CACHE_TRYLOOP(cache)
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
ftc_cache_init(FTC_Cache cache)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_ERROR(varformat)
FTC_Node_FreeFunc node_free
FTC_Cache_Done(FTC_Cache cache)
#define FTC_HASH_MAX_LOAD
FTC_Cache_NewNode(FTC_Cache cache, FT_PtrDist hash, FT_Pointer query, FTC_Node *anode)
#define FTC_HASH_SUB_LOAD
#define FTC_HASH_INITIAL_SIZE
FTC_Node_CompareFunc node_compare
FTC_Node_WeightFunc node_weight
FTC_MruNode_Up(FTC_MruNode *plist, FTC_MruNode node)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
FTC_Cache caches[FTC_MAX_CACHES]
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
#define FT_NEW_ARRAY(ptr, count)
FTC_Cache_RemoveFaceID(FTC_Cache cache, FTC_FaceID face_id)
FTC_Node_NewFunc node_new
FTC_Node_CompareFunc node_remove_faceid
#define FTC_NODE__TOP_FOR_HASH(cache, hash)
GLuint GLuint GLsizei count
FT_TRACE0(("cff_property_set: missing property `%s'\, property_name))
FTC_Cache_Init(FTC_Cache cache)
ftc_cache_done(FTC_Cache cache)
FTC_MruNode_Prepend(FTC_MruNode *plist, FTC_MruNode node)