1 | #-abcl We're only grovelling ABCL docstrings here. |
---|
2 | (defun grovel-docstrings-as-tex (&optional (package (find-package :java))) |
---|
3 | (with-open-file (stream "java.tex" :direction :output) |
---|
4 | (loop :for symbol :being :each :external-symbol :of package |
---|
5 | :collecting (symbol-as-tex symbol)))) |
---|
6 | |
---|
7 | (asdf:load-system 'swank) ;; XXX Does this load the SWANK-BACKEND package as well |
---|
8 | |
---|
9 | (defun arglist-as-string (symbol) |
---|
10 | (loop :for arg :in (arglist symbol) |
---|
11 | :collecting (format nil "~A" (symbol-name arg)))) |
---|
12 | |
---|
13 | (defvar *type-alist* |
---|
14 | '((:function . "Function") |
---|
15 | (:macro . "Macro") |
---|
16 | (:variable . "Variable") |
---|
17 | (:generic-function . "Generic Function"))) |
---|
18 | |
---|
19 | (defun symbol-as-tex (symbol) |
---|
20 | "Return the TeX representation of a SYMBOL as Tex." |
---|
21 | (let (type documentation arglist doc) |
---|
22 | (when (setf doc (swank-backend:describe-symbol-for-emacs symbol)) |
---|
23 | (cond |
---|
24 | ((find :function doc) |
---|
25 | (setf type :function |
---|
26 | documentation (second doc) |
---|
27 | arglist (arglist-as-string symbol))) |
---|
28 | ((find :variable doc) |
---|
29 | (setf type :variable |
---|
30 | documentation (second doc))) |
---|
31 | ((find :macro doc) |
---|
32 | (setf type :macro |
---|
33 | documentation (second doc))) |
---|
34 | ((find :generic-function doc) |
---|
35 | (setf type :generic-function |
---|
36 | documentation (second doc)))) |
---|
37 | (format nil "\\ref{~A:~A}~&--- ~A [\\textbf{~A}]: ~A" |
---|
38 | (symbol-name symbol) |
---|
39 | (package-name (symbol-package symbol)) |
---|
40 | (cdr (assoc type *type-alist*)) |
---|
41 | (symbol-name symbol) |
---|
42 | (package-name (symbol-package symbol)))))) |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | |
---|