Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Prepared for running with cedet 1.0:

- wrapped every semantic-function and variable in ecb-semantic-wrapper.el
  • Loading branch information...
commit b1ff42ba4ccb66851c24f209a90d418758f937e5 1 parent d2bfd47
authored November 04, 2003

Showing 1 changed file with 148 additions and 0 deletions. Show diff stats Hide diff stats

  1. 148  ecb-semantic-wrapper.el
148  ecb-semantic-wrapper.el
... ...
@@ -0,0 +1,148 @@
  1
+;;; ecb-semantic-wrapper.el -- define wrappers for all semantic funcs/vars
  2
+
  3
+;; Copyright (C) 2000 - 2003 Jesper Nordenberg,
  4
+;;                           Klaus Berndl,
  5
+;;                           Free Software Foundation, Inc.
  6
+
  7
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
  8
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
  9
+;;             Kevin A. Burton <burton@openprivacy.org>
  10
+;; Keywords: browser, code, programming, tools
  11
+;; Created: 2003
  12
+
  13
+;; This program is free software; you can redistribute it and/or modify it under
  14
+;; the terms of the GNU General Public License as published by the Free Software
  15
+;; Foundation; either version 2, or (at your option) any later version.
  16
+
  17
+;; This program is distributed in the hope that it will be useful, but WITHOUT
  18
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  19
+;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  20
+;; details.
  21
+
  22
+;; You should have received a copy of the GNU General Public License along with
  23
+;; GNU Emacs; see the file COPYING.  If not, write to the Free Software
  24
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  25
+
  26
+;; $Id$
  27
+
  28
+;;; Commentary:
  29
+
  30
+;; This file contains wrappers for every semantic-function and -variable used
  31
+;; by ECB independent which semantic version is used. So the ECB-code is
  32
+;; independent from the fact, if semantic 2.0 offers backward-compatibility or
  33
+;; not. This library offers for each variable V of semantic a getter-function
  34
+;; named "ecb--V" and for each function F an alias named "ecb--F". V and F
  35
+;; follow the naming conventiones of semantic 2.0 but the resulting functions
  36
+;; always point to the correct variable or function of semantic independent
  37
+;; which semantic version is loaded. ECB only uses the functions exported from
  38
+;; ecb-semantic-wrapper.el!
  39
+
  40
+
  41
+(require 'semantic)
  42
+
  43
+(eval-when-compile
  44
+  (require 'silentcomp))
  45
+
  46
+;; -- getter functions for all variables of semantic currently used by ECB ---
  47
+
  48
+(defsubst ecb--semantic-symbol->name-assoc-list ()
  49
+  "Return the value of `semantic-symbol->name-assoc-list'."
  50
+  (symbol-value 'semantic-symbol->name-assoc-list))
  51
+
  52
+(defsubst ecb--semantic-format-tag-functions ()
  53
+  "Return either the value of `semantic-format-tag-functions' or
  54
+`semantic-token->text-functions' depending which semantic version is loaded."
  55
+  (if (boundp 'semantic-format-tag-functions)
  56
+      (symbol-value 'semantic-format-tag-functions)
  57
+    (symbol-value 'semantic-token->text-functions)))
  58
+
  59
+(defsubst ecb--semantic-orphaned-member-metaparent-type ()
  60
+  "Return the value of `semantic-orphaned-member-metaparent-type'."
  61
+  (symbol-value 'semantic-orphaned-member-metaparent-type))
  62
+
  63
+(defsubst ecb--semantic-uml-colon-string ()
  64
+  "Return the value of `semantic-uml-colon-string'."
  65
+  (symbol-value 'semantic-uml-colon-string))
  66
+
  67
+(defsubst ecb--semantic-format-face-alist ()
  68
+  "Return either the value of `semantic-format-face-alist' or
  69
+`semantic-face-alist' depending which semantic version is loaded."
  70
+  (if (boundp 'semantic-format-face-alist)
  71
+      (symbol-value 'semantic-format-face-alist)
  72
+    (symbol-value 'semantic-face-alist)))
  73
+
  74
+(defsubst ecb--semantic-after-toplevel-cache-change-hook ()
  75
+  "Return the hook-symbol `semantic-after-toplevel-cache-change-hook'."
  76
+  'semantic-after-toplevel-cache-change-hook)
  77
+
  78
+(defsubst ecb--semantic-after-partial-cache-change-hook ()
  79
+  "Return the hook-symbol `semantic-after-partial-cache-change-hook'."
  80
+  'semantic-after-partial-cache-change-hook)
  81
+
  82
+;; -- an alias for all functions of semantic currently used by ECB ---
  83
+
  84
+(defconst ecb--semantic-function-alist
  85
+  '((semantic-active-p               . semantic-active-p) 
  86
+    (semantic-adopt-external-members . semantic-adopt-external-members)
  87
+    (semantic-bovinate-toplevel      . semantic-bovinate-toplevel)
  88
+    (semantic-bucketize              . semantic-bucketize)
  89
+    (semantic-c-template-string      . semantic-c-template-string)
  90
+    (semantic-clear-toplevel-cache   . semantic-clear-toplevel-cache)
  91
+    (semantic-colorize-text          . semantic--format-colorize-text)
  92
+    (semantic-current-nonterminal    . semantic-current-tag)
  93
+    (semantic-equivalent-tokens-p    . semantic-equivalent-tag-p)
  94
+    (semantic-find-dependency        . semantic-dependency-tag-file)
  95
+    (semantic-find-documentation     . semantic-documentation-for-tag)
  96
+    (semantic-flex-start             . semantic-lex-token-start)
  97
+    (semantic-nonterminal-children   . semantic-tag-children-compatibility)
  98
+    (semantic-nonterminal-protection . semantic-tag-protection)
  99
+    (semantic-overlay-live-p         . semantic-overlay-live-p)
  100
+    (semantic-overlay-p              . semantic-overlay-p)
  101
+    (semantic-token-buffer           . semantic-tag-buffer)
  102
+    (semantic-token-end              . semantic-tag-end)
  103
+    (semantic-token-function-parent  . semantic-tag-function-parent)
  104
+    (semantic-token-get              . semantic--tag-get-property)
  105
+    (semantic-token-name             . semantic-tag-name)
  106
+    (semantic-token-overlay          . semantic-tag-overlay)
  107
+    (semantic-token-p                . semantic-tag-p)
  108
+    (semantic-token-put              . semantic--tag-put-property)
  109
+    (semantic-token-start            . semantic-tag-start)
  110
+    (semantic-token-token            . semantic-tag-class)
  111
+    (semantic-token-type             . semantic-tag-type)
  112
+    (semantic-token-type-parent-superclass . semantic-tag-type-superclass)
  113
+    (semantic-token-type-parent-implement . semantic-tag-type-interfaces)
  114
+    (semantic-token-with-position-p . semantic-tag-with-position-p))
  115
+  "Alist where the car is a function of semantic 1.X and the cdr is the
  116
+equivalent new function of semantic 2.X. This alist should contain every
  117
+function ECB uses from the semantic library.")
  118
+
  119
+(defconst ecb--semantic-format-function-alist
  120
+  '((semantic-name-nonterminal                  . semantic-format-tag-name)
  121
+    (semantic-abbreviate-nonterminal            . semantic-format-tag-abbreviate)
  122
+    (semantic-summarize-nonterminal             . semantic-format-tag-summarize)
  123
+    (semantic-prototype-nonterminal             . semantic-format-tag-prototype)
  124
+    (semantic-concise-prototype-nonterminal     . semantic-format-tag-concise-prototype)
  125
+    (semantic-uml-abbreviate-nonterminal        . semantic-format-tag-uml-abbreviate)
  126
+    (semantic-uml-prototype-nonterminal         . semantic-format-tag-uml-prototype)
  127
+    (semantic-uml-concise-prototype-nonterminal . semantic-format-tag-uml-concise-prototype)
  128
+    (semantic-prin1-nonterminal                 . semantic-format-tag-prin1))
  129
+"Alist where the car is a function of semantic 1.X and the cdr is the
  130
+equivalent new function of semantic 2.X. This alist should contain every
  131
+function of `semantic-token->text-functions' (rsp. for semantic 2.X
  132
+`semantic-format-tag-functions'.")
  133
+
  134
+;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: What about the
  135
+;; semanticdb-functions ECB uses currently?
  136
+
  137
+;; new let us create the aliase. Each alias has the name "ecb--"<function of
  138
+;; semantic 2.0>.
  139
+(dolist (f-elem (append ecb--semantic-function-alist
  140
+                        ecb--semantic-format-function-alist))
  141
+  (defalias (intern (concat "ecb--" (symbol-name (cdr f-elem))))
  142
+    (if (fboundp (cdr f-elem))
  143
+        (cdr f-elem)
  144
+      (car f-elem))))
  145
+
  146
+(silentcomp-provide 'ecb-semantic-wrapper)
  147
+
  148
+;;; ecb-semantic-wrapper.el end here

0 notes on commit b1ff42b

Please sign in to comment.
Something went wrong with that request. Please try again.