Add .gitignore
[parse-docstrings.git] / frontend.lisp
blobcbb8458ff6d41b6380f7df73a39e83bde68197cd
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; texinfo-docstrings.lisp --- Front-end script.
4 ;;;
5 ;;; Copyright (C) 2007, Luis Oliveira <loliveira@common-lisp.net>
6 ;;;
7 ;;; Permission is hereby granted, free of charge, to any person
8 ;;; obtaining a copy of this software and associated documentation
9 ;;; files (the "Software"), to deal in the Software without
10 ;;; restriction, including without limitation the rights to use, copy,
11 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
12 ;;; of the Software, and to permit persons to whom the Software is
13 ;;; furnished to do so, subject to the following conditions:
14 ;;;
15 ;;; The above copyright notice and this permission notice shall be
16 ;;; included in all copies or substantial portions of the Software.
17 ;;;
18 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ;;; DEALINGS IN THE SOFTWARE.
27 (in-package #:cl-launch)
29 (defun print-help-and-quit ()
30 (write-line "Usage: texinfo-docstrings [html|pdf|all] <system> <filename> <title> <css style> packages...")
31 (quit 1))
33 (when (< (length *arguments*) 6)
34 (write-line "Not enough arguments.")
35 (print-help-and-quit))
37 (defparameter *output*
38 (let ((arg1 (first *arguments*)))
39 (cond
40 ((string-equal arg1 "html") 'html)
41 ((string-equal arg1 "pdf") 'pdf)
42 ((string-equal arg1 "all") 'all)
43 (t (print-help-and-quit)))))
45 (defparameter *system* (second *arguments*))
46 (defparameter *filename* (third *arguments*))
47 (defparameter *title* (fourth *arguments*))
48 (defparameter *css-style* (fifth *arguments*))
49 (defparameter *packages* (mapcar #'string-upcase (nthcdr 5 *arguments*)))
51 (load-system *system*)
53 (eval-when (:compile-toplevel :load-toplevel :execute)
54 (asdf:oos 'asdf:load-op :texinfo-docstrings))
56 (apply #'texinfo-docstrings:generate-includes "include/" *packages*)
58 (defparameter *sysdir*
59 (namestring
60 (make-pathname :directory
61 (pathname-directory
62 (asdf:system-definition-pathname
63 (asdf:find-system :texinfo-docstrings))))))
65 (defparameter *gendocs-template-dir*
66 (or (getenv "GENDOCS_TEMPLATE_DIR") *sysdir*))
68 (when (string-equal *css-style* "default")
69 (setq *css-style*
70 (format nil "~Astyles/~A"
71 *sysdir*
72 (case *output*
73 (html "edi-style.css")
74 (t "style.css")))))
76 (let ((asdf::*verbose-out* *terminal-io*))
77 (ecase *output*
78 (html
79 (asdf:run-shell-command "echo not yet"))
80 (pdf
81 (asdf:run-shell-command "echo not yet"))
82 (all
83 (asdf:run-shell-command
84 "GENDOCS_TEMPLATE_DIR=~A sh ~Agendocs.sh --html \"--css-include=~A\" ~A \"~A\""
85 *gendocs-template-dir* *sysdir* *css-style* *filename* *title*))))