]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/ctxt.el
Merge from emacs-23; up to 2010-05-28T19:18:47Z!juri@jurta.org.
[gnu-emacs] / lisp / cedet / semantic / ctxt.el
index 40da8153aec70347bf34c6aaaf7d908f9810f17c..08049201756b4996008c4529c1c8280b42cc81c4 100644 (file)
@@ -1,7 +1,6 @@
 ;;; semantic/ctxt.el --- Context calculations for Semantic tools.
 
-;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-;;; 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
@@ -31,7 +30,6 @@
 ;; the current context is calculated.
 ;;
 (require 'semantic)
-(require 'semantic/find)
 
 ;;; Code:
 (defvar semantic-command-separation-character
@@ -50,6 +48,8 @@ Used for identifying arguments to functions.")
 ;;
 ;; These context are nested blocks of code, such as code in an
 ;; if clause
+(declare-function semantic-current-tag-of-class "semantic/find")
+
 (define-overloadable-function semantic-up-context (&optional point bounds-type)
   "Move point up one context from POINT.
 Return non-nil if there are no more context levels.
@@ -59,6 +59,7 @@ movement to.  If this is nil, 'function is used.
 This will find the smallest tag of that class (function, variable,
 type, etc) and make sure non-nil is returned if you cannot
 go up past the bounds of that tag."
+  (require 'semantic/find)
   (if point (goto-char point))
   (let ((nar (semantic-current-tag-of-class (or bounds-type 'function))))
     (if nar
@@ -84,7 +85,7 @@ Return non-nil if there is no upper context.
 The default behavior uses `semantic-up-context'.")
 
 (defun semantic-beginning-of-context-default (&optional point)
-  "Move POINT to the beginning of the current context via parenthisis.
+  "Move POINT to the beginning of the current context via parenthesis.
 Return non-nil if there is no upper context."
   (if point (goto-char point))
   (if (semantic-up-context)
@@ -99,7 +100,7 @@ Be default, this uses `semantic-up-context', and assumes parenthetical
 block delimiters.")
 
 (defun semantic-end-of-context-default (&optional point)
-  "Move POINT to the end of the current context via parenthisis.
+  "Move POINT to the end of the current context via parenthesis.
 Return non-nil if there is no upper context."
   (if point (goto-char point))
   (let ((start (point)))
@@ -154,15 +155,11 @@ Return non-nil if there is no upper context."
   "Get the local variables based on POINT's context.
 Local variables are returned in Semantic tag format.
 This can be overriden with `get-local-variables'."
-  ;; The working status is to let the parser work properly
-  (let ((semantic--progress-reporter
-        (make-progress-reporter (semantic-parser-working-message "Local")
-                                0 100)))
+  ;; Disable parsing messages
+  (let ((semantic--progress-reporter nil))
     (save-excursion
       (if point (goto-char point))
-      (let* ((semantic-working-type nil)
-            ;; Disable parsing messages
-            (case-fold-search semantic-case-fold))
+      (let* ((case-fold-search semantic-case-fold))
        (:override-with-args ())))))
 
 (defun semantic-get-local-variables-default ()
@@ -508,7 +505,7 @@ cursor is on the text representing that function.")
 
 (defun semantic-ctxt-current-function-default (&optional point)
   "Return the current function call the cursor is in at POINT.
-The call will be identifed for C like langauges with the form
+The call will be identified for C like languages with the form
  NAME ( args ... )"
   (if point (goto-char point))
   (let ((case-fold-search semantic-case-fold))
@@ -574,6 +571,7 @@ Assume a functional typed language.  Uses very simple rules."
        '(type)
        ))))
 
+;;;###autoload
 (define-overloadable-function semantic-ctxt-current-mode (&optional point)
   "Return the major mode active at POINT.
 POINT defaults to the value of point in current buffer.
@@ -599,14 +597,25 @@ that may or may not have a name.)")
 (defun semantic-ctxt-scoped-types-default (&optional point)
   "Return a list of scoped types by name for the current context at POINT.
 This is very different for various languages, and does nothing unless
-overriden."
-  (if point (goto-char point))
-  (let ((case-fold-search semantic-case-fold))
-    ;; We need to look at TYPES within the bounds of locally parse arguments.
-    ;; C needs to find using statements and the like too.  Bleh.
-    nil
-    ))
+overridden."
+  nil)
+
+(define-overloadable-function semantic-ctxt-imported-packages (&optional point)
+  "Return a list of package tags or names which are being imported at POINT.
+The return value is a list of strings which are package names
+that are implied in code.  Thus a C++ symbol:
+  foo::bar();
+where there is a statement such as:
+  using baz;
+means that the first symbol might be:
+  baz::foo::bar();"
+  nil)
 
 (provide 'semantic/ctxt)
 
+;; Local variables:
+;; generated-autoload-file: "loaddefs.el"
+;; generated-autoload-load-name: "semantic/ctxt"
+;; End:
+
 ;;; semantic/ctxt.el ends here