1 ;;; sun-eos-menu.el --- Implements the XEmacs/SPARCworks menubar
3 ;; Copyright (C) 1995 Sun Microsystems, Inc.
5 ;; Maintainer: Eduardo Pelegri-Llopart <eduardo.pelegri-llopart@Eng.Sun.COM>
6 ;; Author: Eduardo Pelegri-Llopart <eduardo.pelegri-llopart@Eng.Sun.COM>
8 ;; Keywords: SPARCworks EOS Era on SPARCworks menubar
11 ;; This file contains functions that populate a SPARCworks menu
12 ;; Please send feedback to eduardo.pelegri-llopart@eng.sun.com
16 (require 'eos-common "sun-eos-common")
18 (defun eos::toggle-sbrowser-selected-frame ()
19 ;; Toggle whether this frame is selected for SBrowser
21 (if (equal eos::sbrowser-frame (selected-frame))
22 (eos::select-sbrowser-frame nil)
23 (eos::select-sbrowser-frame (selected-frame)))
26 (defun eos::toggle-debugger-selected-frame ()
27 ;; Toggle whether this frame is selected for Debugger
29 (if (equal eos::debugger-frame (selected-frame))
30 (eos::select-debugger-frame nil)
31 (eos::select-debugger-frame (selected-frame)))
34 (defvar eos::long-menu
36 ["Read and Execute a Dbx Command" eos::dbx-cmd (not (eq eos::key-mode 'none))]
37 ["Run" eos::run (not (eq eos::key-mode 'none))]
38 ["Fix" eos::fix (not (eq eos::key-mode 'none))]
40 ["Print" eos::print (not (eq eos::key-mode 'none))]
41 ["Print *" eos::print* (not (eq eos::key-mode 'none))]
42 ["Dismiss Print" eos::dismiss-print-frame (not (eq eos::key-mode 'none))]
44 ["Continue" eos::cont (not (eq eos::key-mode 'none))]
45 ["Stop" eos::stop-at (not (eq eos::key-mode 'none))]
46 ["Clear" eos::clear-at (not (eq eos::key-mode 'none))]
47 ["Next" eos::next (not (eq eos::key-mode 'none))]
48 ["Step" eos::step (not (eq eos::key-mode 'none))]
49 ["Step Up" eos::step-up (not (eq eos::key-mode 'none))]
50 ["Continue To" eos::cont-to (not (eq eos::key-mode 'none))]
52 ["Stack Up" eos::up (not (eq eos::key-mode 'none))]
53 ["Stack Down" eos::down (not (eq eos::key-mode 'none))]
55 ("Start Tool and Enable Frame"
56 ["Debugger" eos::start-debugger t]
57 ["Dbx" eos::start-dbx t]
58 ["SBrowser" eos::start-sbrowser t]
61 ["Enable Frame for SBrowser"
62 eos::toggle-sbrowser-selected-frame
64 :selected (equal eos::sbrowser-frame
66 ["Enable Frame for Debugger and Dbx"
67 eos::toggle-debugger-selected-frame
69 :selected (equal eos::debugger-frame
72 ["News..." eos::sw-news t]
76 (defvar eos::short-menu
78 ("Start Tool and Enable Frame"
79 ["Debugger" eos::start-debugger t]
80 ["Dbx" eos::start-dbx t]
81 ["SBrowser" eos::start-sbrowser t]
84 ["Enable Frame for SBrowser"
85 eos::toggle-sbrowser-selected-frame
87 :selected (equal eos::sbrowser-frame
89 ["Enable Frame for Debugger and Dbx"
90 eos::toggle-debugger-selected-frame
92 :selected (equal eos::debugger-frame
95 ["News..." eos::sw-news t]
99 (defun eos::menubar-startup ()
100 ;; Actions to do at startup for eos-menubar.el
101 (if (and (eq (device-type (selected-device)) 'x)
102 (or (not (local-variable-p 'current-menubar (current-buffer)))
104 "SPARCworks menu will be local (menubar is buffer-local); proceed?")))
106 (add-menu-button '("Help") ["SPARCworks..." eos::sw-intro t])
108 (append '("SPARCworks") (copy-tree eos::short-menu))
114 ;; Insertion of text with a font
117 (defun eos::insert-italics (a-string)
118 (eos::insert-with-font a-string 'italic))
120 (defun eos::insert-bold (a-string)
121 (eos::insert-with-font a-string 'bold))
123 (defun eos::insert-with-font (a-string a-font)
129 (setq ext (make-extent a b))
130 (set-extent-face ext (find-face a-font))
134 ;; Generic insert code
137 (defun eos::insert (s)
138 (let ((len (length s))
143 (setq newpos (string-match "#[bnir]" s pos))
144 (if (and newpos (> newpos pos))
146 (cond ((equal (aref s (+ newpos 1)) ?b) ; bold
147 (if (equal state 'normal)
149 (insert (substring s pos newpos))
151 (error "found bold when not in normal")))
152 ((equal (aref s (+ newpos 1)) ?r) ; red
153 (if (equal state 'normal)
155 (insert (substring s pos newpos))
157 (error "found red when not in normal")))
158 ((equal (aref s (+ newpos 1)) ?i) ; italics
159 (if (equal state 'normal)
161 (insert (substring s pos newpos))
162 (setq state 'italics))
163 (error "found italics when not in normal")))
164 ((equal (aref s (+ newpos 1)) ?n) ; normal
165 (cond ((equal state 'italics)
166 (eos::insert-italics (substring s pos newpos))
167 (setq state 'normal))
169 (eos::insert-bold (substring s pos newpos))
170 (setq state 'normal))
171 ((equal state 'normal)
172 (error "found normal when in normal"))))
174 (error "internal error"))
176 (setq pos (+ newpos 2))
178 (if (equal state 'normal)
180 (insert (substring s pos))
182 (error "eos::insert with unclosed special font"))
190 (defun eos::sw-intro ()
191 "Generate an intro buffer."
193 (let ((buffer1 (get-buffer-create " *SPARCworks Intro*"))
195 (switch-to-buffer buffer1)
196 (setq buffer-read-only nil)
197 (delete-region (point-min) (point-max))
199 #bSPARCworks Editor Integration#n
200 Eos is copyright (c) 1995 by Sun Microsystems.
202 #bIntroduction (for Eos 1.5.x)#n
204 #iSPARCworks#n is a set of integrated programming tools from SunSoft that
205 support the program development cycle. #iXEmacs#n is a version of the Emacs
206 editor that includes interfaces to the selection service and to the
207 #iToolTalk#n service. The #iEos#n package uses these two interfaces to provide
208 a simple yet useful editor integration with three SPARCworks tools:
209 the #iSourceBrowser#n, the #iDebugger#n and #iDbx#n. Eos requires XEmacs 19.12
210 or above, and SW3.0.1 or above.
212 When used with Eos, the Debugger and SourceBrowser do not include a
213 source pane for displaying of sources and instead use an XEmacs frame.
214 Then the user can interact with the XEmacs frame in a way very similar
215 to how the source panes of the SW tools would be used. The user can also
216 start Dbx and request that sources be shown in XEmacs.
220 In most cases, the user will start an interaction with Eos as follows:
224 (2) Load \"eos.el\" to add a SPARCworks submenu to the menubar (this
225 step might not be needed if Eos is preloaded to your XEmacs binary), and
227 (3) On some XEmacs frame use the SPARCworks submenu and start the
228 desired tool and simultaneously enable that frame to display sources.
230 The toolbar for the enabled frame will change after (3) to show that
231 this frame will behave as the source display for the SW tool and to
232 indicate that some actions on the tool can be performed from this frame.
234 The actions available depend on the SW tool. The interaction model for
235 the Debugger and the SourceBrowser can be described as #iselect on the
236 XEmacs frame and then click on the button on the SW tool#n. As an example,
237 a browser query can be performed by selecting some text and then clicking
238 on the query button on the SBrowser tool; the source for the first match
239 will appear in the XEmacs frame, together with a glyph showing the match.
241 The Debugger and Dbx can also be driven from XEmacs. Most frequently
242 this will be done using the ToolBar. Entries in the toolbar of a frame
243 enabled for debugging are deactivated when there is not enough information
244 to invoke their associated commands (due to technical reasons, it is
245 necessary for XEmacs to have had a frame enabled for Debugger/Dbx when
246 a debug or attach command was issued to Debugger/Dbx to make most toolbar
247 commands active). As an example, to set a breakpoint at some line, select
248 a position in that line and then click on the toolbar icon with the stop
249 with the arrow inside.
255 In the scenario described above, the user simultaneously starts a tool
256 and enables a frame for that tool. The two actions can also be done
257 independently. The tools (Source Browser, Debugger, and Dbx) have to
258 be started with the \"-editor\" option and the XEmacs frame can be
259 enabled manually using the SPARCworks submenu. The most common use
260 of this feature is to disable and re-enable a frame, be it to recover
261 the default toolbar, or to avoid conflicts with other active tools
262 (see the paragraph below on multiple active tools).
266 At any given time there can be at most one frame enabled to display
267 Source Browser sources, and at most one frame enabled to display
268 Debugger and Dbx sources. The same XEmacs frame can be used for both
269 types of sources. The toolbar of an enabled frame always starts with
270 an informational icon. This icon is a large-font #ii#n with either a
271 smaller-font #iB#n, if the frame has browsing enabled, and/or a smaller-font
272 #iD#n, if the frame has debugging enabled.
274 If no frames are enabled for a given tool, the editor integration for
275 that tool is disabled. This means that XEmacs deregisters the TT
276 patterns relevant to this tool, and XEmacs does not receive any
277 messages from that tool.
279 #iMultiple Active Tools#n
281 In order to provide a simpler user model, Eos has no provisions to
282 #igracefully#n support more than one simultaneous active tool of a
283 given class per TT session. A Debugger and a SourceBrowser, or a Dbx
284 and a SourceBrowser, can coexist gracefully, but a Debugger and a Dbx
285 cannot, and neither can two SourceBrowsers, two Debuggers, or two
286 dbxs. This simplification is consistent with the needs of most users.
288 The implementation of Eos notifies the user if she attempts to start two
289 conflicting tools, but it does not enforce the restriction. In some
290 cases two conflicting tools can be used profitably by a careful user,
291 but in others the result is likely to be chaos. An example of the first
292 is using two SourceBrowsers, and one of the later is attempting to send
293 debugging commands from XEmacs to two debuggers.
295 If a user really needs to have multiple active tools, she can do this
296 in a safe way by creating several TT sessions (e.g. using #ittsession
297 -c /bin/csh#n, see the man page for ttsession), and placing the tools
298 with their own XEmacses in separate TT sessions.
300 #iA Visual Data Inspector in XEmacs#n
302 Users that choose to drive the debugger from XEmacs also have
303 available a #ivery simple#n but fast visual data inspector. The results
304 of #iprint#n and #iprint*#n commands are formatted into an XEmacs buffer
305 (#i\"*Eos Print Output*\"#n) and presented into a separate frame.
306 This frame is mapped and unmapped so that, except for the first time,
309 #iBuffers for Debugger/Dbx Interaction#n
311 When starting dbx as a subprocess, a buffer will be created to interact
312 with dbx. The name of this buffer is of the form #i\"*Eos dbx*\"#n.
314 If a dbx engine is receiving requests from both Debugger and XEmacs
315 (e.g. it was started via #idebugger -editor#n), the responses to
316 commands sent by XEmacs will be shown in the echo area and will be
317 recorded in a read-only buffer (#i\"*Eos Debugger Log*\"#n), but responses
318 to Debugger commands will not appear. Conversely, responses to Debugger
319 commands will appear in the Debugger transcript pane but not in XEmacs's
320 log buffer. This is a limitation of the underlying TT protocols.
324 Although tty support is not an official part of Eos, it is possible
325 with some extra effort and specialized knowledge from the user.
327 #iStarting a ToolTalk Session#n
329 Eos requires a ToolTalk communication. This may require starting a TT
332 (0) Start a ToolTalk session, and a shell so that all processes
333 started from this shell will use the new TT session. Do this by
334 executing \"ttsession -c /bin/csh\" - or whatever shell you use
336 At this point, you can start your XEmacs on that shell, as shown in
337 step (1) above. Note that, since there is no TTY toolbar in 19.12
338 (nor 19.13), an alternative mechanism must be used to enable the
341 A typical use for tty is to interact with dbx. The command
342 #ieos::start-dbx#n will select the tty frame for debugging and will start
343 a dbx buffer. From this point on, dbx will use this tty frame to show
344 its sources. The introduction and news messages can be generated
345 using the commands #ieos::sw-intro#n and #ieos::sw-news#n. You can interact
346 with the dbx subprocess by typing to its associated input buffer or
347 using some key bindings.
351 A tty user can interact with Eos by invoking directly the Eos
352 commands, evaluating elisp expressions, or through some key-bindings.
353 The expert user may provide her own key bindings. Eos also provides two
354 set of global bindings, which are activated by evaluating the
355 expressions (eos::set-key-mode 'prefix) or (eos::set-key-mode
360 Due to a bug in the internal subprocess machinery of XEmacs 19.12, the
361 default prompt of dbx subprocesses will show the full path to the binary.
362 The prompt can be overridden using the ksh variable PS1\; one way to do
363 this is by adding the following line to your ~/.dbxrc:
369 You are encouraged to send us feedback via the Comments button in
370 the About Box of either SPARCworks tool, or directly to
371 eos-comments@cs.uiuc.edu.
374 (setq buffer-read-only t)
375 (goto-char (point-min))
376 (view-mode nil 'kill-buffer) ;; assume the new view-less
380 ;; Cheat Sheets for keyboard mappings
382 ;; This depends on the mapping being used!
385 (defun eos::sw-cheat-sheet ()
386 "Generate buffer that has a description of the key maps that can be
387 printed, cut and then taped somewhere (like on the keyboard or on your
388 monitor). This is particularly useful for the function keys"
390 (let ((buffer1 (get-buffer-create " *Cheat Sheets*"))
392 (switch-to-buffer buffer1)
393 (setq buffer-read-only nil)
394 (delete-region (point-min) (point-max))
396 #bCheat Sheets for Eos#n
398 This buffer has a description of the key maps that can be printed, cut
399 and then taped somewhere (like on the keyboard or on your monitor).
400 This is particularly useful for the function keys since their numbers
401 don't any particular mnemonic value.
404 #bWhen using function keys#n #i[Options->SPARCworks->Use Function Keys]#n
406 ----------------------------------------
410 Do Print Cont ---- Next
411 Run Print* Stop <Ctrl> Step
412 Fix Dismiss Clear <Shft> Step Up
415 ----------------------------------------
417 #bWhen using prefix map#n #i[Options->SPARCworks->Use C-c d Prefix Map]#n
419 ----------------------------------------
431 Stop b (for breakpoint)
440 ----------------------------------------
443 (setq buffer-read-only t)
444 (goto-char (point-min))
445 (view-mode nil 'kill-buffer) ;; assume the new view-less
452 (defun eos::sw-news ()
453 "Generate a News buffer."
455 (let ((buffer1 (get-buffer-create " *Eos News*"))
457 (switch-to-buffer buffer1)
458 (setq buffer-read-only nil)
459 (delete-region (point-min) (point-max))
463 See the #iHelp#n top-level menu for additional information on the
464 SPARCworks lightweight editor integration (Eos). The current version
465 of Eos is available as the contents of the variable eos::version.
469 Support for 19.12 and 19.13. Works on TTYs. Uses real ToolBar.
470 Toolbars for debugger & content inspector are frame-local.
471 Better icons and glyphs. Support for (load-library \"eos\").
472 Ease-of-use: startup for tools.
473 Icon files are now defined \"in-line\" to simplify administration.
475 Removed the following to simplify use:
476 - Textual toolbar (from 1.4).
477 - Option submenu to add keymaps for debugger use.
479 - Any pretenses to support SW3.0; use SW3.0.1 instead.
483 Added eos::add-button interface.
487 Added toolbar like in dbxtool. Toolbar uses echo-help to show
488 meaning of buttons, (setq inhibit-help-echo t) if you don't
491 Selection now remains after \"print\"-like commands. Now it
492 is possible to have the *debugger* buffer in the frame selected
493 for displaying debugged sources.
495 Added a command to relayout debugger buffers so they show in
496 a layout similar to that of dbxtool.
500 Provided popup-menu bindings for those debugger actions
501 that operate on the contents of the selection or its position;
502 selectable via options.
504 The *debugger* buffer now support M-p and M-n.
508 Better support for interactions via *debugger* buffer and directly
509 using a prefix map and function keys.
511 Converted to use new toggle and radio menus, reorganizing
512 SPARCworks menu to factor out help and options into submenus,
513 which are now available under the Options and Help top-level menus.
517 Some internal cleanup.
519 Eos now provides basic machinery to drive the debugger
520 engine directly using ToolTalk messages. This feature is
521 not yet very well polished. You can try using it at your own risk,
522 or await for release 1.2 (soon to come) that will provide a better
523 interface and improved functionality, as well as documentation
528 First widely available release. Supports simple #iselect and click#n model.
530 #bPossible Future Enhancements#n
532 * Add a \"peek-in-source\" mechanism to show the values of
533 expressions in the sources.
535 * The comint package should be generalized to allow for TT-based
536 interpreters and it should be used in Eos.
538 * Key & popup bindings should probably be a minor mode (currently
539 it conflicts with cc-mode).
541 * Should support locking a print frame to force new print frames. Also,
542 should allow for following fields in print frames.
547 Send feedback to #ieos-comments@cs.uiuc.edu#n")
548 (setq buffer-read-only t)
549 (goto-char (point-min))
550 (view-mode nil 'kill-buffer) ;; assume the new view-less
553 (provide 'eos-menubar)
555 ;;; sun-eos-debugger.el ends here