summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-05-25 19:44:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-05-25 19:44:02 -0700
commit69fd1c3054df29be26299b4b23bac29e2c2bceb5 (patch)
treee3551fa2ce25ecb4e3c72f7d081731e5c181093d /lib.h
parent989f2de823ed6f8edd14540665e9ff1041ae79cc (diff)
downloadtxr-69fd1c3054df29be26299b4b23bac29e2c2bceb5.tar.gz
txr-69fd1c3054df29be26299b4b23bac29e2c2bceb5.tar.bz2
txr-69fd1c3054df29be26299b4b23bac29e2c2bceb5.zip
search, rsearch: rewrite using seq_info and bugfix.
* lib.c (seq_getpos, seq_setpos): New functions. * lib.h (seq_getpos, seq_setpos): Declared. (search_list, rsearch_list): Static functions removed. (search_common): New static function. (search, contains, rsearch): These functions are now trivial wrappers around search_common. A requirement problem is fixed in rsearch: when the key is empty, the length of sequence is returned rather than zero, because zero is obviously not the right most place where an empty key matches. * txr.1: Documentation updated.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index b3541b20..87a5f266 100644
--- a/lib.h
+++ b/lib.h
@@ -551,6 +551,8 @@ void seq_iter_rewind(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_getpos(val self, seq_iter_t *it);
+void seq_setpos(val self, seq_iter_t *it, val pos);
val seq_begin(val obj);
val seq_next(val iter, val end_val);
val seq_reset(val iter, val obj);