4 ;; SUMMARY: Eiffel source code browser.
5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: oop, tools
11 ;; ORIG-DATE: 12-Dec-89
12 ;; LAST-MOD: 10-May-01 at 12:49:59 by Bob Weiner
14 ;; Copyright (C) 1989-1995, 1997 BeOpen.com
15 ;; See the file BR-COPY for license information.
17 ;; This file is part of the OO-Browser.
21 ;; Use `eif-browse' to invoke the Eiffel browser. Prefix arg prompts for
22 ;; name of Environment file.
26 ;;; ************************************************************************
27 ;;; Other required Elisp libraries
28 ;;; ************************************************************************
30 (mapcar 'require '(br-start br br-eif-ft))
32 ;;; ************************************************************************
34 ;;; ************************************************************************
37 (defun eif-browse (&optional env-file no-ui)
38 "Invoke the Eiffel OO-Browser.
39 This allows browsing through Eiffel library and system class hierarchies.
40 With an optional prefix arg ENV-FILE equal to t, prompt for Environment file
41 to use. Alternatively, a string value of ENV-FILE is used as the Environment
42 file name. See also the file \"br-help\"."
44 (let ((same-lang (equal br-lang-prefix eif-lang-prefix))
49 ;; Save other language Environment in memory
50 (if br-lang-prefix (br-env-copy nil))
51 (setq br-lang-prefix eif-lang-prefix
52 *br-save-wconfig* nil))
53 ;; `same-env' non-nil means the new Env is the previous Env or the most
54 ;; recent previous Env of the same language as the new Env
55 (setq same-env (or (equal eif-env-file env-file)
57 (or eif-lib-search-dirs eif-sys-search-dirs))))
60 ;; If we just switched languages, restore the cached data for the new
62 (if same-lang nil (br-env-copy t))
63 ;; Environment may appear to be the same but its loading may have
64 ;; been interrupted, so ensure all variables are initialized properly.
65 (eif-browse-setup env-file)
66 (if (or (null br-paths-htable) (equal br-paths-htable br-empty-htable))
68 (br-env-try-load (or env-file br-env-file) br-env-file))))
70 ;; Create default Environment file specification if needed and none
73 (t (or env-file (file-exists-p eif-env-file)
74 (br-env-create eif-env-file eif-lang-prefix))
75 (or env-file (setq env-file eif-env-file))
77 ;; Start browsing a new Environment.
79 (eif-browse-setup env-file)
80 (setq load-succeeded (br-env-init env-file same-lang nil))
82 (setq *br-save-wconfig* nil
83 eif-env-file br-env-file
84 eif-env-name br-env-name
85 eif-sys-search-dirs br-sys-search-dirs
86 eif-lib-search-dirs br-lib-search-dirs))))
91 (or (and same-lang same-env) (br-refresh))))
93 (t (message "(eif-browse): You must build the Environment to browse it.")))))
95 ;; Don't filter Environment classes when listed.
96 (defalias 'eif-class-list-filter 'br-class-list-identity)
98 (defun eif-class-definition-regexp (class)
99 "Return regexp to uniquely match the definition of CLASS name."
100 (concat eif-class-name-before (regexp-quote class)
101 eif-class-name-after))
103 ;;; ************************************************************************
104 ;;; Internal functions
105 ;;; ************************************************************************
107 (defun eif-browse-setup (env-file)
108 "Setup language-dependent functions for OO-Browser."
110 (defalias 'br-lang-mode
111 (cond ((or (featurep 'eiffel3) (featurep 'eiffel-mode))
113 ((load "eiffel3" 'missing-ok 'nomessage)
114 (provide 'eiffel-mode))
115 ((load "eiffel" 'missing-ok 'nomessage)
116 (provide 'eiffel-mode))
117 (t 'fundamental-mode)))
118 (br-setup-constants env-file)
119 ;; Setup to add default classes to system class table after building it.
120 ;; This must come after br-setup-constants call since it clears these
122 (if (fboundp 'add-hook)
123 (add-hook 'br-after-build-sys-hook 'eif-add-default-classes)
124 (setq br-after-build-sys-hook '(eif-add-default-classes))))
126 (provide 'eif-browse)