cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 6bcf67551d19a877fcbb2f859d20fc5c4500ec27
parent 73d26a0f42b90cc78454d78672e79d0877dd2faf
Author: Tomas Hlavaty <tom@logand.com>
Date:   Fri, 20 Oct 2017 19:43:14 +0200

remove unnecessary package prefix

Diffstat:
Mrw.lisp | 44++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/rw.lisp b/rw.lisp @@ -171,7 +171,7 @@ (let ((b (make-circular-list n))) (flet ((next () (prog1 (car b) - (setf (car b) (rw:next reader) + (setf (car b) (next reader) b (cdr b))))) (dotimes (i n) (next)) @@ -185,7 +185,7 @@ found) (lambda () (unless found - (let ((c (rw:next reader))) + (let ((c (next reader))) (when c (block here (setq z (loop @@ -207,7 +207,7 @@ found) (flet ((next () (unless found - (let ((c (rw:next reader))) + (let ((c (next reader))) (when c (block here (setq z (loop @@ -308,25 +308,25 @@ (setf (aref z i) x))))) (defun next-z0 (reader &optional (radix 10)) - (let ((x (rw:till reader - (ecase radix - (2 '(#\0 #\1)) - (8 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7)) - (10 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)) - (16 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 - #\a #\b #\c #\d #\e #\f - #\A #\B #\C #\D #\E #\F))) - t))) + (let ((x (till reader + (ecase radix + (2 '(#\0 #\1)) + (8 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7)) + (10 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)) + (16 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 + #\a #\b #\c #\d #\e #\f + #\A #\B #\C #\D #\E #\F))) + t))) (when x (parse-integer (coerce x 'string) :radix radix)))) (defun next-utf8 (reader) - (let ((i1 (rw:next reader)) i2 i3 i4 o2 o3 o4) + (let ((i1 (next reader)) i2 i3 i4 o2 o3 o4) (macrolet ((wrong () `(error "wrong UTF-8 sequence ~x ~x ~x ~x" i1 i2 i3 i4)) (tail (i o) `(progn - (setq ,i (rw:next reader)) + (setq ,i (next reader)) (unless (and (typep ,i '(unsigned-byte 8)) (= #x80 (logand #b11000000 ,i))) (wrong)) @@ -370,17 +370,17 @@ (lambda () (next-utf8 octet-reader)))) -;;(rw:till (rw:peek-reader (utf8-reader (rw:reader #(#x24))))) -;;(rw:till (rw:peek-reader (utf8-reader (rw:reader #(#xc2 #xa2))))) -;;(rw:till (rw:peek-reader (utf8-reader (rw:reader #(#xe2 #x82 #xac))))) -;;(rw:till (rw:peek-reader (utf8-reader (rw:reader #(#xf0 #x90 #x8d #x88))))) -;;(rw:till (rw:peek-reader (utf8-reader (rw:reader #(#xc0 #x80))))) ;; overlong +;;(till (peek-reader (utf8-reader (reader #(#x24))))) +;;(till (peek-reader (utf8-reader (reader #(#xc2 #xa2))))) +;;(till (peek-reader (utf8-reader (reader #(#xe2 #x82 #xac))))) +;;(till (peek-reader (utf8-reader (reader #(#xf0 #x90 #x8d #x88))))) +;;(till (peek-reader (utf8-reader (reader #(#xc0 #x80))))) ;; overlong (defun bit-reader (octet-reader) (let (octet bit) (lambda () (unless octet - (setq octet (rw:next octet-reader) + (setq octet (next octet-reader) bit 7)) (when octet (prog1 (if (logbitp bit octet) 1 0) @@ -388,7 +388,7 @@ (decf bit) (setq octet nil))))))) -;;(rw:till (rw:peek-reader (bit-reader (rw:reader '(#b10110111 #b01111011))))) +;;(till (peek-reader (bit-reader (reader '(#b10110111 #b01111011))))) ;; TODO next-u64|128 ;; TODO next-s8|16|32|64|128 @@ -550,7 +550,7 @@ (defun wrap-reader (reader fn) (lambda () - (let ((z (rw:next reader))) + (let ((z (next reader))) (when z (funcall fn z)))))