-
-(defun init-hyperobject-class (cl)
- (let ((fmtstr-text "")
- (fmtstr-html "")
- (fmtstr-xml "")
- (fmtstr-text-labels "")
- (fmtstr-html-labels "")
- (fmtstr-xml-labels "")
- (fmtstr-html-ref "")
- (fmtstr-xml-ref "")
- (fmtstr-html-ref-labels "")
- (fmtstr-xml-ref-labels "")
- (first-field t)
- (value-func '())
- (xmlvalue-func '())
- (classname (class-name cl))
- (package (symbol-package (class-name cl)))
- (references nil)
- (subobjects nil))
- (declare (ignore classname))
- (dolist (f (class-slots cl))
- (if (slot-value f 'subobject)
- (push (make-instance 'subobject :name (slot-definition-name f)
- :reader (if (eq t (esd-subobject f))
- (slot-definition-name f)
- (esd-subobject f)))
- subobjects)
- (let ((name (slot-definition-name f))
- (namestr (symbol-name (slot-definition-name f)))
- (namestr-lower (string-downcase (symbol-name (slot-definition-name f))))
- (type (slot-value f 'ho-type))
- (formatter (slot-value f 'format-func))
- (value-fmt "~a")
- (plain-value-func nil)
- html-str xml-str html-label-str xml-label-str)
-
- (when (or (eql type :integer) (eql type :fixnum))
- (setq value-fmt "~d"))
-
- (when (eql type :commainteger)
- (setq value-fmt "~:d"))
-
- (when (eql type :boolean)
- (setq value-fmt "~a"))
-
- (if first-field
- (setq first-field nil)
- (progn
- (string-append fmtstr-text " ")
- (string-append fmtstr-html " ")
- (string-append fmtstr-xml " ")
- (string-append fmtstr-text-labels " ")
- (string-append fmtstr-html-labels " ")
- (string-append fmtstr-xml-labels " ")
- (string-append fmtstr-html-ref " ")
- (string-append fmtstr-xml-ref " ")
- (string-append fmtstr-html-ref-labels " ")
- (string-append fmtstr-xml-ref-labels " ")))
-
- (setq html-str (concatenate 'string "<span class=\"" namestr-lower "\">" value-fmt "</span>"))
- (setq xml-str (concatenate 'string "<" namestr-lower ">" value-fmt "</" namestr-lower ">"))
- (setq html-label-str (concatenate 'string "<span class=\"label\">" namestr-lower "</span> <span class=\"" namestr-lower "\">" value-fmt "</span>"))
- (setq xml-label-str (concatenate 'string "<label>" namestr-lower "</label> <" namestr-lower ">" value-fmt "</" namestr-lower ">"))
-
+
+(defun find-slot-by-name (cl name)
+ (find name (class-slots cl) :key #'slot-definition-name))
+
+
+(defun process-subobjects (cl)
+ "Process class subobjects slot"
+ (dolist (slot (class-slots cl))
+ (when (slot-value slot 'subobject)
+ (push (make-instance 'subobject :name (slot-definition-name slot)
+ :reader (if (eq t (esd-subobject slot))
+ (slot-definition-name slot)
+ (esd-subobject slot)))
+ subobjects)))
+ (setf (slot-value cl 'subobjects) subobjects))
+
+(defun process-documentation (cl)
+ "Calculate class documentation slot"
+ (setf (slot-value cl 'documentation)
+ (format nil "Hyperobject class: ~A" (slot-value cl 'description)))
+ )
+
+
+(defun process-views (cl)
+ "Calculate all view slots for a hyperobject class"
+ (let ((fmtstr-text "")
+ (fmtstr-html "")
+ (fmtstr-xml "")
+ (fmtstr-text-labels "")
+ (fmtstr-html-labels "")
+ (fmtstr-xml-labels "")
+ (fmtstr-html-ref "")
+ (fmtstr-xml-ref "")
+ (fmtstr-html-ref-labels "")
+ (fmtstr-xml-ref-labels "")
+ (first-field t)
+ (value-func '())
+ (xmlvalue-func '())
+ (classname (class-name cl))
+ (package (symbol-package (class-name cl)))
+ (references nil)
+ (subobjects nil))
+ (declare (ignore classname))
+ (dolist (slot-name (slot-value cl 'print-slots))
+ (let ((slot (find-slot-by-name cl slot-name)))
+ (unless slot
+ (error "Slot ~A is not found in class ~S" slot-name cl))
+ (let ((name (slot-definition-name slot))
+ (namestr (symbol-name (slot-definition-name slot)))
+ (namestr-lower (string-downcase (symbol-name (slot-definition-name slot))))
+ (type (slot-value slot 'ho-type))
+ (print-formatter (slot-value slot 'print-formatter))
+ (value-fmt "~a")
+ (plain-value-func nil)
+ html-str xml-str html-label-str xml-label-str)
+
+ (when (or (eql type :integer) (eql type :fixnum))
+ (setq value-fmt "~d"))
+
+ (when (eql type :boolean)
+ (setq value-fmt "~a"))
+
+ (if first-field
+ (setq first-field nil)
+ (progn
+ (string-append fmtstr-text " ")
+ (string-append fmtstr-html " ")
+ (string-append fmtstr-xml " ")
+ (string-append fmtstr-text-labels " ")
+ (string-append fmtstr-html-labels " ")
+ (string-append fmtstr-xml-labels " ")
+ (string-append fmtstr-html-ref " ")
+ (string-append fmtstr-xml-ref " ")
+ (string-append fmtstr-html-ref-labels " ")
+ (string-append fmtstr-xml-ref-labels " ")))
+
+ (setq html-str (concatenate 'string "<span class=\"" namestr-lower "\">" value-fmt "</span>"))
+ (setq xml-str (concatenate 'string "<" namestr-lower ">" value-fmt "</" namestr-lower ">"))
+ (setq html-label-str (concatenate 'string "<span class=\"label\">" namestr-lower "</span> <span class=\"" namestr-lower "\">" value-fmt "</span>"))
+ (setq xml-label-str (concatenate 'string "<label>" namestr-lower "</label> <" namestr-lower ">" value-fmt "</" namestr-lower ">"))
+