diff options
| author | Chong Yidong | 2009-09-13 15:58:30 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-09-13 15:58:30 +0000 |
| commit | a964f5e552c64a53fb4b5c417f1825807cdcca6f (patch) | |
| tree | 8709f2b8c145118620e7c3f0efb840de37a4ccbe | |
| parent | 0a3b3f9e131bc5f0cf8034326d14d7737a6162b3 (diff) | |
| download | emacs-a964f5e552c64a53fb4b5c417f1825807cdcca6f.tar.gz emacs-a964f5e552c64a53fb4b5c417f1825807cdcca6f.zip | |
Synch to Eric M. Ludlam's upstream CEDET repository.
* cedet/semantic/wisent/java-tags.el:
* cedet/semantic/wisent/javat-wy.el: New files.
* cedet/semantic/wisent/java.el:
* cedet/semantic/wisent/java-wy.el: Files removed.
* cedet/semantic/java.el (semantic-java-prototype-function)
(semantic-java-prototype-variable, semantic-java-prototype-type):
Doc fix
(java-mode::semantic-format-tag-prototype): Renamed from
semantic-format-prototype-tag, which didn't match the overloadable
function.
* cedet/semantic/bovine/c.el (semantic-c-dereference-namespace-alias):
Deal correctly with nested namespaces. Make sure type actually
exists in original namespace.
* cedet/semantic/lex-spp.el (semantic-lex-spp-hack-depth): New.
(semantic-lex-spp-lex-text-string): Use above to enable recursion.
* cedet/semantic/format.el: Whitespace cleanup.
(semantic-test-all-format-tag-functions): Move to end.
(semantic-format-tag-prototype, semantic-format-tag-name)
(semantic-format-tag-name-default): Revert to original upstream
positions.
* cedet/semantic/elp.el: File removed.
* cedet/semantic/analyze.el (semantic-adebug-analyze): New
function, moved here from semantic/adebug.
* cedet/semantic/adebug.el: Declare external semanticdb functions.
(semantic-adebug-analyze, semantic-adebug-edebug-expr): Deleted.
* emacs-lisp/eieio.el (eieio-unbound): Default value is now robust
to recompile.
* emacs-lisp/eieio-datadebug.el: Add eieio objects to the list of
data debug things to recognize.
* emacs-lisp/eieio-comp.el: Synch to upstream.
* cedet/data-debug.el: Don't require eieio and semantic/tag.
If eieio is loaded, require eieio-datadebug.
(data-debug-insert-ring-button): Do not be specific about the ring
contents.
(data-debug-thing-alist): Remove eieio and semantic specific
entries.
(data-debug-add-specialized-thing): New function.
* cedet/cedet.el: Update commentary.
* cedet/cedet-edebug.el: Require edebug and debug.
| -rw-r--r-- | lisp/ChangeLog | 58 | ||||
| -rw-r--r-- | lisp/cedet/cedet-edebug.el | 3 | ||||
| -rw-r--r-- | lisp/cedet/cedet.el | 24 | ||||
| -rw-r--r-- | lisp/cedet/data-debug.el | 59 | ||||
| -rw-r--r-- | lisp/cedet/semantic/adebug.el | 42 | ||||
| -rw-r--r-- | lisp/cedet/semantic/analyze.el | 20 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/c.el | 25 | ||||
| -rw-r--r-- | lisp/cedet/semantic/db-find.el | 1 | ||||
| -rw-r--r-- | lisp/cedet/semantic/db-global.el | 1 | ||||
| -rw-r--r-- | lisp/cedet/semantic/elp.el | 775 | ||||
| -rw-r--r-- | lisp/cedet/semantic/find.el | 4 | ||||
| -rw-r--r-- | lisp/cedet/semantic/format.el | 169 | ||||
| -rw-r--r-- | lisp/cedet/semantic/java.el | 13 | ||||
| -rw-r--r-- | lisp/cedet/semantic/lex-spp.el | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/tag.el | 3 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/java-tags.el (renamed from lisp/cedet/semantic/wisent/java.el) | 111 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/java-wy.el | bin | 46580 -> 0 bytes | |||
| -rw-r--r-- | lisp/cedet/semantic/wisent/javat-wy.el | bin | 0 -> 19194 bytes | |||
| -rw-r--r-- | lisp/cedet/semantic/wisent/js-wy.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-comp.el | 101 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-datadebug.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio.el | 13 |
22 files changed, 352 insertions, 1084 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 060c238c725..984110fd65e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,61 @@ | |||
| 1 | 2009-09-13 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | Synch to Eric Ludlam's upstream CEDET repository. | ||
| 4 | |||
| 5 | * cedet/semantic/wisent/java-tags.el: | ||
| 6 | * cedet/semantic/wisent/javat-wy.el: New files. | ||
| 7 | |||
| 8 | * cedet/semantic/wisent/java.el: | ||
| 9 | * cedet/semantic/wisent/java-wy.el: Files removed. | ||
| 10 | |||
| 11 | * cedet/semantic/java.el (semantic-java-prototype-function) | ||
| 12 | (semantic-java-prototype-variable, semantic-java-prototype-type): | ||
| 13 | Doc fix | ||
| 14 | (java-mode::semantic-format-tag-prototype): Renamed from | ||
| 15 | semantic-format-prototype-tag, which didn't match the overloadable | ||
| 16 | function. | ||
| 17 | |||
| 18 | * cedet/semantic/bovine/c.el (semantic-c-dereference-namespace-alias): | ||
| 19 | Deal correctly with nested namespaces. Make sure type actually | ||
| 20 | exists in original namespace. | ||
| 21 | |||
| 22 | * cedet/semantic/lex-spp.el (semantic-lex-spp-hack-depth): New. | ||
| 23 | (semantic-lex-spp-lex-text-string): Use above to enable recursion. | ||
| 24 | |||
| 25 | * cedet/semantic/format.el: Whitespace cleanup. | ||
| 26 | (semantic-test-all-format-tag-functions): Move to end. | ||
| 27 | (semantic-format-tag-prototype, semantic-format-tag-name) | ||
| 28 | (semantic-format-tag-name-default): Revert to original upstream | ||
| 29 | positions. | ||
| 30 | |||
| 31 | * cedet/semantic/elp.el: File removed. | ||
| 32 | |||
| 33 | * cedet/semantic/analyze.el (semantic-adebug-analyze): New | ||
| 34 | function, moved here from semantic/adebug. | ||
| 35 | |||
| 36 | * cedet/semantic/adebug.el: Declare external semanticdb functions. | ||
| 37 | (semantic-adebug-analyze, semantic-adebug-edebug-expr): Deleted. | ||
| 38 | |||
| 39 | * emacs-lisp/eieio.el (eieio-unbound): Default value is now robust | ||
| 40 | to recompile. | ||
| 41 | |||
| 42 | * emacs-lisp/eieio-datadebug.el: Add eieio objects to the list of | ||
| 43 | data debug things to recognize. | ||
| 44 | |||
| 45 | * emacs-lisp/eieio-comp.el: Synch to upstream. | ||
| 46 | |||
| 47 | * cedet/data-debug.el: Don't require eieio and semantic/tag. | ||
| 48 | If eieio is loaded, require eieio-datadebug. | ||
| 49 | (data-debug-insert-ring-button): Do not be specific about the ring | ||
| 50 | contents. | ||
| 51 | (data-debug-thing-alist): Remove eieio and semantic specific | ||
| 52 | entries. | ||
| 53 | (data-debug-add-specialized-thing): New function. | ||
| 54 | |||
| 55 | * cedet/cedet.el: Update commentary. | ||
| 56 | |||
| 57 | * cedet/cedet-edebug.el: Require edebug and debug. | ||
| 58 | |||
| 1 | 2009-09-07 Chong Yidong <cyd@stupidchicken.com> | 59 | 2009-09-07 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 60 | ||
| 3 | * emacs-lisp/autoload.el (make-autoload): Handle defclass form. | 61 | * emacs-lisp/autoload.el (make-autoload): Handle defclass form. |
diff --git a/lisp/cedet/cedet-edebug.el b/lisp/cedet/cedet-edebug.el index 3b6bcf7148c..09af834853c 100644 --- a/lisp/cedet/cedet-edebug.el +++ b/lisp/cedet/cedet-edebug.el | |||
| @@ -31,6 +31,9 @@ | |||
| 31 | ;; printing. | 31 | ;; printing. |
| 32 | 32 | ||
| 33 | ;;; Code: | 33 | ;;; Code: |
| 34 | (require 'edebug) | ||
| 35 | (require 'debug) | ||
| 36 | |||
| 34 | (defvar cedet-edebug-prin1-extensions nil | 37 | (defvar cedet-edebug-prin1-extensions nil |
| 35 | "An alist of of code that can extend PRIN1 for edebug. | 38 | "An alist of of code that can extend PRIN1 for edebug. |
| 36 | Each entry has the value: (CONDITION . PRIN1COMMAND).") | 39 | Each entry has the value: (CONDITION . PRIN1COMMAND).") |
diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el index e089407a195..2ff55dc8258 100644 --- a/lisp/cedet/cedet.el +++ b/lisp/cedet/cedet.el | |||
| @@ -24,26 +24,22 @@ | |||
| 24 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 24 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 25 | 25 | ||
| 26 | ;;; Commentary: | 26 | ;;; Commentary: |
| 27 | |||
| 28 | ;;; Code: | ||
| 27 | ;; | 29 | ;; |
| 28 | ;; This library automatically setups your [X]Emacs to use CEDET tools. | 30 | ;; This library automatically setups your [X]Emacs to use CEDET tools. |
| 29 | ;; | 31 | ;; |
| 30 | ;; (require 'cedet) | 32 | ;; Add the following into your ~/.emacs startup file: |
| 31 | ;; | ||
| 32 | ;; If you want to turn on useful or all Semantic features by default, | ||
| 33 | ;; respectively add: | ||
| 34 | ;; | 33 | ;; |
| 35 | ;; (setq semantic-load-turn-useful-things-on t) | 34 | ;; (load-file "<INSTALL-PATH>/cedet/common/cedet.el") |
| 36 | ;; or | ||
| 37 | ;; (setq semantic-load-turn-everything-on t) | ||
| 38 | ;; | 35 | ;; |
| 39 | ;; before loading this file, like this: | 36 | ;; Once loaded, you can enable additional feature. For example, |
| 37 | ;; this will enable some basic and advance features: | ||
| 40 | ;; | 38 | ;; |
| 41 | ;; (setq semantic-load-turn-useful-things-on t) | 39 | ;; (load-file "<INSTALL-PATH>/cedet/common/cedet.el") |
| 42 | ;; (require 'cedet) | 40 | ;; (global-ede-mode t) |
| 43 | ;; | 41 | ;; (semantic-load-enable-code-helpers) |
| 44 | ;; That's it! | 42 | ;; (global-srecode-minor-mode 1) |
| 45 | |||
| 46 | ;;; Code: | ||
| 47 | 43 | ||
| 48 | (eval-when-compile | 44 | (eval-when-compile |
| 49 | (require 'cl)) | 45 | (require 'cl)) |
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index a82e4dbac29..d132e47fc9a 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el | |||
| @@ -43,9 +43,6 @@ | |||
| 43 | 43 | ||
| 44 | (require 'font-lock) | 44 | (require 'font-lock) |
| 45 | (require 'ring) | 45 | (require 'ring) |
| 46 | (require 'eieio) | ||
| 47 | (eval-when-compile | ||
| 48 | (require 'semantic/tag)) | ||
| 49 | 46 | ||
| 50 | ;;; Code: | 47 | ;;; Code: |
| 51 | 48 | ||
| @@ -384,18 +381,9 @@ PREBUTTONTEXT is some text between prefix and the stuff list button." | |||
| 384 | (ring-size ring))) | 381 | (ring-size ring))) |
| 385 | (ringthing | 382 | (ringthing |
| 386 | (if (= (ring-length ring) 0) nil (ring-ref ring 0))) | 383 | (if (= (ring-length ring) 0) nil (ring-ref ring 0))) |
| 387 | (tip (format "Ring max-size %d, length %d. Full of: %S" | 384 | (tip (format "Ring max-size %d, length %d." |
| 388 | (ring-size ring) | 385 | (ring-size ring) |
| 389 | (ring-length ring) | 386 | (ring-length ring))) |
| 390 | (cond ((stringp ringthing) | ||
| 391 | "strings") | ||
| 392 | ((semantic-tag-p ringthing) | ||
| 393 | "tags") | ||
| 394 | ((eieio-object-p ringthing) | ||
| 395 | "eieio objects") | ||
| 396 | ((listp ringthing) | ||
| 397 | "List of somethin'") | ||
| 398 | (t "stuff")))) | ||
| 399 | ) | 387 | ) |
| 400 | (insert prefix prebuttontext str) | 388 | (insert prefix prebuttontext str) |
| 401 | (setq end (point)) | 389 | (setq end (point)) |
| @@ -763,25 +751,6 @@ FACE is the face to use." | |||
| 763 | ;; nil | 751 | ;; nil |
| 764 | (null . data-debug-insert-nil) | 752 | (null . data-debug-insert-nil) |
| 765 | 753 | ||
| 766 | ;; eieio object | ||
| 767 | ((lambda (thing) (object-p thing)) . data-debug-insert-object-button) | ||
| 768 | |||
| 769 | ;; tag | ||
| 770 | (semantic-tag-p . data-debug-insert-tag) | ||
| 771 | |||
| 772 | ;; taglist | ||
| 773 | ((lambda (thing) (and (listp thing) (semantic-tag-p (car thing)))) . | ||
| 774 | data-debug-insert-tag-list-button) | ||
| 775 | |||
| 776 | ;; find results | ||
| 777 | (semanticdb-find-results-p . data-debug-insert-find-results-button) | ||
| 778 | |||
| 779 | ;; Elt of a find-results | ||
| 780 | ((lambda (thing) (and (listp thing) | ||
| 781 | (semanticdb-abstract-table-child-p (car thing)) | ||
| 782 | (semantic-tag-p (cdr thing)))) . | ||
| 783 | data-debug-insert-db-and-tag-button) | ||
| 784 | |||
| 785 | ;; Overlay | 754 | ;; Overlay |
| 786 | (data-debug-overlay-p . data-debug-insert-overlay-button) | 755 | (data-debug-overlay-p . data-debug-insert-overlay-button) |
| 787 | 756 | ||
| @@ -829,6 +798,22 @@ FACE is the face to use." | |||
| 829 | ) | 798 | ) |
| 830 | "Alist of methods used to insert things into an Ddebug buffer.") | 799 | "Alist of methods used to insert things into an Ddebug buffer.") |
| 831 | 800 | ||
| 801 | ;; An augmentation function for the thing alist. | ||
| 802 | (defun data-debug-add-specialized-thing (predicate fcn) | ||
| 803 | "Add a new specialized thing to display with data-debug. | ||
| 804 | PREDICATE is a function that returns t if a thing is this new type. | ||
| 805 | FCN is a function that will display stuff in the data debug buffer." | ||
| 806 | (let ((entry (cons predicate fcn)) | ||
| 807 | ;; Specialized entries show up AFTER nil, | ||
| 808 | ;; but before listp, vectorp, symbolp, and | ||
| 809 | ;; other general things. Splice it into | ||
| 810 | ;; the beginning. | ||
| 811 | (first (nthcdr 0 data-debug-thing-alist)) | ||
| 812 | (second (nthcdr 1 data-debug-thing-alist)) | ||
| 813 | ) | ||
| 814 | (when (not (member entry data-debug-thing-alist)) | ||
| 815 | (setcdr first (cons entry second))))) | ||
| 816 | |||
| 832 | ;; uber insert method | 817 | ;; uber insert method |
| 833 | (defun data-debug-insert-thing (thing prefix prebuttontext &optional parent) | 818 | (defun data-debug-insert-thing (thing prefix prebuttontext &optional parent) |
| 834 | "Insert THING with PREFIX. | 819 | "Insert THING with PREFIX. |
| @@ -853,7 +838,7 @@ If PARENT is non-nil, it is somehow related as a parent to thing." | |||
| 853 | ;;; MAJOR MODE | 838 | ;;; MAJOR MODE |
| 854 | ;; | 839 | ;; |
| 855 | ;; The Ddebug major mode provides an interactive space to explore | 840 | ;; The Ddebug major mode provides an interactive space to explore |
| 856 | ;; the current state of semantic's parsing and analysis | 841 | ;; complicated data structures. |
| 857 | ;; | 842 | ;; |
| 858 | (defgroup data-debug nil | 843 | (defgroup data-debug nil |
| 859 | "data-debug group." | 844 | "data-debug group." |
| @@ -1044,7 +1029,7 @@ Do nothing if already expanded." | |||
| 1044 | 1029 | ||
| 1045 | ;;; DEBUG COMMANDS | 1030 | ;;; DEBUG COMMANDS |
| 1046 | ;; | 1031 | ;; |
| 1047 | ;; Various commands to output aspects of the current semantic environment. | 1032 | ;; Various commands for displaying complex data structures. |
| 1048 | 1033 | ||
| 1049 | (defun data-debug-edebug-expr (expr) | 1034 | (defun data-debug-edebug-expr (expr) |
| 1050 | "Dump out the contets of some expression EXPR in edebug with ddebug." | 1035 | "Dump out the contets of some expression EXPR in edebug with ddebug." |
| @@ -1092,7 +1077,9 @@ If the result is a list or vector, then use the data debugger to display it." | |||
| 1092 | (let ((str (eval-expression-print-format (car values)))) | 1077 | (let ((str (eval-expression-print-format (car values)))) |
| 1093 | (if str (princ str t)))))) | 1078 | (if str (princ str t)))))) |
| 1094 | 1079 | ||
| 1095 | |||
| 1096 | (provide 'data-debug) | 1080 | (provide 'data-debug) |
| 1097 | 1081 | ||
| 1082 | (if (featurep 'eieio) | ||
| 1083 | (require 'eieio-datadebug)) | ||
| 1084 | |||
| 1098 | ;;; data-debug.el ends here | 1085 | ;;; data-debug.el ends here |
diff --git a/lisp/cedet/semantic/adebug.el b/lisp/cedet/semantic/adebug.el index fa474d3a0f2..cbe2985f6e5 100644 --- a/lisp/cedet/semantic/adebug.el +++ b/lisp/cedet/semantic/adebug.el | |||
| @@ -32,9 +32,17 @@ | |||
| 32 | ;; | 32 | ;; |
| 33 | ;; Allow interactive navigation of the analysis process, tags, etc. | 33 | ;; Allow interactive navigation of the analysis process, tags, etc. |
| 34 | 34 | ||
| 35 | (require 'eieio) | ||
| 35 | (require 'data-debug) | 36 | (require 'data-debug) |
| 36 | (require 'eieio-datadebug) | 37 | (require 'semantic) |
| 37 | (require 'semantic/analyze) | 38 | (require 'semantic/tag) |
| 39 | (require 'semantic/format) | ||
| 40 | |||
| 41 | (declare-function semanticdb-get-database "semantic/db") | ||
| 42 | (declare-function semanticdb-directory-loaded-p "semantic/db") | ||
| 43 | (declare-function semanticdb-file-table "semantic/db") | ||
| 44 | (declare-function semanticdb-needs-refresh-p "semantic/db") | ||
| 45 | (declare-function semanticdb-full-filename "semantic/db") | ||
| 38 | 46 | ||
| 39 | ;;; Code: | 47 | ;;; Code: |
| 40 | 48 | ||
| @@ -303,38 +311,10 @@ Display the results as a debug list." | |||
| 303 | 311 | ||
| 304 | (data-debug-insert-find-results fr "*"))) | 312 | (data-debug-insert-find-results fr "*"))) |
| 305 | 313 | ||
| 306 | (defun semantic-adebug-analyze (&optional ctxt) | ||
| 307 | "Perform `semantic-analyze-current-context'. | ||
| 308 | Display the results as a debug list. | ||
| 309 | Optional argument CTXT is the context to show." | ||
| 310 | (interactive) | ||
| 311 | (let ((start (current-time)) | ||
| 312 | (ctxt (or ctxt (semantic-analyze-current-context))) | ||
| 313 | (end (current-time))) | ||
| 314 | (if (not ctxt) | ||
| 315 | (message "No Analyzer Results") | ||
| 316 | (message "Analysis took %.2f seconds." | ||
| 317 | (semantic-elapsed-time start end)) | ||
| 318 | (semantic-analyze-pulse ctxt) | ||
| 319 | (if ctxt | ||
| 320 | (progn | ||
| 321 | (data-debug-new-buffer "*Analyzer ADEBUG*") | ||
| 322 | (data-debug-insert-object-slots ctxt "]")) | ||
| 323 | (message "No Context to analyze here."))))) | ||
| 324 | |||
| 325 | (defun semantic-adebug-edebug-expr (expr) | ||
| 326 | "Dump out the contets of some expression EXPR in edebug with adebug." | ||
| 327 | (interactive "sExpression: ") | ||
| 328 | (let ((v (eval (read expr)))) | ||
| 329 | (if (not v) | ||
| 330 | (message "Expression %s is nil." expr) | ||
| 331 | (data-debug-new-buffer "*expression ADEBUG*") | ||
| 332 | (data-debug-insert-thing v "?" "") | ||
| 333 | ))) | ||
| 334 | |||
| 335 | (defun semanticdb-debug-file-tag-check (startfile) | 314 | (defun semanticdb-debug-file-tag-check (startfile) |
| 336 | "Report debug info for checking STARTFILE for up-to-date tags." | 315 | "Report debug info for checking STARTFILE for up-to-date tags." |
| 337 | (interactive "FFile to Check (default = current-buffer): ") | 316 | (interactive "FFile to Check (default = current-buffer): ") |
| 317 | (require 'semantic/db) | ||
| 338 | (let* ((file (file-truename startfile)) | 318 | (let* ((file (file-truename startfile)) |
| 339 | (default-directory (file-name-directory file)) | 319 | (default-directory (file-name-directory file)) |
| 340 | (db (or | 320 | (db (or |
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index 2beb41319ea..7d8143e3a69 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el | |||
| @@ -675,6 +675,26 @@ Returns an object based on symbol `semantic-analyze-context'." | |||
| 675 | context-return)) | 675 | context-return)) |
| 676 | 676 | ||
| 677 | 677 | ||
| 678 | (defun semantic-adebug-analyze (&optional ctxt) | ||
| 679 | "Perform `semantic-analyze-current-context'. | ||
| 680 | Display the results as a debug list. | ||
| 681 | Optional argument CTXT is the context to show." | ||
| 682 | (interactive) | ||
| 683 | (let ((start (current-time)) | ||
| 684 | (ctxt (or ctxt (semantic-analyze-current-context))) | ||
| 685 | (end (current-time))) | ||
| 686 | (if (not ctxt) | ||
| 687 | (message "No Analyzer Results") | ||
| 688 | (message "Analysis took %.2f seconds." | ||
| 689 | (semantic-elapsed-time start end)) | ||
| 690 | (semantic-analyze-pulse ctxt) | ||
| 691 | (if ctxt | ||
| 692 | (progn | ||
| 693 | (data-debug-new-buffer "*Analyzer ADEBUG*") | ||
| 694 | (data-debug-insert-object-slots ctxt "]")) | ||
| 695 | (message "No Context to analyze here."))))) | ||
| 696 | |||
| 697 | |||
| 678 | ;;; DEBUG OUTPUT | 698 | ;;; DEBUG OUTPUT |
| 679 | ;; | 699 | ;; |
| 680 | ;; Friendly output of a context analysis. | 700 | ;; Friendly output of a context analysis. |
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index 2cd872a723c..5ab658d6af7 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el | |||
| @@ -1374,20 +1374,29 @@ with a fully qualified name in the original namespace. Returns | |||
| 1374 | nil if NAMESPACE is not an alias." | 1374 | nil if NAMESPACE is not an alias." |
| 1375 | (when (eq (semantic-tag-get-attribute namespace :kind) 'alias) | 1375 | (when (eq (semantic-tag-get-attribute namespace :kind) 'alias) |
| 1376 | (let ((typename (semantic-analyze-split-name (semantic-tag-name type))) | 1376 | (let ((typename (semantic-analyze-split-name (semantic-tag-name type))) |
| 1377 | ns newtype) | 1377 | ns nstype originaltype newtype) |
| 1378 | ;; Get name of namespace this one's an alias for. | 1378 | ;; Make typename unqualified |
| 1379 | (if (listp typename) | ||
| 1380 | (setq typename (last typename)) | ||
| 1381 | (setq typename (list typename))) | ||
| 1379 | (when | 1382 | (when |
| 1380 | (setq ns (semantic-analyze-split-name | 1383 | (and |
| 1381 | (semantic-tag-name | 1384 | ;; Get original namespace and make sure TYPE exists there. |
| 1382 | (car (semantic-tag-get-attribute namespace :members))))) | 1385 | (setq ns (semantic-tag-name |
| 1386 | (car (semantic-tag-get-attribute namespace :members)))) | ||
| 1387 | (setq nstype (semanticdb-typecache-find ns)) | ||
| 1388 | (setq originaltype (semantic-find-tags-by-name | ||
| 1389 | (car typename) | ||
| 1390 | (semantic-tag-get-attribute nstype :members)))) | ||
| 1383 | ;; Construct new type with name in original namespace. | 1391 | ;; Construct new type with name in original namespace. |
| 1392 | (setq ns (semantic-analyze-split-name ns)) | ||
| 1384 | (setq newtype | 1393 | (setq newtype |
| 1385 | (semantic-tag-clone | 1394 | (semantic-tag-clone |
| 1386 | type | 1395 | (car originaltype) |
| 1387 | (semantic-analyze-unsplit-name | 1396 | (semantic-analyze-unsplit-name |
| 1388 | (if (listp ns) | 1397 | (if (listp ns) |
| 1389 | (append (butlast ns) (last typename)) | 1398 | (append ns typename) |
| 1390 | (append (list ns) (last typename)))))))))) | 1399 | (append (list ns) typename))))))))) |
| 1391 | 1400 | ||
| 1392 | ;; This searches a type in a namespace, following through all using | 1401 | ;; This searches a type in a namespace, following through all using |
| 1393 | ;; statements. | 1402 | ;; statements. |
diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index 1066ffd642f..817d716ab74 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el | |||
| @@ -602,6 +602,7 @@ isn't in memory yet." | |||
| 602 | "Load an unloaded file in FILENAME using the default semanticdb loader." | 602 | "Load an unloaded file in FILENAME using the default semanticdb loader." |
| 603 | (semanticdb-file-table-object filename)) | 603 | (semanticdb-file-table-object filename)) |
| 604 | 604 | ||
| 605 | ;; The creation of the overload occurs above. | ||
| 605 | (defun semanticdb-find-table-for-include-default (includetag &optional table) | 606 | (defun semanticdb-find-table-for-include-default (includetag &optional table) |
| 606 | "Default implementation of `semanticdb-find-table-for-include'. | 607 | "Default implementation of `semanticdb-find-table-for-include'. |
| 607 | Uses `semanticdb-current-database-list' as the search path. | 608 | Uses `semanticdb-current-database-list' as the search path. |
diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el index b32255e7f1b..cf91a0498f4 100644 --- a/lisp/cedet/semantic/db-global.el +++ b/lisp/cedet/semantic/db-global.el | |||
| @@ -162,7 +162,6 @@ Return a list of tags." | |||
| 162 | Optional argument TAGS is a list of tags to search. | 162 | Optional argument TAGS is a list of tags to search. |
| 163 | Return a list of tags." | 163 | Return a list of tags." |
| 164 | (if tags (call-next-method) | 164 | (if tags (call-next-method) |
| 165 | ;; YOUR IMPLEMENTATION HERE | ||
| 166 | (let* ((semantic-symref-tool 'global) | 165 | (let* ((semantic-symref-tool 'global) |
| 167 | (result (semantic-symref-find-tags-by-regexp regex 'project)) | 166 | (result (semantic-symref-find-tags-by-regexp regex 'project)) |
| 168 | ) | 167 | ) |
diff --git a/lisp/cedet/semantic/elp.el b/lisp/cedet/semantic/elp.el deleted file mode 100644 index a9f8354fd07..00000000000 --- a/lisp/cedet/semantic/elp.el +++ /dev/null | |||
| @@ -1,775 +0,0 @@ | |||
| 1 | ;;; semantic/elp.el --- Bind ELP to measure Semantic | ||
| 2 | |||
| 3 | ;;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | ;; | ||
| 24 | ;; Provide fast ways to profile various (often slow) Semantic processes. | ||
| 25 | |||
| 26 | (require 'elp) | ||
| 27 | (require 'data-debug) | ||
| 28 | (require 'semantic/adebug) | ||
| 29 | (require 'semantic/tag-ls) | ||
| 30 | (require 'semantic/tag-file) | ||
| 31 | (require 'semantic/db) | ||
| 32 | (require 'semantic/db-find) | ||
| 33 | (require 'semantic/db-typecache) | ||
| 34 | (require 'semantic/scope) | ||
| 35 | (require 'semantic/analyze/fcn) | ||
| 36 | (require 'semantic/analyze) | ||
| 37 | (require 'semantic/analyze/complete) | ||
| 38 | |||
| 39 | (declare-function semantic-idle-scheduler-work-parse-neighboring-files | ||
| 40 | "semantic/idle") | ||
| 41 | |||
| 42 | ;;; Code: | ||
| 43 | (defvar semantic-elp-emacs-core-list | ||
| 44 | '( | ||
| 45 | append | ||
| 46 | copy-sequence | ||
| 47 | expand-file-name | ||
| 48 | file-exists-p | ||
| 49 | file-name-directory | ||
| 50 | file-name-nondirectory | ||
| 51 | file-attributes | ||
| 52 | file-truename | ||
| 53 | find-buffer-visiting | ||
| 54 | length | ||
| 55 | locate-file | ||
| 56 | nconc | ||
| 57 | nreverse | ||
| 58 | sort | ||
| 59 | string< | ||
| 60 | string= | ||
| 61 | ) | ||
| 62 | "List of Emacs functions for profiling.") | ||
| 63 | |||
| 64 | (defvar semantic-elp-eieio-core-list | ||
| 65 | '( | ||
| 66 | eieio-generic-call | ||
| 67 | eieio-generic-call-primary-only | ||
| 68 | eieiomt-method-list | ||
| 69 | eieio-generic-form | ||
| 70 | eieio-oref | ||
| 71 | eieio-oset | ||
| 72 | obj-of-class-p | ||
| 73 | ) | ||
| 74 | "List of EIEIO functions for profiling.") | ||
| 75 | |||
| 76 | (defvar semantic-elp-ede-core-list | ||
| 77 | '( | ||
| 78 | ede-current-project | ||
| 79 | ede-directory-get-open-project | ||
| 80 | ede-expand-filename | ||
| 81 | ede-expand-filename-impl | ||
| 82 | ede-locate-file-in-project | ||
| 83 | ede-locate-file-in-project-impl | ||
| 84 | ede-system-include-path | ||
| 85 | ede-toplevel | ||
| 86 | ede-toplevel-project | ||
| 87 | ede-directory-project-p | ||
| 88 | ) | ||
| 89 | "List of EDE functions to watch out for.") | ||
| 90 | |||
| 91 | (defvar semantic-elp-semantic-core-list | ||
| 92 | '( | ||
| 93 | semantic-ctxt-current-argument | ||
| 94 | semantic-ctxt-current-assignment | ||
| 95 | semantic-ctxt-current-class-list | ||
| 96 | semantic-ctxt-current-function | ||
| 97 | semantic-ctxt-current-symbol-and-bounds | ||
| 98 | semantic-current-tag | ||
| 99 | semantic-dependency-tag-file | ||
| 100 | semantic-equivalent-tag-p | ||
| 101 | semantic-fetch-tags | ||
| 102 | semantic-fetch-tags-fast | ||
| 103 | semantic-find-tag-by-overlay | ||
| 104 | semantic-sort-tags-by-name-decreasing | ||
| 105 | semantic-sort-tags-by-name-increasing | ||
| 106 | semantic-sort-tags-by-name-then-type-increasing | ||
| 107 | semantic-sort-tags-by-type-decreasing | ||
| 108 | semantic-sort-tags-by-type-increasing | ||
| 109 | semantic-tag-clone | ||
| 110 | semantic-tag-components | ||
| 111 | semantic-tag-copy | ||
| 112 | semantic-tag-external-member-children | ||
| 113 | semantic-tag-file-name | ||
| 114 | semantic-tag-function-arguments | ||
| 115 | semantic-tag-function-parent | ||
| 116 | semantic-tag-get-attribute | ||
| 117 | semantic-tag-in-buffer-p | ||
| 118 | semantic-tag-include-filename | ||
| 119 | ;;semantic-tag-lessp-name-then-type | ||
| 120 | semantic-tag-name | ||
| 121 | semantic-tag-new-type | ||
| 122 | semantic-tag-of-class-p | ||
| 123 | semantic-tag-of-type-p | ||
| 124 | semantic-tag-of-type-p | ||
| 125 | semantic-tag-p | ||
| 126 | semantic-tag-prototype-p | ||
| 127 | semantic-tag-set-faux | ||
| 128 | semantic-tag-type | ||
| 129 | semantic-tag-type-members | ||
| 130 | semantic-tag-type-superclasses | ||
| 131 | semantic-tag-with-position-p | ||
| 132 | ) | ||
| 133 | "List of core Semantic functions for profiling.") | ||
| 134 | (defvar semantic-elp-semantic-find-core-list | ||
| 135 | '( | ||
| 136 | semantic-find-tags-by-class | ||
| 137 | semantic-find-tags-by-name | ||
| 138 | semantic-find-tags-by-name-regexp | ||
| 139 | semantic-find-tags-by-scope-protection | ||
| 140 | semantic-find-tags-by-type | ||
| 141 | semantic-find-tags-for-completion | ||
| 142 | semantic-find-tags-included | ||
| 143 | semantic-find-tags-of-compound-type | ||
| 144 | ) | ||
| 145 | "List of semantic-find routines for profiling.") | ||
| 146 | |||
| 147 | (defvar semantic-elp-semanticdb-core-list | ||
| 148 | '( | ||
| 149 | semanticdb-cache-get | ||
| 150 | semanticdb-current-database-list | ||
| 151 | semanticdb-file-table | ||
| 152 | semanticdb-file-table-object | ||
| 153 | semanticdb-full-filename | ||
| 154 | semanticdb-get-buffer | ||
| 155 | semanticdb-get-table-index | ||
| 156 | semanticdb-refresh-references | ||
| 157 | semanticdb-refresh-table | ||
| 158 | semanticdb-needs-refresh-p | ||
| 159 | semanticdb-directory-loaded-p | ||
| 160 | semanticdb-full-filename | ||
| 161 | semanticdb-create-table-for-file | ||
| 162 | ) | ||
| 163 | "List of core Semanticdb functions for profiling.") | ||
| 164 | |||
| 165 | (defvar semantic-elp-include-path-list | ||
| 166 | '( | ||
| 167 | semanticdb-find-incomplete-cache-entries-p | ||
| 168 | semanticdb-find-load-unloaded | ||
| 169 | semanticdb-find-table-for-include | ||
| 170 | semanticdb-find-throttle-active-p | ||
| 171 | semanticdb-find-translate-path-default | ||
| 172 | semanticdb-find-translate-path-brutish-default | ||
| 173 | semanticdb-find-translate-path-includes--internal | ||
| 174 | semanticdb-find-translate-path-includes-default | ||
| 175 | ) | ||
| 176 | "List of include path calculation functions for profiling.") | ||
| 177 | |||
| 178 | (defvar semantic-elp-semanticdb-find-list | ||
| 179 | '( | ||
| 180 | semanticdb-fast-strip-find-results | ||
| 181 | semanticdb-find-results-p | ||
| 182 | semanticdb-find-tags-by-class | ||
| 183 | semanticdb-find-tags-by-name | ||
| 184 | semanticdb-find-tags-by-name-regexp | ||
| 185 | semanticdb-find-tags-collector | ||
| 186 | semanticdb-find-tags-external-children-of-type | ||
| 187 | semanticdb-find-tags-for-completion | ||
| 188 | semanticdb-strip-find-results | ||
| 189 | ) | ||
| 190 | "List of semanticdb find functions to profile. | ||
| 191 | You may also need `semantic-elp-include-path-list'.") | ||
| 192 | |||
| 193 | (defun semantic-elp-core-enable () | ||
| 194 | "Do an ELP reset, and enable profiling of the core system." | ||
| 195 | (elp-reset-all) | ||
| 196 | (elp-instrument-list semantic-elp-emacs-core-list) | ||
| 197 | (elp-instrument-list semantic-elp-eieio-core-list) | ||
| 198 | (elp-instrument-list semantic-elp-ede-core-list) | ||
| 199 | (elp-instrument-list semantic-elp-semantic-core-list) | ||
| 200 | (elp-instrument-list semantic-elp-semanticdb-core-list) | ||
| 201 | (elp-instrument-list semantic-elp-semanticdb-find-list) | ||
| 202 | (elp-instrument-list semantic-elp-include-path-list) | ||
| 203 | ) | ||
| 204 | |||
| 205 | |||
| 206 | (defun semantic-elp-include-path-enable () | ||
| 207 | "Enable profiling for `semanticdb-find-translate-path'." | ||
| 208 | (semantic-elp-core-enable) | ||
| 209 | (elp-set-master 'semanticdb-find-translate-path-default) | ||
| 210 | ) | ||
| 211 | |||
| 212 | (defvar semantic-elp-typecache-list | ||
| 213 | '( | ||
| 214 | semantic-analyze-split-name | ||
| 215 | semanticdb-get-typecache | ||
| 216 | semanticdb-typecache-merge-streams | ||
| 217 | semanticdb-typecache-safe-tag-members | ||
| 218 | semanticdb-typecache-apply-filename | ||
| 219 | semanticdb-typecache-file-tags | ||
| 220 | semanticdb-typecache-include-tags | ||
| 221 | ) | ||
| 222 | "List of typecaching functions for profiling.") | ||
| 223 | |||
| 224 | (defun semantic-elp-profile-typecache (tab) | ||
| 225 | "Profile the typecache. Start with table TAB." | ||
| 226 | (let ((tc (semanticdb-get-typecache tab))) | ||
| 227 | (semanticdb-typecache-file-tags tab) | ||
| 228 | (semanticdb-typecache-include-tags tab) | ||
| 229 | tc)) | ||
| 230 | |||
| 231 | (defun semantic-elp-typecache-enable () | ||
| 232 | "Enable profiling for `semanticdb-get-typecache'." | ||
| 233 | (semantic-elp-include-path-enable) | ||
| 234 | (elp-instrument-list semantic-elp-typecache-list) | ||
| 235 | (elp-set-master 'semantic-elp-profile-typecache) | ||
| 236 | ) | ||
| 237 | |||
| 238 | (defvar semantic-elp-scope-list | ||
| 239 | '( | ||
| 240 | semantic-analyze-find-tag | ||
| 241 | semantic-analyze-scope-nested-tags | ||
| 242 | semantic-analyze-scoped-types | ||
| 243 | semantic-analyze-scoped-types | ||
| 244 | semantic-analyze-tag-prototype-p | ||
| 245 | semantic-analyze-scoped-type-parts | ||
| 246 | semantic-calculate-scope | ||
| 247 | semantic-ctxt-scoped-types | ||
| 248 | semantic-get-all-local-variables | ||
| 249 | semantic-scope-find | ||
| 250 | semanticdb-typecache-find | ||
| 251 | semanticdb-typecache-merge-streams | ||
| 252 | ) | ||
| 253 | "List of scope calculation functions for profiling.") | ||
| 254 | |||
| 255 | (defun semantic-elp-scope-enable () | ||
| 256 | "Enable profiling for `semanticdb-calculate-scope'." | ||
| 257 | (semantic-elp-core-enable) | ||
| 258 | (elp-instrument-list semantic-elp-typecache-list) | ||
| 259 | (elp-instrument-list semantic-elp-scope-list) | ||
| 260 | (elp-set-master 'semantic-calculate-scope) | ||
| 261 | ) | ||
| 262 | |||
| 263 | (defvar semantic-elp-analyze-list | ||
| 264 | '( | ||
| 265 | semantic-analyze-current-symbol | ||
| 266 | semantic-analyze-current-context | ||
| 267 | semantic-analyze-dereference-metatype | ||
| 268 | semantic-analyze-find-tag-sequence | ||
| 269 | semantic-analyze-interesting-tag | ||
| 270 | semantic-analyze-pop-to-context | ||
| 271 | semantic-analyze-select-best-tag | ||
| 272 | semantic-analyze-tag-type | ||
| 273 | semantic-analyze-type-to-name | ||
| 274 | semantic-analyze-type-constraint | ||
| 275 | semantic-analyze-scoped-type-parts | ||
| 276 | semantic-cache-data-to-buffer | ||
| 277 | ) | ||
| 278 | "List of analyzer calculation functions for profiling.") | ||
| 279 | |||
| 280 | (defun semantic-elp-analyze-enable () | ||
| 281 | "Enable profiling for `semanticdb-analyze-current-context'." | ||
| 282 | (semantic-elp-scope-enable) | ||
| 283 | (elp-instrument-list semantic-elp-analyze-list) | ||
| 284 | (elp-set-master 'semantic-analyze-current-context) | ||
| 285 | ) | ||
| 286 | |||
| 287 | (defvar semantic-elp-symref-list | ||
| 288 | '( | ||
| 289 | semantic-symref-hits-in-region | ||
| 290 | semantic-symref-test-count-hits-in-tag | ||
| 291 | ) | ||
| 292 | "List of symref functions for profiling.") | ||
| 293 | |||
| 294 | (defun semantic-elp-analyze-symref-hits () | ||
| 295 | "Enable profiling for `semanticdb-analyze-current-context'." | ||
| 296 | (semantic-elp-analyze-enable) | ||
| 297 | (elp-instrument-list semantic-elp-symref-list) | ||
| 298 | (elp-set-master 'semantic-symref-test-count-hits-in-tag) | ||
| 299 | ) | ||
| 300 | |||
| 301 | (defvar semantic-elp-complete-list | ||
| 302 | '( | ||
| 303 | semantic-analyze-possible-completions | ||
| 304 | semantic-analyze-possible-completions-default | ||
| 305 | semantic-analyze-tags-of-class-list | ||
| 306 | semantic-analyze-type-constants | ||
| 307 | semantic-unique-tag-table-by-name | ||
| 308 | ) | ||
| 309 | "List of smart completion functions for profiling.") | ||
| 310 | |||
| 311 | (defun semantic-elp-complete-enable () | ||
| 312 | "Enable profiling for `semanticdb-analyze-current-context'." | ||
| 313 | (semantic-elp-analyze-enable) | ||
| 314 | (elp-instrument-list semantic-elp-complete-list) | ||
| 315 | (elp-set-master 'semantic-analyze-possible-completions) | ||
| 316 | ) | ||
| 317 | |||
| 318 | ;;; Storage Classes | ||
| 319 | ;; | ||
| 320 | ;; | ||
| 321 | (defclass semantic-elp-data () | ||
| 322 | ((raw :initarg :raw | ||
| 323 | :type list | ||
| 324 | :documentation | ||
| 325 | "The raw ELP data.") | ||
| 326 | (sort :initform time | ||
| 327 | :documentation | ||
| 328 | "Which column do we sort our data by during various dumps.") | ||
| 329 | (sorted :initform nil | ||
| 330 | :documentation | ||
| 331 | "The sorted and filtered version of this data.") | ||
| 332 | (total :initarg :total | ||
| 333 | :initform nil | ||
| 334 | :documentation | ||
| 335 | "The total time spent in the operation. | ||
| 336 | Recorded outside of ELP.") | ||
| 337 | ) | ||
| 338 | "Class for managing ELP data.") | ||
| 339 | |||
| 340 | (defmethod semantic-elp-change-sort ((data semantic-elp-data) &optional newsort) | ||
| 341 | "Change the sort in DATA object to NEWSORT." | ||
| 342 | (cond ((eq newsort 'rotate) | ||
| 343 | (let* ((arot '((time . avg) | ||
| 344 | (avg . calls) | ||
| 345 | (calls . name) | ||
| 346 | (name . time))) | ||
| 347 | (next (cdr (assoc (oref data sort) arot))) | ||
| 348 | ) | ||
| 349 | (oset data sort next))) | ||
| 350 | ((null newsort) | ||
| 351 | nil) | ||
| 352 | (t | ||
| 353 | (oset data sort newsort))) | ||
| 354 | (let ((r (copy-sequence (oref data raw))) | ||
| 355 | (s (oref data sort))) | ||
| 356 | (cond ((eq s 'time) | ||
| 357 | (oset data sorted (sort r (lambda (a b) | ||
| 358 | (> (aref a 1) (aref b 1)) | ||
| 359 | ))) | ||
| 360 | ) | ||
| 361 | ((eq s 'avg) | ||
| 362 | (oset data sorted (sort r (lambda (a b) | ||
| 363 | (> (aref a 2) (aref b 2)) | ||
| 364 | ))) | ||
| 365 | ) | ||
| 366 | ((eq s 'calls) | ||
| 367 | (oset data sorted (sort r (lambda (a b) | ||
| 368 | (> (aref a 0) (aref b 0)) | ||
| 369 | ))) | ||
| 370 | ) | ||
| 371 | ((eq s 'name) | ||
| 372 | (oset data sorted (sort r (lambda (a b) | ||
| 373 | (string< (aref a 3) (aref b 3)) | ||
| 374 | ))) | ||
| 375 | ) | ||
| 376 | (t (message "Don't know how to resort with %s" s) | ||
| 377 | )))) | ||
| 378 | |||
| 379 | (defun semantic-elp-goto-function (point) | ||
| 380 | "Goto the function from the ELP data. | ||
| 381 | Argument POINT is where to get the data from." | ||
| 382 | (let* ((data (get-text-property point 'ddebug)) | ||
| 383 | ) | ||
| 384 | (find-function (intern-soft (aref data 3))) | ||
| 385 | )) | ||
| 386 | |||
| 387 | (defmethod semantic-elp-dump-table ((data semantic-elp-data) | ||
| 388 | prefix) | ||
| 389 | "dump out the current DATA table using PREFIX before each line." | ||
| 390 | (let* ((elpd (oref data sorted)) | ||
| 391 | (spaces (make-string (- (length prefix) 2) ? )) | ||
| 392 | ) | ||
| 393 | (data-debug-insert-simple-thing | ||
| 394 | "Calls\t Total Time\t Avg Time/Call\tName" | ||
| 395 | spaces " " 'underline) | ||
| 396 | (dolist (d elpd) | ||
| 397 | (when (> (aref d 0) 0) ;; We had some calls | ||
| 398 | (let ((start (point)) | ||
| 399 | (end nil)) | ||
| 400 | (data-debug-insert-simple-thing | ||
| 401 | (format " % 4d\t% 2.7f\t% 2.7f\t%s" | ||
| 402 | (aref d 0) (aref d 1) (aref d 2) (aref d 3)) | ||
| 403 | spaces " " nil) | ||
| 404 | (setq end (1- (point))) | ||
| 405 | (put-text-property start end 'ddebug d) | ||
| 406 | (put-text-property start end 'ddebug-noexpand t) | ||
| 407 | (put-text-property start end 'ddebug-function | ||
| 408 | 'semantic-elp-goto-function) | ||
| 409 | ) | ||
| 410 | )) | ||
| 411 | ) | ||
| 412 | ) | ||
| 413 | |||
| 414 | (defmethod data-debug/eieio-insert-slots ((data semantic-elp-data) | ||
| 415 | prefix) | ||
| 416 | "Show the fields of ELP data in an adebug buffer. | ||
| 417 | Ignore the usual, and format a nice table." | ||
| 418 | (data-debug-insert-thing (object-name-string data) | ||
| 419 | prefix | ||
| 420 | "Name: ") | ||
| 421 | (let* ((cl (object-class data)) | ||
| 422 | (cv (class-v cl))) | ||
| 423 | (data-debug-insert-thing (class-constructor cl) | ||
| 424 | prefix | ||
| 425 | "Class: ") | ||
| 426 | ) | ||
| 427 | |||
| 428 | (data-debug-insert-thing (oref data :total) | ||
| 429 | prefix | ||
| 430 | "Total Time Spent: ") | ||
| 431 | |||
| 432 | (let ((s (oref data sort)) | ||
| 433 | ) | ||
| 434 | ;; Show how it's sorted: | ||
| 435 | (let ((start (point)) | ||
| 436 | (end nil) | ||
| 437 | ) | ||
| 438 | (insert prefix "Sort Method: " (symbol-name s)) | ||
| 439 | (setq end (point)) | ||
| 440 | ;; (data-debug-insert-thing s prefix "Sort Method: ") | ||
| 441 | (put-text-property start end 'ddebug data) | ||
| 442 | (put-text-property start end 'ddebug-noexpand t) | ||
| 443 | (put-text-property start end 'ddebug-indent(length prefix)) | ||
| 444 | (put-text-property start end 'ddebug-prefix prefix) | ||
| 445 | (put-text-property start end 'ddebug-function | ||
| 446 | 'semantic-elp-change-sort-adebug) | ||
| 447 | (put-text-property start end 'help-echo | ||
| 448 | "Change the Sort by selecting twice.") | ||
| 449 | (insert "\n")) | ||
| 450 | |||
| 451 | ;; How to sort the raw data | ||
| 452 | (semantic-elp-change-sort data) | ||
| 453 | ) | ||
| 454 | ;; Display | ||
| 455 | (semantic-elp-dump-table data prefix) | ||
| 456 | ) | ||
| 457 | |||
| 458 | (defun semantic-elp-change-sort-adebug (point) | ||
| 459 | "Change the sort function here. Redisplay. | ||
| 460 | Argument POINT is where the text is." | ||
| 461 | (let* ((data (get-text-property point 'ddebug)) | ||
| 462 | (prefix (get-text-property point 'ddebug-prefix)) | ||
| 463 | ) | ||
| 464 | ;; Get rid of the old table. | ||
| 465 | (data-debug-contract-current-line) | ||
| 466 | ;; Change it | ||
| 467 | (semantic-elp-change-sort data 'rotate) | ||
| 468 | (end-of-line) | ||
| 469 | (forward-word -1) | ||
| 470 | (delete-region (point) (point-at-eol)) | ||
| 471 | (insert (symbol-name (oref data sort))) | ||
| 472 | ;; Redraw it. | ||
| 473 | (save-excursion | ||
| 474 | (end-of-line) | ||
| 475 | (forward-char 1) | ||
| 476 | (semantic-elp-dump-table data prefix)) | ||
| 477 | )) | ||
| 478 | |||
| 479 | (defclass semantic-elp-object-base (eieio-persistent) | ||
| 480 | ((file-header-line :initform ";; SEMANTIC ELP Profiling Save File") | ||
| 481 | (total :initarg :total | ||
| 482 | :type number | ||
| 483 | :documentation | ||
| 484 | "Amount of time spent during the entire collection.") | ||
| 485 | ) | ||
| 486 | "Base elp object.") | ||
| 487 | |||
| 488 | (defclass semantic-elp-object (semantic-elp-object-base) | ||
| 489 | ((time :initarg :time | ||
| 490 | :type semantic-elp-data | ||
| 491 | :documentation | ||
| 492 | "Times for calculating something.") | ||
| 493 | (answer :initarg :answer | ||
| 494 | :documentation | ||
| 495 | "Any answer that might be useful.")) | ||
| 496 | "Simple elp object for remembering one analysis run.") | ||
| 497 | |||
| 498 | (defclass semantic-elp-object-analyze (semantic-elp-object-base) | ||
| 499 | ((pathtime :initarg :pathtime | ||
| 500 | :type semantic-elp-data | ||
| 501 | :documentation | ||
| 502 | "Times for calculating the include path.") | ||
| 503 | (typecachetime :initarg :typecachetime | ||
| 504 | :type semantic-elp-data | ||
| 505 | :documentation | ||
| 506 | "Times for calculating the typecache.") | ||
| 507 | (scopetime :initarg :scopetime | ||
| 508 | :type semantic-elp-data | ||
| 509 | :documentation | ||
| 510 | "Times for calculating the typecache") | ||
| 511 | (ctxttime :initarg :ctxttime | ||
| 512 | :type semantic-elp-data | ||
| 513 | :documentation | ||
| 514 | "Times for calculating the context.") | ||
| 515 | (completiontime :initarg :completiontime | ||
| 516 | :type semantic-elp-data | ||
| 517 | :documentation | ||
| 518 | "Times for calculating the completions.") | ||
| 519 | ) | ||
| 520 | "Results from a profile run.") | ||
| 521 | |||
| 522 | ;;; ELP hackery. | ||
| 523 | ;; | ||
| 524 | |||
| 525 | (defvar semantic-elp-last-results nil | ||
| 526 | "Save the last results from an ELP run for more post processing.") | ||
| 527 | |||
| 528 | (defun semantic-elp-results (name) | ||
| 529 | "Fetch results from the last run, and display. | ||
| 530 | Copied out of elp.el and modified only slightly. | ||
| 531 | Argument NAME is the name to give the ELP data object." | ||
| 532 | (let ((resvec | ||
| 533 | (mapcar | ||
| 534 | (function | ||
| 535 | (lambda (funsym) | ||
| 536 | (let* ((info (get funsym elp-timer-info-property)) | ||
| 537 | (symname (format "%s" funsym)) | ||
| 538 | (cc (aref info 0)) | ||
| 539 | (tt (aref info 1))) | ||
| 540 | (if (not info) | ||
| 541 | (insert "No profiling information found for: " | ||
| 542 | symname) | ||
| 543 | ;;(setq longest (max longest (length symname))) | ||
| 544 | (vector cc tt (if (zerop cc) | ||
| 545 | 0.0 ;avoid arithmetic div-by-zero errors | ||
| 546 | (/ (float tt) (float cc))) | ||
| 547 | symname))))) | ||
| 548 | elp-all-instrumented-list)) | ||
| 549 | ) ; end let | ||
| 550 | (setq semantic-elp-last-results (semantic-elp-data name :raw resvec)) | ||
| 551 | (elp-reset-all)) | ||
| 552 | ) | ||
| 553 | |||
| 554 | ;;; The big analyze and timer function! | ||
| 555 | ;; | ||
| 556 | ;; | ||
| 557 | |||
| 558 | (defvar semantic-elp-last-run nil | ||
| 559 | "The results from the last elp run.") | ||
| 560 | |||
| 561 | (defun semantic-elp-analyze () | ||
| 562 | "Run the analyzer, using ELP to measure performance." | ||
| 563 | (interactive) | ||
| 564 | (let ((elp-recycle-buffers-p nil) | ||
| 565 | (totalstart (current-time)) | ||
| 566 | (totalstop nil) | ||
| 567 | start stop | ||
| 568 | path pathtime | ||
| 569 | typecache typecachetime | ||
| 570 | scope scopetime | ||
| 571 | ctxt ctxttime | ||
| 572 | completion completiontime) | ||
| 573 | ;; Force tag table to be up to date. | ||
| 574 | (semantic-clear-toplevel-cache) | ||
| 575 | (semantic-fetch-tags) | ||
| 576 | ;; Path translation | ||
| 577 | (semantic-elp-include-path-enable) | ||
| 578 | (progn | ||
| 579 | (setq start (current-time)) | ||
| 580 | (setq path (semanticdb-find-translate-path nil nil)) | ||
| 581 | (setq stop (current-time))) | ||
| 582 | (semantic-elp-results "translate-path") | ||
| 583 | (setq pathtime semantic-elp-last-results) | ||
| 584 | (oset pathtime :total (semantic-elapsed-time start stop)) | ||
| 585 | ;; typecache | ||
| 586 | (let* ((tab semanticdb-current-table) | ||
| 587 | (idx (semanticdb-get-table-index tab)) | ||
| 588 | (tc nil) | ||
| 589 | ) | ||
| 590 | (semantic-elp-typecache-enable) | ||
| 591 | (progn | ||
| 592 | (setq start (current-time)) | ||
| 593 | (setq tc (semantic-elp-profile-typecache tab)) | ||
| 594 | (setq stop (current-time))) | ||
| 595 | (setq typecache tc)) | ||
| 596 | (semantic-elp-results "typecache") | ||
| 597 | (setq typecachetime semantic-elp-last-results) | ||
| 598 | (oset typecachetime :total (semantic-elapsed-time start stop)) | ||
| 599 | ;; Scope | ||
| 600 | (semantic-elp-scope-enable) | ||
| 601 | (progn | ||
| 602 | (setq start (current-time)) | ||
| 603 | (setq scope (semantic-calculate-scope)) | ||
| 604 | (setq stop (current-time))) | ||
| 605 | (semantic-elp-results "scope") | ||
| 606 | (setq scopetime semantic-elp-last-results) | ||
| 607 | (oset scopetime :total (semantic-elapsed-time start stop)) | ||
| 608 | ;; Analyze! | ||
| 609 | (semantic-elp-analyze-enable) | ||
| 610 | (progn | ||
| 611 | (setq start (current-time)) | ||
| 612 | (setq ctxt (semantic-analyze-current-context)) ; skip caching | ||
| 613 | (setq stop (current-time))) | ||
| 614 | (semantic-elp-results "analyze") | ||
| 615 | (setq ctxttime semantic-elp-last-results) | ||
| 616 | (oset ctxttime :total (semantic-elapsed-time start stop)) | ||
| 617 | ;; Complete! | ||
| 618 | (semantic-elp-complete-enable) | ||
| 619 | (progn | ||
| 620 | (setq start (current-time)) | ||
| 621 | (setq completion (semantic-analyze-possible-completions ctxt)) | ||
| 622 | (setq stop (current-time))) | ||
| 623 | (semantic-elp-results "complete") | ||
| 624 | (setq completiontime semantic-elp-last-results) | ||
| 625 | (oset completiontime :total (semantic-elapsed-time start stop)) | ||
| 626 | ;; Finish it | ||
| 627 | (setq totalstop (current-time)) | ||
| 628 | ;; build it | ||
| 629 | (let ((elpobj (semantic-elp-object-analyze | ||
| 630 | "ELP" | ||
| 631 | :total (semantic-elapsed-time totalstart totalstop) | ||
| 632 | :pathtime pathtime | ||
| 633 | :typecachetime typecachetime | ||
| 634 | :scopetime scopetime | ||
| 635 | :ctxttime ctxttime | ||
| 636 | :completiontime completiontime | ||
| 637 | ))) | ||
| 638 | (data-debug-show elpobj) | ||
| 639 | (setq semantic-elp-last-run elpobj) | ||
| 640 | (let ((saveas (read-file-name "Save Profile to: " (expand-file-name "~/") | ||
| 641 | "semantic.elp" nil "semantic.elp"))) | ||
| 642 | (oset elpobj :file saveas) | ||
| 643 | (eieio-persistent-save elpobj) | ||
| 644 | ) | ||
| 645 | ))) | ||
| 646 | |||
| 647 | (defun semantic-elp-idle-work () | ||
| 648 | "Run the idle work scheduler, using ELP to measure performance." | ||
| 649 | (interactive) | ||
| 650 | (require 'semantic/idle) | ||
| 651 | (let ((elp-recycle-buffers-p nil) | ||
| 652 | (totalstart nil) | ||
| 653 | (totalstop nil) | ||
| 654 | ans time | ||
| 655 | ) | ||
| 656 | ;; Path translation | ||
| 657 | (semantic-elp-core-enable) | ||
| 658 | (setq totalstart (current-time)) | ||
| 659 | (semantic-idle-scheduler-work-parse-neighboring-files) | ||
| 660 | (setq totalstop (current-time)) | ||
| 661 | (semantic-elp-results "") | ||
| 662 | (setq time semantic-elp-last-results) | ||
| 663 | (oset time :total (semantic-elapsed-time totalstart totalstop)) | ||
| 664 | ;; build it | ||
| 665 | (let ((elpobj (semantic-elp-object | ||
| 666 | "ELP" | ||
| 667 | :total (semantic-elapsed-time totalstart totalstop) | ||
| 668 | :time time))) | ||
| 669 | (data-debug-show elpobj) | ||
| 670 | (setq semantic-elp-last-run elpobj) | ||
| 671 | (let ((saveas (read-file-name "Save Profile to: " (expand-file-name "~/") | ||
| 672 | "semantic.elp" nil "semantic.elp"))) | ||
| 673 | (oset elpobj :file saveas) | ||
| 674 | (eieio-persistent-save elpobj) | ||
| 675 | ) | ||
| 676 | ))) | ||
| 677 | |||
| 678 | (defun semantic-elp-searchdb () | ||
| 679 | "Run a semanticdb search routine with the profiler. | ||
| 680 | The expectation is that you will edit this fcn with different | ||
| 681 | `semanticdb-find-' routines." | ||
| 682 | (interactive) | ||
| 683 | (let ((elp-recycle-buffers-p nil) | ||
| 684 | (totalstart nil) | ||
| 685 | (totalstop nil) | ||
| 686 | ans time | ||
| 687 | ) | ||
| 688 | ;; reset | ||
| 689 | (semantic-clear-toplevel-cache) | ||
| 690 | (semantic-fetch-tags) | ||
| 691 | |||
| 692 | ;; Path translation | ||
| 693 | (semantic-elp-include-path-enable) | ||
| 694 | (setq totalstart (current-time)) | ||
| 695 | |||
| 696 | (setq ans (semanticdb-find-tags-by-name-regexp "task" nil)) | ||
| 697 | |||
| 698 | (setq totalstop (current-time)) | ||
| 699 | (semantic-elp-results "") | ||
| 700 | (setq time semantic-elp-last-results) | ||
| 701 | (oset time :total (semantic-elapsed-time totalstart totalstop)) | ||
| 702 | ;; build it | ||
| 703 | (let ((elpobj (semantic-elp-object | ||
| 704 | "ELP" | ||
| 705 | :total (semantic-elapsed-time totalstart totalstop) | ||
| 706 | :time time | ||
| 707 | :answer ans))) | ||
| 708 | (data-debug-show elpobj) | ||
| 709 | (setq semantic-elp-last-run elpobj) | ||
| 710 | (let ((saveas (read-file-name "Save Profile to: " (expand-file-name "~/") | ||
| 711 | "semantic.elp" nil "semantic.elp"))) | ||
| 712 | (oset elpobj :file saveas) | ||
| 713 | (eieio-persistent-save elpobj) | ||
| 714 | ) | ||
| 715 | ))) | ||
| 716 | |||
| 717 | (defun semantic-elp-symref-hit-count () | ||
| 718 | "Run a `semantic-symref-test-count-hits-in-tag' with elp on." | ||
| 719 | (interactive) | ||
| 720 | (let ((elp-recycle-buffers-p nil) | ||
| 721 | (totalstart nil) | ||
| 722 | (totalstop nil) | ||
| 723 | ans time | ||
| 724 | ) | ||
| 725 | ;; reset | ||
| 726 | (semantic-clear-toplevel-cache) | ||
| 727 | (semantic-fetch-tags) | ||
| 728 | |||
| 729 | ;; Build up caches so we get user use timings. | ||
| 730 | (semantic-analyze-current-context) | ||
| 731 | |||
| 732 | ;; Enable everything for analysis. | ||
| 733 | (semantic-elp-analyze-symref-hits) | ||
| 734 | |||
| 735 | ;; Do the analysis | ||
| 736 | (setq totalstart (current-time)) | ||
| 737 | |||
| 738 | (setq ans (semantic-symref-test-count-hits-in-tag)) | ||
| 739 | |||
| 740 | (setq totalstop (current-time)) | ||
| 741 | |||
| 742 | (semantic-elp-results "") | ||
| 743 | (setq time semantic-elp-last-results) | ||
| 744 | (oset time :total (semantic-elapsed-time totalstart totalstop)) | ||
| 745 | ;; build it | ||
| 746 | (let ((elpobj (semantic-elp-object | ||
| 747 | "ELP" | ||
| 748 | :total (semantic-elapsed-time totalstart totalstop) | ||
| 749 | :time time | ||
| 750 | :answer ans))) | ||
| 751 | (data-debug-show elpobj) | ||
| 752 | (setq semantic-elp-last-run elpobj) | ||
| 753 | ;;(let ((saveas (read-file-name "Save Profile to: " (expand-file-name "~/") | ||
| 754 | ;; "semantic.elp" nil "semantic.elp"))) | ||
| 755 | ;; (oset elpobj :file saveas) | ||
| 756 | ;; (eieio-persistent-save elpobj) | ||
| 757 | ;; ) | ||
| 758 | ))) | ||
| 759 | |||
| 760 | (defun semantic-elp-show-last-run () | ||
| 761 | "Show the last elp run." | ||
| 762 | (interactive) | ||
| 763 | (when (not semantic-elp-last-run) | ||
| 764 | (error "No last run to show")) | ||
| 765 | (data-debug-show semantic-elp-last-run)) | ||
| 766 | |||
| 767 | (defun semantic-elp-load-old-run (file) | ||
| 768 | "Load an old run from FILE, and show it." | ||
| 769 | (interactive "fLast Run File: ") | ||
| 770 | (setq semantic-elp-last-run | ||
| 771 | (eieio-persistent-read file)) | ||
| 772 | (data-debug-show semantic-elp-last-run)) | ||
| 773 | |||
| 774 | (provide 'semantic/elp) | ||
| 775 | ;;; semantic/elp.el ends here | ||
diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index 4ab6a8d8a62..0a7475081be 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | ;; | 53 | ;; |
| 54 | ;; These routines provide fast access to tokens based on a buffer that | 54 | ;; These routines provide fast access to tokens based on a buffer that |
| 55 | ;; has parsed tokens in it. Uses overlays to perform the hard work. | 55 | ;; has parsed tokens in it. Uses overlays to perform the hard work. |
| 56 | 56 | ;; | |
| 57 | ;;;###autoload | 57 | ;;;###autoload |
| 58 | (defun semantic-find-tag-by-overlay (&optional positionormarker buffer) | 58 | (defun semantic-find-tag-by-overlay (&optional positionormarker buffer) |
| 59 | "Find all tags covering POSITIONORMARKER by using overlays. | 59 | "Find all tags covering POSITIONORMARKER by using overlays. |
| @@ -257,7 +257,7 @@ TABLE is a semantic tags table. See `semantic-something-to-tag-table'." | |||
| 257 | (nreverse result))) | 257 | (nreverse result))) |
| 258 | 258 | ||
| 259 | ;;; Top level Searches | 259 | ;;; Top level Searches |
| 260 | 260 | ;; | |
| 261 | ;;;###autoload | 261 | ;;;###autoload |
| 262 | (defun semantic-find-first-tag-by-name (name &optional table) | 262 | (defun semantic-find-first-tag-by-name (name &optional table) |
| 263 | "Find the first tag with NAME in TABLE. | 263 | "Find the first tag with NAME in TABLE. |
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el index f967740ad2b..b13673318d2 100644 --- a/lisp/cedet/semantic/format.el +++ b/lisp/cedet/semantic/format.el | |||
| @@ -33,13 +33,12 @@ | |||
| 33 | ;; | 33 | ;; |
| 34 | 34 | ||
| 35 | ;;; Code: | 35 | ;;; Code: |
| 36 | (eval-when-compile (require 'font-lock)) | ||
| 36 | (require 'semantic) | 37 | (require 'semantic) |
| 37 | (require 'semantic/tag-ls) | 38 | (require 'semantic/tag-ls) |
| 38 | (require 'ezimage) | 39 | (require 'ezimage) |
| 39 | 40 | ||
| 40 | (eval-when-compile | 41 | (eval-when-compile (require 'semantic/find)) |
| 41 | (require 'font-lock) | ||
| 42 | (require 'semantic/find)) | ||
| 43 | 42 | ||
| 44 | ;;; Tag to text overload functions | 43 | ;;; Tag to text overload functions |
| 45 | ;; | 44 | ;; |
| @@ -68,7 +67,7 @@ COLOR indicates that the generated text should be colored using | |||
| 68 | `font-lock'.") | 67 | `font-lock'.") |
| 69 | 68 | ||
| 70 | (semantic-varalias-obsolete 'semantic-token->text-functions | 69 | (semantic-varalias-obsolete 'semantic-token->text-functions |
| 71 | 'semantic-format-tag-functions) | 70 | 'semantic-format-tag-functions) |
| 72 | 71 | ||
| 73 | (defvar semantic-format-tag-custom-list | 72 | (defvar semantic-format-tag-custom-list |
| 74 | (append '(radio) | 73 | (append '(radio) |
| @@ -79,7 +78,7 @@ COLOR indicates that the generated text should be colored using | |||
| 79 | Use this variable in the :type field of a customizable variable.") | 78 | Use this variable in the :type field of a customizable variable.") |
| 80 | 79 | ||
| 81 | (semantic-varalias-obsolete 'semantic-token->text-custom-list | 80 | (semantic-varalias-obsolete 'semantic-token->text-custom-list |
| 82 | 'semantic-format-tag-custom-list) | 81 | 'semantic-format-tag-custom-list) |
| 83 | 82 | ||
| 84 | (defcustom semantic-format-use-images-flag ezimage-use-images | 83 | (defcustom semantic-format-use-images-flag ezimage-use-images |
| 85 | "Non-nil means semantic format functions use images. | 84 | "Non-nil means semantic format functions use images. |
| @@ -95,61 +94,6 @@ Images can be used as icons instead of some types of text strings." | |||
| 95 | "Text used to separate names when between namespaces/classes and functions.") | 94 | "Text used to separate names when between namespaces/classes and functions.") |
| 96 | (make-variable-buffer-local 'semantic-format-parent-separator) | 95 | (make-variable-buffer-local 'semantic-format-parent-separator) |
| 97 | 96 | ||
| 98 | ;;;###autoload | ||
| 99 | (define-overloadable-function semantic-format-tag-name (tag &optional parent color) | ||
| 100 | "Return the name string describing TAG. | ||
| 101 | The name is the shortest possible representation. | ||
| 102 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 103 | Optional argument COLOR means highlight the prototype with font-lock colors.") | ||
| 104 | |||
| 105 | (defun semantic-format-tag-name-default (tag &optional parent color) | ||
| 106 | "Return an abbreviated string describing TAG. | ||
| 107 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 108 | Optional argument COLOR means highlight the prototype with font-lock colors." | ||
| 109 | (let ((name (semantic-tag-name tag)) | ||
| 110 | (destructor | ||
| 111 | (if (eq (semantic-tag-class tag) 'function) | ||
| 112 | (semantic-tag-function-destructor-p tag)))) | ||
| 113 | (when destructor | ||
| 114 | (setq name (concat "~" name))) | ||
| 115 | (if color | ||
| 116 | (setq name (semantic--format-colorize-text name (semantic-tag-class tag)))) | ||
| 117 | name)) | ||
| 118 | |||
| 119 | ;;;###autoload | ||
| 120 | (define-overloadable-function semantic-format-tag-prototype (tag &optional parent color) | ||
| 121 | "Return a prototype for TAG. | ||
| 122 | This function should be overloaded, though it need not be used. | ||
| 123 | This is because it can be used to create code by language independent | ||
| 124 | tools. | ||
| 125 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 126 | Optional argument COLOR means highlight the prototype with font-lock colors.") | ||
| 127 | |||
| 128 | |||
| 129 | (defun semantic-test-all-format-tag-functions (&optional arg) | ||
| 130 | "Test all outputs from `semantic-format-tag-functions'. | ||
| 131 | Output is generated from the function under `point'. | ||
| 132 | Optional argument ARG specifies not to use color." | ||
| 133 | (interactive "P") | ||
| 134 | (require 'semantic/find) | ||
| 135 | (semantic-fetch-tags) | ||
| 136 | (let* ((tag (semantic-current-tag)) | ||
| 137 | (par (semantic-current-tag-parent)) | ||
| 138 | (fns semantic-format-tag-functions)) | ||
| 139 | (with-output-to-temp-buffer "*format-tag*" | ||
| 140 | (princ "Tag->format function tests:") | ||
| 141 | (while fns | ||
| 142 | (princ "\n") | ||
| 143 | (princ (car fns)) | ||
| 144 | (princ ":\n ") | ||
| 145 | (let ((s (funcall (car fns) tag par (not arg)))) | ||
| 146 | (save-excursion | ||
| 147 | (set-buffer "*format-tag*") | ||
| 148 | (goto-char (point-max)) | ||
| 149 | (insert s))) | ||
| 150 | (setq fns (cdr fns)))) | ||
| 151 | )) | ||
| 152 | |||
| 153 | (defvar semantic-format-face-alist | 97 | (defvar semantic-format-face-alist |
| 154 | `( (function . font-lock-function-name-face) | 98 | `( (function . font-lock-function-name-face) |
| 155 | (variable . font-lock-variable-name-face) | 99 | (variable . font-lock-variable-name-face) |
| @@ -180,7 +124,7 @@ Faces used are generated in `font-lock' for consistency, and will not | |||
| 180 | be used unless font lock is a feature.") | 124 | be used unless font lock is a feature.") |
| 181 | 125 | ||
| 182 | (semantic-varalias-obsolete 'semantic-face-alist | 126 | (semantic-varalias-obsolete 'semantic-face-alist |
| 183 | 'semantic-format-face-alist) | 127 | 'semantic-format-face-alist) |
| 184 | 128 | ||
| 185 | 129 | ||
| 186 | 130 | ||
| @@ -198,7 +142,7 @@ for details on adding new types." | |||
| 198 | text)) | 142 | text)) |
| 199 | 143 | ||
| 200 | (make-obsolete 'semantic-colorize-text | 144 | (make-obsolete 'semantic-colorize-text |
| 201 | 'semantic--format-colorize-text) | 145 | 'semantic--format-colorize-text) |
| 202 | 146 | ||
| 203 | (defun semantic--format-colorize-merge-text (precoloredtext face-class) | 147 | (defun semantic--format-colorize-merge-text (precoloredtext face-class) |
| 204 | "Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS. | 148 | "Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS. |
| @@ -280,6 +224,7 @@ Argument COLOR specifies to colorize the text." | |||
| 280 | 224 | ||
| 281 | 225 | ||
| 282 | ;;; Abstract formatting functions | 226 | ;;; Abstract formatting functions |
| 227 | ;; | ||
| 283 | 228 | ||
| 284 | (defun semantic-format-tag-prin1 (tag &optional parent color) | 229 | (defun semantic-format-tag-prin1 (tag &optional parent color) |
| 285 | "Convert TAG to a string that is the print name for TAG. | 230 | "Convert TAG to a string that is the print name for TAG. |
| @@ -311,6 +256,27 @@ of FACE-CLASS for which this is used." | |||
| 311 | (stringp (car anything))) | 256 | (stringp (car anything))) |
| 312 | (semantic--format-colorize-text (car anything) colorhint)))) | 257 | (semantic--format-colorize-text (car anything) colorhint)))) |
| 313 | 258 | ||
| 259 | ;;;###autoload | ||
| 260 | (define-overloadable-function semantic-format-tag-name (tag &optional parent color) | ||
| 261 | "Return the name string describing TAG. | ||
| 262 | The name is the shortest possible representation. | ||
| 263 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 264 | Optional argument COLOR means highlight the prototype with font-lock colors.") | ||
| 265 | |||
| 266 | (defun semantic-format-tag-name-default (tag &optional parent color) | ||
| 267 | "Return an abbreviated string describing TAG. | ||
| 268 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 269 | Optional argument COLOR means highlight the prototype with font-lock colors." | ||
| 270 | (let ((name (semantic-tag-name tag)) | ||
| 271 | (destructor | ||
| 272 | (if (eq (semantic-tag-class tag) 'function) | ||
| 273 | (semantic-tag-function-destructor-p tag)))) | ||
| 274 | (when destructor | ||
| 275 | (setq name (concat "~" name))) | ||
| 276 | (if color | ||
| 277 | (setq name (semantic--format-colorize-text name (semantic-tag-class tag)))) | ||
| 278 | name)) | ||
| 279 | |||
| 314 | (declare-function semantic-go-to-tag "semantic/tag-file") | 280 | (declare-function semantic-go-to-tag "semantic/tag-file") |
| 315 | 281 | ||
| 316 | (defun semantic--format-tag-parent-tree (tag parent) | 282 | (defun semantic--format-tag-parent-tree (tag parent) |
| @@ -430,14 +396,14 @@ Optional argument COLOR means highlight the prototype with font-lock colors.") | |||
| 430 | Optional argument PARENT is the parent type if TAG is a detail. | 396 | Optional argument PARENT is the parent type if TAG is a detail. |
| 431 | Optional argument COLOR means highlight the prototype with font-lock colors." | 397 | Optional argument COLOR means highlight the prototype with font-lock colors." |
| 432 | (let* ((proto (semantic-format-tag-prototype tag nil color)) | 398 | (let* ((proto (semantic-format-tag-prototype tag nil color)) |
| 433 | (names (if parent | 399 | (names (if parent |
| 434 | semantic-symbol->name-assoc-list-for-type-parts | 400 | semantic-symbol->name-assoc-list-for-type-parts |
| 435 | semantic-symbol->name-assoc-list)) | 401 | semantic-symbol->name-assoc-list)) |
| 436 | (tsymb (semantic-tag-class tag)) | 402 | (tsymb (semantic-tag-class tag)) |
| 437 | (label (capitalize (or (cdr-safe (assoc tsymb names)) | 403 | (label (capitalize (or (cdr-safe (assoc tsymb names)) |
| 438 | (symbol-name tsymb))))) | 404 | (symbol-name tsymb))))) |
| 439 | (if color | 405 | (if color |
| 440 | (setq label (semantic--format-colorize-text label 'label))) | 406 | (setq label (semantic--format-colorize-text label 'label))) |
| 441 | (concat label ": " proto))) | 407 | (concat label ": " proto))) |
| 442 | 408 | ||
| 443 | (define-overloadable-function semantic-format-tag-summarize-with-file (tag &optional parent color) | 409 | (define-overloadable-function semantic-format-tag-summarize-with-file (tag &optional parent color) |
| @@ -450,7 +416,7 @@ Optional argument COLOR means highlight the prototype with font-lock colors.") | |||
| 450 | Optional argument PARENT is the parent type if TAG is a detail. | 416 | Optional argument PARENT is the parent type if TAG is a detail. |
| 451 | Optional argument COLOR means highlight the prototype with font-lock colors." | 417 | Optional argument COLOR means highlight the prototype with font-lock colors." |
| 452 | (let* ((proto (semantic-format-tag-prototype tag nil color)) | 418 | (let* ((proto (semantic-format-tag-prototype tag nil color)) |
| 453 | (file (semantic-tag-file-name tag)) | 419 | (file (semantic-tag-file-name tag)) |
| 454 | ) | 420 | ) |
| 455 | ;; Nothing for tag? Try parent. | 421 | ;; Nothing for tag? Try parent. |
| 456 | (when (and (not file) (and parent)) | 422 | (when (and (not file) (and parent)) |
| @@ -505,6 +471,15 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 505 | )) | 471 | )) |
| 506 | 472 | ||
| 507 | ;;; Prototype generation | 473 | ;;; Prototype generation |
| 474 | ;; | ||
| 475 | ;;;###autoload | ||
| 476 | (define-overloadable-function semantic-format-tag-prototype (tag &optional parent color) | ||
| 477 | "Return a prototype for TAG. | ||
| 478 | This function should be overloaded, though it need not be used. | ||
| 479 | This is because it can be used to create code by language independent | ||
| 480 | tools. | ||
| 481 | Optional argument PARENT is the parent type if TAG is a detail. | ||
| 482 | Optional argument COLOR means highlight the prototype with font-lock colors.") | ||
| 508 | 483 | ||
| 509 | (defun semantic-format-tag-prototype-default (tag &optional parent color) | 484 | (defun semantic-format-tag-prototype-default (tag &optional parent color) |
| 510 | "Default method for returning a prototype for TAG. | 485 | "Default method for returning a prototype for TAG. |
| @@ -516,14 +491,14 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 516 | (type (if (member class '(function variable type)) | 491 | (type (if (member class '(function variable type)) |
| 517 | (semantic-format-tag-type tag color))) | 492 | (semantic-format-tag-type tag color))) |
| 518 | (args (if (member class '(function type)) | 493 | (args (if (member class '(function type)) |
| 519 | (semantic--format-tag-arguments | 494 | (semantic--format-tag-arguments |
| 520 | (if (eq class 'function) | 495 | (if (eq class 'function) |
| 521 | (semantic-tag-function-arguments tag) | 496 | (semantic-tag-function-arguments tag) |
| 522 | (list "") | 497 | (list "") |
| 523 | ;;(semantic-tag-type-members tag) | 498 | ;;(semantic-tag-type-members tag) |
| 524 | ) | 499 | ) |
| 525 | #'semantic-format-tag-prototype | 500 | #'semantic-format-tag-prototype |
| 526 | color))) | 501 | color))) |
| 527 | (const (semantic-tag-get-attribute tag :constant-flag)) | 502 | (const (semantic-tag-get-attribute tag :constant-flag)) |
| 528 | (tm (semantic-tag-get-attribute tag :typemodifiers)) | 503 | (tm (semantic-tag-get-attribute tag :typemodifiers)) |
| 529 | (mods (append | 504 | (mods (append |
| @@ -581,14 +556,14 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 581 | ")")) | 556 | ")")) |
| 582 | ((eq class 'variable) | 557 | ((eq class 'variable) |
| 583 | (let* ((deref (semantic-tag-get-attribute | 558 | (let* ((deref (semantic-tag-get-attribute |
| 584 | tag :dereference)) | 559 | tag :dereference)) |
| 585 | (array "") | 560 | (array "") |
| 586 | ) | 561 | ) |
| 587 | (while (and deref (/= deref 0)) | 562 | (while (and deref (/= deref 0)) |
| 588 | (setq array (concat array "[]") | 563 | (setq array (concat array "[]") |
| 589 | deref (1- deref))) | 564 | deref (1- deref))) |
| 590 | (concat (semantic-format-tag-name tag parent color) | 565 | (concat (semantic-format-tag-name tag parent color) |
| 591 | array))) | 566 | array))) |
| 592 | (t | 567 | (t |
| 593 | (semantic-format-tag-abbreviate tag parent color))))) | 568 | (semantic-format-tag-abbreviate tag parent color))))) |
| 594 | 569 | ||
| @@ -756,6 +731,32 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 756 | )) | 731 | )) |
| 757 | 732 | ||
| 758 | 733 | ||
| 734 | ;;; Test routines | ||
| 735 | ;; | ||
| 736 | (defun semantic-test-all-format-tag-functions (&optional arg) | ||
| 737 | "Test all outputs from `semantic-format-tag-functions'. | ||
| 738 | Output is generated from the function under `point'. | ||
| 739 | Optional argument ARG specifies not to use color." | ||
| 740 | (interactive "P") | ||
| 741 | (semantic-fetch-tags) | ||
| 742 | (let* ((tag (semantic-current-tag)) | ||
| 743 | (par (semantic-current-tag-parent)) | ||
| 744 | (fns semantic-format-tag-functions)) | ||
| 745 | (with-output-to-temp-buffer "*format-tag*" | ||
| 746 | (princ "Tag->format function tests:") | ||
| 747 | (while fns | ||
| 748 | (princ "\n") | ||
| 749 | (princ (car fns)) | ||
| 750 | (princ ":\n ") | ||
| 751 | (let ((s (funcall (car fns) tag par (not arg)))) | ||
| 752 | (save-excursion | ||
| 753 | (set-buffer "*format-tag*") | ||
| 754 | (goto-char (point-max)) | ||
| 755 | (insert s))) | ||
| 756 | (setq fns (cdr fns)))) | ||
| 757 | )) | ||
| 758 | |||
| 759 | |||
| 759 | ;;; Compatibility and aliases | 760 | ;;; Compatibility and aliases |
| 760 | ;; | 761 | ;; |
| 761 | (semantic-alias-obsolete 'semantic-prin1-nonterminal | 762 | (semantic-alias-obsolete 'semantic-prin1-nonterminal |
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index 3a57c65792d..b7f2e9a16b0 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el | |||
| @@ -24,9 +24,6 @@ | |||
| 24 | ;; | 24 | ;; |
| 25 | ;; Common function for Java parsers. | 25 | ;; Common function for Java parsers. |
| 26 | 26 | ||
| 27 | ;;; History: | ||
| 28 | ;; | ||
| 29 | |||
| 30 | ;;; Code: | 27 | ;;; Code: |
| 31 | (require 'semantic) | 28 | (require 'semantic) |
| 32 | (require 'semantic/ctxt) | 29 | (require 'semantic/ctxt) |
| @@ -169,7 +166,7 @@ corresponding compound declaration." | |||
| 169 | "Return a function (method) prototype for TAG. | 166 | "Return a function (method) prototype for TAG. |
| 170 | Optional argument PARENT is a parent (containing) item. | 167 | Optional argument PARENT is a parent (containing) item. |
| 171 | Optional argument COLOR indicates that color should be mixed in. | 168 | Optional argument COLOR indicates that color should be mixed in. |
| 172 | See also `semantic-format-prototype-tag'." | 169 | See also `semantic-format-tag-prototype'." |
| 173 | (let ((name (semantic-tag-name tag)) | 170 | (let ((name (semantic-tag-name tag)) |
| 174 | (type (semantic-java-type tag)) | 171 | (type (semantic-java-type tag)) |
| 175 | (tmpl (semantic-tag-get-attribute tag :template-specifier)) | 172 | (tmpl (semantic-tag-get-attribute tag :template-specifier)) |
| @@ -197,7 +194,7 @@ See also `semantic-format-prototype-tag'." | |||
| 197 | "Return a variable (field) prototype for TAG. | 194 | "Return a variable (field) prototype for TAG. |
| 198 | Optional argument PARENT is a parent (containing) item. | 195 | Optional argument PARENT is a parent (containing) item. |
| 199 | Optional argument COLOR indicates that color should be mixed in. | 196 | Optional argument COLOR indicates that color should be mixed in. |
| 200 | See also `semantic-format-prototype-tag'." | 197 | See also `semantic-format-tag-prototype'." |
| 201 | (let ((name (semantic-tag-name tag)) | 198 | (let ((name (semantic-tag-name tag)) |
| 202 | (type (semantic-java-type tag))) | 199 | (type (semantic-java-type tag))) |
| 203 | (concat (if color | 200 | (concat (if color |
| @@ -212,7 +209,7 @@ See also `semantic-format-prototype-tag'." | |||
| 212 | "Return a type (class/interface) prototype for TAG. | 209 | "Return a type (class/interface) prototype for TAG. |
| 213 | Optional argument PARENT is a parent (containing) item. | 210 | Optional argument PARENT is a parent (containing) item. |
| 214 | Optional argument COLOR indicates that color should be mixed in. | 211 | Optional argument COLOR indicates that color should be mixed in. |
| 215 | See also `semantic-format-prototype-tag'." | 212 | See also `semantic-format-tag-prototype'." |
| 216 | (let ((name (semantic-tag-name tag)) | 213 | (let ((name (semantic-tag-name tag)) |
| 217 | (type (semantic-tag-type tag)) | 214 | (type (semantic-tag-type tag)) |
| 218 | (tmpl (semantic-tag-get-attribute tag :template-specifier))) | 215 | (tmpl (semantic-tag-get-attribute tag :template-specifier))) |
| @@ -222,7 +219,7 @@ See also `semantic-format-prototype-tag'." | |||
| 222 | name) | 219 | name) |
| 223 | (or tmpl "")))) | 220 | (or tmpl "")))) |
| 224 | 221 | ||
| 225 | (define-mode-local-override semantic-format-prototype-tag | 222 | (define-mode-local-override semantic-format-tag-prototype |
| 226 | java-mode (tag &optional parent color) | 223 | java-mode (tag &optional parent color) |
| 227 | "Return a prototype for TOKEN. | 224 | "Return a prototype for TOKEN. |
| 228 | Optional argument PARENT is a parent (containing) item. | 225 | Optional argument PARENT is a parent (containing) item. |
| @@ -235,7 +232,7 @@ Optional argument COLOR indicates that color should be mixed in." | |||
| 235 | tag parent color))) | 232 | tag parent color))) |
| 236 | 233 | ||
| 237 | (semantic-alias-obsolete 'semantic-java-prototype-nonterminal | 234 | (semantic-alias-obsolete 'semantic-java-prototype-nonterminal |
| 238 | 'semantic-format-prototype-tag-java-mode) | 235 | 'semantic-format-tag-prototype-java-mode) |
| 239 | 236 | ||
| 240 | ;; Include Tag Name | 237 | ;; Include Tag Name |
| 241 | ;; | 238 | ;; |
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 39258f550d3..de0f6fa61d4 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el | |||
| @@ -834,14 +834,18 @@ Parsing starts inside the parens, and ends at the end of TOKEN." | |||
| 834 | 834 | ||
| 835 | (nreverse toks))))) | 835 | (nreverse toks))))) |
| 836 | 836 | ||
| 837 | (defvar semantic-lex-spp-hack-depth 0 | ||
| 838 | "Current depth of recursive calls to `semantic-lex-spp-lex-text-string'.") | ||
| 839 | |||
| 837 | (defun semantic-lex-spp-lex-text-string (text) | 840 | (defun semantic-lex-spp-lex-text-string (text) |
| 838 | "Lex the text string TEXT using the current buffer's state. | 841 | "Lex the text string TEXT using the current buffer's state. |
| 839 | Use this to parse text extracted from a macro as if it came from | 842 | Use this to parse text extracted from a macro as if it came from |
| 840 | the current buffer. Since the lexer is designed to only work in | 843 | the current buffer. Since the lexer is designed to only work in |
| 841 | a buffer, we need to create a new buffer, and populate it with rules | 844 | a buffer, we need to create a new buffer, and populate it with rules |
| 842 | and variable state from the current buffer." | 845 | and variable state from the current buffer." |
| 843 | ;; @TODO - will this fcn recurse? | 846 | (let* ((semantic-lex-spp-hack-depth (1+ semantic-lex-spp-hack-depth)) |
| 844 | (let* ((buf (get-buffer-create " *SPP parse hack*")) | 847 | (buf (get-buffer-create (format " *SPP parse hack %d*" |
| 848 | semantic-lex-spp-hack-depth))) | ||
| 845 | (mode major-mode) | 849 | (mode major-mode) |
| 846 | (fresh-toks nil) | 850 | (fresh-toks nil) |
| 847 | (toks nil) | 851 | (toks nil) |
diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el index febe4046f84..015efb24fd9 100644 --- a/lisp/cedet/semantic/tag.el +++ b/lisp/cedet/semantic/tag.el | |||
| @@ -42,9 +42,6 @@ | |||
| 42 | ;; III. Tag Comparison. Allows explicit or comparitive tests to see | 42 | ;; III. Tag Comparison. Allows explicit or comparitive tests to see |
| 43 | ;; if two tags are the same. | 43 | ;; if two tags are the same. |
| 44 | 44 | ||
| 45 | ;;; History: | ||
| 46 | ;; | ||
| 47 | |||
| 48 | ;;; Code: | 45 | ;;; Code: |
| 49 | ;; | 46 | ;; |
| 50 | 47 | ||
diff --git a/lisp/cedet/semantic/wisent/java.el b/lisp/cedet/semantic/wisent/java-tags.el index af7c33ffe40..ff5e0634d96 100644 --- a/lisp/cedet/semantic/wisent/java.el +++ b/lisp/cedet/semantic/wisent/java-tags.el | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | ;;; semantic/wisent/java.el --- Java LALR parser for Emacs | 1 | ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 | 3 | ;;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: David Ponce <david@dponce.com> | 6 | ;; Author: David Ponce <david@dponce.com> |
| 7 | ;; Maintainer: David Ponce <david@dponce.com> | 7 | ;; Maintainer: David Ponce <david@dponce.com> |
| 8 | ;; Created: 19 June 2001 | 8 | ;; Created: 15 Dec 2001 |
| 9 | ;; Keywords: syntax | 9 | ;; Keywords: syntax |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| @@ -32,34 +32,65 @@ | |||
| 32 | ;;; Code: | 32 | ;;; Code: |
| 33 | 33 | ||
| 34 | (require 'semantic/wisent) | 34 | (require 'semantic/wisent) |
| 35 | (require 'semantic/wisent/java-wy) | 35 | (require 'semantic/wisent/javat-wy) |
| 36 | (require 'semantic/java) | 36 | (require 'semantic/java) |
| 37 | 37 | ||
| 38 | ;;; Enable Semantic in `java-mode'. | 38 | ;;;; |
| 39 | ;; | 39 | ;;;; Simple parser error reporting function |
| 40 | (defun wisent-java-init-parser-context () | 40 | ;;;; |
| 41 | "Initialize context of the LR parser engine. | 41 | |
| 42 | Used as a local `wisent-pre-parse-hook' to cleanup the stack of enum | 42 | (defun wisent-java-parse-error (msg) |
| 43 | names in scope." | 43 | "Error reporting function called when a parse error occurs. |
| 44 | (setq wisent-java-wy--enums nil)) | 44 | MSG is the message string to report." |
| 45 | ;; (let ((error-start (nth 2 wisent-input))) | ||
| 46 | ;; (if (number-or-marker-p error-start) | ||
| 47 | ;; (goto-char error-start))) | ||
| 48 | (message msg) | ||
| 49 | ;;(debug) | ||
| 50 | ) | ||
| 45 | 51 | ||
| 52 | ;;;; | ||
| 53 | ;;;; Local context | ||
| 54 | ;;;; | ||
| 55 | |||
| 56 | (define-mode-local-override semantic-get-local-variables | ||
| 57 | java-mode () | ||
| 58 | "Get local values from a specific context. | ||
| 59 | Parse the current context for `field_declaration' nonterminals to | ||
| 60 | collect tags, such as local variables or prototypes. | ||
| 61 | This function override `get-local-variables'." | ||
| 62 | (let ((vars nil) | ||
| 63 | ;; We want nothing to do with funny syntaxing while doing this. | ||
| 64 | (semantic-unmatched-syntax-hook nil)) | ||
| 65 | (while (not (semantic-up-context (point) 'function)) | ||
| 66 | (save-excursion | ||
| 67 | (forward-char 1) | ||
| 68 | (setq vars | ||
| 69 | (append (semantic-parse-region | ||
| 70 | (point) | ||
| 71 | (save-excursion (semantic-end-of-context) (point)) | ||
| 72 | 'field_declaration | ||
| 73 | 0 t) | ||
| 74 | vars)))) | ||
| 75 | vars)) | ||
| 76 | |||
| 77 | ;;;; | ||
| 78 | ;;;; Semantic integration of the Java LALR parser | ||
| 79 | ;;;; | ||
| 80 | |||
| 81 | ;;;###autoload | ||
| 46 | (defun wisent-java-default-setup () | 82 | (defun wisent-java-default-setup () |
| 47 | "Hook run to setup Semantic in `java-mode'." | 83 | "Hook run to setup Semantic in `java-mode'. |
| 48 | ;; Use the Wisent LALR(1) parser to analyze Java sources. | 84 | Use the alternate LALR(1) parser." |
| 49 | (wisent-java-wy--install-parser) | 85 | (wisent-java-tags-wy--install-parser) |
| 50 | (semantic-make-local-hook 'wisent-pre-parse-hook) | ||
| 51 | (add-hook 'wisent-pre-parse-hook | ||
| 52 | 'wisent-java-init-parser-context nil t) | ||
| 53 | (setq | 86 | (setq |
| 54 | ;; Lexical analysis | 87 | ;; Lexical analysis |
| 55 | semantic-lex-number-expression semantic-java-number-regexp | 88 | semantic-lex-number-expression semantic-java-number-regexp |
| 56 | semantic-lex-depth nil | 89 | semantic-lex-analyzer 'wisent-java-tags-lexer |
| 57 | semantic-lex-analyzer 'wisent-java-lexer | ||
| 58 | ;; Parsing | 90 | ;; Parsing |
| 59 | semantic-tag-expand-function 'semantic-java-expand-tag | 91 | semantic-tag-expand-function 'semantic-java-expand-tag |
| 60 | ;; Environment | 92 | ;; Environment |
| 61 | semantic-imenu-summary-function 'semantic-format-tag-prototype | 93 | semantic-imenu-summary-function 'semantic-format-tag-prototype |
| 62 | semantic-imenu-expandable-tag-classes '(type variable) | ||
| 63 | imenu-create-index-function 'semantic-create-imenu-index | 94 | imenu-create-index-function 'semantic-create-imenu-index |
| 64 | semantic-type-relation-separator-character '(".") | 95 | semantic-type-relation-separator-character '(".") |
| 65 | semantic-command-separation-character ";" | 96 | semantic-command-separation-character ";" |
| @@ -80,35 +111,15 @@ names in scope." | |||
| 80 | ;; Setup javadoc stuff | 111 | ;; Setup javadoc stuff |
| 81 | (semantic-java-doc-setup)) | 112 | (semantic-java-doc-setup)) |
| 82 | 113 | ||
| 114 | ;;;###autoload | ||
| 83 | (add-hook 'java-mode-hook 'wisent-java-default-setup) | 115 | (add-hook 'java-mode-hook 'wisent-java-default-setup) |
| 84 | 116 | ||
| 85 | ;;; Overridden Semantic API. | 117 | (provide 'semantic/wisent/java-tags) |
| 86 | ;; | ||
| 87 | (define-mode-local-override semantic-tag-components java-mode (tag) | ||
| 88 | "Return a list of components for TAG." | ||
| 89 | (if (semantic-tag-of-class-p tag 'function) | ||
| 90 | (semantic-tag-function-arguments tag) | ||
| 91 | ;; Simply return the value of the :members attribute. | ||
| 92 | (semantic-tag-get-attribute tag :members))) | ||
| 93 | 118 | ||
| 94 | (define-mode-local-override semantic-get-local-variables | 119 | ;; Local variables: |
| 95 | java-mode () | 120 | ;; generated-autoload-file: "../loaddefs.el" |
| 96 | "Get local variable declarations from the current context." | 121 | ;; generated-autoload-feature: semantic/loaddefs |
| 97 | (let (result | 122 | ;; generated-autoload-load-name: "semantic/wisent/java-tags" |
| 98 | ;; Ignore funny syntax while doing this. | 123 | ;; End: |
| 99 | semantic-unmatched-syntax-hook) | 124 | |
| 100 | (while (not (semantic-up-context (point) 'function)) | 125 | ;;; semantic/wisent/java-tags.el ends here |
| 101 | (save-excursion | ||
| 102 | (forward-char 1) | ||
| 103 | (push (semantic-parse-region | ||
| 104 | (point) | ||
| 105 | (save-excursion (semantic-end-of-context) (point)) | ||
| 106 | ;; See this production in wisent-java.wy. | ||
| 107 | 'block_statement | ||
| 108 | nil t) | ||
| 109 | result))) | ||
| 110 | (apply 'append result))) | ||
| 111 | |||
| 112 | (provide 'semantic/wisent/java) | ||
| 113 | |||
| 114 | ;;; semantic/wisent/java.el ends here | ||
diff --git a/lisp/cedet/semantic/wisent/java-wy.el b/lisp/cedet/semantic/wisent/java-wy.el deleted file mode 100644 index 0c8de5527e2..00000000000 --- a/lisp/cedet/semantic/wisent/java-wy.el +++ /dev/null | |||
| Binary files differ | |||
diff --git a/lisp/cedet/semantic/wisent/javat-wy.el b/lisp/cedet/semantic/wisent/javat-wy.el new file mode 100644 index 00000000000..0cbee2c086b --- /dev/null +++ b/lisp/cedet/semantic/wisent/javat-wy.el | |||
| Binary files differ | |||
diff --git a/lisp/cedet/semantic/wisent/js-wy.el b/lisp/cedet/semantic/wisent/js-wy.el index 8419e55ae1f..8d25b726605 100644 --- a/lisp/cedet/semantic/wisent/js-wy.el +++ b/lisp/cedet/semantic/wisent/js-wy.el | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | ;;; Commentary: | 20 | ;;; Commentary: |
| 21 | ;; | 21 | ;; |
| 22 | ;; This file was generated from the grammar file | 22 | ;; This file was generated from the grammar file |
| 23 | ;; semantic/wisent/javascript-jv.wy in the CEDET repository. | 23 | ;; semantic/wisent/wisent-javascript-jv.wy in the CEDET repository. |
| 24 | 24 | ||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | (require 'semantic/lex) | 26 | (require 'semantic/lex) |
diff --git a/lisp/emacs-lisp/eieio-comp.el b/lisp/emacs-lisp/eieio-comp.el index 8c75aee313a..8b21490e5b8 100644 --- a/lisp/emacs-lisp/eieio-comp.el +++ b/lisp/emacs-lisp/eieio-comp.el | |||
| @@ -32,70 +32,24 @@ | |||
| 32 | 32 | ||
| 33 | ;;; Code: | 33 | ;;; Code: |
| 34 | 34 | ||
| 35 | (eval-and-compile | ||
| 36 | (if (featurep 'xemacs) | ||
| 37 | (progn | ||
| 38 | ;; XEmacs compatibility settings. | ||
| 39 | (if (not (fboundp 'byte-compile-compiled-obj-to-list)) | ||
| 40 | (defun byte-compile-compiled-obj-to-list (moose) nil)) | ||
| 41 | (if (not (boundp 'byte-compile-outbuffer)) | ||
| 42 | (defvar byte-compile-outbuffer nil)) | ||
| 43 | (defmacro eieio-byte-compile-princ-code (code outbuffer) | ||
| 44 | `(progn (if (atom ,code) | ||
| 45 | (princ "#[" ,outbuffer) | ||
| 46 | (princ "'(" ,outbuffer)) | ||
| 47 | (let ((codelist (if (byte-code-function-p ,code) | ||
| 48 | (byte-compile-compiled-obj-to-list ,code) | ||
| 49 | (append ,code nil)))) | ||
| 50 | (while codelist | ||
| 51 | (eieio-prin1 (car codelist) ,outbuffer) | ||
| 52 | (princ " " ,outbuffer) | ||
| 53 | (setq codelist (cdr codelist)))) | ||
| 54 | (if (atom ,code) | ||
| 55 | (princ "]" ,outbuffer) | ||
| 56 | (princ ")" ,outbuffer)))) | ||
| 57 | (defun eieio-prin1 (code outbuffer) | ||
| 58 | (cond ((byte-code-function-p code) | ||
| 59 | (let ((codelist (byte-compile-compiled-obj-to-list code))) | ||
| 60 | (princ "#[" outbuffer) | ||
| 61 | (while codelist | ||
| 62 | (eieio-prin1 (car codelist) outbuffer) | ||
| 63 | (princ " " outbuffer) | ||
| 64 | (setq codelist (cdr codelist))) | ||
| 65 | (princ "]" outbuffer))) | ||
| 66 | ((vectorp code) | ||
| 67 | (let ((i 0) (ln (length code))) | ||
| 68 | (princ "[" outbuffer) | ||
| 69 | (while (< i ln) | ||
| 70 | (eieio-prin1 (aref code i) outbuffer) | ||
| 71 | (princ " " outbuffer) | ||
| 72 | (setq i (1+ i))) | ||
| 73 | (princ "]" outbuffer))) | ||
| 74 | (t (prin1 code outbuffer))))) | ||
| 75 | ;; Emacs: | ||
| 76 | (defmacro eieio-byte-compile-princ-code (code outbuffer) | ||
| 77 | (list 'prin1 code outbuffer)) | ||
| 78 | ;; Dynamically bound in byte-compile-from-buffer. | ||
| 79 | (defvar bytecomp-outbuffer) | ||
| 80 | (defvar bytecomp-filename))) | ||
| 81 | |||
| 82 | (declare-function eieio-defgeneric-form "eieio" (method doc-string)) | 35 | (declare-function eieio-defgeneric-form "eieio" (method doc-string)) |
| 83 | 36 | ||
| 84 | (defun byte-compile-defmethod-param-convert (paramlist) | 37 | ;; Some compatibility stuff |
| 85 | "Convert method params into the params used by the defmethod thingy. | 38 | (eval-and-compile |
| 86 | Argument PARAMLIST is the paramter list to convert." | 39 | (if (not (fboundp 'byte-compile-compiled-obj-to-list)) |
| 87 | (let ((argfix nil)) | 40 | (defun byte-compile-compiled-obj-to-list (moose) nil)) |
| 88 | (while paramlist | 41 | |
| 89 | (setq argfix (cons (if (listp (car paramlist)) | 42 | (if (not (boundp 'byte-compile-outbuffer)) |
| 90 | (car (car paramlist)) | 43 | (defvar byte-compile-outbuffer nil)) |
| 91 | (car paramlist)) | 44 | ) |
| 92 | argfix)) | ||
| 93 | (setq paramlist (cdr paramlist))) | ||
| 94 | (nreverse argfix))) | ||
| 95 | 45 | ||
| 96 | ;; This teaches the byte compiler how to do this sort of thing. | 46 | ;; This teaches the byte compiler how to do this sort of thing. |
| 97 | (put 'defmethod 'byte-hunk-handler 'byte-compile-file-form-defmethod) | 47 | (put 'defmethod 'byte-hunk-handler 'byte-compile-file-form-defmethod) |
| 98 | 48 | ||
| 49 | ;; Variables used free: | ||
| 50 | (defvar outbuffer) | ||
| 51 | (defvar filename) | ||
| 52 | |||
| 99 | (defun byte-compile-file-form-defmethod (form) | 53 | (defun byte-compile-file-form-defmethod (form) |
| 100 | "Mumble about the method we are compiling. | 54 | "Mumble about the method we are compiling. |
| 101 | This function is mostly ripped from `byte-compile-file-form-defun', but | 55 | This function is mostly ripped from `byte-compile-file-form-defun', but |
| @@ -126,14 +80,18 @@ that is called but rarely. Argument FORM is the body of the method." | |||
| 126 | (lamparams (byte-compile-defmethod-param-convert params)) | 80 | (lamparams (byte-compile-defmethod-param-convert params)) |
| 127 | (arg1 (car params)) | 81 | (arg1 (car params)) |
| 128 | (class (if (listp arg1) (nth 1 arg1) nil)) | 82 | (class (if (listp arg1) (nth 1 arg1) nil)) |
| 129 | (my-outbuffer (if (featurep 'xemacs) | 83 | (my-outbuffer (if (eval-when-compile (featurep 'xemacs)) |
| 130 | byte-compile-outbuffer | 84 | byte-compile-outbuffer |
| 131 | bytecomp-outbuffer))) | 85 | (condition-case nil |
| 86 | bytecomp-outbuffer | ||
| 87 | (error outbuffer)))) | ||
| 88 | ) | ||
| 132 | (let ((name (format "%s::%s" (or class "#<generic>") meth))) | 89 | (let ((name (format "%s::%s" (or class "#<generic>") meth))) |
| 133 | (if byte-compile-verbose | 90 | (if byte-compile-verbose |
| 134 | ;; bytecomp-filename is from byte-compile-from-buffer. | 91 | ;; #### filename used free |
| 135 | (message "Compiling %s... (%s)" (or bytecomp-filename "") name)) | 92 | (message "Compiling %s... (%s)" (or filename "") name)) |
| 136 | (setq byte-compile-current-form name)) ; for warnings | 93 | (setq byte-compile-current-form name) ; for warnings |
| 94 | ) | ||
| 137 | ;; Flush any pending output | 95 | ;; Flush any pending output |
| 138 | (byte-compile-flush-pending) | 96 | (byte-compile-flush-pending) |
| 139 | ;; Byte compile the body. For the byte compiled forms, add the | 97 | ;; Byte compile the body. For the byte compiled forms, add the |
| @@ -149,8 +107,9 @@ that is called but rarely. Argument FORM is the body of the method." | |||
| 149 | (princ key my-outbuffer) | 107 | (princ key my-outbuffer) |
| 150 | (prin1 params my-outbuffer) | 108 | (prin1 params my-outbuffer) |
| 151 | (princ " " my-outbuffer) | 109 | (princ " " my-outbuffer) |
| 152 | (eieio-byte-compile-princ-code code my-outbuffer) | 110 | (prin1 code my-outbuffer) |
| 153 | (princ "))" my-outbuffer)) | 111 | (princ "))" my-outbuffer) |
| 112 | ) | ||
| 154 | ;; Now add this function to the list of known functions. | 113 | ;; Now add this function to the list of known functions. |
| 155 | ;; Don't bother with a doc string. Not relevant here. | 114 | ;; Don't bother with a doc string. Not relevant here. |
| 156 | (add-to-list 'byte-compile-function-environment | 115 | (add-to-list 'byte-compile-function-environment |
| @@ -165,6 +124,18 @@ that is called but rarely. Argument FORM is the body of the method." | |||
| 165 | ;; nil prevents cruft from appearing in the output buffer. | 124 | ;; nil prevents cruft from appearing in the output buffer. |
| 166 | nil)) | 125 | nil)) |
| 167 | 126 | ||
| 127 | (defun byte-compile-defmethod-param-convert (paramlist) | ||
| 128 | "Convert method params into the params used by the defmethod thingy. | ||
| 129 | Argument PARAMLIST is the paramter list to convert." | ||
| 130 | (let ((argfix nil)) | ||
| 131 | (while paramlist | ||
| 132 | (setq argfix (cons (if (listp (car paramlist)) | ||
| 133 | (car (car paramlist)) | ||
| 134 | (car paramlist)) | ||
| 135 | argfix)) | ||
| 136 | (setq paramlist (cdr paramlist))) | ||
| 137 | (nreverse argfix))) | ||
| 138 | |||
| 168 | (provide 'eieio-comp) | 139 | (provide 'eieio-comp) |
| 169 | 140 | ||
| 170 | ;;; eieio-comp.el ends here | 141 | ;;; eieio-comp.el ends here |
diff --git a/lisp/emacs-lisp/eieio-datadebug.el b/lisp/emacs-lisp/eieio-datadebug.el index f9ec56da7c1..b6c116e064d 100644 --- a/lisp/emacs-lisp/eieio-datadebug.el +++ b/lisp/emacs-lisp/eieio-datadebug.el | |||
| @@ -121,6 +121,10 @@ PREBUTTONTEXT is some text between PREFIX and the object button." | |||
| 121 | (setq publa (cdr publa) publd (cdr publd))) | 121 | (setq publa (cdr publa) publd (cdr publd))) |
| 122 | ))) | 122 | ))) |
| 123 | 123 | ||
| 124 | ;;; Augment the Data debug thing display list. | ||
| 125 | (data-debug-add-specialized-thing (lambda (thing) (object-p thing)) | ||
| 126 | #'data-debug-insert-object-button) | ||
| 127 | |||
| 124 | ;;; DEBUG METHODS | 128 | ;;; DEBUG METHODS |
| 125 | ;; | 129 | ;; |
| 126 | ;; A generic function to run DDEBUG on an object and popup a new buffer. | 130 | ;; A generic function to run DDEBUG on an object and popup a new buffer. |
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 28af9bad419..ff7dc823430 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el | |||
| @@ -36,8 +36,6 @@ | |||
| 36 | ;; is the only way I seem to be able to make this stuff load properly. | 36 | ;; is the only way I seem to be able to make this stuff load properly. |
| 37 | 37 | ||
| 38 | ;; @TODO - fix :initform to be a form, not a quoted value | 38 | ;; @TODO - fix :initform to be a form, not a quoted value |
| 39 | ;; @TODO - For API calls like `object-p', replace with something | ||
| 40 | ;; that does not conflict with "object", meaning a lisp object. | ||
| 41 | ;; @TODO - Prefix non-clos functions with `eieio-'. | 39 | ;; @TODO - Prefix non-clos functions with `eieio-'. |
| 42 | 40 | ||
| 43 | ;;; Code: | 41 | ;;; Code: |
| @@ -53,7 +51,7 @@ | |||
| 53 | (message eieio-version)) | 51 | (message eieio-version)) |
| 54 | 52 | ||
| 55 | (eval-and-compile | 53 | (eval-and-compile |
| 56 | ;; Abount the above. EIEIO must process it's own code when it compiles | 54 | ;; About the above. EIEIO must process it's own code when it compiles |
| 57 | ;; itself, thus, by eval-and-compiling outselves, we solve the problem. | 55 | ;; itself, thus, by eval-and-compiling outselves, we solve the problem. |
| 58 | 56 | ||
| 59 | ;; Compatibility | 57 | ;; Compatibility |
| @@ -109,7 +107,10 @@ execute a `call-next-method'. DO NOT SET THIS YOURSELF!") | |||
| 109 | (defvar eieio-initializing-object nil | 107 | (defvar eieio-initializing-object nil |
| 110 | "Set to non-nil while initializing an object.") | 108 | "Set to non-nil while initializing an object.") |
| 111 | 109 | ||
| 112 | (defconst eieio-unbound (make-symbol "unbound") | 110 | (defconst eieio-unbound |
| 111 | (if (and (boundp 'eieio-unbound) (symbolp eieio-unbound)) | ||
| 112 | eieio-unbound | ||
| 113 | (make-symbol "unbound")) | ||
| 113 | "Uninterned symbol representing an unbound slot in an object.") | 114 | "Uninterned symbol representing an unbound slot in an object.") |
| 114 | 115 | ||
| 115 | ;; This is a bootstrap for eieio-default-superclass so it has a value | 116 | ;; This is a bootstrap for eieio-default-superclass so it has a value |
| @@ -2744,6 +2745,10 @@ Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate." | |||
| 2744 | '(cedet-edebug-prin1-recurse object) ) | 2745 | '(cedet-edebug-prin1-recurse object) ) |
| 2745 | )) | 2746 | )) |
| 2746 | 2747 | ||
| 2748 | ;; Done in cedet/data-debug.el: | ||
| 2749 | ;; (eval-after-load "data-debug" | ||
| 2750 | ;; '(require 'eieio-datadebug)) | ||
| 2751 | |||
| 2747 | ;;; Interfacing with imenu in emacs lisp mode | 2752 | ;;; Interfacing with imenu in emacs lisp mode |
| 2748 | ;; (Only if the expression is defined) | 2753 | ;; (Only if the expression is defined) |
| 2749 | ;; | 2754 | ;; |