Go to the source code of this file.
|  | 
| #define | st__INCLUDED | 
|  | 
| #define | EXTERN   extern | 
|  | 
| #define | ARGS(protos)   protos | 
|  | 
| #define | st__is_member(table, key)   st__lookup(table,key,(char **) 0) | 
|  | 
| #define | st__count(table)   ((table)->num_entries) | 
|  | 
| #define | st__DEFAULT_MAX_DENSITY   5 | 
|  | 
| #define | st__DEFAULT_INIT_TABLE_SIZE   11 | 
|  | 
| #define | st__DEFAULT_GROW_FACTOR   2.0 | 
|  | 
| #define | st__DEFAULT_REORDER_FLAG   0 | 
|  | 
| #define | st__foreach_item(table, gen, key, value)   for(gen= st__init_gen(table); st__gen(gen,key,value) || ( st__free_gen(gen),0);) | 
|  | 
| #define | st__foreach_item_int(table, gen, key, value)   for(gen= st__init_gen(table); st__gen_int(gen,key,value) || ( st__free_gen(gen),0);) | 
|  | 
| #define | st__OUT_OF_MEM   -10000 | 
|  | 
|  | 
| st__table * | st__init_table_with_params (st__compare_func_type compare, st__hash_func_type hash, int size, int density, double grow_factor, int reorder_flag) | 
|  | 
| st__table * | st__init_table (st__compare_func_type, st__hash_func_type) | 
|  | 
| void | st__free_table (st__table *) | 
|  | 
| int | st__lookup (st__table *, const char *, char **) | 
|  | 
| int | st__lookup_int (st__table *, char *, int *) | 
|  | 
| int | st__insert (st__table *, const char *, char *) | 
|  | 
| int | st__add_direct (st__table *, char *, char *) | 
|  | 
| int | st__find_or_add (st__table *, char *, char ***) | 
|  | 
| int | st__find (st__table *, char *, char ***) | 
|  | 
| st__table * | st__copy (st__table *) | 
|  | 
| int | st__delete (st__table *, const char **, char **) | 
|  | 
| int | st__delete_int (st__table *, long *, char **) | 
|  | 
| int | st__foreach (st__table *, st__PFSR, char *) | 
|  | 
| int | st__strhash (const char *, int) | 
|  | 
| int | st__numhash (const char *, int) | 
|  | 
| int | st__ptrhash (const char *, int) | 
|  | 
| int | st__numcmp (const char *, const char *) | 
|  | 
| int | st__ptrcmp (const char *, const char *) | 
|  | 
| st__generator * | st__init_gen (st__table *) | 
|  | 
| int | st__gen (st__generator *, const char **, char **) | 
|  | 
| int | st__gen_int (st__generator *, const char **, long *) | 
|  | 
| void | st__free_gen (st__generator *) | 
|  | 
      
        
          | #define ARGS | ( |  | protos | ) | protos | 
      
 
Definition at line 37 of file st.h.
 
 
Definition at line 32 of file st.h.
 
 
      
        
          | #define st__count | ( |  | table | ) | ((table)->num_entries) | 
      
 
Definition at line 71 of file st.h.
 
 
      
        
          | #define st__DEFAULT_GROW_FACTOR   2.0 | 
      
 
Definition at line 104 of file st.h.
 
 
      
        
          | #define st__DEFAULT_INIT_TABLE_SIZE   11 | 
      
 
Definition at line 103 of file st.h.
 
 
      
        
          | #define st__DEFAULT_MAX_DENSITY   5 | 
      
 
Definition at line 102 of file st.h.
 
 
      
        
          | #define st__DEFAULT_REORDER_FLAG   0 | 
      
 
Definition at line 105 of file st.h.
 
 
Definition at line 107 of file st.h.
 
 
Definition at line 110 of file st.h.
 
 
Definition at line 16 of file st.h.
 
 
Definition at line 70 of file st.h.
 
 
      
        
          | #define st__OUT_OF_MEM   -10000 | 
      
 
Definition at line 113 of file st.h.
 
 
      
        
          | typedef int(*  st__compare_func_type)(const char *, const char *) | 
      
 
Definition at line 41 of file st.h.
 
 
Definition at line 63 of file st.h.
 
 
      
        
          | typedef int(*  st__hash_func_type)(const char *, int) | 
      
 
Definition at line 42 of file st.h.
 
 
Definition at line 76 of file st.h.
 
 
      
        
          | typedef enum st__retval(*  st__PFSR)(char *, char *, char *) | 
      
 
Definition at line 75 of file st.h.
 
 
Definition at line 51 of file st.h.
 
 
Definition at line 44 of file st.h.
 
 
| Enumerator | 
|---|
| st__CONTINUE |  | 
| st__STOP |  | 
| st__DELETE |  | 
Definition at line 73 of file st.h.
 
 
      
        
          | int st__add_direct | ( | st__table * | , | 
        
          |  |  | char * | , | 
        
          |  |  | char * |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 205 of file st.c.
  211     if (table->num_entries / table->num_bins >= table->max_density) {
 
  218     if (newEntry == NULL) {
 
  223     newEntry->
next = table->bins[hash_val];
 
  224     table->bins[hash_val] = newEntry;
 
  225     table->num_entries++;
 
static int rehash(st__table *table)
#define ABC_ALLOC(type, num)
#define do_hash(key, table)
 
 
 
Definition at line 330 of file st.c.
  334     int i, j, num_bins = old_table->num_bins;
 
  337     if (newEntry_table == NULL) {
 
  341     *newEntry_table = *old_table;
 
  343     if (newEntry_table->
bins == NULL) {
 
  347     for(i = 0; i < num_bins ; i++) {
 
  348     newEntry_table->
bins[i] = NULL;
 
  349     ptr = old_table->bins[i];
 
  350     while (ptr != NULL) {
 
  352         if (newEntry == NULL) {
 
  353         for (j = 0; j <= i; j++) {
 
  354             newEntryptr = newEntry_table->
bins[j];
 
  355             while (newEntryptr != NULL) {
 
  356             next = newEntryptr->
next;
 
  366         newEntry->
next = newEntry_table->
bins[i];
 
  367         newEntry_table->
bins[i] = newEntry;
 
  371     return newEntry_table;
 
struct hash_element * next
#define ABC_ALLOC(type, num)
 
 
 
Definition at line 375 of file st.c.
  378     const char *
key = *keyp;
 
  381     hash_val = 
do_hash(key, table);
 
  393     table->num_entries--;
 
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define do_hash(key, table)
 
 
 
      
        
          | int st__delete_int | ( | st__table * | , | 
        
          |  |  | long * | , | 
        
          |  |  | char ** |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 398 of file st.c.
  401     char *
key = (
char *) *keyp;
 
  404     hash_val = 
do_hash(key, table);
 
  414     *keyp = (long) ptr->
key;
 
  416     table->num_entries--;
 
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define do_hash(key, table)
 
 
 
      
        
          | int st__find | ( | st__table * | , | 
        
          |  |  | char * | , | 
        
          |  |  | char *** |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 264 of file st.c.
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define do_hash(key, table)
 
 
 
      
        
          | int st__find_or_add | ( | st__table * | , | 
        
          |  |  | char * | , | 
        
          |  |  | char *** |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 230 of file st.c.
  240     if (table->num_entries / table->num_bins >= table->max_density) {
 
  247     if (newEntry == NULL) {
 
  251     newEntry->
record = (
char *) 0;
 
  252     newEntry->
next = table->bins[hash_val];
 
  253     table->bins[hash_val] = newEntry;
 
  254     table->num_entries++;
 
  255     if (slot != NULL) *slot = &newEntry->
record;
 
  258     if (slot != NULL) *slot = &ptr->
record;
 
static int rehash(st__table *table)
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define ABC_ALLOC(type, num)
#define do_hash(key, table)
 
 
 
Definition at line 556 of file st.c.
 
 
Definition at line 81 of file st.c.
   86     for(i = 0; i < table->num_bins ; i++) {
 
struct hash_element * next
 
 
 
Definition at line 502 of file st.c.
  506     if (gen->entry == NULL) {
 
  508     for(i = gen->index; i < gen->table->num_bins; i++) {
 
  509         if (gen->table->bins[i] != NULL) {
 
  511         gen->entry = gen->table->bins[i];
 
  515     if (gen->entry == NULL) {
 
  519     *key_p = gen->entry->key;
 
  521     *value_p = gen->entry->record;
 
  523     gen->entry = gen->entry->next;
 
 
 
 
Definition at line 529 of file st.c.
  533     if (gen->entry == NULL) {
 
  535     for(i = gen->index; i < gen->table->num_bins; i++) {
 
  536         if (gen->table->bins[i] != NULL) {
 
  538         gen->entry = gen->table->bins[i];
 
  542     if (gen->entry == NULL) {
 
  546     *key_p = gen->entry->key;
 
  548     *value_p = (long) gen->entry->record;
 
  550     gen->entry = gen->entry->next;
 
 
 
 
Definition at line 486 of file st.c.
#define ABC_ALLOC(type, num)
 
 
 
Definition at line 72 of file st.c.
#define st__DEFAULT_REORDER_FLAG
#define st__DEFAULT_GROW_FACTOR
st__table * st__init_table_with_params(st__compare_func_type compare, st__hash_func_type hash, int size, int density, double grow_factor, int reorder_flag)
static uint32_t hash(uint32_t x)
#define st__DEFAULT_MAX_DENSITY
#define st__DEFAULT_INIT_TABLE_SIZE
 
 
 
Definition at line 41 of file st.c.
   47     if (newTable == NULL) {
 
   61     if (newTable->
bins == NULL) {
 
   65     for(i = 0; i < 
size; i++) {
 
   66     newTable->
bins[i] = 0;
 
st__compare_func_type compare
#define ABC_ALLOC(type, num)
static uint32_t hash(uint32_t x)
 
 
 
Definition at line 171 of file st.c.
  182     if (table->num_entries/table->num_bins >= table->max_density) {
 
  189     if (newEntry == NULL) {
 
  192     newEntry->
key = (
char *)
key;
 
  194     newEntry->
next = table->bins[hash_val];
 
  195     table->bins[hash_val] = newEntry;
 
  196     table->num_entries++;
 
static int rehash(st__table *table)
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define ABC_ALLOC(type, num)
#define do_hash(key, table)
 
 
 
Definition at line 114 of file st.c.
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define do_hash(key, table)
 
 
 
      
        
          | int st__lookup_int | ( | st__table * | , | 
        
          |  |  | char * | , | 
        
          |  |  | int * |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 134 of file st.c.
#define FIND_ENTRY(table, hash_val, key, ptr, last)
#define do_hash(key, table)
 
 
 
Definition at line 474 of file st.c.
 
 
      
        
          | int st__numhash | ( | const char * | , | 
        
          |  |  | int |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 462 of file st.c.
#define st__NUMHASH(x, size)
 
 
 
Definition at line 480 of file st.c.
 
 
      
        
          | int st__ptrhash | ( | const char * | , | 
        
          |  |  | int |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 468 of file st.c.
#define st__PTRHASH(x, size)
 
 
 
      
        
          | int st__strhash | ( | const char * | , | 
        
          |  |  | int |  | 
        
          |  | ) |  |  | 
      
 
Definition at line 449 of file st.c.
  454     while ((c = *
string++) != 
'\0') {
 
  458     return ((val < 0) ? -val : val)%modulus;