1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: ml-class.lisp
6 ;;;; Purpose: Markup Language Metaclass
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2000
10 ;;;; This metaclass as functions to classes to allow display
11 ;;;; in Text, HTML, and XML formats. This includes hyperlinking
12 ;;;; capability and sub-objects.
14 ;;;; $Id: ml-class.lisp,v 1.6 2002/10/13 17:39:50 kevin Exp $
16 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
18 ;;;; KMRCL users are granted the rights to distribute and use this software
19 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
20 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
21 ;;;; *************************************************************************
25 (declaim (optimize (speed 3) (safety 1)))
27 (defun ml-class-of (obj)
28 #-(or cmu sbcl) (class-of obj)
29 #+sbcl (sb-pcl:class-of obj)
30 #+cmu (pcl:class-of obj))
32 (defclass ml-class (standard-class)
33 ((title :initarg :title :type string :reader ml-std-title
35 "Print Title for class")
36 (fields :initarg :fields :reader ml-std-fields
38 "List of field lists for printing. Format is
39 ((fieldname type optional-formatter) ... )")
41 :initarg :subobjects-lists :reader ml-std-subobjects-lists
43 "List of fields that contain a list of subobjects objects.")
45 :initarg :ref-fields :type list :reader ml-std-ref-field
47 "List of fields that can be referred to by browsers.
48 Format is ((field-name field-lookup-func other-link-params) ...)")
50 ;;; The remainder of these fields are calculated one time
51 ;;; in finalize-inheritence.
52 (value-func :initform nil :type function :reader ml-std-value-func)
53 (xmlvalue-func :initform nil :type function :reader ml-std-xmlvalue-func)
54 (fmtstr-text :initform nil :type string :reader ml-std-fmtstr-text)
55 (fmtstr-html :initform nil :type string :reader ml-std-fmtstr-html)
56 (fmtstr-xml :initform nil :type string :reader ml-std-fmtstr-xml)
57 (fmtstr-text-labels :initform nil :type string :reader ml-std-fmtstr-text-labels)
58 (fmtstr-html-labels :initform nil :type string :reader ml-std-fmtstr-html-labels)
59 (fmtstr-xml-labels :initform nil :type string :reader ml-std-fmtstr-xml-labels)
60 (fmtstr-html-ref :initform nil :type string :reader ml-std-fmtstr-html-ref)
61 (fmtstr-xml-ref :initform nil :type string :reader ml-std-fmtstr-xml-ref)
62 (fmtstr-html-ref-labels :initform nil :type string :reader ml-std-fmtstr-html-ref-labels)
63 (fmtstr-xml-ref-labels :initform nil :type string :reader ml-std-fmtstr-xml-ref-labels)
65 (:default-initargs :title nil :fields nil :subobjects-lists nil :ref-fields nil)
66 (:documentation "Metaclass for Markup Language classes."))
69 (defmethod pcl:validate-superclass ((class ml-class) (superclass pcl::standard-class))
73 (defmethod sb-pcl:validate-superclass ((class ml-class) (superclass sb-pcl::standard-class))
77 (defmethod pcl:validate-superclass ((class pcl::standard-class) (superclass ml-class))
81 (defmethod sb-pcl:validate-superclass ((class sb-pcl::standard-class) (superclass ml-class))
85 (defmethod mop:finalize-inheritance :after ((cl ml-class))
89 (defmethod clos:finalize-inheritance :after ((cl ml-class))
93 (defmethod pcl:finalize-inheritance :after ((cl ml-class))
97 (defmethod sb-pcl:finalize-inheritance :after ((cl ml-class))
101 (defmethod clos:process-a-class-option ((class ml-class)
105 (error "ml-class title must have a value"))
106 (if (null (cdr value))
107 (list name (car value))
108 (list name `',value)))
111 (defmethod clos:process-a-class-option ((class ml-class)
115 (error "ml-class fields must have a value"))
116 (list name `',value))
119 (defmethod clos:process-a-class-option ((class ml-class)
120 (name (eql :ref-fields))
123 (error "ml-class ref-fields must have a value"))
124 (list name `',value))
127 (defmethod clos:process-a-class-option ((class ml-class)
128 (name (eql :subobjects-lists))
131 (error "ml-class subobjects-lists must have a value"))
132 (list name `',value))
134 ;;;; Class initialization function
136 (defun init-ml-class (cl)
137 (let ((fmtstr-text "")
140 (fmtstr-text-labels "")
141 (fmtstr-html-labels "")
142 (fmtstr-xml-labels "")
145 (fmtstr-html-ref-labels "")
146 (fmtstr-xml-ref-labels "")
150 (classname (class-name cl))
151 (ref-fields (slot-value cl 'ref-fields)))
152 (declare (ignore classname))
153 (dolist (f (slot-value cl 'fields))
155 (namestr (symbol-name (car f)))
156 (namestr-lower (string-downcase (symbol-name (car f))))
158 (formatter (caddr f))
160 (plain-value-func nil)
161 html-str xml-str html-label-str xml-label-str)
163 (when (or (eql type :integer) (eql type :fixnum))
164 (setq value-fmt "~d"))
166 (when (eql type :commainteger)
167 (setq value-fmt "~:d"))
169 (when (eql type :boolean)
170 (setq value-fmt "~a"))
173 (setq first-field nil)
175 (string-append fmtstr-text " ")
176 (string-append fmtstr-html " ")
177 (string-append fmtstr-xml " ")
178 (string-append fmtstr-text-labels " ")
179 (string-append fmtstr-html-labels " ")
180 (string-append fmtstr-xml-labels " ")
181 (string-append fmtstr-html-ref " ")
182 (string-append fmtstr-xml-ref " ")
183 (string-append fmtstr-html-ref-labels " ")
184 (string-append fmtstr-xml-ref-labels " ")))
186 (setq html-str value-fmt)
187 (setq xml-str (concatenate 'string "<" namestr-lower ">" value-fmt "</" namestr-lower ">"))
188 (setq html-label-str (concatenate 'string "<i>" namestr-lower "</i> " value-fmt))
189 (setq xml-label-str (concatenate 'string "<label>" namestr-lower "</label> <" namestr-lower ">" value-fmt "</" namestr-lower ">"))
191 (string-append fmtstr-text value-fmt)
192 (string-append fmtstr-html html-str)
193 (string-append fmtstr-xml xml-str)
194 (string-append fmtstr-text-labels namestr-lower " " value-fmt)
195 (string-append fmtstr-html-labels html-label-str)
196 (string-append fmtstr-xml-labels xml-label-str)
198 (if (find name ref-fields :key #'car)
200 (string-append fmtstr-html-ref "<~~a>" value-fmt "</~~a>")
201 (string-append fmtstr-xml-ref "<~~a>" value-fmt "</~~a>")
202 (string-append fmtstr-html-ref-labels "<i>" namestr-lower "</i> <~~a>" value-fmt "</~~a>")
203 (string-append fmtstr-xml-ref-labels "<label>" namestr-lower "</label> <~~a>" value-fmt "</~~a>"))
205 (string-append fmtstr-html-ref html-str)
206 (string-append fmtstr-xml-ref xml-str)
207 (string-append fmtstr-html-ref-labels html-label-str)
208 (string-append fmtstr-xml-ref-labels xml-label-str)))
211 (setq plain-value-func
212 (list `(,formatter (,(concat-symbol-pkg
213 :umlisp namestr) x))))
214 (setq plain-value-func
215 (list `(,(concat-symbol-pkg
216 :umlisp namestr) x))))
217 (setq value-func (append value-func plain-value-func))
219 (if (eql type :cdata)
220 (setq xmlvalue-func (append xmlvalue-func (list `(xml-cdata ,@plain-value-func))))
221 (setq xmlvalue-func (append xmlvalue-func plain-value-func)))
224 (setq value-func `(lambda (x) (values ,@value-func)))
225 (setq value-func (compile nil (eval value-func)))
226 (setq xmlvalue-func `(lambda (x) (values ,@xmlvalue-func)))
227 (setq xmlvalue-func (compile nil (eval xmlvalue-func)))
229 (setf (slot-value cl 'fmtstr-text) fmtstr-text)
230 (setf (slot-value cl 'fmtstr-html) fmtstr-html)
231 (setf (slot-value cl 'fmtstr-xml) fmtstr-xml)
232 (setf (slot-value cl 'fmtstr-text-labels) fmtstr-text-labels)
233 (setf (slot-value cl 'fmtstr-html-labels) fmtstr-html-labels)
234 (setf (slot-value cl 'fmtstr-xml-labels) fmtstr-xml-labels)
235 (setf (slot-value cl 'fmtstr-html-ref) fmtstr-html-ref)
236 (setf (slot-value cl 'fmtstr-xml-ref) fmtstr-xml-ref)
237 (setf (slot-value cl 'fmtstr-html-ref-labels) fmtstr-html-ref-labels)
238 (setf (slot-value cl 'fmtstr-xml-ref-labels) fmtstr-xml-ref-labels)
239 (setf (slot-value cl 'value-func) value-func)
240 (setf (slot-value cl 'xmlvalue-func) xmlvalue-func))
244 (defun ml-class-fmtstr-text (obj)
245 (slot-value (ml-class-of obj) 'fmtstr-text))
247 (defun ml-class-fmtstr-html (obj)
248 (slot-value (ml-class-of obj) 'fmtstr-html))
250 (defun ml-class-fmtstr-xml (obj)
251 (slot-value (ml-class-of obj) 'fmtstr-xml))
253 (defun ml-class-fmtstr-text-labels (obj)
254 (slot-value (ml-class-of obj) 'fmtstr-text-labels))
256 (defun ml-class-fmtstr-html-labels (obj)
257 (slot-value (ml-class-of obj) 'fmtstr-html-labels))
259 (defun ml-class-fmtstr-xml-labels (obj)
260 (slot-value (ml-class-of obj) 'fmtstr-xml-labels))
262 (defun ml-class-value-func (obj)
263 (slot-value (ml-class-of obj) 'value-func))
265 (defun ml-class-xmlvalue-func (obj)
266 (slot-value (ml-class-of obj) 'xmlvalue-func))
268 (eval-when (:compile-toplevel :load-toplevel :execute)
269 (defun ml-class-title (obj)
270 (awhen (slot-value (ml-class-of obj) 'title)
275 (defun ml-class-subobjects-lists (obj)
276 (slot-value (ml-class-of obj) 'subobjects-lists))
278 (defun ml-class-ref-fields (obj)
279 (slot-value (ml-class-of obj) 'ref-fields))
281 (defun ml-class-fields (obj)
282 (slot-value (ml-class-of obj) 'fields))
284 (defun ml-class-fmtstr-html-ref (obj)
285 (slot-value (ml-class-of obj) 'fmtstr-html-ref))
287 (defun ml-class-fmtstr-xml-ref (obj)
288 (slot-value (ml-class-of obj) 'fmtstr-xml-ref))
290 (defun ml-class-fmtstr-html-ref-labels (obj)
291 (slot-value (ml-class-of obj) 'fmtstr-html-ref-labels))
293 (defun ml-class-fmtstr-xml-ref-labels (obj)
294 (slot-value (ml-class-of obj) 'fmtstr-xml-ref-labels))
296 ;;; Class name functions
298 (defmethod ml-class-stdname ((name string))
299 (string-downcase (subseq name :start 1)))
301 (defmethod ml-class-stdname ((cl standard-object))
302 (string-downcase (subseq (class-name (ml-class-of cl)) :start 1)))
304 ;;;; Generic Print functions
306 (defparameter *default-textformat* nil)
307 (defparameter *default-htmlformat* nil)
308 (defparameter *default-htmlrefformat* nil)
309 (defparameter *default-xmlformat* nil)
310 (defparameter *default-xmlrefformat* nil)
311 (defparameter *default-nullformat* nil)
312 (defparameter *default-init-format?* nil)
314 (defun make-format-instance (fmt)
315 (unless *default-init-format?*
316 (setq *default-textformat* (make-instance 'textformat))
317 (setq *default-htmlformat* (make-instance 'htmlformat))
318 (setq *default-htmlrefformat* (make-instance 'htmlrefformat))
319 (setq *default-xmlformat* (make-instance 'xmlformat))
320 (setq *default-xmlrefformat* (make-instance 'xmlrefformat))
321 (setq *default-nullformat* (make-instance 'nullformat))
322 (setq *default-init-format?* t))
325 (:text *default-textformat*)
326 (:html *default-htmlformat*)
327 (:htmlref *default-htmlrefformat*)
328 (:xml *default-xmlformat*)
329 (:xmlref *default-xmlrefformat*)
330 (:null *default-nullformat*)
331 (otherwise *default-textformat*)))
333 ;;;; Output format classes for print ml-classes
335 (defclass dataformat ()
336 ((file-start-str :type string :initarg :file-start-str :reader file-start-str)
337 (file-end-str :type string :initarg :file-end-str :reader file-end-str)
338 (list-start-fmtstr :type string :initarg :list-start-fmtstr :reader list-start-fmtstr)
339 (list-start-value-func :type function :initarg :list-start-value-func :reader list-start-value-func)
340 (list-start-indent :initarg :list-start-indent :reader list-start-indent)
341 (list-end-fmtstr :type string :initarg :list-end-fmtstr :reader list-end-fmtstr)
342 (list-end-value-func :type function :initarg :list-end-value-func :reader list-end-value-func)
343 (list-end-indent :initarg :list-end-indent :reader list-end-indent)
344 (obj-start-fmtstr :type string :initarg :obj-start-fmtstr :reader obj-start-fmtstr)
345 (obj-start-value-func :initarg :obj-start-value-func :reader obj-start-value-func)
346 (obj-start-indent :initarg :obj-start-indent :reader obj-start-indent)
347 (obj-end-fmtstr :type string :initarg :obj-end-fmtstr :reader obj-end-fmtstr)
348 (obj-end-value-func :initarg :obj-end-value-func :reader obj-end-value-func)
349 (obj-end-indent :initarg :obj-end-indent :reader obj-end-indent)
350 (obj-data-indent :initarg :obj-data-indent :reader obj-data-indent)
351 (obj-data-fmtstr :initarg :obj-data-fmtstr :reader obj-data-fmtstr)
352 (obj-data-fmtstr-labels :initarg :obj-data-fmtstr-labels :reader obj-data-fmtstr-labels)
353 (obj-data-end-fmtstr :initarg :obj-data-end-fmtstr :reader obj-data-end-fmtstr)
354 (obj-data-value-func :initarg :obj-data-value-func :reader obj-data-value-func)
355 (link-ref :initarg :link-ref :reader link-ref))
356 (:default-initargs :file-start-str nil :file-end-str nil :list-start-fmtstr nil :list-start-value-func nil
357 :list-start-indent nil :list-end-fmtstr nil :list-end-value-func nil :list-end-indent nil
358 :obj-start-fmtstr nil :obj-start-value-func nil :obj-start-indent nil
359 :obj-end-fmtstr nil :obj-end-value-func nil :obj-end-indent nil
360 :obj-data-indent nil :obj-data-fmtstr nil :obj-data-fmtstr-labels nil :obj-data-end-fmtstr nil
361 :obj-data-value-func nil :link-ref nil)
362 (:documentation "Parent for all dataformat objects"))
364 (defclass binaryformat (dataformat)
367 (defclass nullformat (dataformat)
370 (defun text-list-start-value-func (obj nitems)
371 (values (ml-class-title obj) nitems))
373 (defclass textformat (dataformat)
375 (:default-initargs :list-start-fmtstr "~a~P:~%"
376 :list-start-value-func #'text-list-start-value-func
379 :obj-data-fmtstr #'ml-class-fmtstr-text
380 :obj-data-fmtstr-labels #'ml-class-fmtstr-text-labels
381 :obj-data-end-fmtstr "~%"
382 :obj-data-value-func #'ml-class-value-func))
384 (defclass htmlformat (textformat)
386 (:default-initargs :file-start-str "<html><body>~%"
387 :file-end-str "</body><html>~%"
389 :list-start-fmtstr "<p><b>~a~P:</b></p><ul>~%"
390 :list-start-value-func #'text-list-start-value-func
391 :list-end-fmtstr "</ul>~%"
393 :list-end-value-func #'identity
395 :obj-start-fmtstr "<li>"
396 :obj-start-value-func #'identity
398 :obj-end-fmtstr "</li>~%"
399 :obj-end-value-func #'identity
401 :obj-data-fmtstr #'ml-class-fmtstr-html-labels
402 :obj-data-fmtstr-labels #'ml-class-fmtstr-html-labels
403 :obj-data-value-func #'ml-class-value-func))
406 (defun class-name-of (obj)
407 (string-downcase (class-name (ml-class-of obj))))
409 (defun xmlformat-list-end-value-func (x)
410 (format nil "~alist" (string-downcase (class-name (ml-class-of x)))))
412 (defun xmlformat-list-start-value-func (x nitems)
413 (values (format nil "~alist" (string-downcase (class-name (ml-class-of x)))) (ml-class-title x) nitems))
415 (defclass xmlformat (textformat)
417 (:default-initargs :file-start-str "" ; (std-xml-header)
419 :list-start-fmtstr "<~a><title>~a~p:</title> ~%"
420 :list-start-value-func #'xmlformat-list-start-value-func
422 :list-end-fmtstr "</~a>~%"
423 :list-end-value-func #'xmlformat-list-end-value-func
424 :obj-start-fmtstr "<~a>"
425 :obj-start-value-func #'class-name-of
427 :obj-end-fmtstr "</~a>~%"
428 :obj-end-value-func #'class-name-of
431 :obj-data-fmtstr #'ml-class-fmtstr-xml
432 :obj-data-fmtstr-labels #'ml-class-fmtstr-xml-labels
433 :obj-data-value-func #'ml-class-xmlvalue-func))
435 (defclass link-ref ()
436 ((fmtstr :type function :initarg :fmtstr :accessor fmtstr)
437 (fmtstr-labels :type function :initarg :fmtstr-labels :accessor fmtstr-labels)
438 (page-name :type string :initarg :page-name :accessor page-name)
439 (href-head :type string :initarg :href-head :accessor href-head)
440 (href-end :type string :initarg :href-end :accessor href-end)
441 (ampersand :type string :initarg :ampersand :accessor ampersand))
442 (:default-initargs :fmtstr nil
444 :page-name "disp-func1"
445 :href-head nil :href-end nil :ampersand nil)
446 (:documentation "Formatting for a linked reference"))
448 (defclass html-link-ref (link-ref)
450 (:default-initargs :fmtstr #'ml-class-fmtstr-html-ref
451 :fmtstr-labels #'ml-class-fmtstr-html-ref-labels
456 (defclass xml-link-ref (link-ref)
458 (:default-initargs :fmtstr #'ml-class-fmtstr-xml-ref
459 :fmtstr-labels #'ml-class-fmtstr-xml-ref-labels
460 :href-head "xmllink xlink:type=\"simple\" xlink:href="
465 (defclass htmlrefformat (htmlformat)
467 (:default-initargs :link-ref (make-instance 'html-link-ref)))
469 (defclass xmlrefformat (xmlformat)
471 (:default-initargs :link-ref (make-instance 'xml-link-ref)))
474 ;;; File Start and Ends
476 (defmethod fmt-file-start ((fmt dataformat) (s stream)))
478 (defmethod fmt-file-start ((fmt textformat) (s stream))
479 (aif (file-start-str fmt)
482 (defmethod fmt-file-end ((fmt textformat) (s stream))
483 (aif (file-end-str fmt)
486 ;;; List Start and Ends
488 (defmethod fmt-list-start (x (fmt textformat) (s stream) &optional (indent 0) (num-items 1))
489 (if (list-start-indent fmt)
490 (indent-spaces indent s))
491 (aif (list-start-fmtstr fmt)
494 (funcall (list-start-value-func fmt) x num-items)))))
496 (defmethod fmt-list-end (x (fmt textformat) (s stream) &optional (indent 0) (num-items 1))
497 (declare (ignore num-items))
498 (if (list-end-indent fmt)
499 (indent-spaces indent s))
500 (aif (list-end-fmtstr fmt)
503 (funcall (list-end-value-func fmt) x)))))
505 ;;; Object Start and Ends
507 (defmethod fmt-obj-start (x (fmt textformat) (s stream) &optional (indent 0))
508 (if (obj-start-indent fmt)
509 (indent-spaces indent s))
510 (aif (obj-start-fmtstr fmt)
513 (funcall (obj-start-value-func fmt) x)))))
515 (defmethod fmt-obj-end (x (fmt textformat) (s stream) &optional (indent 0))
516 (if (obj-end-indent fmt)
517 (indent-spaces indent s))
518 (aif (obj-end-fmtstr fmt)
521 (funcall (obj-end-value-func fmt) x)))))
525 (defmethod make-link-start (obj (ref link-ref) fieldname fieldfunc fieldvalue refvars)
526 (declare (ignore obj fieldname))
527 (format nil "~a\"~a?func=~a~akey=~a~a\""
528 (href-head ref) (make-url (page-name ref)) fieldfunc
529 (ampersand ref) fieldvalue
532 (dolist (var refvars)
533 (string-append varstr (format nil "~a~a=~a"
534 (ampersand ref) (car var) (cadr var))))
538 (defmethod make-link-end (obj (ref link-ref) fieldname)
539 (declare (ignore obj fieldname))
540 (format nil "~a" (href-end ref))
543 (defmethod fmt-obj-data (x (fmt textformat) s
544 &optional (indent 0) (label nil) (refvars nil))
545 (if (obj-data-indent fmt)
546 (indent-spaces indent s))
548 (fmt-obj-data-with-ref x fmt s label refvars)
549 (fmt-obj-data-plain x fmt s label))
550 (aif (obj-data-end-fmtstr fmt)
553 (defmethod fmt-obj-data-plain (x (fmt textformat) s label)
556 (funcall (obj-data-fmtstr-labels fmt) x)
558 (funcall (funcall (obj-data-value-func fmt) x) x)))
559 (apply #'format s (funcall (obj-data-fmtstr fmt) x)
561 (funcall (funcall (obj-data-value-func fmt) x) x)))))
563 (defmethod fmt-obj-data-with-ref (x (fmt textformat) s label refvars)
564 (let ((refstr (make-ref-data-str x fmt label))
568 (funcall (funcall (obj-data-value-func fmt) x) x))))
570 ;; make list of reference link fields for printing to refstr template
571 (dolist (field (ml-class-ref-fields x))
573 (make-link-start x (link-ref fmt) (car field) (cadr field)
574 (nth (position (car field) (ml-class-fields x) :key #'car) field-values)
575 (append (caddr field) refvars)))
576 (link-end (make-link-end x (link-ref fmt) (car field))))
577 (push link-start refvalues)
578 (push link-end refvalues)))
579 (setq refvalues (nreverse refvalues))
581 (apply #'format s refstr refvalues)))
583 (defmethod obj-data (x)
584 "Returns the objects data as a string. Used by common-graphics outline function"
585 (let ((fmt (make-format-instance :text)))
586 (apply #'format nil (funcall (obj-data-fmtstr fmt) x)
588 (funcall (funcall (obj-data-value-func fmt) x) x)))))
590 (defmethod make-ref-data-str (x (fmt textformat) &optional (label nil))
591 "Return fmt string for that contains ~a slots for reference link start and end"
592 (unless (link-ref fmt)
593 (error "fmt does not contain a link-ref"))
596 (apply #'format nil (funcall (fmtstr-labels (link-ref fmt)) x)
598 (funcall (funcall (obj-data-value-func fmt) x) x)))
599 (apply #'format nil (funcall (fmtstr (link-ref fmt)) x)
600 (multiple-value-list (funcall (funcall (obj-data-value-func fmt) x) x))))))
603 ;;; Display method for objects
606 (defmethod load-all-subobjects (objs)
607 "Load all subobjects if they have not already been loaded."
609 (let ((objlist (mklist objs)))
610 (dolist (obj objlist)
611 (awhen (ml-class-subobjects-lists obj) ;; access list of functions
612 (dolist (child-obj it) ;; for each child function
613 (awhen (funcall (car child-obj) obj)
614 (load-all-subobjects it))))))
617 (defmethod output-ml-class (objs (fmt dataformat) (strm stream)
618 &optional (label nil) (english-only-function nil)
619 (indent 0) (subobjects nil) (refvars nil))
620 "Display a single or list of ml-class instances and their subobjects"
622 (setq objs (mklist objs))
623 (let ((nobjs (length objs)))
624 (fmt-list-start (car objs) fmt strm indent nobjs)
626 (unless (and english-only-function (not (funcall english-only-function obj)))
627 (fmt-obj-start obj fmt strm indent)
628 (fmt-obj-data obj fmt strm (1+ indent) label refvars)
630 (awhen (ml-class-subobjects-lists obj) ;; access list of functions
631 (dolist (child-obj it) ;; for each child function
632 (awhen (funcall (car child-obj) obj) ;; access set of child objects
633 (output-ml-class it fmt strm label
634 english-only-function
635 (1+ indent) subobjects refvars)))))
636 (fmt-obj-end obj fmt strm indent)))
637 (fmt-list-end (car objs) fmt strm indent nobjs))
640 (defun display-ml-class (objs &key (os *standard-output*) (format :text)
641 (label nil) (english-only-function nil) (subobjects nil)
642 (file-wrapper t) (refvars nil))
643 "EXPORTED Function: displays a ml-class. Simplies call to output-ml-class"
644 (let ((fmt (make-format-instance format)))
646 (fmt-file-start fmt os))
648 (output-ml-class objs fmt os label english-only-function 0 subobjects refvars))
650 (fmt-file-end fmt os)))