summaryrefslogtreecommitdiff
path: root/libyasm/hamt.h
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2006-04-16 22:46:22 +0000
committerPeter Johnson <peter@tortall.net>2006-04-16 22:46:22 +0000
commitba76728dedf67d37a6ccdb6c66e863c545c43d2a (patch)
treeb4b774b4023c4c51779846502f72f15bdb2dfd65 /libyasm/hamt.h
parent3c5cabcd47d3040bae002876ec63fa5cff085b10 (diff)
downloadyasm-ba76728dedf67d37a6ccdb6c66e863c545c43d2a.tar.gz
* symrec.pxi: Implement iterators.
* symrec.h (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value): Supporting functions. * symrec.c (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value): Implement by passing through to... * hamt.h (HAMT_first, HAMT_next, HAMTEntry_get_data): New. * hamt.c (HAMT_first, HAMT_next, HAMTEntry_get_data): Implement. svn path=/trunk/yasm/; revision=1495
Diffstat (limited to 'libyasm/hamt.h')
-rw-r--r--libyasm/hamt.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libyasm/hamt.h b/libyasm/hamt.h
index 78d380e7..865844ca 100644
--- a/libyasm/hamt.h
+++ b/libyasm/hamt.h
@@ -36,6 +36,8 @@
/** Hash array mapped trie data structure (opaque type). */
typedef struct HAMT HAMT;
+/** Hash array mapped trie entry (opaque type). */
+typedef struct HAMTEntry HAMTEntry;
/** Create new, empty, HAMT. error_func() is called when an internal error is
* encountered--it should NOT return to the calling function.
@@ -91,4 +93,22 @@ int HAMT_traverse(HAMT *hamt, /*@null@*/ void *d,
int (*func) (/*@dependent@*/ /*@null@*/ void *node,
/*@null@*/ void *d));
+/** Get the first entry in a HAMT.
+ * \param hamt Hash array mapped trie
+ * \return First entry in HAMT, or NULL if HAMT is empty.
+ */
+const HAMTEntry *HAMT_first(const HAMT *hamt);
+
+/** Get the next entry in a HAMT.
+ * \param prev Previous entry in HAMT
+ * \return Next entry in HAMT, or NULL if no more entries.
+ */
+/*@null@*/ const HAMTEntry *HAMT_next(const HAMTEntry *prev);
+
+/** Get the corresponding data for a HAMT entry.
+ * \param entry HAMT entry (as returned by HAMT_first() and HAMT_next())
+ * \return Corresponding data item.
+ */
+void *HAMTEntry_get_data(const HAMTEntry *entry);
+
#endif