/[stamp]/stamp/files-utilities.lisp
ViewVC logotype

Contents of /stamp/files-utilities.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Wed Dec 5 12:14:54 2007 UTC (6 years, 4 months ago) by rstrandh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +22 -22 lines
Cleanups
1 ;;; files-utilities
2
3 ;;; Management of the various files of the system.
4
5 (in-package :stamp-core)
6
7 (declaim (optimize (debug 3)))
8
9 ;;; Given two file names, copy the bytes in the
10 ;;; first one to the second one.
11 (defun copy-file (from to)
12 (with-open-file (in from
13 :direction :input
14 :element-type 'unsigned-byte
15 :if-does-not-exist :error
16 :if-exists :overwrite)
17 (with-open-file (out to
18 :direction :output
19 :element-type 'unsigned-byte
20 :if-does-not-exist :create
21 :if-exists :overwrite)
22 (loop for byte = (read-byte in nil nil)
23 until (null byte)
24 do (write-byte byte out)))))
25
26 ;;; Read a file and return a list of the top-level in it.
27 (defun read-file-to-list (file)
28 (with-open-file (stream file
29 :direction :input
30 :if-does-not-exist :error)
31 (loop for l = (read stream nil nil)
32 until (null l)
33 collect l)))
34
35 ;;; Allows to verify if files tags1 and tags2 are identical.
36 (defun compare-tag-files (file1 file2)
37 (let ((l1 (read-file-to-list file1))
38 (l2 (read-file-to-list file2)))
39 (equal l1 l2)))
40
41

  ViewVC Help
Powered by ViewVC 1.1.5