X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/abdf50aad1a95f1df8d11c54ff1623077eb84193..a07d8d005f69c0f9f5da2e09c6ee39cb1e1801aa:/posn-stream.lisp diff --git a/posn-stream.lisp b/posn-stream.lisp index b687ad0..ffc06d6 100644 --- a/posn-stream.lisp +++ b/posn-stream.lisp @@ -57,14 +57,10 @@ ;;; Locations. (defclass file-location () - ((pathname :initarg :pathname - :type (or pathname null) + ((pathname :initarg :pathname :type (or pathname null) :accessor file-location-pathname) - (line :initarg :line - :type (or fixnum null) - :accessor file-location-line) - (column :initarg :column - :type (or fixnum null) + (line :initarg :line :type (or fixnum null) :accessor file-location-line) + (column :initarg :column :type (or fixnum null) :accessor file-location-column)) (:documentation "A simple structure containing file location information. @@ -89,11 +85,13 @@ (make-file-location (stream-pathname stream) nil nil))) (defmethod print-object ((object file-location) stream) - (if *print-escape* - (call-next-method) - (with-slots (pathname line column) object - (format stream "~:[~;~:*~A~]~@[:~D~]~@[:~D~]" - pathname line column)))) + (maybe-print-unreadable-object (object stream :type t) + (with-slots (pathname line column) object + (format stream "~:[~;~:*~A~]~@[:~D~]~@[:~D~]" + pathname line column)))) + +(defmethod make-load-form ((object file-location) &optional environment) + (make-load-form-saving-slots object :environment environment)) ;;;-------------------------------------------------------------------------- ;;; Proxy streams. @@ -101,8 +99,7 @@ ;; Base classes for proxy streams. (defclass proxy-stream (fundamental-stream) - ((ustream :initarg :stream - :type stream + ((ustream :initarg :stream :type stream :reader position-aware-stream-underlying-stream)) (:documentation "Base class for proxy streams. @@ -231,18 +228,12 @@ ;; Base class. (defclass position-aware-stream (proxy-stream) - ((file :initarg :file - :initform nil - :type pathname - :accessor position-aware-stream-file) - (line :initarg :line - :initform 1 - :type fixnum - :accessor position-aware-stream-line) - (column :initarg :column - :initform 0 - :type fixnum - :accessor position-aware-stream-column)) + ((file :initarg :file :initform nil + :type pathname :accessor position-aware-stream-file) + (line :initarg :line :initform 1 + :type fixnum :accessor position-aware-stream-line) + (column :initarg :column :initform 0 + :type fixnum :accessor position-aware-stream-column)) (:documentation "Character stream which keeps track of the line and column position.