diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:36 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:36 -0800 |
commit | 5bea21e81ed516440e34e480f2c33ca41aa8c597 (patch) | |
tree | 653ace1b8fe0a9916d861d35ff8f611b46c80d37 /byte.txi | |
parent | 237c6e380aebdcbc70bd1c9ecf7d3f6effca2752 (diff) | |
download | slib-5bea21e81ed516440e34e480f2c33ca41aa8c597.tar.gz slib-5bea21e81ed516440e34e480f2c33ca41aa8c597.zip |
Import Upstream version 3a4upstream/3a4
Diffstat (limited to 'byte.txi')
-rw-r--r-- | byte.txi | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -73,6 +73,19 @@ Returns a newly allocated copy of the given @var{bytes}. @end defun +@defun subbytes bytes start end + +@var{bytes} must be a bytes, and @var{start} and @var{end} +must be exact integers satisfying + +@center 0 <= @var{start} <= @var{end} <= @w{@t{(bytes-length @var{bytes})@r{.}}} + +@code{subbytes} returns a newly allocated bytes formed from the bytes of +@var{bytes} beginning with index @var{start} (inclusive) and ending with index +@var{end} (exclusive). +@end defun + + @deffn {Procedure} bytes-reverse! bytes Reverses the order of byte-array @var{bytes}. @@ -162,31 +175,31 @@ by @code{current-output-port}. @end defun @noindent -@code{substring-read!} and @code{substring-write} provide +@code{subbytes-read!} and @code{subbytes-write} provide lower-level procedures for reading and writing blocks of bytes. The relative size of @var{start} and @var{end} determines the order of writing. -@deffn {Procedure} substring-read! string start end port +@deffn {Procedure} subbytes-read! string start end port -@deffnx {Procedure} substring-read! string start end +@deffnx {Procedure} subbytes-read! string start end Fills @var{string} with up to @code{(abs (- @var{start} @var{end}))} bytes read from @var{port}. The first byte read is stored at index @var{string}. -@code{substring-read!} returns the number of bytes read. +@code{subbytes-read!} returns the number of bytes read. @var{port} may be omitted, in which case it defaults to the value returned by @code{current-input-port}. @end deffn -@defun substring-write string start end port +@defun subbytes-write string start end port -@defunx substring-write string start end -@code{substring-write} writes @code{(abs (- @var{start} @var{end}))} bytes to -output-port @var{port}. The first byte written is index @var{start} of @var{string}. @code{substring-write} +@defunx subbytes-write string start end +@code{subbytes-write} writes @code{(abs (- @var{start} @var{end}))} bytes to +output-port @var{port}. The first byte written is index @var{start} of @var{string}. @code{subbytes-write} returns the number of bytes written. @var{port} may be omitted, in which case it defaults to the value returned |