summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-10-17 06:45:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-10-17 06:45:43 -0700
commitddbd4325247083477e0f6270f36332cfb03e49e1 (patch)
tree5a8379e0c1e609a0ff9729adbb4c644741dbfb96 /txr.1
parente327bc964cc81e8da899b35cb4ab9f660066e918 (diff)
downloadtxr-ddbd4325247083477e0f6270f36332cfb03e49e1.tar.gz
txr-ddbd4325247083477e0f6270f36332cfb03e49e1.tar.bz2
txr-ddbd4325247083477e0f6270f36332cfb03e49e1.zip
buffers: new functions buf-str and str-buf.
* buf.c (make_owned_buf, buf_str, str_buf): New functions. (buf_init): buf-str and str-buf intrinsics registered. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.138
1 files changed, 38 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 49141465..3b430094 100644
--- a/txr.1
+++ b/txr.1
@@ -24862,6 +24862,44 @@ The return value of all three functions is that of the
.code put-buf
operation which is implicitly performed.
+.coNP Functions @ buf-str and @ str-buf
+.synb
+.mets (buf-str < buf <> [ null-term-p ])
+.mets (str-buf < str <> [ null-term-p ])
+.syne
+.desc
+The
+.code buf-str
+and
+.code str-buf
+functions perform UTF-8 conversion between the buffer and character string
+data types.
+
+The
+.code buf-str
+function takes the contents of buffer
+.meta buf
+to be UTF-8 data, which is converted to a character string and returned.
+Null bytes in the buffer are mapped to the pseudo-null character
+.codn #\exDC00 .
+If a true argument is given to the
+.meta null-term-p
+parameter, then if the contents of
+.meta buf
+end in a null byte, that byte is not included in the conversion.
+
+The
+.code str-buf
+function UTF-8-encodes
+.meta str
+and returns a buffer containing the converted representation.
+If a true argument is given to the
+.meta null-term-p
+parameter, then a null terminating byte is added to the buffer.
+This byte is added even if the previous byte is already a null byte
+from the conversion of a pseudo-null character occurring in
+.metn str .
+
.SS* Structures
\*(TX supports a structure data type. Structures are objects which