diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-17 22:00:26 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-17 22:00:26 -0700 |
commit | 8656383c44f2080e59c526ff3b7fb7ac4c2301a9 (patch) | |
tree | 848bed3247eac226bf57fa0a34e8744fa7a7810b | |
parent | 969dff328ab43e3a96248fc9cce41584819b9114 (diff) | |
download | txr-8656383c44f2080e59c526ff3b7fb7ac4c2301a9.tar.gz txr-8656383c44f2080e59c526ff3b7fb7ac4c2301a9.tar.bz2 txr-8656383c44f2080e59c526ff3b7fb7ac4c2301a9.zip |
Provide functions to alter range objects.
Ranges continue to be immutable; but a
backdoor is needed for upcoming support for
circular notation.
* lib.c (set_from, set_to): New functions.
* lib.h (set_from, set_to): Declared.
-rw-r--r-- | lib.c | 14 | ||||
-rw-r--r-- | lib.h | 2 |
2 files changed, 16 insertions, 0 deletions
@@ -8712,6 +8712,20 @@ val to(val range) return range->rn.to; } +val set_from(val range, val from) +{ + type_check(range, RNG); + set(mkloc(range->rn.from, range), from); + return range; +} + +val set_to(val range, val to) +{ + type_check(range, RNG); + set(mkloc(range->rn.to, range), to); + return range; +} + val env(void) { if (env_list) { @@ -971,6 +971,8 @@ val rcons(val from, val to); val rangep(val obj); val from(val range); val to(val range); +val set_from(val range, val from); +val set_to(val range, val to); val env(void); void out_str_char(wchar_t ch, val out, int *semi_flag); val obj_print_impl(val obj, val out, val pretty); |