summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-07-15 10:22:53 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-07-15 10:22:53 -0700
commitd151853a6be4548c8a4d02b839b7dce689217a7d (patch)
tree8fe2b02c2c3ecdc1a4df502b7884f1b22d16a205 /txr.1
parentb15f6304249de5ba503bedc9944cb57aa1771cd8 (diff)
downloadtxr-d151853a6be4548c8a4d02b839b7dce689217a7d.tar.gz
txr-d151853a6be4548c8a4d02b839b7dce689217a7d.tar.bz2
txr-d151853a6be4548c8a4d02b839b7dce689217a7d.zip
carray: add offset to carray-buf.
* ffi.c (struct carray): New member, offs. (make_carray): Initiialize offs member from new argument. (copy_carray, carray_blank, carry_ptr, carray_sub, carray_pun, carray_unum, carray_num): Pass zero offset to (carray_buf): New optional parameter off_in. (carray_buf_sync): Handle offset. (ffi_init): Update registration of carray-buf. * ffi.h (make_carray, carray_buf): Declaration updated. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.132
1 files changed, 28 insertions, 4 deletions
diff --git a/txr.1 b/txr.1
index d55a2839..8fbe698d 100644
--- a/txr.1
+++ b/txr.1
@@ -57707,7 +57707,7 @@ function, and of
.coNP Function @ carray-buf
.synb
-.mets (carray-buf < buf << type )
+.mets (carray-buf < buf < type <> [ offset ])
.syne
.desc
The
@@ -57718,15 +57718,39 @@ object which refers to the storage provided and managed by the buffer object
.metn buf ,
providing a view of that storage, and manipulation thereof, as an array.
+The optional
+.meta offset
+parameter specifies an offset from the start of the buffer to the
+location which is interpreted as the start of the
+.codn carray ,
+which extends from that offset to the end of the buffer.
+
+The default value is zero: the
+.code carray
+covers the entire buffer.
+
+If a value is specified, it must be in the range zero to the length of
+.metn buf .
+
The
.meta type
argument must be a compiled FFI type whose size is nonzero.
-The bytewise length of
+
+The
+.code carray
+is overlaid onto the storage of
+.meta buf
+as follows:
+
+First,
+.meta offs
+is subtracted from the bytewise length of
.metn buf ,
as reported by
.code length-buf
-function ,
-is divided by the size of
+function to produce the effective length of the storage to be used for the array.
+
+The effective length is divided by the size of
.metn type ,
as reported by
.codn ffi-size .