Commit 375a9ec6 authored by Eric Timmons's avatar Eric Timmons
Browse files

Rename ARCHIVE-ENTRY-TYPE -> ENTRY-TYPE

parent b1af77e3
......@@ -35,11 +35,11 @@
(:documentation
"Base class of a tar archive."))
(defgeneric archive-header-type (archive)
(defgeneric header-type (archive)
(:documentation
"Given an archive, return a symbol naming the header class."))
"Given a tar-file, return a symbol naming the header class."))
(defgeneric archive-entry-type (archive header)
(defgeneric entry-type (archive header)
(:documentation
"Return a symbol naming the class to use to represent the entry for HEADER in ARCHIVE."))
......@@ -138,8 +138,8 @@ Further operations on the archive are undefined."
(error "Corrupt archive"))))
(if (null-block-p buffer 0)
nil
(let ((header (read-header-from-buffer (archive-header-type archive) buffer :start 0)))
(make-instance (archive-entry-type archive header)
(let ((header (read-header-from-buffer (header-type archive) buffer :start 0)))
(make-instance (entry-type archive header)
:archive archive
:header header
:start-position start-position)))))
......
......@@ -5,9 +5,9 @@
(in-package #:tar-file)
(defclass entry ()
((archive
:initarg :archive
:reader entry-archive)
((tar-file
:initarg :tar-file
:reader entry-tar-file)
(start-position
:initarg :start-position
:reader start-position
......@@ -25,7 +25,7 @@
(:documentation
"A regular file."))
(defun write-file-entry (archive name &rest args &key uname gname mode mtime uid gid size data)
(defun write-file-entry (tar-file name &rest args &key uname gname mode mtime uid gid size data)
(declare (ignore uname gname mode mtime uid gid))
;; Compute the size when necessary.
(when (null size)
......@@ -40,7 +40,7 @@
(push size args)
(push :size args))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag (if (typep archive 'v7-archive)
+tar-regular-alternate-file+
......@@ -57,7 +57,7 @@
(defun write-hard-link-entry (archive name &rest args &key uname gname mode mtime uid gid linkname)
(declare (ignore uname gname mode mtime uid gid linkname))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag +tar-hard-link+
args))
......@@ -72,7 +72,7 @@
(defun write-symbolic-link-entry (archive name &rest args &key uname gname mode mtime uid gid linkname)
(declare (ignore uname gname mode mtime uid gid linkname))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag +tar-symbolic-link+
args))
......@@ -88,7 +88,7 @@
(defun write-character-device-entry (archive name &rest args &key uname gname mode mtime uid gid
devmajor devminor)
(declare (ignore uname gname mode mtime uid gid devmajor devminor))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag +tar-character-device+
args))
......@@ -104,7 +104,7 @@
(defun write-block-device-entry (archive name &rest args &key uname gname mode mtime uid gid
devmajor devminor)
(declare (ignore uname gname mode mtime uid gid devmajor devminor))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag +tar-block-device+
args))
......@@ -124,7 +124,7 @@
(defun write-fifo-entry (archive name &rest args &key uname gname mode mtime uid gid)
(declare (ignore uname gname mode mtime uid gid))
(let ((header (apply #'make-instance (archive-header-type archive)
(let ((header (apply #'make-instance (header-type archive)
:name name
:typeflag +tar-fifo-device+
args))
......
......@@ -61,8 +61,8 @@
(defmacro do-entries ((entry archive &optional result)
&body body)
"Iterate over the entries in ARCHIVE. For each entry, ENTRY is bound to
an ARCHIVE-ENTRY representing the entry. RESULT is used as in DOTIMES."
"Iterate over the entries in ARCHIVE. For each entry, ENTRY is bound to an
ENTRY representing the entry. RESULT is used as in DOTIMES."
(let ((archive-var (gensym)))
`(let ((,archive-var ,archive))
(do ((,entry (read-entry ,archive-var)
......
......@@ -48,7 +48,7 @@
(defclass gnu-archive (archive) ())
(defmethod archive-header-type ((archive gnu-archive))
(defmethod header-type ((archive gnu-archive))
'gnu-header)
(defun detect-gnu-archive (buffer)
......@@ -60,7 +60,7 @@
(register-type-detector 'detect-gnu-archive)
(defmethod archive-entry-type ((archive gnu-archive) header)
(defmethod entry-type ((archive gnu-archive) header)
(alexandria:switch ((typeflag header))
(+tar-regular-file+
'file-entry)
......
......@@ -37,7 +37,7 @@
(defclass ustar-archive (archive) ())
(defmethod archive-header-type ((archive ustar-archive))
(defmethod header-type ((archive ustar-archive))
'ustar-header)
(defun detect-ustar-archive (buffer)
......@@ -49,7 +49,7 @@
(register-type-detector 'detect-ustar-archive)
(defmethod archive-entry-type ((archive ustar-archive) header)
(defmethod entry-type ((archive ustar-archive) header)
(alexandria:switch ((typeflag header))
(+tar-regular-file+
'file-entry)
......
......@@ -19,10 +19,10 @@
(defclass v7-archive (archive) ())
(defmethod archive-header-type ((archive v7-archive))
(defmethod header-type ((archive v7-archive))
'v7-header)
(defmethod archive-entry-type ((archive v7-archive) header)
(defmethod entry-type ((archive v7-archive) header)
(if (alexandria:ends-with +ascii-/+ (name header))
'directory-entry
(alexandria:switch ((typeflag header))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment