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 | 557fc8f813618be7c54c39d40ce2d61e910e449b (patch) | |
tree | 848bed3247eac226bf57fa0a34e8744fa7a7810b | |
parent | 2a86036236cbdbf3cf3b9f0604ba27ec7712e1dd (diff) | |
download | txr-557fc8f813618be7c54c39d40ce2d61e910e449b.tar.gz txr-557fc8f813618be7c54c39d40ce2d61e910e449b.tar.bz2 txr-557fc8f813618be7c54c39d40ce2d61e910e449b.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); |