Update of /project/stamp/cvsroot/stamp In directory clnet:/tmp/cvs-serv27737
Modified Files: files-utilities.lisp Log Message: Cleanups
--- /project/stamp/cvsroot/stamp/files-utilities.lisp 2007/04/06 08:58:48 1.2 +++ /project/stamp/cvsroot/stamp/files-utilities.lisp 2007/12/05 12:14:54 1.3 @@ -4,36 +4,36 @@
(in-package :stamp-core)
-;;; Makes a copy bit to bit of the file "from" -;;; into the file "to". +(declaim (optimize (debug 3))) + +;;; Given two file names, copy the bytes in the +;;; first one to the second one. (defun copy-file (from to) - (with-open-file (in from - :direction :input - :element-type 'unsigned-byte - :if-does-not-exist :error - :if-exists :overwrite) + (with-open-file (in from + :direction :input + :element-type 'unsigned-byte + :if-does-not-exist :error + :if-exists :overwrite) (with-open-file (out to - :direction :output - :element-type 'unsigned-byte - :if-does-not-exist :create - :if-exists :overwrite) - (do ((i (read-byte in nil -1) - (read-byte in nil -1))) - ((minusp i)) - (declare (fixnum i)) - (write-byte i out))))) + :direction :output + :element-type 'unsigned-byte + :if-does-not-exist :create + :if-exists :overwrite) + (loop for byte = (read-byte in nil nil) + until (null byte) + do (write-byte byte out)))))
-;;; Reads the file take off and send back it in the form of list. +;;; Read a file and return a list of the top-level in it. (defun read-file-to-list (file) (with-open-file (stream file - :direction :input - :if-does-not-exist :error) + :direction :input + :if-does-not-exist :error) (loop for l = (read stream nil nil) - until (null l) - collect l))) + until (null l) + collect l)))
;;; Allows to verify if files tags1 and tags2 are identical. -(defun compare-tags-files (file1 file2) +(defun compare-tag-files (file1 file2) (let ((l1 (read-file-to-list file1)) (l2 (read-file-to-list file2))) (equal l1 l2)))