Source

semantic / semantic-example.el

Diff from to

semantic-example.el

 ;;; semanto-example.el --- Examples using the semantic API
 
-;;; Copyright (C) 2002 Eric M. Ludlam
+;;; Copyright (C) 2002, 2003, 2004, 2005 Eric M. Ludlam
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 ;;
 ;; Simplified example programs that use the semantic API.
 
+;;; Code:
 (defun se-jump (name)
   "Jump to the token with NAME.
 Shows how to:
      ;; ( "this" "that" "th" )
      (car (reverse (semantic-ctxt-current-symbol)))
      ;; The stream is from this buffer
-     (semantic-bovinate-toplevel t)
+     (semantic-fetch-tags)
      ;; We don't need a filter.
      nil )))
   (let (tok pos)
     ;; Search for the token
-    (setq tok (semantic-find-nonterminal-by-name
+    (setq tok (semantic-find-first-tag-by-name
 	       name
 	       ;; Get the stream.  May be a buffer too.
-	       (semantic-bovinate-toplevel t)
+	       (semantic-fetch-tags)
 	       ;; Look inside structures
 	       t
 	       ;; Don't search include files. Perhaps a later
     (if tok
 	(progn
 	  ;; Get the position of the token.
-	  (setq pos (semantic-token-start tok))
+	  (setq pos (semantic-tag-start tok))
 	  ;; Jump.
 	  ;; Because we only searched this buffer, we can assume the token is
 	  ;; also in this buffer.
       (error "No tag %s found" name)
       )))
 
-(defcustom se-summary-function 'semantic-uml-prototype-nonterminal
+(defcustom se-summary-function 'semantic-format-tag-uml-prototype
   "*Function to use when showing info about a token for Examples.
 Shows how to:
   * Create a customization variable."
   :group 'semantic
-  :type semantic-token->text-custom-list)
+  :type semantic-format-tag-custom-list)
 
 (defun se-show (name)
   "Show important information about some token with NAME.
 Shows how to:
- * Create a variable with `semantic-token->text-functions'.
+ * Create a variable with `semantic-format-tag-functions'.
  * Create the colorized text."
   (interactive (list (semantic-read-symbol "Symbol: ")))
-  (let ((tok (semantic-find-nonterminal-by-name name (current-buffer) t))
+  (let ((tok (semantic-find-first-tag-by-name name (current-buffer) t))
 	parent
 	msg)
     (if tok
 	  ;; Token text functions can take a PARENT argument.  To find this
 	  ;; really quickly, jump to TOK, then use the overlay mechanism to
 	  ;; Find it.
-	  (goto-char (semantic-token-start tok))
-	  (setq parent (semantic-current-nonterminal-parent))
+	  (goto-char (semantic-tag-start tok))
+	  (setq parent (semantic-current-tag-parent))
 	  ;; Create a message
 	  (setq msg (funcall se-summary-function tok parent t))
 	  ;; Display it
    (list (read-string "Symbol: "
 		      ;; Current symbol is the default
 		      (car (reverse (semantic-ctxt-current-symbol))))))
-  (let ((tok (semanticdb-find-nonterminal-by-name-regexp
+  (let ((tok (semanticdb-deep-find-tags-by-name-regexp
 	      name
 	      ;; The current list of active databases for this file.
 	      ;; This is the same as passing `nil'
 	      (semanticdb-current-database-list)
-	      t   ;; Search inside types
-	      nil ;; Do not search include files
-	      nil ;; Only files of the same mode
 	      t   ;; When a token is found, make sure it is
 	          ;; an active buffer.
 	      )))