summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-04 14:40:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-04 14:40:08 -0700
commitb5d5dcb8dcde90bb1766eb88a36e962f8e43fd33 (patch)
tree93788d6da3020c898b7261edc7e8b6d0154aeab9 /lib.h
parentea991039e9f7e9254a283e4eca92b6f8a9090425 (diff)
downloadtxr-b5d5dcb8dcde90bb1766eb88a36e962f8e43fd33.tar.gz
txr-b5d5dcb8dcde90bb1766eb88a36e962f8e43fd33.tar.bz2
txr-b5d5dcb8dcde90bb1766eb88a36e962f8e43fd33.zip
Bugfixes to the semantics of binding environments, which
were broken in the face of deletions (local, forget). For some stupid reason, I had written a destructive routine for removing elements from an association list, and used it as the basis for the local and forget directives. * lib.c (eq_f, car_f): New variables. (identity_tramp, equal_tramp): Obsolete functions removed. (apply): Broken function disabled at run time. (funcall, funcall1, funcall2): Throw meaningful error instead of aborting. (alist_remove_test): New static function. (alist_remove, alist_remove1): Rewritten to be functional rather than destructive. (alist_nremove, alist_nremove1): Destructive functions, using previous implementations of alist and alist_nremove. (do_sort): Recurses directly rather than via sort. That was probably why this helper was introduced! (find, set_diff): New functions. (obj_init): gc-protect new variables eq_f and car_f, and initialize them. Initializations for equal_f and identity_f changed to use equal and identity directly, without the obsolete wrappers. * lib.h (eq_f, car_f, alist_nremove, alist_nremove1, find, set_diff): Declared. * match.c (match_line): Use set_diff to determine what bindings are new, rather than ldiff and ldiff-like logic which break when the new bindings do not share structure with the old. (match_files): Likewise.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib.h b/lib.h
index cf397751..6dd743f9 100644
--- a/lib.h
+++ b/lib.h
@@ -237,8 +237,7 @@ extern val nothrow_k, args_k;
extern val null_string;
extern val null_list; /* (nil) */
-extern val identity_f;
-extern val equal_f;
+extern val identity_f, equal_f, eq_f, car_f;
extern const wchar_t *progname;
extern val prog_string;
@@ -381,6 +380,8 @@ val acons_new(val list, val key, val value);
val *acons_new_l(val *list, val key, val *new_p);
val alist_remove(val list, val keys);
val alist_remove1(val list, val key);
+val alist_nremove(val list, val keys);
+val alist_nremove1(val list, val key);
val copy_cons(val cons);
val copy_alist(val list);
val mapcar(val fun, val list);
@@ -388,6 +389,8 @@ val mapcon(val fun, val list);
val mappend(val fun, val list);
val merge(val list1, val list2, val lessfun, val keyfun);
val sort(val list, val lessfun, val keyfun);
+val find(val list, val key, val testfun, val keyfun);
+val set_diff(val list1, val list2, val testfun, val keyfun);
void obj_print(val obj, val stream);
void obj_pprint(val obj, val stream);