summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-09-26 20:22:06 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-09-26 20:22:06 -0700
commit070d3dfe7759943406cd76e7aebe72bf92ab3503 (patch)
tree254d02889a993cb4caeb568422291e7cf2726cca /lib.h
parentf3fe0151fc4116f0fec40e7454d8866f11908560 (diff)
downloadtxr-070d3dfe7759943406cd76e7aebe72bf92ab3503.tar.gz
txr-070d3dfe7759943406cd76e7aebe72bf92ab3503.tar.bz2
txr-070d3dfe7759943406cd76e7aebe72bf92ab3503.zip
New feature: @(deffilter)
Bugfix in @(throw) when non-symbol is thrown: exception message referred to the symbol throw rather than the erroneous object. * filter.c (build_filter_from_list, register_filter): New functions. * filter.h (register_filter): New function declared. * lib.c (deffilter_s): New variable defined. (chain): Function changed from single list argument to variable argument list to reduce the complexity of use. (do_and, and): New functions. (obj_init): deffilter_s initializatio added. * lib.h (deffilter_s, and): New declarations. (chain): Declaration updated to new function signature. (eq): Changed from macro to inline function. * match.c (do_output_line): Simplified expression involving chain. (do_output): Likewise. (match_files): Bugfix in error handling of throw. Implementation of deffilter. * txr.1: Documented deffilter.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib.h b/lib.h
index db597da5..4ad81d7b 100644
--- a/lib.h
+++ b/lib.h
@@ -222,7 +222,7 @@ extern val all_s, some_s, none_s, maybe_s, cases_s, collect_s, until_s, coll_s;
extern val define_s, output_s, single_s, first_s, last_s, empty_s;
extern val repeat_s, rep_s, flatten_s, forget_s;
extern val local_s, merge_s, bind_s, cat_s;
-extern val try_s, catch_s, finally_s, throw_s, defex_s;
+extern val try_s, catch_s, finally_s, throw_s, defex_s, deffilter_s;
extern val error_s, type_error_s, internal_error_s;
extern val numeric_error_s, range_error_s;
extern val query_error_s, file_error_s, process_error_s;
@@ -350,7 +350,8 @@ val funcall2(val fun, val arg1, val arg2);
val reduce_left(val fun, val list, val init, val key);
val bind2(val fun2, val arg);
val bind2other(val fun2, val arg2);
-val chain(val fun1_list);
+val chain(val first_fun, ...);
+val and(val first_fun, ...);
val vector(val alloc);
val vec_get_fill(val vec);
val vec_set_fill(val vec, val fill);
@@ -392,9 +393,9 @@ val match(val spec, val data);
#define nil ((obj_t *) 0)
-#define nao ((obj_t *) (1 << TAG_SHIFT)) /* "not an object" sentinel value. */
+INLINE val eq(val a, val b) { return ((a) == (b) ? t : nil); }
-#define eq(a, b) ((a) == (b) ? t : nil)
+#define nao ((obj_t *) (1 << TAG_SHIFT)) /* "not an object" sentinel value. */
#define if2(a, b) ((a) ? (b) : nil)