The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

hash.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define hashcheck(hp, data)   hashitem( hp, data, 0 )
#define hashenter(hp, data)   (!hashitem( hp, data, !0 ))

Typedefs

typedef hashdata HASHDATA

Functions

int hash_free (struct hash *hp, HASHDATA *data)
void hashdone (struct hash *hp)
void hashenumerate (struct hash *hp, void(*f)(void *, void *), void *data)
hashhashinit (int datalen, char *name)
int hashitem (struct hash *hp, HASHDATA **data, int enter)


Define Documentation

#define hashcheck hp,
data   )     hashitem( hp, data, 0 )
 

Definition at line 20 of file hash.h.

Referenced by builtin_export(), builtin_import(), check_defined(), lookup_rule(), macro_header_get(), make_class_module(), search(), search_for_target(), type_check(), and var_get().

#define hashenter hp,
data   )     (!hashitem( hp, data, !0 ))
 

Definition at line 19 of file hash.h.

Referenced by bindmodule(), bindtarget(), enter_rule(), import_module(), macro_headers(), make_class_module(), newstr(), profile_enter(), regex_compile(), search(), time_enter(), timestamp(), and var_enter().


Typedef Documentation

typedef struct hashdata HASHDATA
 

Definition at line 11 of file hash.h.

Referenced by bindmodule(), bindtarget(), builtin_export(), builtin_import(), check_defined(), enter_rule(), hash_free(), hashitem(), import_module(), lookup_rule(), macro_header_get(), macro_headers(), make_class_module(), newstr(), profile_enter(), regex_compile(), search(), search_for_target(), time_enter(), timestamp(), type_check(), var_enter(), and var_get().


Function Documentation

int hash_free struct hash hp,
HASHDATA data
 

void hashdone struct hash hp  ) 
 

Definition at line 291 of file hash.c.

References hash::base, hashstat(), i, hash::items, hash::list, and hash::tab.

Referenced by delete_module(), donerules(), donestamps(), donestr(), and var_done().

00292 {
00293         int i;
00294 
00295         if( !hp )
00296             return;
00297 
00298         if( DEBUG_MEM )
00299             hashstat( hp );
00300 
00301         if( hp->tab.base )
00302                 free( (char *)hp->tab.base );
00303         for( i = 0; i <= hp->items.list; i++ )
00304                 free( hp->items.lists[i].base );
00305         free( (char *)hp );
00306 }

Here is the call graph for this function:

void hashenumerate struct hash hp,
void(*)(void *, void *)  f,
void *  data
 

Definition at line 236 of file hash.c.

References hash::base, data, item::data, f(), i, ITEM, hash::items, hashdata::key, hash::list, hash::more, hash::nel, and hash::size.

Referenced by bind_explicitly_located_targets(), builtin_rulenames(), builtin_varnames(), delete_module(), donerules(), import_base_rules(), imported_modules(), profile_dump(), and var_done().

00237 {
00238     int i;
00239     for( i = 0; i <= hp->items.list; i++ )
00240     {
00241         char *next = hp->items.lists[i].base;
00242         int nel = hp->items.lists[i].nel;
00243         if ( i == hp->items.list )
00244             nel -= hp->items.more;
00245 
00246         for( ; nel--; next += hp->items.size )
00247         {
00248             register ITEM *i = (ITEM *)next;
00249             
00250             if ( i->data.key != 0 ) /* don't enumerate freed items */
00251                 f(&i->data, data);
00252         }
00253     }
00254 }

Here is the call graph for this function:

struct hash* hashinit int  datalen,
char *  name
 

Definition at line 265 of file hash.c.

References ALIGNED, hash::base, hash::bloat, ITEM, hash::nel, and hash::tab.

Referenced by bindmodule(), bindtarget(), demand_rules(), import_module(), macro_headers(), make_class_module(), newstr(), profile_enter(), regex_compile(), search(), search_for_target(), timestamp(), and var_enter().

00268 {
00269         struct hash *hp = (struct hash *)malloc( sizeof( *hp ) );
00270 
00271         hp->bloat = 3;
00272         hp->tab.nel = 0;
00273         hp->tab.base = (ITEM **)0;
00274         hp->items.more = 0;
00275     hp->items.free = 0;
00276         hp->items.datalen = datalen;
00277         hp->items.size = sizeof( struct hashhdr ) + ALIGNED( datalen );
00278         hp->items.list = -1;
00279         hp->items.nel = 0;
00280         hp->inel = 11;
00281         hp->name = name;
00282 
00283         return hp;
00284 }

int hashitem struct hash hp,
HASHDATA **  data,
int  enter
 


Generated on Mon Nov 8 17:08:01 2004 for MPT by  doxygen 1.3.9.1