2 (load "../gcl-tk/convert.el")
3 ;(let ((i 2000)) (while (> i 0) (do-one) (setq i (- i 1))))
5 (defun get-match (i) (buffer-substring (match-beginning i
) (match-end i
)))
6 (defun list-matches (l)
9 (setq ans
(cons (get-match (car l
)) ans
)))
16 (re-search-forward "\x1f" nil t
)
19 (end (save-excursion (re-search-forward "\x1f" nil t
) (point))))
20 (cond ((looking-at "F\\([^\n]+\\)\n\\([^\n]+\\) in \\([A-Z_a-z]+\\) package[:]?[\n ]\\(Args\\|Syntax\\): ")
21 (let ((fun (get-match 1))
23 (package (get-match 3))
25 (goto-char (match-end 0))
26 (cond ((equal (get-match 4) "Syntax")
31 (progn (let ((beg (point)))
33 (buffer-substring beg
(point)))))))
35 (setq body
(buffer-substring (point) (- end
1)))
36 (delete-region beg end
)
38 (get-buffer-create package
)
40 (goto-char (point-max))
42 (if (equal type
"Function")
44 (concat (setq def
"@deffn") " {" type
"}"))
46 fun
" " args
"\nPackage:" package
"\n"
48 (insert "\n@end " (substring def
1) "\n")
50 ((looking-at "V\\([^\n]+\\)\n\\([^\n]+\\) in \\([A-Z_a-z]+\\) package:\n")
51 (let ((fun (get-match 1))
53 (package (get-match 3))
55 (goto-char (match-end 0))
56 (setq body
(buffer-substring (point) (- end
1)))
57 (delete-region beg end
)
59 (get-buffer-create package
)
61 (goto-char (point-max))
62 (insert (if (string-match "^\\*" fun
)
64 (concat (setq def
"@defvr")" {Constant}"))
66 fun
" " "\nPackage:" package
"\n"
68 (insert "\n@end " (substring def
1) "\n")))))))
73 (while (re-search-forward "{Constant}" nil t
)
74 (let* ((tem (read-char ))
77 '((?s .
"{Special Variable}")
78 (?d .
"{Declaration}"))))))
79 (if u
(replace-match u
)))))
81 (setq b-alist
'((?n .
"number.texi")
82 (?s .
"sequence.texi")
83 (?c .
"character.texi")
86 (?a .
"internal.texi")
91 (?d .
"structure.texi")
92 (?I .
"iteration.texi")
93 (?u .
"user-interface.texi")
99 (while (re-search-forward "\n@def" nil t
)
100 (let ((beg (match-beginning 0)) me tem
101 (end (save-excursion (re-search-forward "\n@end def[a-z]+" nil t
)
104 (setq tem
(read-char ))
105 (cond ((setq tem
(cdr (assoc tem b-alist
)))
106 (setq me
(buffer-substring beg end
))
107 (delete-region beg end
)
110 (get-buffer-create tem
)
112 (goto-char (point-max))
113 (insert me
"\n")))))))
117 (setq xall
(mapcar 'cdr b-alist
))
119 ;(let ((all xall)) (while all (set-buffer (car all)) (write-file (car all)) (setq all (cdr all))))
120 ;(let ((all xall)) (while all (find-file (car all)) (setq all (cdr all))))
121 (let ((all xall
) x
) (while all
(set-buffer (car all
)) (goto-char (point-min)) (insert "@node " (setq x
(capitalize (car all
))) "\n@chapter "x
"\n") (write-file (car all
)) (set-buffer "gcl-si.texi")(goto-char (point-max)) (insert "\\n@include " (car all
) "\n") (setq all
(cdr all
))))
124 (let ((all xall
) x
) (while all
(switch-to-buffer (car all
)) (goto-char (point-min)) (insert "@node " (setq x
(capitalize (car all
))) "\n@chapter "x
"\n") (save-buffer) (set-buffer "gcl-si.texi")(goto-char (point-max)) (insert "\\n@include " (car all
) "\n") (setq all
(cdr all
))))
126 (let ((all xall
) x
) (while all
(switch-to-buffer (car all
)) (goto-char (point-min)) (insert "@node " (setq x
(capitalize (car all
))) "\n@chapter "x
"\n") (save-buffer) (set-buffer "gcl-si.texi")(goto-char (point-max)) (insert "\\n@include " (car all
) "\n") (setq all
(cdr all
))))