diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-06-12 06:46:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-06-12 06:46:45 -0700 |
commit | 2fe27a3760606616a9b859a145cb1b358cfa415a (patch) | |
tree | cc9c8f980dd74cd0afe0be091017a5f4cc5580a0 /lib.h | |
parent | c54df81f05e622bd3ce6daa0bc4ba5d3999f958d (diff) | |
download | txr-2fe27a3760606616a9b859a145cb1b358cfa415a.tar.gz txr-2fe27a3760606616a9b859a145cb1b358cfa415a.tar.bz2 txr-2fe27a3760606616a9b859a145cb1b358cfa415a.zip |
seq iterators: new peek operation.
* lib.c (seq_iter_peek_nil, seq_iter_peek_list,
seq_iter_peek_vec, seq_iter_peek_hash): New static functions.
(seq_geti): New function.
(seq_iter_init): Initialize new peek member of seq_iter
structure.
* lib.h (struct seq_iter): New member, peek.
(seq_peek): New inline function.
(seq_geti): Declared.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -379,6 +379,7 @@ typedef struct seq_iter { cnum len; } ul; int (*get)(struct seq_iter *, val *pval); + int (*peek)(struct seq_iter *, val *pval); } seq_iter_t; extern const seq_kind_t seq_kind_tab[MAXTYPE+1]; @@ -533,6 +534,8 @@ seq_info_t seq_info(val cobj); void seq_iter_init(val self, seq_iter_t *it, val obj); void seq_iter_rewind(val self, seq_iter_t *it); INLINE int seq_get(seq_iter_t *it, val *pval) { return it->get(it, pval); } +INLINE int seq_peek(seq_iter_t *it, val *pval) { return it->peek(it, pval); } +val seq_geti(seq_iter_t *it); val seq_begin(val obj); val seq_next(val iter, val end_val); val seq_reset(val iter, val obj); |