]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-defs.el
(ada-gnatls-args): Fix docstring.
[gnu-emacs] / lisp / progmodes / cc-defs.el
index b68e167ffa01d4ee52272bbcd747368eea492cef..e932456fa9129750084dd83db20332c37693c1bb 100644 (file)
@@ -1,9 +1,11 @@
 ;;; cc-defs.el --- compile time definitions for CC Mode
 
-;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   Free Software Foundation, Inc.
 
-;; Authors:    1998- Martin Stjernholm
+;; Authors:    2003- Alan Mackenzie
+;;             1998- Martin Stjernholm
 ;;             1992-1999 Barry A. Warsaw
 ;;             1987 Dave Detlefs and Stewart Clamen
 ;;             1985 Richard M. Stallman
@@ -16,7 +18,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
          (not (fboundp 'push)))
       (cc-load "cc-fix")))
 
-(eval-after-load "font-lock"
-  '(if (and (not (featurep 'cc-fix)) ; only load the file once.
-            (let (font-lock-keywords)
-              (font-lock-compile-keywords '("\\<\\>"))
-             font-lock-keywords))     ; did the previous call foul this up?
-       (load "cc-fix")))
+; (eval-after-load "font-lock"  ; 2006-07-09.  font-lock is now preloaded
+;   '
+(if (and (not (featurep 'cc-fix)) ; only load the file once.
+        (featurep 'xemacs)     ; There is now (2005/12) code in GNU Emacs CVS
+                               ; to make the call to f-l-c-k throw an error.
+        (let (font-lock-keywords)
+          (font-lock-compile-keywords '("\\<\\>"))
+          font-lock-keywords))     ; did the previous call foul this up?
+    (load "cc-fix")) ;)
 
 ;; The above takes care of the delayed loading, but this is necessary
 ;; to ensure correct byte compilation.
 (eval-when-compile
   (if (and (not (featurep 'cc-fix))
+          (featurep 'xemacs)
           (progn
             (require 'font-lock)
             (let (font-lock-keywords)
@@ -90,7 +96,7 @@
 \f
 ;;; Variables also used at compile time.
 
-(defconst c-version "5.31"
+(defconst c-version "5.31.4"
   "CC Mode version number.")
 
 (defconst c-version-sym (intern c-version))
@@ -574,6 +580,24 @@ right side of it."
 ;; Wrappers for common scan-lists cases, mainly because it's almost
 ;; impossible to get a feel for how that function works.
 
+(defmacro c-go-list-forward ()
+  "Move backward across one balanced group of parentheses.
+
+Return POINT when we succeed, NIL when we fail.  In the latter case, leave
+point unmoved."
+  `(c-safe (let ((endpos (scan-lists (point) 1 0)))
+            (goto-char endpos)
+            endpos)))
+
+(defmacro c-go-list-backward ()
+  "Move backward across one balanced group of parentheses.
+
+Return POINT when we succeed, NIL when we fail.  In the latter case, leave
+point unmoved."
+  `(c-safe (let ((endpos (scan-lists (point) -1 0)))
+            (goto-char endpos)
+            endpos)))
+
 (defmacro c-up-list-forward (&optional pos limit)
   "Return the first position after the list sexp containing POS,
 or nil if no such position exists.  The point is used if POS is left out.
@@ -684,7 +708,8 @@ be after it."
            ;; c-parse-state to between 3 and 60 times faster when
            ;; braces are hung.  It can also degrade performance by
            ;; about as much when braces are not hung.
-           '(let (pos)
+           '(let (beginning-of-defun-function end-of-defun-function
+                                              pos)
               (while (not pos)
                 (save-restriction
                   (widen)
@@ -707,7 +732,8 @@ be after it."
                  ))
               (goto-char pos)))
        ;; Emacs, which doesn't have buffer-syntactic-context-depth
-       (beginning-of-defun))
+       (let (beginning-of-defun-function end-of-defun-function)
+        (beginning-of-defun)))
      ;; if defun-prompt-regexp is non-nil, b-o-d won't leave us at the
      ;; open brace.
      (and defun-prompt-regexp
@@ -716,7 +742,7 @@ be after it."
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; V i r t u a l   S e m i c o l o n s 
+;; 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
@@ -759,8 +785,8 @@ be after it."
 ;; call `c-beginning-of-statement-1'.
 ;;
 ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing
-;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is
-;; "unknown" if there is no cache entry current for the line. 
+;; 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.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defmacro c-at-vsemi-p (&optional pos)
@@ -1031,35 +1057,35 @@ MODE is either a mode symbol or a list of mode symbols."
 
 \f
 ;; Make edebug understand the macros.
-(eval-after-load "edebug"
-  '(progn
-     (def-edebug-spec cc-eval-when-compile t)
-     (def-edebug-spec c-point t)
-     (def-edebug-spec c-set-region-active t)
-     (def-edebug-spec c-safe t)
-     (def-edebug-spec c-save-buffer-state let*)
-     (def-edebug-spec c-tentative-buffer-changes t)
-     (def-edebug-spec c-forward-syntactic-ws t)
-     (def-edebug-spec c-backward-syntactic-ws t)
-     (def-edebug-spec c-forward-sexp t)
-     (def-edebug-spec c-backward-sexp t)
-     (def-edebug-spec c-up-list-forward t)
-     (def-edebug-spec c-up-list-backward t)
-     (def-edebug-spec c-down-list-forward t)
-     (def-edebug-spec c-down-list-backward t)
-     (def-edebug-spec c-add-syntax t)
-     (def-edebug-spec c-add-class-syntax t)
-     (def-edebug-spec c-benign-error t)
-     (def-edebug-spec c-with-syntax-table t)
-     (def-edebug-spec c-skip-ws-forward t)
-     (def-edebug-spec c-skip-ws-backward t)
-     (def-edebug-spec c-major-mode-is t)
-     (def-edebug-spec c-put-char-property t)
-     (def-edebug-spec c-get-char-property t)
-     (def-edebug-spec c-clear-char-property t)
-     (def-edebug-spec c-clear-char-properties t)
-     (def-edebug-spec c-put-overlay t)
-     (def-edebug-spec c-delete-overlay t)))
+;(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 c-point t)
+(def-edebug-spec c-set-region-active t)
+(def-edebug-spec c-safe t)
+(def-edebug-spec c-save-buffer-state let*)
+(def-edebug-spec c-tentative-buffer-changes t)
+(def-edebug-spec c-forward-syntactic-ws t)
+(def-edebug-spec c-backward-syntactic-ws t)
+(def-edebug-spec c-forward-sexp t)
+(def-edebug-spec c-backward-sexp t)
+(def-edebug-spec c-up-list-forward t)
+(def-edebug-spec c-up-list-backward t)
+(def-edebug-spec c-down-list-forward t)
+(def-edebug-spec c-down-list-backward t)
+(def-edebug-spec c-add-syntax t)
+(def-edebug-spec c-add-class-syntax t)
+(def-edebug-spec c-benign-error t)
+(def-edebug-spec c-with-syntax-table t)
+(def-edebug-spec c-skip-ws-forward t)
+(def-edebug-spec c-skip-ws-backward t)
+(def-edebug-spec c-major-mode-is t)
+(def-edebug-spec c-put-char-property t)
+(def-edebug-spec c-get-char-property t)
+(def-edebug-spec c-clear-char-property t)
+(def-edebug-spec c-clear-char-properties t)
+(def-edebug-spec c-put-overlay t)
+(def-edebug-spec c-delete-overlay t) ;))
 
 \f
 ;;; Functions.
@@ -1400,11 +1426,11 @@ non-nil, a caret is prepended to invert the set."
        (modify-syntax-entry ?< ".")
        (modify-syntax-entry ?> ".")
        (insert "<()>")
-       (c-mark-<-as-paren 1)
-       (c-mark->-as-paren 4)
-       (goto-char 1)
+       (c-mark-<-as-paren (point-min))
+       (c-mark->-as-paren (+ 3 (point-min)))
+       (goto-char (point-min))
        (c-forward-sexp)
-       (if (= (point) 5)
+       (if (= (point) (+ 4 (point-min)))
            (setq list (cons 'syntax-properties list))
          (error (concat
                  "CC Mode is incompatible with this version of Emacs - "
@@ -1464,7 +1490,8 @@ non-nil, a caret is prepended to invert the set."
       (kill-buffer buf))
 
     ;; See if `parse-partial-sexp' returns the eighth element.
-    (if (c-safe (>= (length (save-excursion (parse-partial-sexp 1 1))) 10))
+    (if (c-safe (>= (length (save-excursion (parse-partial-sexp (point) (point))))
+                   10))
        (setq list (cons 'pps-extended-state list))
       (error (concat
              "CC Mode is incompatible with this version of Emacs - "
@@ -1489,8 +1516,8 @@ might be present:
                    (i.e. the syntax class `|').
 'pps-extended-state `parse-partial-sexp' returns a list with at least 10
                    elements, i.e. it contains the position of the start of
-                   the last comment or string. It's always set - CC Mode no
-                   longer works in emacsen without this feature.
+                   the last comment or string.  It's always set - CC Mode
+                    no longer works in emacsen without this feature.
 'posix-char-classes The regexp engine understands POSIX character classes.
 'col-0-paren        It's possible to turn off the ad-hoc rule that a paren
                    in column zero is the start of a defun.
@@ -1614,7 +1641,7 @@ itself is evaluated."
 
 (defmacro c-lang-defconst (name &rest args)
   "Set the language specific values of the language constant NAME.
-The second argument can be an optional docstring.  The rest of the
+The second argument can optionally be a docstring.  The rest of the
 arguments are one or more repetitions of LANG VAL where LANG specifies
 the language(s) that VAL applies to.  LANG is the name of the
 language, i.e. the mode name without the \"-mode\" suffix, or a list
@@ -1711,7 +1738,7 @@ constant.  A file is identified by its base name."
        ;; Emacs has a weird bug where it seems to fail to read
        ;; backquote lists from byte compiled files correctly (,@
        ;; forms, to be specific), so make sure the bindings in the
-       ;; expansion below doesn't contain any backquote stuff.
+       ;; expansion below don't contain any backquote stuff.
        ;; (XEmacs handles it correctly and doesn't need this for that
        ;; reason, but we also use this expansion handle
        ;; `c-lang-defconst-eval-immediately' and to register
@@ -1734,9 +1761,10 @@ constant.  A file is identified by its base name."
                               ,@(and pre-files `(',pre-files))))))
 
 (put 'c-lang-defconst 'lisp-indent-function 1)
-(eval-after-load "edebug"
-  '(def-edebug-spec c-lang-defconst
-     (&define name [&optional stringp] [&rest sexp def-form])))
+;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
+;  '
+(def-edebug-spec c-lang-defconst
+  (&define name [&optional stringp] [&rest sexp def-form]))
 
 (defun c-define-lang-constant (name bindings &optional pre-files)
   ;; Used by `c-lang-defconst'.