annotate lisp/oobr/c++-browse.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 4103f0995bd7
children 4be1180a9e89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: c++-browse.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: C++ source code browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: c, oop, tools
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
9 ;; ORG: Motorola Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 12-Dec-89
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
12 ;; LAST-MOD: 20-Sep-95 at 14:18:40 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
14 ;; Copyright (C) 1989-1995 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; See the file BR-COPY for license information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; This file is part of the OO-Browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
21 ;; Use 'c++-browse' to invoke the C++ OO-Browser. Prefix arg prompts for
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; name of Environment file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (mapcar 'require '(br-start br br-c++-ft))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defun c++-browse (&optional env-file no-ui)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "Invoke the C++ OO-Browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 This allows browsing through C++ library and system class hierarchies. With
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 an optional non-nil prefix argument ENV-FILE, prompt for Environment file to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 use. Alternatively, a string value of ENV-FILE is used as the Environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 file name. See also the file \"br-help\"."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (let ((same-lang (equal br-lang-prefix c++-lang-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (load-succeeded t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 same-env)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (if same-lang
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; Save other language Environment in memory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (if br-lang-prefix (br-env-copy nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (setq br-lang-prefix c++-lang-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 *br-save-wconfig* nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (setq same-env (or (equal c++-env-file env-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (and (null env-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (or c++-lib-search-dirs c++-sys-search-dirs))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; Continue browsing an Environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ((and same-env same-lang))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ((and same-env (not same-lang))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (c++-browse-setup) (br-env-copy t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; Create default Environment file specification if needed and none
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (t (or env-file (file-exists-p c++-env-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (br-env-create c++-env-file c++-lang-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (or env-file (setq env-file c++-env-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;; Start browsing a new Environment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (c++-browse-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (setq load-succeeded (br-env-init env-file same-lang nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (if load-succeeded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (setq *br-save-wconfig* nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 c++-env-file load-succeeded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 c++-sys-search-dirs br-sys-search-dirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 c++-lib-search-dirs br-lib-search-dirs))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (cond (load-succeeded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (br-init)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (or no-ui (br-browse)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (no-ui nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (t (message "(c++-browse): You must build the Environment to browse it.")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; Don't filter Environment classes when listed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (fset 'c++-class-list-filter 'identity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun c++-mode-setup ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
88 "Load best available C++ major mode and set 'br-lang-mode' to the function that invokes it."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (fset 'br-lang-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (cond ((or (featurep 'cc-mode) (featurep 'c++-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 'c++-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ((load "cc-mode" 'missing-ok 'nomessage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (provide 'c++-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ((load "c++-mode" 'missing-ok 'nomessage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (provide 'c++-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ((featurep 'c-mode) 'c-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ((load "c-mode" nil 'nomessage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (provide 'c-mode)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ;;; Internal functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defun c++-browse-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 "Setup language-dependent functions for OO-Browser."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (br-setup-functions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;; Use this until an info function is implemented for the language.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (fmakunbound 'br-insert-class-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (fset 'br-store-class-info 'c++-store-class-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (c++-mode-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (br-setup-constants)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;; Setup to add default classes to system class table after building it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; This must come after br-setup-constants call since it clears these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;; hooks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (if (fboundp 'add-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (add-hook 'br-after-build-sys-hook 'c++-add-default-classes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (setq br-after-build-sys-hook '(c++-add-default-classes))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (provide 'c++-browse)