Lines Matching refs:entry
91 static void antlr3VectorDel (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry);
92 static void * antlr3VectorGet (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry);
93 static void * antrl3VectorRemove (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry);
96 static ANTLR3_UINT32 antlr3VectorSet (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry, void * element, void (ANTLR3_CDECL *freeptr)(void *), ANTLR3_BOOLEAN freeExisting);
200 pANTLR3_HASH_ENTRY entry;
216 entry = thisBucket->entries;
220 while (entry != NULL)
222 /* Save next entry - we do not want to access memory in entry after we
225 nextEntry = entry->nextEntry;
231 if (entry->free != NULL)
233 entry->free(entry->data);
238 if (entry->keybase.type == ANTLR3_HASH_TYPE_STR && entry->keybase.key.sKey != NULL)
240 ANTLR3_FREE(entry->keybase.key.sKey);
243 /* Free this entry
245 ANTLR3_FREE(entry);
246 entry = nextEntry; /* Load next pointer to see if we shoud free it */
271 /** Remove a numeric keyed entry from a hash table if it exists,
278 pANTLR3_HASH_ENTRY entry;
293 * of the entry we are deleting (if we find it).
295 entry = bucket->entries; /* Entry to examine */
296 nextPointer = & bucket->entries; /* Where to put the next pointer of the deleted entry */
298 while (entry != NULL)
300 /* See if this is the entry we wish to delete
302 if (entry->keybase.key.iKey == key)
304 /* It was the correct entry, so we set the next pointer
305 * of the previous entry to the next pointer of this
308 (*nextPointer) = entry->nextEntry;
312 return entry;
316 /* We found an entry but it wasn't the one that was wanted, so
319 nextPointer = & (entry->nextEntry); /* Address of the next pointer in the current entry */
320 entry = entry->nextEntry; /* Address of the next element in the bucket (if any) */
335 pANTLR3_HASH_ENTRY entry;
350 * of the entry we are deleting (if we find it).
352 entry = bucket->entries; /* Entry to examine */
353 nextPointer = & bucket->entries; /* Where to put the next pointer of the deleted entry */
355 while (entry != NULL)
357 /* See if this is the entry we wish to delete
359 if (strcmp((const char *)key, (const char *)entry->keybase.key.sKey) == 0)
361 /* It was the correct entry, so we set the next pointer
362 * of the previous entry to the next pointer of this
365 (*nextPointer) = entry->nextEntry;
371 ANTLR3_FREE(entry->keybase.key.sKey);
373 entry->keybase.key.sKey = NULL;
377 return entry;
381 /* We found an entry but it wasn't the one that was wanted, so
384 nextPointer = & (entry->nextEntry); /* Address of the next pointer in the current entry */
385 entry = entry->nextEntry; /* Address of the next element in the bucket (if any) */
398 pANTLR3_HASH_ENTRY entry;
400 entry = antlr3HashRemoveI(table, key);
402 /* Now we can free the elements and the entry in order
404 if (entry != NULL && entry->free != NULL)
406 /* Call programmer supplied function to release this entry data
408 entry->free(entry->data);
409 entry->data = NULL;
411 /* Finally release the space for this entry block.
413 ANTLR3_FREE(entry);
422 pANTLR3_HASH_ENTRY entry;
424 entry = antlr3HashRemove(table, key);
426 /* Now we can free the elements and the entry in order
428 if (entry != NULL && entry->free != NULL)
430 /* Call programmer supplied function to release this entry data
432 entry->free(entry->data);
433 entry->data = NULL;
435 /* Finally release the space for this entry block.
437 ANTLR3_FREE(entry);
448 pANTLR3_HASH_ENTRY entry;
458 /* Now we can inspect the key at each entry in the bucket
461 entry = bucket->entries;
463 while (entry != NULL)
465 if (entry->keybase.key.iKey == key)
467 /* Match was found, return the data pointer for this entry
469 return entry->data;
471 entry = entry->nextEntry;
487 pANTLR3_HASH_ENTRY entry;
498 /* Now we can inspect the key at each entry in the bucket
501 entry = bucket->entries;
503 while (entry != NULL)
505 if (strcmp((const char *)key, (const char *)entry->keybase.key.sKey) == 0)
507 /* Match was found, return the data pointer for this entry
509 return entry->data;
511 entry = entry->nextEntry;
527 pANTLR3_HASH_ENTRY entry;
546 /* The value at new pointer is pointing to an existing entry.
559 /* Point to the next entry pointer of the current entry we
567 * add our new entry, so let's crate the entry and add it in.
569 entry = (pANTLR3_HASH_ENTRY)ANTLR3_MALLOC((size_t)sizeof(ANTLR3_HASH_ENTRY));
571 if (entry == NULL)
576 entry->data = element; /* Install the data element supplied */
577 entry->free = freeptr; /* Function that knows how to release the entry */
578 entry->keybase.type = ANTLR3_HASH_TYPE_INT; /* Indicate the key type stored here for when we free */
579 entry->keybase.key.iKey = key; /* Record the key value */
580 entry->nextEntry = NULL; /* Ensure that the forward pointer ends the chain */
582 *newPointer = entry; /* Install the next entry in this bucket */
598 pANTLR3_HASH_ENTRY entry;
617 /* The value at new pointer is pointing to an existing entry.
630 /* Point to the next entry pointer of the current entry we
638 * add our new entry, so let's crate the entry and add it in.
640 entry = (pANTLR3_HASH_ENTRY)ANTLR3_MALLOC((size_t)sizeof(ANTLR3_HASH_ENTRY));
642 if (entry == NULL)
647 entry->data = element; /* Install the data element supplied */
648 entry->free = freeptr; /* Function that knows how to release the entry */
649 entry->keybase.type = ANTLR3_HASH_TYPE_STR; /* Indicate the key type stored here for free() */
652 entry->keybase.key.sKey = ANTLR3_STRDUP(key); /* Record the key value */
656 entry->keybase.key.sKey = key; /* Record the key value */
658 entry->nextEntry = NULL; /* Ensure that the forward pointer ends the chain */
660 *newPointer = entry; /* Install the next entry in this bucket */
692 en->entry = en->table->buckets->entries; /* First entry to return */
695 * but the antlr3EnumNext() function expects that the en->entry is
700 if (en->entry == NULL)
715 /** \brief Return the next entry in the hashtable being traversed by the supplied
731 /* If the current entry is valid, then use it
740 /* Pointers are already set to the current entry to return, or
743 *key = &(en->entry->keybase);
744 *data = en->entry->data;
754 /** \brief Local function to advance the entry pointer of an enumeration
755 * structure to the next valid entry (if there is one).
760 * - The function always leaves the pointers pointing at a valid entry if there
761 * is one, so if the entry pointer is NULL when this function exits, there were
769 /* See if the current entry pointer is valid first of all
771 if (en->entry != NULL)
773 /* Current entry was a valid point, see if there is another
776 if (en->entry->nextEntry != NULL)
778 /* Next entry in the enumeration is just the next entry
781 en->entry = en->entry->nextEntry;
787 * more buckets then chase them until we find an entry.
799 /* There was an entry in this bucket, so we can use it
800 * for the next entry in the enumeration.
802 en->entry = bucket->entries;
943 pANTLR3_HASH_ENTRY entry;
945 entry = list->table->removeI(list->table, key);
947 if (entry != NULL)
949 return entry->data;
1138 ANTLR3_UINT32 entry;
1140 // We must traverse every entry in the vector and if it has
1142 // the entry pointer
1144 for (entry = 0; entry < vector->count; entry++)
1146 if (vector->elements[entry].freeptr != NULL)
1148 vector->elements[entry].freeptr(vector->elements[entry].element);
1150 vector->elements[entry].freeptr = NULL;
1151 vector->elements[entry].element = NULL;
1154 // Having called any free pointers, we just reset the entry count
1163 ANTLR3_UINT32 entry;
1165 // We must traverse every entry in the vector and if it has
1167 // the entry pointer
1169 for (entry = 0; entry < vector->count; entry++)
1171 if (vector->elements[entry].freeptr != NULL)
1173 vector->elements[entry].freeptr(vector->elements[entry].element);
1175 vector->elements[entry].freeptr = NULL;
1176 vector->elements[entry].element = NULL;
1195 static void antlr3VectorDel (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry)
1199 if (entry >= vector->count)
1206 if (vector->elements[entry].freeptr != NULL)
1208 vector->elements[entry].freeptr(vector->elements[entry].element);
1209 vector->elements[entry].freeptr = NULL;
1212 if (entry == vector->count - 1)
1217 vector->elements[entry].element = NULL;
1221 // Need to shuffle trailing pointers back over the deleted entry
1223 ANTLR3_MEMMOVE(vector->elements + entry, vector->elements + entry + 1, sizeof(ANTLR3_VECTOR_ELEMENT) * (vector->count - entry - 1));
1226 // One less entry in the vector now
1231 static void * antlr3VectorGet (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry)
1235 if (entry < vector->count)
1237 return vector->elements[entry].element;
1247 /// Remove the entry from the vector, but do not free any entry, even if it has
1250 static void * antrl3VectorRemove (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry)
1256 if (entry >= vector->count)
1264 element = vector->elements[entry].element;
1266 if (entry == vector->count - 1)
1271 vector->elements[entry].element = NULL;
1272 vector->elements[entry].freeptr = NULL;
1276 // Need to shuffle trailing pointers back over the deleted entry
1278 ANTLR3_MEMMOVE(vector->elements + entry, vector->elements + entry + 1, sizeof(ANTLR3_VECTOR_ELEMENT) * (vector->count - entry - 1));
1281 // One less entry in the vector now
1341 // Insert the new entry
1352 /// Replace the element at the specified entry point with the supplied
1353 /// entry.
1356 antlr3VectorSet (pANTLR3_VECTOR vector, ANTLR3_UINT32 entry, void * element, void (ANTLR3_CDECL *freeptr)(void *), ANTLR3_BOOLEAN freeExisting)
1361 if (entry >= vector->elementsSize)
1363 antlr3VectorResize(vector, entry); // We will get at least this many
1366 // Valid request, replace the current one, freeing any prior entry if told to
1368 if ( entry < vector->count // If actually replacing an element
1370 && vector->elements[entry].freeptr != NULL // And the existing element has a free pointer
1373 vector->elements[entry].freeptr(vector->elements[entry].element);
1378 vector->elements[entry].freeptr = freeptr;
1379 vector->elements[entry].element = element;
1381 if (entry >= vector->count)
1383 vector->count = entry + 1;
1385 return (ANTLR3_UINT32)(entry); // Indicates the replacement was successful
1389 /// Replace the element at the specified entry point with the supplied
1390 /// entry.
1679 // will start off using their internal entry pointers. We must intialize our pool vector
1680 // to point to its own internal entry table and not the pre-made one.
1837 * means the entry was not in the trie, and we return NULL. A backward pointer
1879 /* This was the key, so return the entry pointer
1901 /** Add an entry into the INT trie.
2075 * bit index we are to insert the new entry at. There are two cases, being where the two keys
2111 * to allocate our entry and insert it etc.
2121 /* Build a new entry block for the new node
2224 /* Do we need to call a custom free pointer for this string entry?
2231 /* Now free the data for this bucket entry
2237 /* The bucket entry is now gone, so we can free the memory for
2238 * the entry itself.
2279 topo->sortVector(topo, myVector); // Sort the vector in place (node numbers are the vector entry numbers)
2553 topo->limit = 0; // Next entry in the sorted table
2606 // the vector entry that was originally at position [0], [1], [2] etc
2638 // just use an indirection table to get the vector entry for a particular sequence
2644 // Start index, each vector entry is located where you think it is
2654 // original element entry n is now located via vIndex[n].
2660 // If the vector entry at i is already the one that it
2668 // The vector entry at i, should be replaced with the
2669 // vector entry indicated by topo->sorted[i]. The vector entry