From 58dce9acc5ce063e979f572e3cae040599918f8d Mon Sep 17 00:00:00 2001 From: Darren Bane Date: Sun, 16 May 2021 00:22:22 +0100 Subject: Fix non-standard syntax --- bitmap.lsp | 19 ++++++++++++------- 1 file 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) -- cgit 1.4.1-2-gfad0