ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
stmm.c File Reference
#include <stdio.h>
#include "misc/extra/extra.h"
#include "stmm.h"
Include dependency graph for stmm.c:

Go to the source code of this file.

Macros

#define STMM_NUMCMP(x, y)
 
#define STMM_NUMHASH(x, size)
 
#define STMM_PTRHASH(x, size)
 
#define EQUAL(func, x, y)
 
#define do_hash(key, table)
 
#define PTR_NOT_EQUAL(table, ptr, user_key)
 
#define FIND_ENTRY(table, hash_val, key, ptr, last)
 
#define ADD_DIRECT(table, key, value, hash_val, new)
 

Functions

stmm_tablestmm_init_table_with_params (stmm_compare_func_type compare, stmm_hash_func_type hash, int size, int density, double grow_factor, int reorder_flag)
 
stmm_tablestmm_init_table (stmm_compare_func_type compare, stmm_hash_func_type hash)
 
void stmm_free_table (stmm_table *table)
 
void stmm_clean (stmm_table *table)
 
int stmm_lookup (stmm_table *table, char *key, char **value)
 
int stmm_lookup_int (stmm_table *table, char *key, int *value)
 
int stmm_insert (stmm_table *table, char *key, char *value)
 
int stmm_add_direct (stmm_table *table, char *key, char *value)
 
int stmm_find_or_add (stmm_table *table, char *key, char ***slot)
 
int stmm_find (stmm_table *table, char *key, char ***slot)
 
stmm_tablestmm_copy (stmm_table *old_table)
 
int stmm_delete (stmm_table *table, char **keyp, char **value)
 
int stmm_delete_int (stmm_table *table, long *keyp, char **value)
 
int stmm_foreach (stmm_table *table, enum stmm_retval(*func)(char *, char *, char *), char *arg)
 
int stmm_strhash (const char *string, int modulus)
 
int stmm_numhash (const char *x, int size)
 
int stmm_ptrhash (const char *x, int size)
 
int stmm_numcmp (const char *x, const char *y)
 
int stmm_ptrcmp (const char *x, const char *y)
 
stmm_generatorstmm_init_gen (stmm_table *table)
 
int stmm_gen (stmm_generator *gen, char **key_p, char **value_p)
 
int stmm_gen_int (stmm_generator *gen, char **key_p, long *value_p)
 
void stmm_free_gen (stmm_generator *gen)
 

Macro Definition Documentation

◆ ADD_DIRECT

#define ADD_DIRECT ( table,
key,
value,
hash_val,
new )
Value:
{\
if (table->num_entries/table->num_bins >= table->max_density) {\
rehash(table);\
hash_val = do_hash(key,table);\
}\
\
\
new->key = key;\
new->record = value;\
new->next = table->bins[hash_val];\
table->bins[hash_val] = new;\
table->num_entries++;\
}
ABC_NAMESPACE_IMPL_START typedef signed char value
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
struct Extra_MmFixed_t_ Extra_MmFixed_t
Definition extra.h:147
enum keys key
Definition main.h:25
#define do_hash(key, table)
Definition st.c:28
Definition stmm.h:47

Definition at line 183 of file stmm.c.

183#define ADD_DIRECT(table, key, value, hash_val, new)\
184{\
185 if (table->num_entries/table->num_bins >= table->max_density) {\
186 rehash(table);\
187 hash_val = do_hash(key,table);\
188 }\
189 \
190 new = (stmm_table_entry *)Extra_MmFixedEntryFetch( (Extra_MmFixed_t *)table->pMemMan );\
191 \
192 new->key = key;\
193 new->record = value;\
194 new->next = table->bins[hash_val];\
195 table->bins[hash_val] = new;\
196 table->num_entries++;\
197}

◆ do_hash

#define do_hash ( key,
table )
Value:
((table->hash == stmm_ptrhash) ? STMM_PTRHASH((key),(table)->num_bins) :\
(table->hash == stmm_numhash) ? STMM_NUMHASH((key), (table)->num_bins) :\
(*table->hash)((key), (table)->num_bins))
int stmm_ptrhash(const char *x, int size)
Definition stmm.c:533
#define STMM_PTRHASH(x, size)
Definition stmm.c:20
#define STMM_NUMHASH(x, size)
Definition stmm.c:18
int stmm_numhash(const char *x, int size)
Definition stmm.c:527

Definition at line 26 of file stmm.c.

26#define do_hash(key, table)\
27 ((table->hash == stmm_ptrhash) ? STMM_PTRHASH((key),(table)->num_bins) :\
28 (table->hash == stmm_numhash) ? STMM_NUMHASH((key), (table)->num_bins) :\
29 (*table->hash)((key), (table)->num_bins))

◆ EQUAL

#define EQUAL ( func,
x,
y )
Value:
((((func) == stmm_numcmp) || ((func) == stmm_ptrcmp)) ?\
(STMM_NUMCMP((x),(y)) == 0) : ((*func)((x), (y)) == 0))
#define STMM_NUMCMP(x, y)
Definition stmm.c:17
int stmm_numcmp(const char *x, const char *y)
Definition stmm.c:539
int stmm_ptrcmp(const char *x, const char *y)
Definition stmm.c:545

Definition at line 21 of file stmm.c.

21#define EQUAL(func, x, y) \
22 ((((func) == stmm_numcmp) || ((func) == stmm_ptrcmp)) ?\
23 (STMM_NUMCMP((x),(y)) == 0) : ((*func)((x), (y)) == 0))

◆ FIND_ENTRY

#define FIND_ENTRY ( table,
hash_val,
key,
ptr,
last )
Value:
(last) = &(table)->bins[hash_val];\
(ptr) = *(last);\
while (PTR_NOT_EQUAL((table), (ptr), (key))) {\
(last) = &(ptr)->next; (ptr) = *(last);\
}\
if ((ptr) != NULL && (table)->reorder_flag) {\
*(last) = (ptr)->next;\
(ptr)->next = (table)->bins[hash_val];\
(table)->bins[hash_val] = (ptr);\
}
#define PTR_NOT_EQUAL(table, ptr, user_key)
Definition st.c:98

Definition at line 121 of file stmm.c.

121#define FIND_ENTRY(table, hash_val, key, ptr, last) \
122 (last) = &(table)->bins[hash_val];\
123 (ptr) = *(last);\
124 while (PTR_NOT_EQUAL((table), (ptr), (key))) {\
125 (last) = &(ptr)->next; (ptr) = *(last);\
126 }\
127 if ((ptr) != NULL && (table)->reorder_flag) {\
128 *(last) = (ptr)->next;\
129 (ptr)->next = (table)->bins[hash_val];\
130 (table)->bins[hash_val] = (ptr);\
131 }

◆ PTR_NOT_EQUAL

#define PTR_NOT_EQUAL ( table,
ptr,
user_key )
Value:
(ptr != NULL && !EQUAL(table->compare, user_key, (ptr)->key))
#define EQUAL(func, x, y)
Definition st.c:23

Definition at line 118 of file stmm.c.

118#define PTR_NOT_EQUAL(table, ptr, user_key)\
119(ptr != NULL && !EQUAL(table->compare, user_key, (ptr)->key))

◆ STMM_NUMCMP

#define STMM_NUMCMP ( x,
y )
Value:
((x) != (y))

Definition at line 17 of file stmm.c.

◆ STMM_NUMHASH

#define STMM_NUMHASH ( x,
size )
Value:
(Abc_AbsInt((long)x)%(size))

Definition at line 18 of file stmm.c.

◆ STMM_PTRHASH

#define STMM_PTRHASH ( x,
size )
Value:
((int)(((ABC_PTRUINT_T)(x)>>2)%size))

Definition at line 20 of file stmm.c.

Function Documentation

◆ stmm_add_direct()

int stmm_add_direct ( stmm_table * table,
char * key,
char * value )

Definition at line 238 of file stmm.c.

239{
240 int hash_val;
241 stmm_table_entry *newEntry;
242
243 hash_val = do_hash (key, table);
244 if (table->num_entries / table->num_bins >= table->max_density) {
245 if (rehash (table) == STMM_OUT_OF_MEM) {
246 return STMM_OUT_OF_MEM;
247 }
248 }
249 hash_val = do_hash (key, table);
250
251// newEntry = ABC_ALLOC( stmm_table_entry, 1 );
252 newEntry = (stmm_table_entry *) Extra_MmFixedEntryFetch ((Extra_MmFixed_t *)table->pMemMan);
253 if (newEntry == NULL) {
254 return STMM_OUT_OF_MEM;
255 }
256
257 newEntry->key = key;
258 newEntry->record = value;
259 newEntry->next = table->bins[hash_val];
260 table->bins[hash_val] = newEntry;
261 table->num_entries++;
262 return 1;
263}
#define do_hash(key, table)
Definition stmm.c:26
#define STMM_OUT_OF_MEM
Definition stmm.h:127
char * key
Definition stmm.h:48
char * record
Definition stmm.h:49
stmm_table_entry * next
Definition stmm.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_clean()

void stmm_clean ( stmm_table * table)

Definition at line 105 of file stmm.c.

106{
107 int i;
108 // clean the bins
109 for (i = 0; i < table->num_bins; i++)
110 table->bins[i] = NULL;
111 // reset the parameters
112 table->num_entries = 0;
113 // restart the memory manager
114 Extra_MmFixedRestart ((Extra_MmFixed_t *)table->pMemMan);
115}
void Extra_MmFixedRestart(Extra_MmFixed_t *p)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_copy()

stmm_table * stmm_copy ( stmm_table * old_table)

Definition at line 374 of file stmm.c.

375{
376 stmm_table *newEntry_table;
377 stmm_table_entry *ptr, /* *newEntryptr, *next, */ *newEntry;
378 int i, /*j, */ num_bins = old_table->num_bins;
379
380 newEntry_table = ABC_ALLOC(stmm_table, 1);
381 if (newEntry_table == NULL) {
382 return NULL;
383 }
384
385 *newEntry_table = *old_table;
386 newEntry_table->bins = ABC_ALLOC(stmm_table_entry *, num_bins);
387 if (newEntry_table->bins == NULL) {
388 ABC_FREE(newEntry_table);
389 return NULL;
390 }
391
392 // allocate the memory manager for the newEntry table
393 newEntry_table->pMemMan = Extra_MmFixedStart (sizeof (stmm_table_entry));
394
395 for (i = 0; i < num_bins; i++) {
396 newEntry_table->bins[i] = NULL;
397 ptr = old_table->bins[i];
398 while (ptr != NULL) {
399// newEntry = ABC_ALLOC( stmm_table_entry, 1 );
400 newEntry = (stmm_table_entry *)Extra_MmFixedEntryFetch ((Extra_MmFixed_t *)newEntry_table->pMemMan);
401 if (newEntry == NULL) {
402/*
403 for ( j = 0; j <= i; j++ )
404 {
405 newEntryptr = newEntry_table->bins[j];
406 while ( newEntryptr != NULL )
407 {
408 next = newEntryptr->next;
409 ABC_FREE( newEntryptr );
410 newEntryptr = next;
411 }
412 }
413*/
414 Extra_MmFixedStop ((Extra_MmFixed_t *)newEntry_table->pMemMan);
415
416 ABC_FREE(newEntry_table->bins);
417 ABC_FREE(newEntry_table);
418 return NULL;
419 }
420 *newEntry = *ptr;
421 newEntry->next = newEntry_table->bins[i];
422 newEntry_table->bins[i] = newEntry;
423 ptr = ptr->next;
424 }
425 }
426 return newEntry_table;
427}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
stmm_table_entry ** bins
Definition stmm.h:62
void * pMemMan
Definition stmm.h:65
int num_bins
Definition stmm.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_delete()

int stmm_delete ( stmm_table * table,
char ** keyp,
char ** value )

Definition at line 430 of file stmm.c.

431{
432 int hash_val;
433 char *key = *keyp;
434 stmm_table_entry *ptr, **last;
435
436 hash_val = do_hash (key, table);
437
438 FIND_ENTRY (table, hash_val, key, ptr, last);
439
440 if (ptr == NULL) {
441 return 0;
442 }
443
444 *last = ptr->next;
445 if (value != NULL)
446 *value = ptr->record;
447 *keyp = ptr->key;
448// ABC_FREE( ptr );
449 Extra_MmFixedEntryRecycle ((Extra_MmFixed_t *)table->pMemMan, (char *) ptr);
450
451 table->num_entries--;
452 return 1;
453}
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
#define FIND_ENTRY(table, hash_val, key, ptr, last)
Definition stmm.c:121
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_delete_int()

int stmm_delete_int ( stmm_table * table,
long * keyp,
char ** value )

Definition at line 456 of file stmm.c.

457{
458 int hash_val;
459 char *key = (char *) *keyp;
460 stmm_table_entry *ptr, **last;
461
462 hash_val = do_hash (key, table);
463
464 FIND_ENTRY (table, hash_val, key, ptr, last);
465
466 if (ptr == NULL) {
467 return 0;
468 }
469
470 *last = ptr->next;
471 if (value != NULL)
472 *value = ptr->record;
473 *keyp = (long) ptr->key;
474// ABC_FREE( ptr );
475 Extra_MmFixedEntryRecycle ((Extra_MmFixed_t *)table->pMemMan, (char *) ptr);
476
477 table->num_entries--;
478 return 1;
479}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_find()

int stmm_find ( stmm_table * table,
char * key,
char *** slot )

Definition at line 306 of file stmm.c.

307{
308 int hash_val;
309 stmm_table_entry *ptr, **last;
310
311 hash_val = do_hash (key, table);
312
313 FIND_ENTRY (table, hash_val, key, ptr, last);
314
315 if (ptr == NULL) {
316 return 0;
317 }
318 else {
319 if (slot != NULL)
320 {
321 *slot = &ptr->record;
322 }
323 return 1;
324 }
325}
Here is the caller graph for this function:

◆ stmm_find_or_add()

int stmm_find_or_add ( stmm_table * table,
char * key,
char *** slot )

Definition at line 266 of file stmm.c.

267{
268 int hash_val;
269 stmm_table_entry *newEntry, *ptr, **last;
270
271 hash_val = do_hash (key, table);
272
273 FIND_ENTRY (table, hash_val, key, ptr, last);
274
275 if (ptr == NULL) {
276 if (table->num_entries / table->num_bins >= table->max_density) {
277 if (rehash (table) == STMM_OUT_OF_MEM) {
278 return STMM_OUT_OF_MEM;
279 }
280 hash_val = do_hash (key, table);
281 }
282
283 // newEntry = ABC_ALLOC( stmm_table_entry, 1 );
284 newEntry = (stmm_table_entry *) Extra_MmFixedEntryFetch ((Extra_MmFixed_t *)table->pMemMan);
285 if (newEntry == NULL) {
286 return STMM_OUT_OF_MEM;
287 }
288
289 newEntry->key = key;
290 newEntry->record = (char *) 0;
291 newEntry->next = table->bins[hash_val];
292 table->bins[hash_val] = newEntry;
293 table->num_entries++;
294 if (slot != NULL)
295 *slot = &newEntry->record;
296 return 0;
297 }
298 else {
299 if (slot != NULL)
300 *slot = &ptr->record;
301 return 1;
302 }
303}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_foreach()

int stmm_foreach ( stmm_table * table,
enum stmm_retval(* func )(char *, char *, char *),
char * arg )

Definition at line 482 of file stmm.c.

483{
484 stmm_table_entry *ptr, **last;
485 enum stmm_retval retval;
486 int i;
487
488 for (i = 0; i < table->num_bins; i++) {
489 last = &table->bins[i];
490 ptr = *last;
491 while (ptr != NULL) {
492 retval = (*func) (ptr->key, ptr->record, arg);
493 switch (retval) {
494 case STMM_CONTINUE:
495 last = &ptr->next;
496 ptr = *last;
497 break;
498 case STMM_STOP:
499 return 0;
500 case STMM_DELETE:
501 *last = ptr->next;
502 table->num_entries--; /* cstevens@ic */
503// ABC_FREE( ptr );
504 Extra_MmFixedEntryRecycle ((Extra_MmFixed_t *)table->pMemMan, (char *) ptr);
505
506 ptr = *last;
507 }
508 }
509 }
510 return 1;
511}
stmm_retval
Definition stmm.h:79
@ STMM_CONTINUE
Definition stmm.h:79
@ STMM_DELETE
Definition stmm.h:79
@ STMM_STOP
Definition stmm.h:79
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_free_gen()

void stmm_free_gen ( stmm_generator * gen)

Definition at line 622 of file stmm.c.

623{
624 ABC_FREE(gen);
625}
Here is the caller graph for this function:

◆ stmm_free_table()

void stmm_free_table ( stmm_table * table)

Definition at line 79 of file stmm.c.

80{
81/*
82 stmm_table_entry *ptr, *next;
83 int i;
84 for ( i = 0; i < table->num_bins; i++ )
85 {
86 ptr = table->bins[i];
87 while ( ptr != NULL )
88 {
89 next = ptr->next;
90 ABC_FREE( ptr );
91 ptr = next;
92 }
93 }
94*/
95 // no need to deallocate entries because they are in the memory manager now
96 // added by alanmi
97 if ( table->pMemMan )
98 Extra_MmFixedStop ((Extra_MmFixed_t *)table->pMemMan);
99 ABC_FREE(table->bins);
100 ABC_FREE(table);
101}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_gen()

int stmm_gen ( stmm_generator * gen,
char ** key_p,
char ** value_p )

Definition at line 567 of file stmm.c.

568{
569 int i;
570
571 if (gen->entry == NULL) {
572 /* try to find next entry */
573 for (i = gen->index; i < gen->table->num_bins; i++) {
574 if (gen->table->bins[i] != NULL) {
575 gen->index = i + 1;
576 gen->entry = gen->table->bins[i];
577 break;
578 }
579 }
580 if (gen->entry == NULL) {
581 return 0; /* that's all folks ! */
582 }
583 }
584 *key_p = gen->entry->key;
585 if (value_p != 0) {
586 *value_p = gen->entry->record;
587 }
588 gen->entry = gen->entry->next;
589 return 1;
590}
int index
Definition stmm.h:72
stmm_table_entry * entry
Definition stmm.h:71
stmm_table * table
Definition stmm.h:70
Here is the caller graph for this function:

◆ stmm_gen_int()

int stmm_gen_int ( stmm_generator * gen,
char ** key_p,
long * value_p )

Definition at line 594 of file stmm.c.

595{
596 int i;
597
598 if (gen->entry == NULL) {
599 /* try to find next entry */
600 for (i = gen->index; i < gen->table->num_bins; i++) {
601 if (gen->table->bins[i] != NULL) {
602 gen->index = i + 1;
603 gen->entry = gen->table->bins[i];
604 break;
605 }
606 }
607 if (gen->entry == NULL) {
608 return 0; /* that's all folks ! */
609 }
610 }
611 *key_p = gen->entry->key;
612 if (value_p != 0)
613 {
614 *value_p = (long) gen->entry->record;
615 }
616 gen->entry = gen->entry->next;
617 return 1;
618}
Here is the caller graph for this function:

◆ stmm_init_gen()

stmm_generator * stmm_init_gen ( stmm_table * table)

Definition at line 551 of file stmm.c.

552{
553 stmm_generator *gen;
554
555 gen = ABC_ALLOC(stmm_generator, 1);
556 if (gen == NULL) {
557 return NULL;
558 }
559 gen->table = table;
560 gen->entry = NULL;
561 gen->index = 0;
562 return gen;
563}
Here is the caller graph for this function:

◆ stmm_init_table()

stmm_table * stmm_init_table ( stmm_compare_func_type compare,
stmm_hash_func_type hash )

Definition at line 69 of file stmm.c.

70{
71 return stmm_init_table_with_params (compare, hash,
76}
stmm_table * stmm_init_table_with_params(stmm_compare_func_type compare, stmm_hash_func_type hash, int size, int density, double grow_factor, int reorder_flag)
Definition stmm.c:35
#define STMM_DEFAULT_INIT_TABLE_SIZE
Definition stmm.h:112
#define STMM_DEFAULT_REORDER_FLAG
Definition stmm.h:114
#define STMM_DEFAULT_MAX_DENSITY
Definition stmm.h:111
#define STMM_DEFAULT_GROW_FACTOR
Definition stmm.h:113
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_init_table_with_params()

stmm_table * stmm_init_table_with_params ( stmm_compare_func_type compare,
stmm_hash_func_type hash,
int size,
int density,
double grow_factor,
int reorder_flag )

Definition at line 35 of file stmm.c.

36{
37 int i;
38 stmm_table *newTable;
39
40 newTable = ABC_ALLOC(stmm_table, 1);
41 if (newTable == NULL) {
42 return NULL;
43 }
44 newTable->compare = compare;
45 newTable->hash = hash;
46 newTable->num_entries = 0;
47 newTable->max_density = density;
48 newTable->grow_factor = grow_factor;
49 newTable->reorder_flag = reorder_flag;
50 if (size <= 0) {
51 size = 1;
52 }
53 newTable->num_bins = size;
54 newTable->bins = ABC_ALLOC(stmm_table_entry *, size);
55 if (newTable->bins == NULL) {
56 ABC_FREE(newTable);
57 return NULL;
58 }
59 for (i = 0; i < size; i++) {
60 newTable->bins[i] = 0;
61 }
62
63 // added by alanmi
64 newTable->pMemMan = Extra_MmFixedStart(sizeof (stmm_table_entry));
65 return newTable;
66}
unsigned long long size
Definition giaNewBdd.h:39
stmm_compare_func_type compare
Definition stmm.h:55
int num_entries
Definition stmm.h:58
int reorder_flag
Definition stmm.h:60
double grow_factor
Definition stmm.h:61
int max_density
Definition stmm.h:59
stmm_hash_func_type hash
Definition stmm.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_insert()

int stmm_insert ( stmm_table * table,
char * key,
char * value )

Definition at line 200 of file stmm.c.

201{
202 int hash_val;
203 stmm_table_entry *newEntry;
204 stmm_table_entry *ptr, **last;
205
206 hash_val = do_hash (key, table);
207
208 FIND_ENTRY (table, hash_val, key, ptr, last);
209
210 if (ptr == NULL) {
211 if (table->num_entries / table->num_bins >= table->max_density) {
212 if (rehash (table) == STMM_OUT_OF_MEM) {
213 return STMM_OUT_OF_MEM;
214 }
215 hash_val = do_hash (key, table);
216 }
217
218// newEntry = ABC_ALLOC( stmm_table_entry, 1 );
219 newEntry = (stmm_table_entry *) Extra_MmFixedEntryFetch ((Extra_MmFixed_t *)table->pMemMan);
220 if (newEntry == NULL) {
221 return STMM_OUT_OF_MEM;
222 }
223
224 newEntry->key = key;
225 newEntry->record = value;
226 newEntry->next = table->bins[hash_val];
227 table->bins[hash_val] = newEntry;
228 table->num_entries++;
229 return 0;
230 }
231 else {
232 ptr->record = value;
233 return 1;
234 }
235}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stmm_lookup()

int stmm_lookup ( stmm_table * table,
char * key,
char ** value )

Definition at line 134 of file stmm.c.

135{
136 int hash_val;
137 stmm_table_entry *ptr, **last;
138
139 hash_val = do_hash (key, table);
140
141 FIND_ENTRY (table, hash_val, key, ptr, last);
142
143 if (ptr == NULL) {
144 return 0;
145 }
146 else {
147 if (value != NULL)
148 {
149 *value = ptr->record;
150 }
151 return 1;
152 }
153}
Here is the caller graph for this function:

◆ stmm_lookup_int()

int stmm_lookup_int ( stmm_table * table,
char * key,
int * value )

Definition at line 156 of file stmm.c.

157{
158 int hash_val;
159 stmm_table_entry *ptr, **last;
160
161 hash_val = do_hash (key, table);
162
163 FIND_ENTRY (table, hash_val, key, ptr, last);
164
165 if (ptr == NULL) {
166 return 0;
167 }
168 else {
169 if (value != 0)
170 {
171 *value = (long) ptr->record;
172 }
173 return 1;
174 }
175}
Here is the caller graph for this function:

◆ stmm_numcmp()

int stmm_numcmp ( const char * x,
const char * y )

Definition at line 539 of file stmm.c.

540{
541 return STMM_NUMCMP (x, y);
542}
Here is the caller graph for this function:

◆ stmm_numhash()

int stmm_numhash ( const char * x,
int size )

Definition at line 527 of file stmm.c.

528{
529 return STMM_NUMHASH (x, size);
530}
Here is the caller graph for this function:

◆ stmm_ptrcmp()

int stmm_ptrcmp ( const char * x,
const char * y )

Definition at line 545 of file stmm.c.

546{
547 return STMM_NUMCMP (x, y);
548}
Here is the caller graph for this function:

◆ stmm_ptrhash()

int stmm_ptrhash ( const char * x,
int size )

Definition at line 533 of file stmm.c.

534{
535 return STMM_PTRHASH (x, size);
536}
Here is the caller graph for this function:

◆ stmm_strhash()

int stmm_strhash ( const char * string,
int modulus )

Definition at line 514 of file stmm.c.

515{
516 int val = 0;
517 int c;
518
519 while ((c = *string++) != '\0') {
520 val = val * 997 + c;
521 }
522
523 return ((val < 0) ? -val : val) % modulus;
524}
Here is the caller graph for this function: