;;; cc-defs.el --- compile time definitions for CC Mode
-;; Copyright (C) 1985, 1987, 1992-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2014 Free Software Foundation, Inc.
;; Authors: 2003- Alan Mackenzie
;; 1998- Martin Stjernholm
;; Silence the compiler.
(cc-bytecomp-defvar c-enable-xemacs-performance-kludge-p) ; In cc-vars.el
-(cc-bytecomp-defun buffer-syntactic-context-depth) ; XEmacs
(cc-bytecomp-defun region-active-p) ; XEmacs
-(cc-bytecomp-defvar zmacs-region-stays) ; XEmacs
-(cc-bytecomp-defvar zmacs-regions) ; XEmacs
(cc-bytecomp-defvar mark-active) ; Emacs
(cc-bytecomp-defvar deactivate-mark) ; Emacs
(cc-bytecomp-defvar inhibit-point-motion-hooks) ; Emacs
(cc-bytecomp-defvar parse-sexp-lookup-properties) ; Emacs
(cc-bytecomp-defvar text-property-default-nonsticky) ; Emacs 21
-(cc-bytecomp-defvar lookup-syntax-properties) ; XEmacs
(cc-bytecomp-defun string-to-syntax) ; Emacs 21
\f
\f
;;; Variables also used at compile time.
-(defconst c-version "5.31.8"
+(defconst c-version "5.32.5"
"CC Mode version number.")
(defconst c-version-sym (intern c-version))
(defmacro c-region-is-active-p ()
;; Return t when the region is active. The determination of region
;; activeness is different in both Emacs and XEmacs.
+ ;; FIXME? Emacs has region-active-p since 23.1, so maybe this test
+ ;; should be updated.
(if (cc-bytecomp-boundp 'mark-active)
;; Emacs.
'mark-active
(defmacro c-set-region-active (activate)
;; Activate the region if ACTIVE is non-nil, deactivate it
;; otherwise. Covers the differences between Emacs and XEmacs.
- (if (cc-bytecomp-fboundp 'zmacs-activate-region)
+ (if (fboundp 'zmacs-activate-region)
;; XEmacs.
`(if ,activate
(zmacs-activate-region)
`(int-to-char ,integer)
integer))
+(defmacro c-last-command-char ()
+ ;; The last character just typed. Note that `last-command-event' exists in
+ ;; both Emacs and XEmacs, but with confusingly different meanings.
+ (if (featurep 'xemacs)
+ 'last-command-char
+ 'last-command-event))
+
(defmacro c-sentence-end ()
;; Get the regular expression `sentence-end'.
(if (cc-bytecomp-fboundp 'sentence-end)
(let ((saved-undo-list (elt saved-state 0)))
(if (eq buffer-undo-list saved-undo-list)
- ;; No change was done afterall.
+ ;; No change was done after all.
(setq buffer-undo-list (cdr saved-undo-list))
(if keep
`(c-forward-sexp ,(if (numberp count) (- count) `(- ,count))))
(defmacro c-safe-scan-lists (from count depth &optional limit)
- "Like `scan-lists' but returns nil instead of signalling errors
+ "Like `scan-lists' but returns nil instead of signaling errors
for unbalanced parens.
A limit for the search may be given. FROM is assumed to be on the
;; `c-parse-state'.
`(progn
- (if (and ,(cc-bytecomp-fboundp 'buffer-syntactic-context-depth)
+ (if (and ,(fboundp 'buffer-syntactic-context-depth)
c-enable-xemacs-performance-kludge-p)
- ,(when (cc-bytecomp-fboundp 'buffer-syntactic-context-depth)
+ ,(when (fboundp 'buffer-syntactic-context-depth)
;; XEmacs only. This can improve the performance of
;; c-parse-state to between 3 and 60 times faster when
;; braces are hung. It can also degrade performance by
;; V i r t u a l S e m i c o l o n s
;;
;; In most CC Mode languages, statements are terminated explicitly by
-;; semicolons or closing braces. In some of the CC modes (currently only AWK
-;; Mode (April 2004)), statements are (or can be) terminated by EOLs. Such a
-;; statement is said to be terminated by a "virtual semicolon" (VS). A
-;; statement terminated by an actual semicolon or brace is never considered to
-;; have a VS.
+;; semicolons or closing braces. In some of the CC modes (currently AWK Mode
+;; and certain user-specified #define macros in C, C++, etc. (November 2008)),
+;; statements are (or can be) terminated by EOLs. Such a statement is said to
+;; be terminated by a "virtual semicolon" (VS). A statement terminated by an
+;; actual semicolon or brace is never considered to have a VS.
;;
;; The indentation engine (or whatever) tests for a VS at a specific position
;; by invoking the macro `c-at-vsemi-p', which in its turn calls the mode
;; specific function (if any) which is the value of the language variable
-;; `c-at-vsemi-p-fn'. The actual details of what constitutes a VS in a
-;; language are thus encapsulated in code specific to that language
-;; (e.g. cc-awk.el). `c-at-vsemi-p' returns non-nil if point (or the optional
-;; parameter POS) is at a VS, nil otherwise.
+;; `c-at-vsemi-p-fn'. This function should only use "low-level" features of
+;; CC Mode, i.e. features which won't trigger infinite recursion. ;-) The
+;; actual details of what constitutes a VS in a language are thus encapsulated
+;; in code specific to that language (e.g. cc-awk.el). `c-at-vsemi-p' returns
+;; non-nil if point (or the optional parameter POS) is at a VS, nil otherwise.
;;
;; The language specific function might well do extensive analysis of the
-;; source text, and may use a cacheing scheme to speed up repeated calls.
+;; source text, and may use a caching scheme to speed up repeated calls.
;;
;; The "virtual semicolon" lies just after the last non-ws token on the line.
;; Like POINT, it is considered to lie between two characters. For example,
;; In addition to `c-at-vsemi-p-fn', a mode may need to supply a function for
;; `c-vsemi-status-unknown-p-fn'. The macro `c-vsemi-status-unknown-p' is a
;; rather recondite kludge. It exists because the function
-;; `c-beginning-of-statement-1' sometimes tests for VSs as an optimisation,
+;; `c-beginning-of-statement-1' sometimes tests for VSs as an optimization,
;; but `c-at-vsemi-p' might well need to call `c-beginning-of-statement-1' in
;; its calculations, thus potentially leading to infinite recursion.
;;
;; `c-beginning-of-statement-1'. `c-vsemi-status-unknown-p' may not itself
;; call `c-beginning-of-statement-1'.
;;
-;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing
+;; The macro `c-vsemi-status-unknown-p' will typically check the caching
;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is
;; "unknown" if there is no cache entry current for the line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make edebug understand the macros.
;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
; '(progn
-(def-edebug-spec cc-eval-when-compile t)
+(def-edebug-spec cc-eval-when-compile (&rest def-form))
(def-edebug-spec c-point t)
(def-edebug-spec c-set-region-active t)
(def-edebug-spec c-safe t)
;; which introduces a CPP construct and every EOL (or EOB, or character
;; preceding //, etc.) which terminates it. We can instantly "comment
;; out" all CPP constructs by giving `c-cpp-delimiter' a syntax-table
-;; propery '(14) (generic comment delimiter).
+;; property '(14) (generic comment delimiter).
(defmacro c-set-cpp-delimiters (beg end)
;; This macro does a hidden buffer change.
`(progn
(let ((buf (generate-new-buffer " test"))
parse-sexp-lookup-properties
parse-sexp-ignore-comments
- lookup-syntax-properties)
+ lookup-syntax-properties) ; XEmacs
(with-current-buffer buf
(set-syntax-table (make-syntax-table))
(t
;; Being evaluated interactively.
(buffer-file-name)))))
- (and file
- (file-name-sans-extension
- (file-name-nondirectory file)))))
+ (and file (file-name-base file))))
(defmacro c-lang-defconst-eval-immediately (form)
"Can be used inside a VAL in `c-lang-defconst' to evaluate FORM
(eval form))
;; Only used at compile time - suppress "might not be defined at runtime".
-(declare-function cl-macroexpand-all "cl-extra" (form &optional env))
+(declare-function cl-macroexpand-all "cl" (form &optional env))
(defmacro c-lang-defconst (name &rest args)
"Set the language specific values of the language constant NAME.