r11037: changes for sbcl mop / whitespace canonicalization
[hyperobject.git] / views.lisp
index 8d43e6995ac21af847bb9fa4d7df8d7f9fd38b20..b9274aafb7834e10e19c95505d9dc0cbec94e07c 100644 (file)
@@ -11,7 +11,7 @@
 ;;;;
 ;;;; This file is Copyright (c) 2000-2004 by Kevin M. Rosenberg
 ;;;; *************************************************************************
+
 (in-package #:hyperobject)
 
 
@@ -23,7 +23,7 @@
          :documentation "List of effective slots for object to be viewed.")
    (id :initform nil :initarg :id :accessor id
        :documentation "id for this view.")
-   (source-code :initform nil :initarg :source-code :accessor source-code 
+   (source-code :initform nil :initarg :source-code :accessor source-code
                :documentation "Source code for generating view.")
    (country-language :initform :en :initarg :country-language
                     :documentation "Country's Language for this view.")
               (make-instance (class-name obj-cl))
               (setq cpl (class-precedence-list obj-cl))))
           (find-view-id-in-class-precedence (second cpl) vid)))))
-                                           
-  
+
+
 (defun get-view-id (obj vid &optional slots)
   "Find or make a category view for an object"
   (let ((obj-cl (class-of obj)))
     ((typep view-def 'object-view)
      view-def)
     ((eq view-def :default)
-     (make-instance 'object-view 
+     (make-instance 'object-view
        :object-class (class-name cl)
        :id :compact-text))
     ((consp view-def)
      (error "Invalid parameter to make-object-view: ~S" view-def))))
 
 (defmethod initialize-instance :after ((self object-view)
-                                      &rest initargs 
+                                      &rest initargs
                                       &key
                                       &allow-other-keys)
   (initialize-view self))
-  
+
 (defun initialize-view (view)
   "Calculate all view slots for a hyperobject class"
   (let ((obj-cl (find-class (object-class view))))
   "Initialize a view based upon a source code"
   (let* ((source-code (source-code view))
         (printer `(lambda
-                      (,(intern (symbol-name '#:self) 
+                      (,(intern (symbol-name '#:self)
                                 (symbol-package (object-class view)))
-                       ,(intern (symbol-name '#:s) 
+                       ,(intern (symbol-name '#:s)
                                 (symbol-package (object-class view))))
-                    (declare (ignorable 
-                              ,(intern (symbol-name '#:self) 
+                    (declare (ignorable
+                              ,(intern (symbol-name '#:self)
                                        (symbol-package (object-class view)))
-                              ,(intern (symbol-name '#:s) 
+                              ,(intern (symbol-name '#:s)
                                        (symbol-package (object-class view)))))
-                    (with-slots ,(slots view) 
-                        ,(intern (symbol-name '#:self) 
+                    (with-slots ,(slots view)
+                        ,(intern (symbol-name '#:self)
                                  (symbol-package (object-class view)))
                       ,@source-code))))
-    (setf (printer view) 
+    (setf (printer view)
       (compile nil (eval printer)))))
 
 (defmacro write-simple (v s)
   (vector-push-extend '(write-string "<td>" s) print-func)
   (ppfc-html title name type formatter cdata print-func)
   (vector-push-extend '(write-string "</td>" s) print-func))
-                     
+
 (defun ppfc-html-labels (label name type formatter cdata print-func)
   (vector-push-extend '(write-string "<span class=\"label\">" s) print-func)
   (vector-push-extend `(write-string ,label s) print-func)
 (defun ppfc-html-link (name type formatter cdata nlink print-func)
   (declare (fixnum nlink))
   (vector-push-extend '(write-char #\< s) print-func)
-  (vector-push-extend `(write-string (nth ,(+ nlink nlink) links) s) print-func) 
+  (vector-push-extend `(write-string (nth ,(+ nlink nlink) links) s) print-func)
   (vector-push-extend '(write-char #\> s) print-func)
   (vector-push-extend `(write-ho-value x ',name ',type ',formatter ,cdata s) print-func)
   (vector-push-extend '(write-string "</" s) print-func)
-  (vector-push-extend `(write-string (nth ,(+ nlink nlink 1) links) s) print-func) 
+  (vector-push-extend `(write-string (nth ,(+ nlink nlink 1) links) s) print-func)
   (vector-push-extend '(write-char #\> s) print-func))
 
 (defun ppfc-html-link-labels (label name type formatter cdata nlink print-func)
         (user-name (esd-user-name slot))
         (xml-user-name (escape-xml-string user-name))
         (xml-tag (escape-xml-string user-name))
-        (type (slot-value slot 'type))
+        (type (slot-value slot #-sbcl 'type
+                                #+sbcl 'sb-pcl::%type))
         (cdata (not (null
                      (and (in vid :xml :xhtml :xml-link :xhtml-link
                               :xml-labels :ie-xml-labels
                           (or formatter
                               (lisp-type-is-a-string type))))))
         (hyperlink (esd-hyperlink slot)))
-    
+
     (case vid
       (:compact-text
        (vector-push-extend
   "Initialize a view based upon a preset vid"
   (unless (creatable-view-id-p obj-cl (id view))
     (error "Unable to automatically create view id ~A" (id view)))
-  
+
   (unless (slots view) (setf (slots view) (default-print-slots obj-cl)))
 
   (let ((links '())
         ((null slots))
       (unless slot
        (error "Slot ~A is not found in class ~S" slot-name obj-cl))
-      
+
       (push-print-fun-code (id view) slot (length links) print-func)
       (when (> (length slots) 1)
        (vector-push-extend '(write-char #\space s) print-func))
                                       ,@(map 'list #'identity print-func)))
     (setf (obj-data-printer view)
          (compile nil (eval (obj-data-print-code view))))
-    
+
     (setf (link-slots view) (nreverse links)))
 
   (finalize-view-by-id view)
 (defun fmt-obj-end (obj view strm indent)
   (when (obj-end-indent view)
     (awhen (indenter view)
-          (funcall it indent strm))) 
+          (funcall it indent strm)))
   (awhen (obj-end-printer view)
         (if (stringp it)
             (write-string it strm)
 (defun fmt-subobj-end (obj view strm indent)
   (when (subobj-end-indent view)
     (awhen (indenter view)
-          (funcall it indent strm))) 
+          (funcall it indent strm)))
   (awhen (subobj-end-printer view)
         (if (stringp it)
             (write-string it strm)
             (funcall it obj strm))))
-  
-;;; Object Data 
+
+;;; Object Data
 
 
 (defun make-link-start (view fieldfunc fieldvalue refvars link-printer)
        (link-printer
         (funcall link-printer link-page fieldfunc fieldvalue refvars s))))
     (write-char #\" s)))
-  
+
 (defun make-link-end (obj view fieldname)
   (declare (ignore obj fieldname))
   (link-href-end view))
            strm vid (1+ indent) filter subobjects refvars
            link-printer)))))
 
-         
+
 (defun view-hyperobject (objs view strm &optional vid (indent 0) filter
                         subobjects refvars link-printer)
   "Display a single or list of hyperobject-class instances and their subobjects"
          (fmt-obj-start obj view strm indent)
          (fmt-obj-data obj view strm (1+ indent) refvars link-printer)
          (fmt-obj-end obj view strm indent)
-         (if subobjects 
+         (if subobjects
              (progn
                (fmt-subobj-start obj view strm indent)
                (view-subobjects obj strm vid indent filter subobjects