VPR-6.0

vpr/SRC/util/hash.h

Go to the documentation of this file.
00001 /** - name:  The string referred to by this hash entry.                        
00002  * - index: The integer identifier for this entry.                            
00003  * - count: Number of times an element with this name has been inserted into  
00004  *        the table.                                                        
00005  * - next:  A pointer to the next (string,index) entry that mapped to the     
00006  *        same hash value, or NULL if there are no more entries.            
00007  */
00008 struct s_hash
00009 {
00010     char *name;
00011     int index;
00012     int count;
00013     struct s_hash *next;
00014 };
00015 
00016 /** - i:  current "line" of the hash table.  That is, hash_table[i] is the     
00017  *     start of the hash linked list for this hash value.                   
00018  * - h_ptr:  Pointer to the next hash structure to be examined in the         
00019  *         iteration.                                                       
00020  */
00021 struct s_hash_iterator
00022 {
00023     int i;
00024     struct s_hash *h_ptr;
00025 };
00026 
00027 
00028 
00029 struct s_hash **alloc_hash_table(void);
00030 void free_hash_table(struct s_hash **hash_table);
00031 struct s_hash_iterator start_hash_table_iterator(void);
00032 struct s_hash *get_next_hash(struct s_hash **hash_table,
00033                              struct s_hash_iterator *hash_iterator);
00034 struct s_hash *insert_in_hash_table(struct s_hash **hash_table,
00035                                     char *name,
00036                                     int next_free_index);
00037 struct s_hash *get_hash_entry(struct s_hash **hash_table,
00038                               char *name);