diff options
Diffstat (limited to 'byte.txi')
-rw-r--r-- | byte.txi | 44 |
1 files changed, 30 insertions, 14 deletions
@@ -48,17 +48,17 @@ nonnegative arguments. @end defun -@defun bytes->list bytes +@defun list->bytes bytes -@code{bytes->list} returns a newly allocated list of the bytes that make up the -given byte-array. +@code{list->bytes} returns a newly allocated byte-array formed from the small +nonnegative integers in the list @var{bytes}. @end defun -@defun list->bytes bytes +@defun bytes->list bytes -@code{list->bytes} returns a newly allocated byte-array formed from the small -nonnegative integers in the list @var{bytes}. +@code{bytes->list} returns a newly allocated list of the bytes that make up the +given byte-array. @end defun @noindent @@ -67,6 +67,22 @@ nonnegative integers in the list @var{bytes}. @findex equal? +@defun bytes->string bytes + +Returns a new string formed from applying @code{integer->char} to +each byte in @code{bytes->string}. Note that this may signal an error for bytes +having values between 128 and 255. +@end defun + + +@defun string->bytes string + +Returns a new byte-array formed from applying @code{char->integer} +to each character in @code{string->bytes}. Note that this may signal an error if an +integer is larger than 255. +@end defun + + @defun bytes-copy bytes Returns a newly allocated copy of the given @var{bytes}. @@ -153,7 +169,7 @@ multi-byte sequences produced and used by number conversion routines @code{(abs @var{n})} bytes read from @var{port}. If @var{n} is positive, then the first byte read is stored at index 0; otherwise the last byte read is stored at index 0. Note that the length of the returned -string will be less than @code{(abs @var{n})} if @var{port} reaches +byte-array will be less than @code{(abs @var{n})} if @var{port} reaches end-of-file. @var{port} may be omitted, in which case it defaults to the value returned @@ -181,12 +197,12 @@ relative size of @var{start} and @var{end} determines the order of writing. -@deffn {Procedure} subbytes-read! string start end port +@deffn {Procedure} subbytes-read! bts start end port -@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}. +@deffnx {Procedure} subbytes-read! bts start end +Fills @var{bts} with up to @code{(abs (- @var{start} @var{end}))} bytes +read from @var{port}. The first byte read is stored at index @var{bts}. @code{subbytes-read!} returns the number of bytes read. @var{port} may be omitted, in which case it defaults to the value returned @@ -194,12 +210,12 @@ by @code{current-input-port}. @end deffn -@defun subbytes-write string start end port +@defun subbytes-write bts start end port -@defunx subbytes-write string start end +@defunx subbytes-write bts 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} +output-port @var{port}. The first byte written is index @var{start} of @var{bts}. @code{subbytes-write} returns the number of bytes written. @var{port} may be omitted, in which case it defaults to the value returned |