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