-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathquicklisp-xref.lisp
37 lines (29 loc) · 1.34 KB
/
quicklisp-xref.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(in-package #:quicklisp-xref)
;;; Instantiate VHOSTs
(defvar vhost1 (make-instance 'hunchentoot:easy-acceptor :port 5000))
;;; Start and Stop
(defun run ()
(hunchentoot:start vhost1))
(defun stop ()
(hunchentoot:stop vhost1))
;;; make parenscript work nicely with cl-who
(setf parenscript:*js-string-delimiter* #\")
;;; helpers
(defmacro escaped-string (string)
`(who:fmt (who:escape-string (format nil "~A" ,string))))
(defun inspect-object (obj)
(loop for the-slot in (mapcar #'sb-pcl:slot-definition-name (sb-pcl:class-slots (class-of obj)))
collect (list the-slot (if (slot-boundp obj the-slot)
(slot-value obj the-slot)
"unbound"))))
;;; pretty print object on a web page
(defun pp-object (obj)
(with-output-to-string (str)
(format str "<pre>")
(format str "~a" (who:escape-string (format nil "~a~%" obj)))
(loop for the-slot in (mapcar #'sb-pcl:slot-definition-name (sb-pcl:class-slots (class-of obj)))
do
(format str "~A~%" (who:escape-string (format nil "~A" (list the-slot (if (slot-boundp obj the-slot)
(slot-value obj the-slot)
"unbound"))))))
(format str "</pre>")))