comparison lisp/cedet/semantic/db-typecache.el @ 110523:a5ad4f188e19

Synch Semantic to CEDET 1.0. Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog. * semantic.el (semantic-version): Update to 2.0. (semantic-mode-map): Add "," and "m" bindings. (navigate-menu): Update. * semantic/symref.el (semantic-symref-calculate-rootdir): New function. (semantic-symref-detect-symref-tool): Use it. * semantic/symref/grep.el (semantic-symref-grep-shell): New var. (semantic-symref-perform-search): Use it. Calculate root dir with semantic-symref-calculate-rootdir. (semantic-symref-derive-find-filepatterns): Improve error message. * semantic/symref/list.el (semantic-symref-results-mode-map): New bindings. (semantic-symref-auto-expand-results): New option. (semantic-symref-results-dump): Obey auto-expand. (semantic-symref-list-expand-all, semantic-symref-regexp) (semantic-symref-list-contract-all) (semantic-symref-list-map-open-hits) (semantic-symref-list-update-open-hits) (semantic-symref-list-create-macro-on-open-hit) (semantic-symref-list-call-macro-on-open-hits): New functions. (semantic-symref-list-menu-entries) (semantic-symref-list-menu): New vars. (semantic-symref-list-map-open-hits): Move cursor to beginning of match before calling the mapped function. * semantic/doc.el (semantic-documentation-comment-preceeding-tag): Do nothing if the mode doesn't provide comment-start-skip. * semantic/scope.el (semantic-analyze-scope-nested-tags-default): Strip duplicates. (semantic-analyze-scoped-inherited-tag-map): Take the tag we are looking for as part of the scoped tags list. * semantic/html.el (semantic-default-html-setup): Add senator-step-at-tag-classes. * semantic/decorate/include.el (semantic-decoration-on-unknown-includes): Change light bgcolor. (semantic-decoration-on-includes-highlight-default): Check that the include tag has a postion. * semantic/complete.el (semantic-collector-local-members): (semantic-complete-read-tag-local-members) (semantic-complete-jump-local-members): New class and functions. (semantic-complete-self-insert): Save excursion before completing. * semantic/analyze/complete.el (semantic-analyze-possible-completions-default): If no completions are found, return the raw by-name-only completion list. Add FLAGS arguments. Add support for 'no-tc (type constraint) and 'no-unique, or no stripping duplicates. (semantic-analyze-possible-completions-default): Add FLAGS arg. * semantic/util-modes.el (semantic-stickyfunc-show-only-functions-p): New option. (semantic-stickyfunc-fetch-stickyline): Don't show stickytext for the very first line in a buffer. * semantic/util.el (semantic-hack-search) (semantic-recursive-find-nonterminal-by-name) (semantic-current-tag-interactive): Deleted. (semantic-describe-buffer): Fix expand-nonterminal. Add lex-syntax-mods, type relation separator char, and command separation char. (semantic-sanity-check): Only message if called interactively. * semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the :filename property and the tag position. * semantic/lex-spp.el (semantic-lex-spp-lex-text-string): Add recursion limit. * semantic/imenu.el (semantic-imenu-bucketize-type-members): Make this buffer local, not the obsoleted variable. * semantic/idle.el: Add breadcrumbs support. (semantic-idle-summary-current-symbol-info-default) (semantic-idle-tag-highlight) (semantic-idle-completion-list-default): Use semanticdb-without-unloaded-file-searches for speed, and to conform to the controls that specify if the idle timer is supposed to be parsing unparsed includes. (semantic-idle-symbol-highlight-face) (semantic-idle-symbol-maybe-highlight): Rename from *-summary-*. Callers changed. (semantic-idle-work-parse-neighboring-files-flag): Default to nil. (semantic-idle-work-update-headers-flag): New var. (semantic-idle-work-for-one-buffer): Use it. (semantic-idle-local-symbol-highlight): Rename from semantic-idle-tag-highlight. (semantic-idle-truncate-long-summaries): New option. * semantic/ia.el (semantic-ia-cache) (semantic-ia-get-completions): Deleted. Callers changed. (semantic-ia-show-variants): New command. (semantic-ia-show-doc): If doc is empty, don't make a temp buffer. (semantic-ia-show-summary): If there isn't anything to show, say so. * semantic/grammar.el (semantic-grammar-create-package): Save the buffer even in batch mode. * semantic/fw.el (semanticdb-without-unloaded-file-searches): New macro. * semantic/dep.el (semantic-dependency-find-file-on-path): Fix case dereferencing ede-object when it is a list. * semantic/db-typecache.el (semanticdb-expand-nested-tag) (semanticdb-typecache-faux-namespace): New functions. (semanticdb-typecache-file-tags) (semanticdb-typecache-merge-streams): Use them. (semanticdb-typecache-file-tags): When deriving tags from a file, give the mode a chance to monkey with the tag copy. (semanticdb-typecache-find-default): Wrap find in save-excursion. (semanticdb-typecache-find-by-name-helper): Merge found names down. * semantic/db-global.el (semanticdb-enable-gnu-global-in-buffer): Don't show messages if GNU Global is not available and we don't want to throw an error. * semantic/db-find.el (semanticdb-find-result-nth-in-buffer): When trying to normalize the tag to a buffer, don't error if set-buffer method doesn't exist. * semantic/db-file.el (semanticdb-save-db): Simplify msg. * semantic/db.el (semanticdb-refresh-table): If forcing a refresh on a file not in a buffer, use semantic-find-file-noselect and delete the buffer after use. (semanticdb-current-database-list): When calculating root via hooks, force it through true-filename and skip the list of possible roots. * semantic/ctxt.el (semantic-ctxt-imported-packages): New. * semantic/analyze/debug.el (semantic-analyzer-debug-insert-tag): Reset standard output to current buffer. (semantic-analyzer-debug-global-symbol) (semantic-analyzer-debug-missing-innertype): Change "prefix" to "symbol" in messages. * semantic/analyze/refs.el: (semantic-analyze-refs-impl) (semantic-analyze-refs-proto): When calculating value, make sure the found tag is 'similar' to the originating tag. (semantic--analyze-refs-find-tags-with-parent): Attempt to identify matches via imported symbols of parents. (semantic--analyze-refs-full-lookup-with-parents): Do a deep search during the brute search. * semantic/analyze.el (semantic-analyze-find-tag-sequence-default): Be robust to calculated scopes being nil. * semantic/bovine/c.el (semantic-c-describe-environment): Add project macro symbol array. (semantic-c-parse-lexical-token): Add recursion limit. (semantic-ctxt-imported-packages, semanticdb-expand-nested-tag): New overrides. (semantic-expand-c-tag-namelist): Split a full type from a typedef out to its own tag. (semantic-expand-c-tag-namelist): Do not split out a typedef'd inline type if it is an anonymous type. (semantic-c-reconstitute-token): Use the optional initializers as a clue that some function is probably a constructor. When defining the type of these constructors, split the parent name, and use only the class part, if applicable. * semantic/bovine/c-by.el: * semantic/wisent/python-wy.el: Regenerate.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 18 Sep 2010 22:49:54 -0400
parents 1d1d5d9bd884
children 9814473572d4
comparison
equal deleted inserted replaced
110522:4bca1a43c0d3 110523:a5ad4f188e19
214 "Make the tag list TAGS found in TABLE safe for the typecache. 214 "Make the tag list TAGS found in TABLE safe for the typecache.
215 Adds a filename and copies the tags." 215 Adds a filename and copies the tags."
216 (semanticdb-typecache-apply-filename 216 (semanticdb-typecache-apply-filename
217 (semanticdb-full-filename table) 217 (semanticdb-full-filename table)
218 tags)) 218 tags))
219
220 (defun semanticdb-typecache-faux-namespace (name members)
221 "Create a new namespace tag with NAME and a set of MEMBERS.
222 The new tag will be a faux tag, used as a placeholder in a typecache."
223 (let ((tag (semantic-tag-new-type name "namespace" members nil)))
224 ;; Make sure we mark this as a fake tag.
225 (semantic-tag-set-faux tag)
226 tag))
219 227
220 (defun semanticdb-typecache-merge-streams (cache1 cache2) 228 (defun semanticdb-typecache-merge-streams (cache1 cache2)
221 "Merge into CACHE1 and CACHE2 together. The Caches will be merged in place." 229 "Merge into CACHE1 and CACHE2 together. The Caches will be merged in place."
222 (if (or (and (not cache1) (not cache2)) 230 (if (or (and (not cache1) (not cache2))
223 (and (not (cdr cache1)) (not cache2)) 231 (and (not (cdr cache1)) (not cache2))
254 (not (string= (semantic-tag-name next) 262 (not (string= (semantic-tag-name next)
255 (semantic-tag-name prev)))) 263 (semantic-tag-name prev))))
256 (setq ans (cons next ans)) 264 (setq ans (cons next ans))
257 ;; ELSE - We have a NAME match. 265 ;; ELSE - We have a NAME match.
258 (setq type (semantic-tag-type next)) 266 (setq type (semantic-tag-type next))
259 (if (semantic-tag-of-type-p prev type) ; Are they the same datatype 267 (if (or (semantic-tag-of-type-p prev type) ; Are they the same datatype
268 (semantic-tag-faux-p prev)
269 (semantic-tag-faux-p next) ; or either a faux tag?
270 )
260 ;; Same Class, we can do a merge. 271 ;; Same Class, we can do a merge.
261 (cond 272 (cond
262 ((and (semantic-tag-of-class-p next 'type) 273 ((and (semantic-tag-of-class-p next 'type)
263 (string= type "namespace")) 274 (string= type "namespace"))
264 ;; Namespaces - merge the children together. 275 ;; Namespaces - merge the children together.
265 (setcar ans 276 (setcar ans
266 (semantic-tag-new-type 277 (semanticdb-typecache-faux-namespace
267 (semantic-tag-name prev) ; - they are the same 278 (semantic-tag-name prev) ; - they are the same
268 "namespace" ; - we know this as fact
269 (semanticdb-typecache-merge-streams 279 (semanticdb-typecache-merge-streams
270 (semanticdb-typecache-safe-tag-members prev) 280 (semanticdb-typecache-safe-tag-members prev)
271 (semanticdb-typecache-safe-tag-members next)) 281 (semanticdb-typecache-safe-tag-members next))
272 nil ; - no attributes
273 )) 282 ))
274 ;; Make sure we mark this as a fake tag.
275 (semantic-tag-set-faux (car ans))
276 ) 283 )
277 ((semantic-tag-prototype-p next) 284 ((semantic-tag-prototype-p next)
278 ;; NEXT is a prototype... so keep previous. 285 ;; NEXT is a prototype... so keep previous.
279 nil ; - keep prev, do nothing 286 nil ; - keep prev, do nothing
280 ) 287 )
297 (nreverse ans)))) 304 (nreverse ans))))
298 305
299 ;;; Refresh / Query API 306 ;;; Refresh / Query API
300 ;; 307 ;;
301 ;; Queries that can be made for the typecache. 308 ;; Queries that can be made for the typecache.
309 (define-overloadable-function semanticdb-expand-nested-tag (tag)
310 "Expand TAG from fully qualified names.
311 If TAG has fully qualified names, expand it to a series of nested
312 namespaces instead."
313 tag)
314
302 (defmethod semanticdb-typecache-file-tags ((table semanticdb-abstract-table)) 315 (defmethod semanticdb-typecache-file-tags ((table semanticdb-abstract-table))
303 "No tags available from non-file based tables." 316 "No tags available from non-file based tables."
304 nil) 317 nil)
305 318
306 (defmethod semanticdb-typecache-file-tags ((table semanticdb-table)) 319 (defmethod semanticdb-typecache-file-tags ((table semanticdb-table))
311 (cache (semanticdb-get-typecache table)) 324 (cache (semanticdb-get-typecache table))
312 ) 325 )
313 326
314 ;; Make sure our file-tags list is up to date. 327 ;; Make sure our file-tags list is up to date.
315 (when (not (oref cache filestream)) 328 (when (not (oref cache filestream))
316 (let ((tags (semantic-find-tags-by-class 'type table))) 329 (let ((tags (semantic-find-tags-by-class 'type table))
330 (exptags nil))
317 (when tags 331 (when tags
318 (setq tags (semanticdb-typecache-safe-tag-list tags table)) 332 (setq tags (semanticdb-typecache-safe-tag-list tags table))
319 (oset cache filestream (semanticdb-typecache-merge-streams tags nil))))) 333 (dolist (T tags)
334 (push (semanticdb-expand-nested-tag T) exptags))
335 (oset cache filestream (semanticdb-typecache-merge-streams exptags nil)))))
320 336
321 ;; Return our cache. 337 ;; Return our cache.
322 (oref cache filestream) 338 (oref cache filestream)
323 )) 339 ))
324 340
370 386
371 387
372 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
373 389
374 ;;; Search Routines 390 ;;; Search Routines
391 ;;
375 ;;;###autoload 392 ;;;###autoload
376 (define-overloadable-function semanticdb-typecache-find (type &optional path find-file-match) 393 (define-overloadable-function semanticdb-typecache-find (type &optional path find-file-match)
377 "Search the typecache for TYPE in PATH. 394 "Search the typecache for TYPE in PATH.
378 If type is a string, split the string, and search for the parts. 395 If type is a string, split the string, and search for the parts.
379 If type is a list, treat the type as a pre-split string. 396 If type is a list, treat the type as a pre-split string.
384 "Default implementation of `semanticdb-typecache-find'. 401 "Default implementation of `semanticdb-typecache-find'.
385 TYPE is the datatype to find. 402 TYPE is the datatype to find.
386 PATH is the search path, which should be one table object. 403 PATH is the search path, which should be one table object.
387 If FIND-FILE-MATCH is non-nil, then force the file belonging to the 404 If FIND-FILE-MATCH is non-nil, then force the file belonging to the
388 found tag to be loaded." 405 found tag to be loaded."
389 (semanticdb-typecache-find-method (or path semanticdb-current-table) 406 (if (not (and (featurep 'semanticdb) semanticdb-current-database))
390 type find-file-match)) 407 nil ;; No DB, no search
408 (save-excursion
409 (semanticdb-typecache-find-method (or path semanticdb-current-table)
410 type find-file-match))))
391 411
392 (defun semanticdb-typecache-find-by-name-helper (name table) 412 (defun semanticdb-typecache-find-by-name-helper (name table)
393 "Find the tag with NAME in TABLE, which is from a typecache. 413 "Find the tag with NAME in TABLE, which is from a typecache.
394 If more than one tag has NAME in TABLE, we will prefer the tag that 414 If more than one tag has NAME in TABLE, we will prefer the tag that
395 is of class 'type." 415 is of class 'type."
396 (let* ((names (semantic-find-tags-by-name name table)) 416 (let* ((names (semantic-find-tags-by-name name table))
397 (types (semantic-find-tags-by-class 'type names))) 417 (nmerge (semanticdb-typecache-merge-streams names nil))
398 (or (car-safe types) (car-safe names)))) 418 (types (semantic-find-tags-by-class 'type nmerge)))
419 (or (car-safe types) (car-safe nmerge))))
399 420
400 (defmethod semanticdb-typecache-find-method ((table semanticdb-abstract-table) 421 (defmethod semanticdb-typecache-find-method ((table semanticdb-abstract-table)
401 type find-file-match) 422 type find-file-match)
402 "Search the typecache in TABLE for the datatype TYPE. 423 "Search the typecache in TABLE for the datatype TYPE.
403 If type is a string, split the string, and search for the parts. 424 If type is a string, split the string, and search for the parts.