It lives!
[sod] / posn-stream.lisp
index b687ad0..ffc06d6 100644 (file)
 ;;; 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.
     (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 "~:[<unnamed>~;~:*~A~]~@[:~D~]~@[:~D~]"
-               pathname line column))))
+  (maybe-print-unreadable-object (object stream :type t)
+    (with-slots (pathname line column) object
+      (format stream "~:[<unnamed>~;~:*~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.
 ;; 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.
 ;; 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.