summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-17 22:00:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-17 22:00:26 -0700
commit8656383c44f2080e59c526ff3b7fb7ac4c2301a9 (patch)
tree848bed3247eac226bf57fa0a34e8744fa7a7810b /lib.c
parent969dff328ab43e3a96248fc9cce41584819b9114 (diff)
downloadtxr-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.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index c032bde1..46033a21 100644
--- a/lib.c
+++ b/lib.c
@@ -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) {