summaryrefslogtreecommitdiffstats
path: root/byte.scm
diff options
context:
space:
mode:
authorJim Pick <jim@jimpick.com>1998-03-08 23:05:22 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitb21cac3362022718634f7086964208b2eed8e897 (patch)
tree16f4b2e70645c0e8e2202023170b5a94baa967e3 /byte.scm
parent3796d2595035e192ed4bf1c9a6bfdb13c3c9d261 (diff)
parentf24b9140d6f74804d5599ec225717d38ca443813 (diff)
downloadslib-b21cac3362022718634f7086964208b2eed8e897.tar.gz
slib-b21cac3362022718634f7086964208b2eed8e897.zip
Import Debian changes 2c0-3debian/2c0-3
slib (2c0-3) unstable; urgency=low * New maintainer. * slibconfig script to automatically configure guile. * Fix type in description, closes: Bug#18996 slib (2c0-2) unstable; urgency=low * Minor fix for debian/rules targets slib (2c0-1) unstable; urgency=low * New upstream source * New maintainer
Diffstat (limited to 'byte.scm')
-rw-r--r--byte.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/byte.scm b/byte.scm
new file mode 100644
index 0000000..3d091ce
--- /dev/null
+++ b/byte.scm
@@ -0,0 +1,14 @@
+;;; "byte.scm" small integers, not necessarily chars.
+
+(define (byte-ref str ind) (char->integer (string-ref str ind)))
+(define (byte-set! str ind val) (string-set! str ind (integer->char val)))
+(define (make-bytes len . opt)
+ (if (null? opt) (make-string len)
+ (make-string len (integer->char (car opt)))))
+(define (write-byte byt . opt) (apply write-char (integer->char byt) opt))
+(define (read-byte . opt)
+ (let ((c (apply read-char opt)))
+ (if (eof-object? c) c (char->integer c))))
+(define (bytes . args) (list->bytes args))
+(define (bytes->list bts) (map char->integer (string->list bts)))
+(define (list->bytes lst) (list->string (map integer->char lst)))