summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
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 0062ac94..64cf66eb 100644
--- a/lib.c
+++ b/lib.c
@@ -1488,6 +1488,20 @@ val chr_tolower(val ch)
return chr(towlower(c_chr(ch)));
}
+val num_chr(val ch)
+{
+ return num_fast(c_chr(ch));
+}
+
+val chr_num(val num)
+{
+ cnum n = c_num(num);
+ if (n < 0 || n > 0x10FFFF)
+ uw_throwf(numeric_error_s,
+ lit("chr-num: ~s is out of character range"), num, nao);
+ return chr(n);
+}
+
val chr_str(val str, val index)
{
bug_unless (length_str_gt(str, index));