diff options
author | Thomas Bushnell, BSG <tb@debian.org> | 2006-10-23 23:55:08 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:37 -0800 |
commit | 97fc07b2d8896b869db55827900f24e6528a9bd6 (patch) | |
tree | 262ed5c19ad83dd59aac33d2e04ace4fbd94bd3b /byte.scm | |
parent | 810b08c931e958fdaa6971b2ce8c5e578130d652 (diff) | |
parent | 5bea21e81ed516440e34e480f2c33ca41aa8c597 (diff) | |
download | slib-97fc07b2d8896b869db55827900f24e6528a9bd6.tar.gz slib-97fc07b2d8896b869db55827900f24e6528a9bd6.zip |
Import Debian changes 3a4-1debian/3a4-1
slib (3a4-1) unstable; urgency=low
* New upstream release.
* slib.texi (Library Catalogs): Repeat change from 3a3-3.
* Makefile: Repeat $(htmldir)slib_toc.html changes from 3a2-1.
Diffstat (limited to 'byte.scm')
-rw-r--r-- | byte.scm | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -1,5 +1,5 @@ ;;; "byte.scm" small integers, not necessarily chars. -; Copyright (C) 2001, 2002, 2003 Aubrey Jaffer +; Copyright (C) 2001, 2002, 2003, 2006 Aubrey Jaffer ; ;Permission to copy this software, to modify it, to redistribute it, ;to distribute modified versions, and to use it for any purpose is @@ -77,6 +77,17 @@ ;;Returns a newly allocated copy of the given @1. (define bytes-copy string-copy) +;;@args bytes start end +;;@1 must be a bytes, and @2 and @3 +;;must be exact integers satisfying +;; +;;@center 0 <= @2 <= @3 <= @w{@t{(bytes-length @1)@r{.}}} +;; +;;@0 returns a newly allocated bytes formed from the bytes of +;;@1 beginning with index @2 (inclusive) and ending with index +;;@3 (exclusive). +(define subbytes substring) + ;;@body ;;Reverses the order of byte-array @1. (define (bytes-reverse! bytes) @@ -149,8 +160,8 @@ (let* ((len (abs n)) (byts (make-bytes len)) (cnt (if (positive? n) - (apply substring-read! byts 0 n port) - (apply substring-read! byts (- n) 0 port)))) + (apply subbytes-read! byts 0 n port) + (apply subbytes-read! byts (- n) 0 port)))) (if (= cnt len) byts (if (positive? n) @@ -168,11 +179,11 @@ ;;by @code{current-output-port}. (define (write-bytes bytes n . port) (if (positive? n) - (apply substring-write bytes 0 n port) - (apply substring-write bytes (- n) 0 port))) + (apply subbytes-write bytes 0 n port) + (apply subbytes-write bytes (- n) 0 port))) ;;@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. @@ -185,7 +196,7 @@ ;; ;;@4 may be omitted, in which case it defaults to the value returned ;;by @code{current-input-port}. -(define (substring-read! string start end . port) +(define (subbytes-read! string start end . port) (if (>= end start) (do ((idx start (+ 1 idx))) ((>= idx end) idx) @@ -211,7 +222,7 @@ ;; ;;@4 may be omitted, in which case it defaults to the value returned ;;by @code{current-output-port}. -(define (substring-write string start end . port) +(define (subbytes-write string start end . port) (if (>= end start) (do ((idx start (+ 1 idx))) ((>= idx end) (- end start)) @@ -219,3 +230,7 @@ (do ((idx (+ -1 start) (+ -1 idx))) ((< idx end) (- start end)) (apply write-byte (byte-ref string idx) port)))) + +;;;; Legacy names. +(define substring-read! subbytes-read!) +(define substring-write subbytes-write) |