summaryrefslogtreecommitdiffstats
path: root/hash.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-11-01 20:26:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-11-01 20:26:32 -0700
commitfcd748480a76b3fef7586483b29fc5281e405e1f (patch)
treee4c6242ea005796849694656429c96e7d45f8552 /hash.h
parentbc4e96982da873a92f218010470ba65b1ef2a6e3 (diff)
downloadtxr-fcd748480a76b3fef7586483b29fc5281e405e1f.tar.gz
txr-fcd748480a76b3fef7586483b29fc5281e405e1f.tar.bz2
txr-fcd748480a76b3fef7586483b29fc5281e405e1f.zip
hash: expose new iterator interface.
* hash.c (struct hash): Declaration removed from here. (hash_iter_init, us_hash_iter_init, hash_iter_next, hash_iter_peek): Functions switched to external linkage. * hash.h (struct hash): Declared here now. (hash_iter_init, us_hash_iter_init, hash_iter_next, hash_iter_peek): Declared.
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/hash.h b/hash.h
index 84045156..20f1040c 100644
--- a/hash.h
+++ b/hash.h
@@ -25,6 +25,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+struct hash_iter {
+ struct hash_iter *next;
+ val hash;
+ cnum chain;
+ val cons;
+};
+
extern val weak_keys_k, weak_vals_k, userdata_k;
extern val equal_based_k, eql_based_k, eq_based_k;
@@ -49,6 +56,10 @@ val get_hash_userdata(val hash);
val set_hash_userdata(val hash, val data);
val hashp(val obj);
val maphash(val func, val hash);
+void hash_iter_init(struct hash_iter *hi, val hash, val self);
+void us_hash_iter_init(struct hash_iter *hi, val hash);
+val hash_iter_next(struct hash_iter *hi);
+val hash_iter_peek(struct hash_iter *hi);
val hash_begin(val hash);
val hash_next(val iter);
val hash_peek(val iter);