Home | History | Annotate | Download | only in src

Lines Matching refs:table

42 // Interface functions for hash table
47 static void antlr3HashDelete (pANTLR3_HASH_TABLE table, void * key);
48 static void * antlr3HashGet (pANTLR3_HASH_TABLE table, void * key);
49 static pANTLR3_HASH_ENTRY antlr3HashRemove (pANTLR3_HASH_TABLE table, void * key);
50 static ANTLR3_INT32 antlr3HashPut (pANTLR3_HASH_TABLE table, void * key, void * element, void (ANTLR3_CDECL *freeptr)(void *));
54 static void antlr3HashDeleteI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key);
55 static void * antlr3HashGetI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key);
56 static pANTLR3_HASH_ENTRY antlr3HashRemoveI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key);
57 static ANTLR3_INT32 antlr3HashPutI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key, void * element, void (ANTLR3_CDECL *freeptr)(void *));
59 static void antlr3HashFree (pANTLR3_HASH_TABLE table);
60 static ANTLR3_UINT32 antlr3HashSize (pANTLR3_HASH_TABLE table);
131 pANTLR3_HASH_TABLE table;
135 table = ANTLR3_MALLOC(sizeof(ANTLR3_HASH_TABLE));
138 if (table == NULL)
145 table->buckets = (pANTLR3_HASH_BUCKET) ANTLR3_MALLOC((size_t) (sizeof(ANTLR3_HASH_BUCKET) * sizeHint));
147 if (table->buckets == NULL)
149 ANTLR3_FREE((void *)table);
153 // Modulo of the table, (bucket count).
155 table->modulo = sizeHint;
157 table->count = 0; /* Nothing in there yet ( I hope) */
163 table->buckets[bucket].entries = NULL;
168 table->allowDups = ANTLR3_FALSE;
171 * entered in the table.
173 table->doStrdup = ANTLR3_TRUE;
178 table->get = antlr3HashGet;
179 table->put = antlr3HashPut;
180 table->del = antlr3HashDelete;
181 table->remove = antlr3HashRemove;
183 table->getI = antlr3HashGetI;
184 table->putI = antlr3HashPutI;
185 table->delI = antlr3HashDeleteI;
186 table->removeI = antlr3HashRemoveI;
188 table->size = antlr3HashSize;
189 table->free = antlr3HashFree;
191 return table;
195 antlr3HashFree(pANTLR3_HASH_TABLE table)
203 /* Free the table, all buckets and all entries, and all the
204 * keys and data (if the table exists)
206 if (table != NULL)
208 for (bucket = 0; bucket < table->modulo; bucket++)
210 thisBucket = &(table->buckets[bucket]);
229 * added to the table.
256 ANTLR3_FREE(table->buckets);
259 /* Now we free teh memory for the table itself
261 ANTLR3_FREE(table);
264 /** return the current size of the hash table
266 static ANTLR3_UINT32 antlr3HashSize (pANTLR3_HASH_TABLE table)
268 return table->count;
271 /** Remove a numeric keyed entry from a hash table if it exists,
274 static pANTLR3_HASH_ENTRY antlr3HashRemoveI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key)
283 hash = (ANTLR3_UINT32)(key % (ANTLR3_INTKEY)(table->modulo));
287 bucket = table->buckets + hash;
310 table->count--;
327 /** Remove the element in the hash table for a particular
331 antlr3HashRemove(pANTLR3_HASH_TABLE table, void * key)
344 bucket = table->buckets + (hash % table->modulo);
369 if (table->doStrdup == ANTLR3_TRUE)
375 table->count--;
396 antlr3HashDeleteI (pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key)
400 entry = antlr3HashRemoveI(table, key);
420 antlr3HashDelete (pANTLR3_HASH_TABLE table, void * key)
424 entry = antlr3HashRemove(table, key);
440 /** Return the element pointer in the hash table for a particular
444 antlr3HashGetI(pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key)
452 hash = (ANTLR3_UINT32)(key % (ANTLR3_INTKEY)(table->modulo));
456 bucket = table->buckets + hash;
479 /** Return the element pointer in the hash table for a particular
483 antlr3HashGet(pANTLR3_HASH_TABLE table, void * key)
496 bucket = table->buckets + (hash % table->modulo);
519 /** Add the element pointer in to the table, based upon the
523 antlr3HashPutI(pANTLR3_HASH_TABLE table, ANTLR3_INTKEY key, void * element, void (ANTLR3_CDECL *freeptr)(void *))
532 hash = (ANTLR3_UINT32)(key % (ANTLR3_INTKEY)(table->modulo));
536 bucket = table->buckets + hash;
540 * in the table and duplicates were not allowed.
551 if (table->allowDups == ANTLR3_FALSE)
584 table->count++;
590 /** Add the element pointer in to the table, based upon the
594 antlr3HashPut(pANTLR3_HASH_TABLE table, void * key, void * element, void (ANTLR3_CDECL *freeptr)(void *))
607 bucket = table->buckets + (hash % table->modulo);
611 * in the table and duplicates were not allowed.
622 if (table->allowDups == ANTLR3_FALSE)
650 if (table->doStrdup == ANTLR3_TRUE)
662 table->count++;
667 /** \brief Creates an enumeration structure to traverse the hash table.
669 * \param table Table to enumerate
673 antlr3EnumNew (pANTLR3_HASH_TABLE table)
690 en->table = table;
692 en->entry = en->table->buckets->entries; /* First entry to return */
697 * pointer, attempt to find the next one that is, (table may be empty
733 if (en->bucket >= en->table->modulo)
735 /* Already exhausted the table
747 * pointer to the next in the table (if any).
762 * no more entries in the table.
791 while (en->bucket < en->table->modulo)
795 bucket = en->table->buckets + en->bucket;
813 * have its bucket count = table->modulo which signifies that we are done.
817 /** \brief Frees up the memory structures that represent a hash table
876 /* Now we need to add a new table
878 list->table = antlr3HashTableNew(sizeHint);
880 if (list->table == (pANTLR3_HASH_TABLE)ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM))
900 return list->table->size(list->table);
908 list->table->free(list->table);
918 list->table->delI(list->table, key);
924 return list->table->getI(list->table, key);
933 key = list->table->size(list->table) + 1;
945 entry = list->table->removeI(list->table, key);
960 return list->table->putI(list->table, key, element, freeptr);
977 /* Now we need to add a new table
1334 // Do we need to resize the vector table?
1680 // to point to its own internal entry table and not the pre-made one.
1700 * shifting in a while loop. Whereas, the lookup table is just
1708 * The table is probably obvious but it is just the number 0..7
1737 * faster to use the bit index as an index into this table
2553 topo->limit = 0; // Next entry in the sorted table
2638 // just use an indirection table to get the vector entry for a particular sequence
2653 // table we just created. The index telsl us where in the vector the