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)
|
|
41
|
|
42 ;; Gobble up the stuff we don't wish to pass on.
|
|
43 (setq command-line-args (cdr (cdr (cdr (cdr command-line-args)))))
|
|
44
|
|
45 ;; First gather up the command line options.
|
|
46 (let (done)
|
|
47 (while (and (null done) command-line-args)
|
|
48 (let ((arg (car command-line-args)))
|
|
49 (cond ((or (string-equal arg "-o") ; Specify DOC file name
|
|
50 (string-equal arg "-a") ; Append to DOC file
|
|
51 (string-equal arg "-d")) ; Set working directory
|
|
52 (if (string-equal arg "-o")
|
|
53 (setq docfile (car (cdr command-line-args))))
|
|
54 (setq options (cons arg options))
|
|
55 (setq options (cons (car (cdr command-line-args)) options)))
|
|
56 ((string-equal arg "-i") ; Set site files to scan
|
|
57 (setq site-file-list (car (cdr command-line-args))))
|
|
58 (t (setq done t)))
|
|
59 (if (null done)
|
|
60 (setq command-line-args (cdr (cdr command-line-args)))))))
|
|
61 (setq options (nreverse options))
|
|
62
|
|
63 ;; (print (concat "Options: " (prin1-to-string options)))
|
|
64
|
|
65 ;; Next process the list of C files.
|
|
66 (while command-line-args
|
|
67 (let ((arg (car command-line-args)))
|
|
68 (if (null (member arg processed))
|
|
69 (setq processed (cons arg processed))))
|
|
70 (setq command-line-args (cdr command-line-args)))
|
|
71
|
|
72 ;; Then process the list of Lisp files.
|
|
73 (define-function 'defalias 'define-function)
|
|
74 (let ((temp-path (expand-file-name ".." (car load-path))))
|
|
75 (setq load-path (nconc (directory-files temp-path t "^[^-.]"
|
|
76 nil 'dirs-only)
|
|
77 (cons temp-path load-path))))
|
|
78
|
|
79 ;; Then process the autoloads
|
|
80 (setq autoload-file-name "auto-autoloads.elc")
|
|
81 (setq source-directory (concat default-directory "../lisp"))
|
|
82 ;; (print (concat "Source directory: " source-directory))
|
|
83 (require 'packages)
|
|
84
|
|
85 ;; We must have some lisp support at this point
|
|
86
|
|
87 ;(load "backquote")
|
|
88 ;(load "bytecomp-runtime")
|
|
89 ;(load "subr")
|
|
90 ;(load "replace")
|
|
91 ;(load "version.el")
|
|
92 ;(load "cl")
|
|
93
|
|
94 ;; (load "featurep")
|
|
95
|
|
96 (let (dumped-lisp-packages)
|
|
97 (load (concat default-directory "../lisp/prim/dumped-lisp.el"))
|
|
98 (setq dumped-lisp-packages
|
|
99 (append dumped-lisp-packages packages-hardcoded-lisp))
|
|
100 (while dumped-lisp-packages
|
|
101 (let ((arg (packages-add-suffix (car dumped-lisp-packages))))
|
|
102 (setq arg (locate-library arg))
|
|
103 (if (null (member arg processed))
|
|
104 (setq processed (cons arg processed)))
|
|
105 (setq dumped-lisp-packages (cdr dumped-lisp-packages)))))
|
|
106
|
|
107 ;; Finally process the list of site-loaded files.
|
|
108 (if site-file-list
|
|
109 (let (site-load-packages)
|
|
110 (load site-file-list t t)
|
|
111 (while site-load-packages
|
|
112 (let ((arg (car site-load-packages)))
|
|
113 (if (not (member arg processed))
|
|
114 (setq processed (cons arg processed))))
|
|
115 (setq site-load-packages (cdr site-load-packages)))))
|
|
116
|
|
117 (let ((autoloads (list-autoloads)))
|
|
118 ;; (print (concat "Autoloads: " (prin1-to-string autoloads)))
|
|
119 (while autoloads
|
|
120 (let ((arg (car autoloads)))
|
|
121 (if (null (member arg processed))
|
|
122 (setq processed (cons arg processed)))
|
|
123 (setq autoloads (cdr autoloads)))))
|
|
124
|
|
125 ;; Now fire up make-docfile and we're done
|
|
126
|
|
127 (setq processed (nreverse processed))
|
|
128
|
|
129 ;; (print (prin1-to-string (append options processed)))
|
|
130
|
|
131 (print "Spawning make-docfile ...")
|
|
132 ;; (print (prin1-to-string (append options processed)))
|
|
133
|
|
134 (setq exec-path (list (concat default-directory "../lib-src")))
|
|
135
|
|
136 ;; (locate-file-clear-hashing nil)
|
|
137 (apply 'call-process-internal
|
|
138 ;; (concat default-directory "../lib-src/make-docfile")
|
|
139 "make-docfile"
|
|
140 nil
|
|
141 t
|
|
142 nil
|
|
143 (append options processed))
|
|
144
|
|
145 ;; (write-region-internal (point-min) (point-max) "/tmp/DOC")
|
|
146
|
|
147 (kill-emacs)
|
|
148
|
|
149 ;;; make-docfile.el ends here
|