aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-20 06:19:14 +0000
committerRichard M. Stallman1994-04-20 06:19:14 +0000
commit9c32788e36fc877cacb1082bb6f29a54c5b8bcbf (patch)
treedd29851b573fa82f4e1bacb58cede06a2997aa68
parent2bdfaa420caf00148bcc07e2694b12f5ae67c49a (diff)
downloademacs-9c32788e36fc877cacb1082bb6f29a54c5b8bcbf.tar.gz
emacs-9c32788e36fc877cacb1082bb6f29a54c5b8bcbf.zip
Doc fixes.
(c-macro-expansion): Handle a and b comment styles. (c-macro-shrink-window-flag): Renamed from c-macro-shrink-window-p. (c-macro-prompt-flag): Renamed from c-macro-prompt-p.
-rw-r--r--lisp/progmodes/cmacexp.el49
1 files changed, 26 insertions, 23 deletions
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index e4c22f0dbe7..5898cecb16e 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -3,7 +3,7 @@
3;; Copyright (C) 1992 Free Software Foundation, Inc. 3;; Copyright (C) 1992 Free Software Foundation, Inc.
4 4
5;; Author: Francesco Potorti` <pot@cnuce.cnr.it> 5;; Author: Francesco Potorti` <pot@cnuce.cnr.it>
6;; Version: $Id: cmacexp.el,v 1.10 1994/02/25 06:27:24 rms Exp rms $ 6;; Version: $Id: cmacexp.el,v 1.11 1994/04/20 06:12:03 rms Exp rms $
7;; Adapted-By: ESR 7;; Adapted-By: ESR
8;; Keywords: c 8;; Keywords: c
9 9
@@ -109,14 +109,14 @@
109 109
110(provide 'cmacexp) 110(provide 'cmacexp)
111 111
112(defvar c-macro-shrink-window-p nil 112(defvar c-macro-shrink-window-flag nil
113 "*Non-nil means shrink the *Macroexpansion* window to fit its contents.") 113 "*Non-nil means shrink the *Macroexpansion* window to fit its contents.")
114 114
115(defvar c-macro-prompt-p nil 115(defvar c-macro-prompt-flag nil
116 "*Non-nil makes c-macro-expand prompt for preprocessor arguments.") 116 "*Non-nil makes `c-macro-expand' prompt for preprocessor arguments.")
117 117
118(defvar c-macro-preprocessor "/lib/cpp -C" "\ 118(defvar c-macro-preprocessor "/lib/cpp -C"
119The preprocessor used by the cmacexp package. 119 "The preprocessor used by the cmacexp package.
120 120
121If you change this, be sure to preserve the -C (don't strip comments) 121If you change this, be sure to preserve the -C (don't strip comments)
122option, or to set an equivalent one.") 122option, or to set an equivalent one.")
@@ -126,15 +126,17 @@ option, or to set an equivalent one.")
126 126
127(defconst c-macro-buffer-name "*Macroexpansion*") 127(defconst c-macro-buffer-name "*Macroexpansion*")
128 128
129(defun c-macro-expand (start end subst) "\ 129(defun c-macro-expand (start end subst)
130Expand all C macros occurring in the region using c-macro-preprocessor. 130 "Expand C macros in the region, using the C preprocessor.
131Normally display output in temp buffer. 131Normally display output in temp buffer, but
132Prefix arg means replace the region with it. 132prefix arg means replace the region with it.
133Prompt for a string of arguments to the preprocessor 133
134\(e.g. -DDEBUG -I ./include) if the user option c-macro-prompt-p is non-nil. 134`c-macro-preprocessor' specifies the preprocessor to use.
135Prompt for arguments to the preprocessor \(e.g. `-DDEBUG -I ./include')
136if the user option `c-macro-prompt-flag' is non-nil.
135 137
136Noninteractive args are START, END, SUBST. 138Noninteractive args are START, END, SUBST.
137For use inside programs see also c-macro-expansion." 139For use inside Lisp programs, see also `c-macro-expansion'."
138 140
139 (interactive "r\nP") 141 (interactive "r\nP")
140 (let ((inbuf (current-buffer)) 142 (let ((inbuf (current-buffer))
@@ -144,7 +146,7 @@ For use inside programs see also c-macro-expansion."
144 (expansion "") 146 (expansion "")
145 (mymsg "")) 147 (mymsg ""))
146 ;; Build the command string. 148 ;; Build the command string.
147 (if c-macro-prompt-p 149 (if c-macro-prompt-flag
148 (setq c-macro-cppflags 150 (setq c-macro-cppflags
149 (read-string "Preprocessor arguments: " 151 (read-string "Preprocessor arguments: "
150 c-macro-cppflags))) 152 c-macro-cppflags)))
@@ -200,10 +202,9 @@ For use inside programs see also c-macro-expansion."
200;; chosen for display exists already but contains something else, the 202;; chosen for display exists already but contains something else, the
201;; window is not re-sized. If the window already contains the current 203;; window is not re-sized. If the window already contains the current
202;; buffer, it is never shrunk, but possibly expanded. Finally, if the 204;; buffer, it is never shrunk, but possibly expanded. Finally, if the
203;; variable c-macro-shrink-window-p is nil the window size is *never* 205;; variable c-macro-shrink-window-flag is nil the window size is *never*
204;; changed. 206;; changed.
205(defun c-macro-display-buffer () 207(defun c-macro-display-buffer ()
206
207 (goto-char (point-min)) 208 (goto-char (point-min))
208 (c-mode) 209 (c-mode)
209 (let ((oldwinheight (window-height)) 210 (let ((oldwinheight (window-height))
@@ -214,7 +215,7 @@ For use inside programs see also c-macro-expansion."
214 (progn 215 (progn
215 (display-buffer (current-buffer) t) 216 (display-buffer (current-buffer) t)
216 (setq popped (/= oldwinheight (window-height))))) 217 (setq popped (/= oldwinheight (window-height)))))
217 (if (and c-macro-shrink-window-p ;user wants fancy shrinking :\) 218 (if (and c-macro-shrink-window-flag ;user wants fancy shrinking :\)
218 (or alreadythere popped)) 219 (or alreadythere popped))
219 ;; Enlarge up to half screen, or shrink properly. 220 ;; Enlarge up to half screen, or shrink properly.
220 (let ((oldwin (selected-window)) 221 (let ((oldwin (selected-window))
@@ -234,8 +235,8 @@ For use inside programs see also c-macro-expansion."
234 (select-window oldwin)))))) 235 (select-window oldwin))))))
235 236
236 237
237(defun c-macro-expansion (start end cppcommand) "\ 238(defun c-macro-expansion (start end cppcommand)
238Run a preprocessor on region and return the output as a string. 239 "Run a preprocessor on region and return the output as a string.
239Expand the region between START and END in the current buffer using 240Expand the region between START and END in the current buffer using
240the shell command CPPCOMMAND (e.g. \"/lib/cpp -C -DDEBUG\"). 241the shell command CPPCOMMAND (e.g. \"/lib/cpp -C -DDEBUG\").
241Be sure to use a -C (don't strip comments) or equivalent option." 242Be sure to use a -C (don't strip comments) or equivalent option."
@@ -285,8 +286,8 @@ Be sure to use a -C (don't strip comments) or equivalent option."
285 ;(switch-to-buffer outbuf) (debug) ;debugging instructions 286 ;(switch-to-buffer outbuf) (debug) ;debugging instructions
286 (while (re-search-backward "\n#\\(endif\\|else\\)\\>" start 'move) 287 (while (re-search-backward "\n#\\(endif\\|else\\)\\>" start 'move)
287 (if (equal (nthcdr 3 (parse-partial-sexp start (point) start-state)) 288 (if (equal (nthcdr 3 (parse-partial-sexp start (point) start-state))
288 '(nil nil nil 0)) ;neither in string nor in 289 '(nil nil nil 0 nil)) ;neither in string nor in
289 ;comment nor after quote 290 ;comment nor after quote
290 (progn 291 (progn
291 (goto-char (match-end 0)) 292 (goto-char (match-end 0))
292;;; (setq linenum (count-lines 1 (point))) 293;;; (setq linenum (count-lines 1 (point)))
@@ -312,13 +313,15 @@ Be sure to use a -C (don't strip comments) or equivalent option."
312 (let* ((startstat (parse-partial-sexp 1 start)) 313 (let* ((startstat (parse-partial-sexp 1 start))
313 (startinstring (nth 3 startstat)) 314 (startinstring (nth 3 startstat))
314 (startincomment (nth 4 startstat)) 315 (startincomment (nth 4 startstat))
315 (startafterquote (nth 5 startstat))) 316 (startafterquote (nth 5 startstat))
317 (startinbcomment (nth 6 startstat)))
316 (concat (if startafterquote " ") 318 (concat (if startafterquote " ")
317 (cond (startinstring (char-to-string startinstring)) 319 (cond (startinstring (char-to-string startinstring))
318 (startincomment "*/")) 320 (startincomment "*/"))
319 (format "\n???!!!???!!!!") 321 (format "\n???!!!???!!!!")
320 (cond (startinstring (char-to-string startinstring)) 322 (cond (startinstring (char-to-string startinstring))
321 (startincomment "/*")) 323 (startincomment "/*")
324 (startinbcomment "//"))
322 (if startafterquote "\\"))) 325 (if startafterquote "\\")))
323 linelist)) 326 linelist))
324 (insert (car linelist)) 327 (insert (car linelist))