Mercurial > hg > xemacs-beta
comparison lisp/oobr/objc-brows.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 4103f0995bd7 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;!emacs | |
2 ;; | |
3 ;; FILE: objc-brows.el | |
4 ;; SUMMARY: Objective-C source code browser. | |
5 ;; USAGE: GNU Emacs Lisp Library | |
6 ;; KEYWORDS: c, oop, tools | |
7 ;; | |
8 ;; AUTHOR: Bob Weiner | |
9 ;; ORG: Motorola Inc. | |
10 ;; | |
11 ;; ORIG-DATE: 12-Dec-89 | |
12 ;; LAST-MOD: 20-Sep-95 at 14:31:42 by Bob Weiner | |
13 ;; | |
14 ;; Copyright (C) 1989-1995 Free Software Foundation, Inc. | |
15 ;; See the file BR-COPY for license information. | |
16 ;; | |
17 ;; This file is part of the OO-Browser. | |
18 ;; | |
19 ;; DESCRIPTION: | |
20 ;; | |
21 ;; Use 'objc-browse' to invoke the Objective-C OO-Browser. Prefix arg | |
22 ;; prompts for name of Environment file. | |
23 ;; | |
24 ;; DESCRIP-END. | |
25 | |
26 (mapcar 'require '(br-start br br-objc-ft)) | |
27 | |
28 ;;; ************************************************************************ | |
29 ;;; Public functions | |
30 ;;; ************************************************************************ | |
31 | |
32 ;; Cases | |
33 ;; | |
34 ;; env-file = nil | |
35 ;; Use default environment, objc-env-file | |
36 ;; if objc not loaded, load it | |
37 ;; if objc-env-file != br-env-file | |
38 ;; switch to objc | |
39 ;; | |
40 ;; env-file = t | |
41 ;; Prompt for env | |
42 ;; if env != objc | |
43 ;; load it | |
44 ;; else if env != br-env | |
45 ;; switch to env | |
46 ;; | |
47 ;; env-file = filename | |
48 ;; if env != objc-env | |
49 ;; | |
50 ;; | |
51 ;; objc-env-file = br-env-file | |
52 | |
53 ;;;###autoload | |
54 (defun objc-browse (&optional env-file no-ui) | |
55 "Invoke the Objective-C OO-Browser. | |
56 This allows browsing through Objective-C library and system class | |
57 hierarchies. With an optional non-nil prefix argument ENV-FILE, prompt for | |
58 Environment file to use. Alternatively, a string value of ENV-FILE is used | |
59 as the Environment file name. See also the file \"br-help\"." | |
60 (interactive "P") | |
61 (let ((same-lang (equal br-lang-prefix objc-lang-prefix)) | |
62 (load-succeeded t) | |
63 same-env) | |
64 (if same-lang | |
65 nil | |
66 ;; Save other language Environment in memory | |
67 (if br-lang-prefix (br-env-copy nil)) | |
68 (setq br-lang-prefix objc-lang-prefix | |
69 *br-save-wconfig* nil)) | |
70 (setq same-env (or (equal objc-env-file env-file) | |
71 (and (null env-file) | |
72 (or objc-lib-search-dirs objc-sys-search-dirs)))) | |
73 (cond | |
74 ;; Continue browsing an Environment | |
75 ((and same-env same-lang)) | |
76 ((and same-env (not same-lang)) | |
77 (objc-browse-setup) (br-env-copy t)) | |
78 ;; | |
79 ;; Create default Environment file specification if needed and none | |
80 ;; exists. | |
81 ;; | |
82 (t (or env-file (file-exists-p objc-env-file) | |
83 (br-env-create objc-env-file objc-lang-prefix)) | |
84 (or env-file (setq env-file objc-env-file)) | |
85 ;; | |
86 ;; Start browsing a new Environment. | |
87 ;; | |
88 (objc-browse-setup) | |
89 (setq load-succeeded (br-env-init env-file same-lang nil)) | |
90 (if load-succeeded | |
91 (setq *br-save-wconfig* nil | |
92 objc-env-file load-succeeded | |
93 objc-sys-search-dirs br-sys-search-dirs | |
94 objc-lib-search-dirs br-lib-search-dirs)))) | |
95 (cond (load-succeeded | |
96 (br-init) | |
97 (or no-ui (br-browse))) | |
98 (no-ui nil) | |
99 (t (message "(objc-browse): You must build the Environment to browse it."))))) | |
100 | |
101 (defun objc-class-list-filter (class-list) | |
102 "Return CLASS-LIST sans any protocol or class category entries. | |
103 Used when Environment classes are listed." | |
104 (delq nil (mapcar (function (lambda (class) | |
105 (if (string-match "[\(\<]" class) | |
106 nil | |
107 class))) | |
108 class-list))) | |
109 | |
110 (defun objc-mode-setup () | |
111 "Load best available Objective-C major mode and set 'br-lang-mode' to the function that invokes it." | |
112 (fset 'br-lang-mode | |
113 (cond ((or (fboundp 'objc-mode) (featurep 'objc-mode)) 'objc-mode) | |
114 ((load "objc-mode" t 'nomessage) 'objc-mode) | |
115 ((featurep 'c-mode) 'c-mode) | |
116 ((load "cc-mode" 'missing-ok 'nomessage) | |
117 (if (fboundp 'objc-mode) 'objc-mode 'c-mode)) | |
118 ((load "c-mode" nil 'nomessage) | |
119 (provide 'c-mode))))) | |
120 | |
121 ;;; ************************************************************************ | |
122 ;;; Internal functions | |
123 ;;; ************************************************************************ | |
124 | |
125 (defun objc-browse-setup () | |
126 "Setup language-dependent functions for OO-Browser." | |
127 (br-setup-functions) | |
128 ;; Use this until an info function is implemented for the language. | |
129 (fmakunbound 'br-insert-class-info) | |
130 (fset 'br-store-class-info 'objc-store-class-info) | |
131 (objc-mode-setup) | |
132 (br-setup-constants) | |
133 ;; Setup to add default classes ([category] and [protocol]) to system class | |
134 ;; table after building it. This must come after br-setup-constants call | |
135 ;; since it clears these hooks. | |
136 (if (fboundp 'add-hook) | |
137 (add-hook 'br-after-build-sys-hook 'objc-add-default-classes) | |
138 (setq br-after-build-sys-hook '(objc-add-default-classes)))) | |
139 | |
140 | |
141 (provide 'objc-brows) |