00001 struct s_hash 00002 { 00003 char *name; 00004 int index; 00005 int count; 00006 struct s_hash *next; 00007 }; 00008 00009 /* name: The string referred to by this hash entry. * 00010 * index: The integer identifier for this entry. * 00011 * count: Number of times an element with this name has been inserted into * 00012 * the table. * 00013 * next: A pointer to the next (string,index) entry that mapped to the * 00014 * same hash value, or NULL if there are no more entries. */ 00015 00016 00017 struct s_hash_iterator 00018 { 00019 int i; 00020 struct s_hash *h_ptr; 00021 }; 00022 00023 /* i: current "line" of the hash table. That is, hash_table[i] is the * 00024 * start of the hash linked list for this hash value. * 00025 * h_ptr: Pointer to the next hash structure to be examined in the * 00026 * iteration. */ 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);