summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-19 22:11:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-19 22:11:50 -0700
commit12d65cff8c48ac1f86b056f542296adbc1fd3651 (patch)
tree5f983a6dfd2af6f483aacb5cb516a018a986f133 /txr.1
parentf4c156db5e4505fc1a18ae7d4a6597b656a20aa2 (diff)
downloadtxr-12d65cff8c48ac1f86b056f542296adbc1fd3651.tar.gz
txr-12d65cff8c48ac1f86b056f542296adbc1fd3651.tar.bz2
txr-12d65cff8c48ac1f86b056f542296adbc1fd3651.zip
ffi: new function, carray-cptr.
* ffi.c (carray_cptr): New function. (ffi_init): Registered intrinsic. * ffi.h (carray_cptr): Declared. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.141
1 files changed, 41 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 9b5956fd..4de55690 100644
--- a/txr.1
+++ b/txr.1
@@ -54968,6 +54968,47 @@ type, the calculated number of elements is rounded down. The trailing portion
of the buffer corresponding to the division remainder, being insufficient
to constitute a whole array element, is excluded from the array view.
+.coNP Function @ carray-cptr
+.synb
+.mets (carray-cptr < cptr < type <> [ length ])
+.syne
+.desc
+The
+.code carray-cptr
+function creates a
+.code carray
+object based on a pointer derived from a
+.code cptr
+object.
+
+The
+.meta cptr
+argument must be of type
+.codn cptr .
+The object's
+.code cptr
+type tag is ignored.
+
+The
+.meta type
+argument must specify a compiled FFI type, which will become
+the element type of the returned
+.codn carray .
+
+If
+.meta length
+is specified as
+.codn nil ,
+or not specified,
+then the returned
+.code carray
+object will be of unknown length. Otherwise,
+.meta length
+must be a non-negative integer which will be taken as the
+length of the array.
+
+Note: this conversion is inherently unsafe.
+
.coNP Function @ length-carray
.synb
.mets (length-carray << carray )