diff options
Diffstat (limited to 'bitmap.lsp')
-rw-r--r-- | bitmap.lsp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bitmap.lsp b/bitmap.lsp index 41d3f64..aaef3a5 100644 --- a/bitmap.lsp +++ b/bitmap.lsp @@ -1,6 +1,8 @@ ;;; Bitmap ;;; This could be extended to a general drawing interface, but for now it's probably better to use Tk's canvas. +(import "compat") + (defconstant +black+ 0) (defconstant +white+ #xFFFFFF) (defconstant +red+ #xFF0000) @@ -81,13 +83,16 @@ (defconstant +whitespace-chars+ '(#\SPACE \#carriage-return #\TAB #\NEWLINE)) -(defun read-header-chars (stream &optional (delimiter-list +whitespace-chars+)) - (do ((c (read-char stream nil :eof) - (read-char stream nil :eof)) - (vals nil (if (or (null c) (char= c #\#)) vals (cons c vals)))) ;;don't collect comment chars - ((or (eql c :eof) (member c delimiter-list)) (map 'string #'identity (nreverse vals))) ;;return strings - (when (char= c #\#) ;;skip comments - (read-line stream)))) +(defun read-header-chars (stream &rest args) + (let ((delimiter-list (if (null args) + +whitespace-chars+ + (car args)))) + (do ((c (read-char stream nil :eof) + (read-char stream nil :eof)) + (vals nil (if (or (null c) (char= c #\#)) vals (cons c vals)))) ;;don't collect comment chars + ((or (eql c :eof) (member c delimiter-list)) (map 'string #'identity (nreverse vals))) ;;return strings + (when (char= c #\#) ;;skip comments + (read-line stream))))) (defun read-ppm-file-header (file) (with-open-file (s file :direction :input) |