annotate lisp/make-docfile.el @ 223:2c611d1463a6 r20-4b10

Import from CVS: tag r20-4b10
author cvs
date Mon, 13 Aug 2007 10:10:54 +0200
parents d44af0c54775
children 0e522484dd2a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; make-docfile.el --- Cache docstrings in external file
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4 ;; Copyright (C) 1985, 1986, 1992-1995, 1997 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 ;; Author: Unknown
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Maintainer: Steven L Baur <steve@altair.xemacs.org>
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; Keywords: internal
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 ;; This is a front-end to the make-docfile program that gathers up all the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 ;; lisp files that will be dumped with XEmacs. It would probably be best
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33 ;; to just move make-docfile.c completely to lisp and be done with it.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 (defvar options nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38 (defvar processed nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39 (defvar docfile nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 (defvar docfile-buffer nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 (defvar site-file-list nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42 (defvar docfile-out-of-date nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 ;; Gobble up the stuff we don't wish to pass on.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 (setq command-line-args (cdr (cdr (cdr (cdr command-line-args)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47 ;; First gather up the command line options.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 (let (done)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 (while (and (null done) command-line-args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 (let ((arg (car command-line-args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 (cond ((or (string-equal arg "-o") ; Specify DOC file name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 (string-equal arg "-a") ; Append to DOC file
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 (string-equal arg "-d")) ; Set working directory
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 (if (string-equal arg "-o")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 (setq docfile (car (cdr command-line-args))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 (setq options (cons arg options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 (setq options (cons (car (cdr command-line-args)) options)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58 ((string-equal arg "-i") ; Set site files to scan
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 (setq site-file-list (car (cdr command-line-args))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 (t (setq done t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61 (if (null done)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 (setq command-line-args (cdr (cdr command-line-args)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 (setq options (nreverse options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 ;; (print (concat "Options: " (prin1-to-string options)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 ;; Next process the list of C files.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 (while command-line-args
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 (let ((arg (car command-line-args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 (if (null (member arg processed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (if (and (null docfile-out-of-date)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 (file-newer-than-file-p arg docfile))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 (setq docfile-out-of-date t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 (setq processed (cons arg processed)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 (setq command-line-args (cdr command-line-args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 ;; Then process the list of Lisp files.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79 (define-function 'defalias 'define-function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 (let ((temp-path (expand-file-name "." (car load-path))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 (setq load-path (nconc (mapcar
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82 #'(lambda (i) (concat i "/"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 (directory-files temp-path t "^[^-.]"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 nil 'dirs-only))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 (cons (file-name-as-directory temp-path)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 load-path))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 ;; Then process the autoloads
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 (setq autoload-file-name "auto-autoloads.elc")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90 (setq source-directory (concat default-directory "../lisp"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 ;; (print (concat "Source directory: " source-directory))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 (require 'packages)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 ;; We must have some lisp support at this point
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
95 (packages-find-packages package-path t t)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 (let (preloaded-file-list)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents: 209
diff changeset
98 (load (concat default-directory "../lisp/dumped-lisp.el"))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 (setq preloaded-file-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 (append preloaded-file-list packages-hardcoded-lisp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 (while preloaded-file-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 (let ((arg0 (packages-add-suffix (car preloaded-file-list)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 (setq arg (locate-library arg0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 (if (null arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 (princ (format "Error: dumped file %s does not exist\n" arg0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 (if (null (member arg processed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 (if (and (null docfile-out-of-date)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 (file-newer-than-file-p arg docfile))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 (setq docfile-out-of-date t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112 (setq processed (cons arg processed)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 (setq preloaded-file-list (cdr preloaded-file-list)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 ;; Finally process the list of site-loaded files.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116 (if site-file-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 (let (site-load-packages)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 (load site-file-list t t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 (while site-load-packages
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 (let ((arg (car site-load-packages)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121 (if (null (member arg processed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 (if (and (null docfile-out-of-date)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 (file-newer-than-file-p arg docfile))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125 (setq docfile-out-of-date t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 (setq processed (cons arg processed)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 (setq site-load-packages (cdr site-load-packages)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129 (packages-find-packages package-path t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 (let ((autoloads (list-autoloads-path)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 ;; (print (concat "Autoloads: " (prin1-to-string autoloads)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 (while autoloads
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 (let ((arg (car autoloads)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 (if (null (member arg processed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137 ;; (print arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 (if (and (null docfile-out-of-date)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 (file-newer-than-file-p arg docfile))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 (setq docfile-out-of-date t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 (setq processed (cons arg processed))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 (setq autoloads (cdr autoloads)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 ;; Now fire up make-docfile and we're done
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 (setq processed (nreverse processed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 ;; (print (prin1-to-string (append options processed)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 (if docfile-out-of-date
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 (princ "Spawning make-docfile ...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 ;; (print (prin1-to-string (append options processed)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 (setq exec-path (list (concat default-directory "../lib-src")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157 ;; (locate-file-clear-hashing nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 (if (memq system-type '(berkeley-unix next-mach))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 ;; Suboptimal, but we have a unresolved bug somewhere in the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 ;; low-level process code
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 (call-process-internal
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162 "/bin/csh"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 "-fc"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167 (mapconcat
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168 'identity
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 (append
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
170 (list (concat default-directory "../lib-src/make-docfile"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
171 options processed)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
172 " "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
173 ;; (print (prin1-to-string (append options processed)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 (apply 'call-process-internal
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175 ;; (concat default-directory "../lib-src/make-docfile")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
176 "make-docfile"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 (append options processed)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 (princ "Spawning make-docfile ...done\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 ;; (write-region-internal (point-min) (point-max) "/tmp/DOC")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
184 )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
185 (princ "DOC file is up to date\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
187 (kill-emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
188
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189 ;;; make-docfile.el ends here