annotate lisp/prim/make-docfile.el @ 163:0132846995bd r20-3b8

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