summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-03-11 22:11:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-03-11 22:11:29 -0700
commit4098bdfbe0406bfacfc8a1b46bfad38964cfd2df (patch)
tree0e758878ad74a2925125fa48ed59a013203ed7ed /lib.h
parent5e1107b94d8dca026a53cf8d8ab6f53d4a01cdac (diff)
downloadtxr-4098bdfbe0406bfacfc8a1b46bfad38964cfd2df.tar.gz
txr-4098bdfbe0406bfacfc8a1b46bfad38964cfd2df.tar.bz2
txr-4098bdfbe0406bfacfc8a1b46bfad38964cfd2df.zip
New sequence iterator object and functions.
* eval.c (eval_init): Register seq-begin, seq-next and seq-reset. * lib.c (seq_iter_s): New symbol variable. (seq_iter_mark): New static function. (seq_iter_ops): New static structure. (seq_begin, seq_next, seq_reset): New functions. (obj_init): Intern seq-iter symbol, used as class name for iterators. * lib.h (seq_iter_s, seq_begin, seq_next, seq_reset): Declared. * txr.1: Documented.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib.h b/lib.h
index cb1b2ef6..70ba864a 100644
--- a/lib.h
+++ b/lib.h
@@ -499,7 +499,7 @@ extern val query_error_s, file_error_s, process_error_s, syntax_error_s;
extern val timeout_error_s, system_error_s, alloc_error_s;
extern val warning_s, defr_warning_s, restart_s, continue_s;
extern val gensym_counter_s;
-extern val rplaca_s, rplacd_s;
+extern val rplaca_s, rplacd_s, seq_iter_s;
#define gensym_counter (deref(lookup_var_l(nil, gensym_counter_s)))
@@ -532,6 +532,9 @@ 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); }
+val seq_begin(val obj);
+val seq_next(val iter, val end_val);
+val seq_reset(val iter, val obj);
val throw_mismatch(val self, val obj, type_t);
INLINE val type_check(val self, val obj, type_t typecode)
{