summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-01-18 10:25:33 -0800
committerKaz Kyheku <kaz@kylheku.com>2020-01-18 10:25:33 -0800
commit72eff372aefb86ca8ae5ad2e95f01d4cc9e0ec78 (patch)
tree0f94bdf96c28c0f9daafd168348230bc81e6cc56 /lib.c
parent7a6a9a21090a36ae094b3a4746a6dd371bd653cb (diff)
downloadtxr-72eff372aefb86ca8ae5ad2e95f01d4cc9e0ec78.tar.gz
txr-72eff372aefb86ca8ae5ad2e95f01d4cc9e0ec78.tar.bz2
txr-72eff372aefb86ca8ae5ad2e95f01d4cc9e0ec78.zip
New function: coded-length.
* eval.c (eval_init): Register coded-length intrinsic. * lib.c (coded_length): New function. * lib.h (coded_length): Declared.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index f4cd1306..d5e8fec4 100644
--- a/lib.c
+++ b/lib.c
@@ -3648,6 +3648,11 @@ val length_str(val str)
}
}
+val coded_length(val str)
+{
+ return unum(utf8_to_buf(0, c_str(str), 0));
+}
+
const wchar_t *c_str(val obj)
{
switch (type(obj)) {