;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Apr 2000
;;;;
-;;;; $Id: views.lisp,v 1.33 2003/05/14 04:28:09 kevin Exp $
-;;;;
-;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg
+;;;; $Id: views.lisp,v 1.36 2003/05/14 05:29:48 kevin Exp $
;;;;
+;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg
;;;; *************************************************************************
(in-package :hyperobject)
(ppfc-xml tag name type formatter cdata 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-char #\> s) print-func)
(when (and (view-has-links-p view) (esd-hyperlink slot))
(push (slot-definition-name slot) links)))
- (setf (obj-data-print-code view) `(lambda (x s links)
- (declare (ignorable links))
- ,@(map 'list #'identity print-func)))
-
- (setf (obj-data-func view)
- (when print-func (compile nil (eval (obj-data-print-code view)))))
+ (when (plusp (length print-func))
+ (setf (obj-data-print-code view) `(lambda (x s links)
+ (declare (ignorable links))
+ ,@(map 'list #'identity print-func)))
+ (setf (obj-data-func view)
+ (compile nil (eval (obj-data-print-code view)))))
(setf (link-slots view) (nreverse links)))
(defvar +newline-string+ (format nil "~%"))
+(defun write-user-name-maybe-plural (obj nitems strm)
+ (write-string
+ (if (> nitems 1)
+ (hyperobject-class-user-name-plural obj)
+ (hyperobject-class-user-name obj))
+ strm))
+
(defun initialize-text-view (view)
(setf (list-start-str-or-func view)
(compile nil
- #'(lambda (obj nitems strm)
- (format strm "~a~P:~%"
- (hyperobject-class-user-name obj) nitems))))
+ (eval '(lambda (obj nitems strm)
+ (write-user-name-maybe-plural obj nitems strm)
+ (write-char #\: strm)
+ (write-char #\Newline strm)))))
(setf (list-start-indent view) t)
(setf (obj-data-indent view) t)
(setf (obj-data-end-str view) +newline-string+))
(defun html-list-start-func (obj nitems strm)
- (format strm "<p><b>~a~p:</b></p><div class=\""
- (hyperobject-class-user-name obj) nitems)
+ (write-string "<p><b>" strm)
+ (write-user-name-maybe-plural obj nitems strm)
+ (write-string ":</b></p><div class=\"" strm)
(write-string (class-name-of obj) strm)
(write-string "\"><ul>" strm)
(write-char #\newline strm))
(write-char #\< strm)
(write-string (class-name-of x) strm)
(write-string "list><title>" strm)
- (format strm "~A~P:</title> ~%"
- (hyperobject-class-user-name x) nitems))
+ (write-user-name-maybe-plural obj nitems strm)
+ (write-string ":</title>" strm)
+ (write-char #\newline strm))
(defun initialize-xml-view (view)
(initialize-text-view view)
(defun view-hyperobject (objs view category strm &optional (indent 0) filter
subobjects refvars)
"Display a single or list of hyperobject-class instances and their subobjects"
+ (declare (fixnum indent))
(let-when (objlist (mklist objs))
(let ((nobjs (length objlist))
(*print-pretty* nil)