+(defmacro define-hyperobject (name parents fields &rest meta-fields)
+ (let* ((meta (make-instance 'hyperobject-meta))
+ (cl-fields (process-hyper-fields fields meta))
+ (title (process-title name meta-fields))
+ (documentation (process-documentation meta-fields))
+ (value-func (gensym))
+ (xml-value-func (gensym)))
+ (init-hyperobject-class name meta)
+ `(progn
+ (eval-when (:compile-toplevel :load-toplevel :execute)
+ (defclass ,name ,(append parents (list 'hyperobject)) ,cl-fields
+ ,@(and documentation (list (list :documentation documentation)))))
+ (let ((,value-func (compile nil (eval (slot-value ,meta 'value-func))))
+ (,xml-value-func (compile nil (eval (slot-value ,meta 'xml-value-func)))))
+ (defmethod ho-title ((obj ,name))
+ ,title)
+ (defmethod ho-name ((obj ,name))
+ ,(string-downcase (symbol-name name)))
+ (defmethod ho-fields ((obj ,name))
+ ',(slot-value meta 'fields))
+ (defmethod ho-references ((obj ,name))
+ ',(slot-value meta 'references))
+ (defmethod ho-subobjects ((obj ,name))
+ ',(slot-value meta 'subobjects))
+ (defmethod ho-value-func ((obj ,name))
+ ,value-func)
+ (defmethod ho-xml-value-func ((obj ,name))
+ ,xml-value-func)
+ (defmethod ho-fmtstr-text ((obj ,name))
+ ,(slot-value meta 'fmtstr-text))
+ (defmethod ho-fmtstr-html ((obj ,name))
+ ,(slot-value meta 'fmtstr-html))
+ (defmethod ho-fmtstr-xml ((obj ,name))
+ ,(slot-value meta 'fmtstr-xml))
+ (defmethod ho-fmtstr-text-labels ((obj ,name))
+ ,(slot-value meta 'fmtstr-text-labels))
+ (defmethod ho-fmtstr-html-labels ((obj ,name))
+ ,(slot-value meta 'fmtstr-html-labels))
+ (defmethod ho-fmtstr-xml-labels ((obj ,name))
+ ,(slot-value meta 'fmtstr-xml-labels))
+ (defmethod ho-fmtstr-html-ref ((obj ,name))
+ ,(slot-value meta 'fmtstr-html-ref))
+ (defmethod ho-fmtstr-xml-ref ((obj ,name))
+ ,(slot-value meta 'fmtstr-xml-ref))
+ (defmethod ho-fmtstr-html-ref-labels ((obj ,name))
+ ,(slot-value meta 'fmtstr-html-ref-labels))
+ (defmethod ho-fmtstr-xml-ref-labels ((obj ,name))
+ ,(slot-value meta 'fmtstr-xml-ref-labels))
+ ))))
+