1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Macros for generating API documentation
7 ;;;; Programmer: Kevin M. Rosenberg based on Matthew Danish's code
8 ;;;; Date Started: Nov 2002
10 ;;;; $Id: api.lisp,v 1.2 2003/06/06 21:59:30 kevin Exp $
12 ;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;; and Copyright (c) 2002 Matthew Danish
15 ;;;; LML users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the GNU General Public License v2
17 ;;;; (http://www.gnu.org/licenses/gpl.html)
18 ;;;; *************************************************************************
22 ;;; Copyright (c) 2002 Matthew Danish.
23 ;;; All rights reserved.
25 ;;; Redistribution and use in source and binary forms, with or without
26 ;;; modification, are permitted provided that the following conditions
28 ;;; 1. Redistributions of source code must retain the above copyright
29 ;;; notice, this list of conditions and the following disclaimer.
30 ;;; 2. Redistributions in binary form must reproduce the above copyright
31 ;;; notice, this list of conditions and the following disclaimer in the
32 ;;; documentation and/or other materials provided with the distribution.
33 ;;; 3. The name of the author may not be used to endorse or promote products
34 ;;; derived from this software without specific prior written permission.
36 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
37 ;;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 ;;; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
39 ;;; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
40 ;;; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 ;;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 ;;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 ;;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45 ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 ;;; For an example, see Matthew Danish's cl-ftp documentation at
48 ;;; http://www.mapcar.org/~mrd/cl-sql/
50 (defmacro api-list (&body body)
51 `(ul ,@(loop for item in body collect `(li ,item))))
54 (let ((*print-case* :downcase))
57 (format nil "~A" x))))
59 (defmacro with-class-info ((class-name superclasses &rest slot-docs) &body other-info)
60 `(p (i "Class ") (b ,(stringify class-name))
61 (i " derived from ") ,(stringify superclasses) " -- " (br)
64 ,@(loop for (slot-name slot-desc slot-default) in slot-docs collect
65 `(li (tt ,(format nil ":~A" slot-name))
66 " -- " ,slot-desc " -- " (i "Default: ")
67 ,(if (eql slot-default :n/a)
69 (format nil "~S" slot-default)))))
72 (defmacro with-macro-info ((macro-name &rest lambda-list) &body other-info)
73 `(p (i "Macro ") (b ,(stringify macro-name)) " "
74 (tt ,(stringify lambda-list)) (br)
77 (defmacro with-function-info ((function-name &rest lambda-list) &body other-info)
78 `(p (i "Function ") (b ,(stringify function-name)) " "
79 (tt ,(stringify lambda-list))
82 (defmacro with-condition-info ((condition-name supers &rest slot-docs) &body other-info)
83 `(p (i "Condition ") (b ,(stringify condition-name))
84 (i " derived from ") ,(stringify supers) " -- " (br)
87 ,@(loop for (slot-name slot-desc slot-reader slot-initarg slot-default) in slot-docs collect
88 `(li (tt ,(stringify slot-name))
89 " -- " ,slot-desc " -- " (i " Default: ")
90 ,(if (eql slot-default :n/a)
92 (format nil "~S" slot-default)))))
95 (defmacro with-functions (&rest slots)
96 `(progn ,@(loop for (fn description . args) in slots collect
97 `(with-function-info (,fn ,@(if args args
98 '(connection-variable)))