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