Skip to content

Commit

Permalink
Add pathname type.
Browse files Browse the repository at this point in the history
  • Loading branch information
stassats committed Feb 10, 2012
1 parent 9065dad commit 287edce
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion disk.lisp
Expand Up @@ -24,7 +24,8 @@
character
simple-vector
array
hash-table)))
hash-table
pathname)))

(defvar *statistics* ())
(defun collect-stats (code)
Expand Down Expand Up @@ -443,6 +444,32 @@
(code-char (read-n-bytes +char-length+ stream))))
string))

;;; Pathname

(defmethod object-size ((pathname pathname))
(+ 1
(object-size (pathname-name pathname))
(object-size (pathname-directory pathname))
(object-size (pathname-device pathname))
(object-size (pathname-type pathname))
(object-size (pathname-version pathname))))

(defmethod write-object ((pathname pathname) stream)
(write-n-bytes #.(type-code 'pathname) 1 stream)
(write-object (pathname-name pathname) stream)
(write-object (pathname-directory pathname) stream)
(write-object (pathname-device pathname) stream)
(write-object (pathname-type pathname) stream)
(write-object (pathname-version pathname) stream))

(defreader pathname (stream)
(make-pathname
:name (read-next-object stream)
:directory (read-next-object stream)
:device (read-next-object stream)
:type (read-next-object stream)
:version (read-next-object stream)))

;;; Cons

(defmethod object-size ((list cons))
Expand Down

0 comments on commit 287edce

Please sign in to comment.