Commit 9c32788e authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

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.
parent 2bdfaa42
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
;; Copyright (C) 1992 Free Software Foundation, Inc. ;; Copyright (C) 1992 Free Software Foundation, Inc.
;; Author: Francesco Potorti` <pot@cnuce.cnr.it> ;; Author: Francesco Potorti` <pot@cnuce.cnr.it>
;; Version: $Id: cmacexp.el,v 1.10 1994/02/25 06:27:24 rms Exp rms $ ;; Version: $Id: cmacexp.el,v 1.11 1994/04/20 06:12:03 rms Exp rms $
;; Adapted-By: ESR ;; Adapted-By: ESR
;; Keywords: c ;; Keywords: c
...@@ -109,14 +109,14 @@ ...@@ -109,14 +109,14 @@
(provide 'cmacexp) (provide 'cmacexp)
(defvar c-macro-shrink-window-p nil (defvar c-macro-shrink-window-flag nil
"*Non-nil means shrink the *Macroexpansion* window to fit its contents.") "*Non-nil means shrink the *Macroexpansion* window to fit its contents.")
(defvar c-macro-prompt-p nil (defvar c-macro-prompt-flag nil
"*Non-nil makes c-macro-expand prompt for preprocessor arguments.") "*Non-nil makes `c-macro-expand' prompt for preprocessor arguments.")
(defvar c-macro-preprocessor "/lib/cpp -C" "\ (defvar c-macro-preprocessor "/lib/cpp -C"
The preprocessor used by the cmacexp package. "The preprocessor used by the cmacexp package.
If you change this, be sure to preserve the -C (don't strip comments) If you change this, be sure to preserve the -C (don't strip comments)
option, or to set an equivalent one.") option, or to set an equivalent one.")
...@@ -126,15 +126,17 @@ option, or to set an equivalent one.") ...@@ -126,15 +126,17 @@ option, or to set an equivalent one.")
(defconst c-macro-buffer-name "*Macroexpansion*") (defconst c-macro-buffer-name "*Macroexpansion*")
(defun c-macro-expand (start end subst) "\ (defun c-macro-expand (start end subst)
Expand all C macros occurring in the region using c-macro-preprocessor. "Expand C macros in the region, using the C preprocessor.
Normally display output in temp buffer. Normally display output in temp buffer, but
Prefix arg means replace the region with it. prefix arg means replace the region with it.
Prompt for a string of arguments to the preprocessor
\(e.g. -DDEBUG -I ./include) if the user option c-macro-prompt-p is non-nil. `c-macro-preprocessor' specifies the preprocessor to use.
Prompt for arguments to the preprocessor \(e.g. `-DDEBUG -I ./include')
if the user option `c-macro-prompt-flag' is non-nil.
Noninteractive args are START, END, SUBST. Noninteractive args are START, END, SUBST.
For use inside programs see also c-macro-expansion." For use inside Lisp programs, see also `c-macro-expansion'."
(interactive "r\nP") (interactive "r\nP")
(let ((inbuf (current-buffer)) (let ((inbuf (current-buffer))
...@@ -144,7 +146,7 @@ For use inside programs see also c-macro-expansion." ...@@ -144,7 +146,7 @@ For use inside programs see also c-macro-expansion."
(expansion "") (expansion "")
(mymsg "")) (mymsg ""))
;; Build the command string. ;; Build the command string.
(if c-macro-prompt-p (if c-macro-prompt-flag
(setq c-macro-cppflags (setq c-macro-cppflags
(read-string "Preprocessor arguments: " (read-string "Preprocessor arguments: "
c-macro-cppflags))) c-macro-cppflags)))
...@@ -200,10 +202,9 @@ For use inside programs see also c-macro-expansion." ...@@ -200,10 +202,9 @@ For use inside programs see also c-macro-expansion."
;; chosen for display exists already but contains something else, the ;; chosen for display exists already but contains something else, the
;; window is not re-sized. If the window already contains the current ;; window is not re-sized. If the window already contains the current
;; buffer, it is never shrunk, but possibly expanded. Finally, if the ;; buffer, it is never shrunk, but possibly expanded. Finally, if the
;; variable c-macro-shrink-window-p is nil the window size is *never* ;; variable c-macro-shrink-window-flag is nil the window size is *never*
;; changed. ;; changed.
(defun c-macro-display-buffer () (defun c-macro-display-buffer ()
(goto-char (point-min)) (goto-char (point-min))
(c-mode) (c-mode)
(let ((oldwinheight (window-height)) (let ((oldwinheight (window-height))
...@@ -214,7 +215,7 @@ For use inside programs see also c-macro-expansion." ...@@ -214,7 +215,7 @@ For use inside programs see also c-macro-expansion."
(progn (progn
(display-buffer (current-buffer) t) (display-buffer (current-buffer) t)
(setq popped (/= oldwinheight (window-height))))) (setq popped (/= oldwinheight (window-height)))))
(if (and c-macro-shrink-window-p ;user wants fancy shrinking :\) (if (and c-macro-shrink-window-flag ;user wants fancy shrinking :\)
(or alreadythere popped)) (or alreadythere popped))
;; Enlarge up to half screen, or shrink properly. ;; Enlarge up to half screen, or shrink properly.
(let ((oldwin (selected-window)) (let ((oldwin (selected-window))
...@@ -234,8 +235,8 @@ For use inside programs see also c-macro-expansion." ...@@ -234,8 +235,8 @@ For use inside programs see also c-macro-expansion."
(select-window oldwin)))))) (select-window oldwin))))))
(defun c-macro-expansion (start end cppcommand) "\ (defun c-macro-expansion (start end cppcommand)
Run a preprocessor on region and return the output as a string. "Run a preprocessor on region and return the output as a string.
Expand the region between START and END in the current buffer using Expand the region between START and END in the current buffer using
the shell command CPPCOMMAND (e.g. \"/lib/cpp -C -DDEBUG\"). the shell command CPPCOMMAND (e.g. \"/lib/cpp -C -DDEBUG\").
Be sure to use a -C (don't strip comments) or equivalent option." Be sure to use a -C (don't strip comments) or equivalent option."
...@@ -285,7 +286,7 @@ Be sure to use a -C (don't strip comments) or equivalent option." ...@@ -285,7 +286,7 @@ Be sure to use a -C (don't strip comments) or equivalent option."
;(switch-to-buffer outbuf) (debug) ;debugging instructions ;(switch-to-buffer outbuf) (debug) ;debugging instructions
(while (re-search-backward "\n#\\(endif\\|else\\)\\>" start 'move) (while (re-search-backward "\n#\\(endif\\|else\\)\\>" start 'move)
(if (equal (nthcdr 3 (parse-partial-sexp start (point) start-state)) (if (equal (nthcdr 3 (parse-partial-sexp start (point) start-state))
'(nil nil nil 0)) ;neither in string nor in '(nil nil nil 0 nil)) ;neither in string nor in
;comment nor after quote ;comment nor after quote
(progn (progn
(goto-char (match-end 0)) (goto-char (match-end 0))
...@@ -312,13 +313,15 @@ Be sure to use a -C (don't strip comments) or equivalent option." ...@@ -312,13 +313,15 @@ Be sure to use a -C (don't strip comments) or equivalent option."
(let* ((startstat (parse-partial-sexp 1 start)) (let* ((startstat (parse-partial-sexp 1 start))
(startinstring (nth 3 startstat)) (startinstring (nth 3 startstat))
(startincomment (nth 4 startstat)) (startincomment (nth 4 startstat))
(startafterquote (nth 5 startstat))) (startafterquote (nth 5 startstat))
(startinbcomment (nth 6 startstat)))
(concat (if startafterquote " ") (concat (if startafterquote " ")
(cond (startinstring (char-to-string startinstring)) (cond (startinstring (char-to-string startinstring))
(startincomment "*/")) (startincomment "*/"))
(format "\n???!!!???!!!!") (format "\n???!!!???!!!!")
(cond (startinstring (char-to-string startinstring)) (cond (startinstring (char-to-string startinstring))
(startincomment "/*")) (startincomment "/*")
(startinbcomment "//"))
(if startafterquote "\\"))) (if startafterquote "\\")))
linelist)) linelist))
(insert (car linelist)) (insert (car linelist))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment