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