Mercurial > emacs
annotate lisp/progmodes/cmacexp.el @ 1631:9c52fcf232bf
Fri Nov 20 05:24:16 1992 Jim Blandy (jimb@totoro.cs.oberlin.edu)
* config.sub: Added machines and operating systems for Emacs
ports, since Emacs now uses config.sub for its configuration.
New manufacturers recognized not to be operating systems: High
Level Hardware (highlevel, defaults to using BSD), Gould
(gould, defaults to System V), Commodore (cbm, defaults to
amigados), National Semiconductor (ns, defaults to Genix), and
Masscomp (masscomp, defaults to RTU).
Recognize the NS1600 (ns16k) and the Clipper (clipper) as
processors.
Recognize these processors with default manufacturers: the
Cydra (cydra) from Cydrome (cydrome), the XPS100 (xps100) from
Honeywell (honeywell), and the Orion (orion) and Orion 1/05
(orion105) from High Level Hardware (highlevel).
If the ISC operating system is given with a version number,
don't kill it and set it to 2.2; just have it default to 2.2
if omitted.
Make Irix SGI's default operating system, not SYSV.
Make BSD Encore's default, so it applies for all Encore
machines, not just the umax and mmax abbreviations.
All of Encore's machines use BSD, not just the ns32k-based
ones. Make it the manufacturer's default.
Make it possible to specify an operating system for a Gould
machine. Make sysv the manufacturer's default, so it applies
when we specify the manufacturer as well as when we omit it.
Add Uniplus (uniplus), Iris (iris), Xenix (xenix), and RTU
(rtu) as recognized operating system names.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Fri, 20 Nov 1992 17:14:50 +0000 |
parents | 213978acbc1e |
children | 1c7d06764d0d |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
612
diff
changeset
|
1 ;;; cmacexp.el --- C macro expansion |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
612
diff
changeset
|
2 |
845 | 3 ;; Copyright (C) 1988 Free Software Foundation, Inc. |
4 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
5 ;; Maintainer: FSF |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
6 ;; Keywords: c |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
7 |
315 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
315 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
24 ;;; Code: |
315 | 25 |
26 (defvar c-macro-preprocessor "/lib/cpp" | |
27 "*Command to be used for C preprocessing.") | |
28 | |
29 (defvar c-macro-options nil | |
30 "*List of options to use in C preprocessing. | |
31 Each string in the list becomes a separate argument to the preprocessor. | |
32 These arguments precede the filename. | |
33 Use the `-I' option here to specify directories for header files.") | |
34 | |
35 (defun c-macro-expand (beg end) | |
36 "Display the result of expanding all C macros occurring in the region. | |
37 The expansion is entirely correct because it uses the C preprocessor. | |
38 You can use the variables `c-macro-preprocessor' and `c-macro-options' | |
612
68ef62058595
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
315
diff
changeset
|
39 to customize how preprocessing is done, or specify header file directories |
68ef62058595
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
315
diff
changeset
|
40 and macros to predefine." |
315 | 41 (interactive "r") |
42 (let ((outbuf (get-buffer-create "*Macroexpansion*")) | |
43 (tempfile "%%macroexpand%%") | |
44 process | |
45 last-needed) | |
46 (save-excursion | |
47 (set-buffer outbuf) | |
48 (erase-buffer)) | |
49 (setq process (apply 'start-process "macros" outbuf c-macro-preprocessor | |
50 c-macro-options)) | |
51 (set-process-sentinel process '(lambda (&rest x))) | |
52 (save-restriction | |
53 (widen) | |
54 (save-excursion | |
55 (goto-char beg) | |
56 (beginning-of-line) | |
57 (setq last-needed (point)) | |
58 (if (re-search-backward "^[ \t]*#" nil t) | |
59 (progn | |
60 ;; Skip continued lines. | |
61 (while (progn (end-of-line) (= (preceding-char) ?\\)) | |
62 (forward-line 1)) | |
63 ;; Skip the last line of the macro definition we found. | |
64 (forward-line 1) | |
65 (setq last-needed (point))))) | |
66 (write-region (point-min) last-needed tempfile nil 'nomsg) | |
67 ;; Output comment ender in case last #-directive is inside a comment. | |
68 ;; Also, terminate any string that we are in. | |
69 (write-region "*//*\"*/\n" nil tempfile t 'nomsg) | |
70 (write-region beg end (concat tempfile "x") nil 'nomsg) | |
71 (process-send-string process (concat "#include \"" tempfile "\"\n")) | |
72 (process-send-string process "\n") | |
73 (process-send-string process (concat "#include \"" tempfile "x\"\n")) | |
74 (process-send-eof process)) | |
75 (while (eq (process-status process) 'run) | |
76 (accept-process-output)) | |
77 (delete-file tempfile) | |
78 (delete-file (concat tempfile "x")) | |
79 (display-buffer outbuf) | |
80 (save-excursion | |
81 (set-buffer outbuf) | |
82 (goto-char (point-max)) | |
83 (forward-line -1) | |
84 (delete-region (point) (point-max)) | |
85 (re-search-backward "\n# 1 ") | |
86 (forward-line 2) | |
87 (while (eolp) (delete-char 1)) | |
88 (delete-region (point-min) (point))) | |
89 (display-buffer outbuf))) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
612
diff
changeset
|
90 |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
612
diff
changeset
|
91 ;;; cmacexp.el ends here |