Sun / sun-eos-menubar.el

steve 911e658 









































































































































































































































































































































































































































































































































































  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
;;; sun-eos-menu.el --- Implements the XEmacs/SPARCworks menubar

;; Copyright (C) 1995  Sun Microsystems, Inc.

;; Maintainer:	Eduardo Pelegri-Llopart <eduardo.pelegri-llopart@Eng.Sun.COM>
;; Author:      Eduardo Pelegri-Llopart <eduardo.pelegri-llopart@Eng.Sun.COM>

;; Keywords:	SPARCworks EOS Era on SPARCworks menubar

;;; Commentary:
;; This file contains functions that populate a SPARCworks menu
;; Please send feedback to eduardo.pelegri-llopart@eng.sun.com

;;; Code:

(require 'eos-common "sun-eos-common")

(defun eos::toggle-sbrowser-selected-frame ()
  ;; Toggle whether this frame is selected for SBrowser
  (interactive)
  (if (equal eos::sbrowser-frame (selected-frame))
      (eos::select-sbrowser-frame nil)
    (eos::select-sbrowser-frame (selected-frame)))
  )

(defun eos::toggle-debugger-selected-frame ()
  ;; Toggle whether this frame is selected for Debugger
  (interactive)
  (if (equal eos::debugger-frame (selected-frame))
      (eos::select-debugger-frame nil)
    (eos::select-debugger-frame (selected-frame)))
  )

(defvar eos::long-menu
  '(
    ["Read and Execute a Dbx Command" eos::dbx-cmd (not (eq eos::key-mode 'none))]
    ["Run" eos::run (not (eq eos::key-mode 'none))]
    ["Fix" eos::fix (not (eq eos::key-mode 'none))]
    "-----"
    ["Print" eos::print (not (eq eos::key-mode 'none))]
    ["Print *" eos::print* (not (eq eos::key-mode 'none))]
    ["Dismiss Print" eos::dismiss-print-frame (not (eq eos::key-mode 'none))]
    "-----"
    ["Continue" eos::cont (not (eq eos::key-mode 'none))]
    ["Stop" eos::stop-at (not (eq eos::key-mode 'none))]
    ["Clear" eos::clear-at (not (eq eos::key-mode 'none))]
    ["Next" eos::next (not (eq eos::key-mode 'none))]
    ["Step" eos::step (not (eq eos::key-mode 'none))]
    ["Step Up" eos::step-up (not (eq eos::key-mode 'none))]
    ["Continue To" eos::cont-to (not (eq eos::key-mode 'none))]
    "-----"
    ["Stack Up" eos::up (not (eq eos::key-mode 'none))]
    ["Stack Down" eos::down (not (eq eos::key-mode 'none))]
    "-----"
    ("Start Tool and Enable Frame"
     ["Debugger" eos::start-debugger t]
     ["Dbx" eos::start-dbx t]
     ["SBrowser" eos::start-sbrowser t]
    )
    "-----"
    ["Enable Frame for SBrowser"
     eos::toggle-sbrowser-selected-frame
     :style toggle
     :selected (equal eos::sbrowser-frame
		      (selected-frame))]
    ["Enable Frame for Debugger and Dbx"
     eos::toggle-debugger-selected-frame
     :style toggle
     :selected (equal eos::debugger-frame
		      (selected-frame))]
    "-----"
    ["News..." eos::sw-news t]
    )
  )

(defvar eos::short-menu
  '(
    ("Start Tool and Enable Frame"
     ["Debugger" eos::start-debugger t]
     ["Dbx" eos::start-dbx t]
     ["SBrowser" eos::start-sbrowser t]
    )
    "-----"
    ["Enable Frame for SBrowser"
     eos::toggle-sbrowser-selected-frame
     :style toggle
     :selected (equal eos::sbrowser-frame
		      (selected-frame))]
    ["Enable Frame for Debugger and Dbx"
     eos::toggle-debugger-selected-frame
     :style toggle
     :selected (equal eos::debugger-frame
		      (selected-frame))]
    "-----"
    ["News..." eos::sw-news t]
    )
  )

(defun eos::menubar-startup ()
  ;; Actions to do at startup for eos-menubar.el
  (if (and (eq (device-type (selected-device)) 'x)
	   (or (not (local-variable-p 'current-menubar (current-buffer)))
	       (yes-or-no-p
		"SPARCworks menu will be local (menubar is buffer-local); proceed?")))
      (progn
	(add-menu-button '("Help") ["SPARCworks..." eos::sw-intro t])
	(add-submenu nil
		     (append '("SPARCworks") (copy-tree eos::short-menu))
		     "Version Control"
		     )
	)))

;;
;; Insertion of text with a font
;;

(defun eos::insert-italics (a-string)
  (eos::insert-with-font a-string 'italic))

(defun eos::insert-bold (a-string)
  (eos::insert-with-font a-string 'bold))

(defun eos::insert-with-font (a-string a-font)
  (interactive "")
  (let (a b ext)
    (setq a (point))
    (insert a-string)
    (setq b (point))
    (setq ext (make-extent a b))
    (set-extent-face ext (find-face a-font))
    ))

;;
;; Generic insert code
;;

(defun eos::insert (s)
  (let ((len (length s))
	(pos 0)
	(newpos 0)
	(state 'normal))
    (while (< pos len)
      (setq newpos (string-match "#[bnir]" s pos))
      (if (and newpos (> newpos pos))
	  (progn
	    (cond ((equal (aref s (+ newpos 1)) ?b) ; bold
		   (if (equal state 'normal)
		       (progn
			 (insert (substring s pos newpos))
			 (setq state 'bold))
		     (error "found bold when not in normal")))
		  ((equal (aref s (+ newpos 1)) ?r) ; red
		   (if (equal state 'normal)
		       (progn
			 (insert (substring s pos newpos))
			 (setq state 'red))
		     (error "found red when not in normal")))
		  ((equal (aref s (+ newpos 1)) ?i) ; italics
		   (if (equal state 'normal)
		       (progn
			 (insert (substring s pos newpos))
			 (setq state 'italics))
		     (error "found italics when not in normal")))
		  ((equal (aref s (+ newpos 1)) ?n) ; normal
		   (cond ((equal state 'italics)
			  (eos::insert-italics (substring s pos newpos))
			  (setq state 'normal))
			 ((equal state 'bold)
			  (eos::insert-bold (substring s pos newpos))
			  (setq state 'normal))
			 ((equal state 'normal)
			  (error "found normal when in normal"))))
		  (t
		   (error "internal error"))
		  )
	    (setq pos (+ newpos 2))
	    )
	(if (equal state 'normal)
	    (progn
	      (insert (substring s pos))
	      (setq pos len))
	  (error "eos::insert with unclosed special font"))
	))
    ))

;;
;; Introduction File
;;

(defun eos::sw-intro ()
  "Generate an intro buffer."
  (interactive)
  (let ((buffer1 (get-buffer-create " *SPARCworks Intro*"))
	)
    (switch-to-buffer buffer1)
    (setq buffer-read-only nil)
    (delete-region (point-min) (point-max))
    (eos::insert "
		#bSPARCworks Editor Integration#n
	    Eos is copyright (c) 1995 by Sun Microsystems.

#bIntroduction (for Eos 1.5.x)#n

#iSPARCworks#n is a set of integrated programming tools from SunSoft that
support the program development cycle. #iXEmacs#n is a version of the Emacs
editor that includes interfaces to the selection service and to the
#iToolTalk#n service.  The #iEos#n package uses these two interfaces to provide
a simple yet useful editor integration with three SPARCworks tools:
the #iSourceBrowser#n, the #iDebugger#n and #iDbx#n.  Eos requires XEmacs 19.12
or above, and SW3.0.1 or above.

When used with Eos, the Debugger and SourceBrowser do not include a
source pane for displaying of sources and instead use an XEmacs frame.
Then the user can interact with the XEmacs frame in a way very similar
to how the source panes of the SW tools would be used.  The user can also
start Dbx and request that sources be shown in XEmacs.

#bSimple Startup#n

In most cases, the user will start an interaction with Eos as follows:

 (1) Start XEmacs,

 (2) Load \"eos.el\" to add a SPARCworks submenu to the menubar (this
step might not be needed if Eos is preloaded to your XEmacs binary), and

 (3) On some XEmacs frame use the SPARCworks submenu and start the
desired tool and simultaneously enable that frame to display sources.

The toolbar for the enabled frame will change after (3) to show that
this frame will behave as the source display for the SW tool and to
indicate that some actions on the tool can be performed from this frame.

The actions available depend on the SW tool.  The interaction model for
the Debugger and the SourceBrowser can be described as #iselect on the
XEmacs frame and then click on the button on the SW tool#n. As an example,
a browser query can be performed by selecting some text and then clicking
on the query button on the SBrowser tool; the source for the first match
will appear in the XEmacs frame, together with a glyph showing the match.

The Debugger and Dbx can also be driven from XEmacs.  Most frequently
this will be done using the ToolBar.  Entries in the toolbar of a frame
enabled for debugging are deactivated when there is not enough information
to invoke their associated commands (due to technical reasons, it is
necessary for XEmacs to have had a frame enabled for Debugger/Dbx when
a debug or attach command was issued to Debugger/Dbx to make most toolbar
commands active).  As an example, to set a breakpoint at some line, select
a position in that line and then click on the toolbar icon with the stop
with the arrow inside.

#bDetails#n

#iManual Startup#n

In the scenario described above, the user simultaneously starts a tool
and enables a frame for that tool. The two actions can also be done
independently. The tools (Source Browser, Debugger, and Dbx) have to
be started with the \"-editor\" option and the XEmacs frame can be
enabled manually using the SPARCworks submenu.  The most common use
of this feature is to disable and re-enable a frame, be it to recover
the default toolbar, or to avoid conflicts with other active tools
(see the paragraph below on multiple active tools).

#iFrame Enabling#n

At any given time there can be at most one frame enabled to display
Source Browser sources, and at most one frame enabled to display
Debugger and Dbx sources.  The same XEmacs frame can be used for both
types of sources.  The toolbar of an enabled frame always starts with
an informational icon.  This icon is a large-font #ii#n with either a
smaller-font #iB#n, if the frame has browsing enabled, and/or a smaller-font
#iD#n, if the frame has debugging enabled.

If no frames are enabled for a given tool, the editor integration for
that tool is disabled. This means that XEmacs deregisters the TT
patterns relevant to this tool, and XEmacs does not receive any
messages from that tool.

#iMultiple Active Tools#n

In order to provide a simpler user model, Eos has no provisions to
#igracefully#n support more than one simultaneous active tool of a
given class per TT session. A Debugger and a SourceBrowser, or a Dbx
and a SourceBrowser, can coexist gracefully, but a Debugger and a Dbx
cannot, and neither can two SourceBrowsers, two Debuggers, or two
dbxs.  This simplification is consistent with the needs of most users.

The implementation of Eos notifies the user if she attempts to start two
conflicting tools, but it does not enforce the restriction.  In some
cases two conflicting tools can be used profitably by a careful user,
but in others the result is likely to be chaos.  An example of the first
is using two SourceBrowsers, and one of the later is attempting to send
debugging commands from XEmacs to two debuggers.

If a user really needs to have multiple active tools, she can do this
in a safe way by creating several TT sessions (e.g. using #ittsession
-c /bin/csh#n, see the man page for ttsession), and placing the tools
with their own XEmacses in separate TT sessions.

#iA Visual Data Inspector in XEmacs#n

Users that choose to drive the debugger from XEmacs also have
available a #ivery simple#n but fast visual data inspector.  The results
of #iprint#n and #iprint*#n commands are formatted into an XEmacs buffer
(#i\"*Eos Print Output*\"#n) and presented into a separate frame.
This frame is mapped and unmapped so that, except for the first time,
it appears quickly.

#iBuffers for Debugger/Dbx Interaction#n

When starting dbx as a subprocess, a buffer will be created to interact
with dbx.  The name of this buffer is of the form #i\"*Eos dbx*\"#n.

If a dbx engine is receiving requests from both Debugger and XEmacs
(e.g. it was started via #idebugger -editor#n), the responses to
commands sent by XEmacs will be shown in the echo area and will be
recorded in a read-only buffer (#i\"*Eos Debugger Log*\"#n), but responses
to Debugger commands will not appear.  Conversely, responses to Debugger
commands will appear in the Debugger transcript pane but not in XEmacs's
log buffer.  This is a limitation of the underlying TT protocols.

#bTTY Support#n

Although tty support is not an official part of Eos, it is possible
with some extra effort and specialized knowledge from the user.

#iStarting a ToolTalk Session#n

Eos requires a ToolTalk communication.  This may require starting a TT
session by:

 (0) Start a ToolTalk session, and a shell so that all processes
started from this shell will use the new TT session.  Do this by
executing \"ttsession -c /bin/csh\" - or whatever shell you use

At this point, you can start your XEmacs on that shell, as shown in
step (1) above.  Note that, since there is no TTY toolbar in 19.12
(nor 19.13), an alternative mechanism must be used to enable the
(tty) frame.

A typical use for tty is to interact with dbx. The command
#ieos::start-dbx#n will select the tty frame for debugging and will start
a dbx buffer.  From this point on, dbx will use this tty frame to show
its sources.  The introduction and news messages can be generated
using the commands #ieos::sw-intro#n and #ieos::sw-news#n.  You can interact
with the dbx subprocess by typing to its associated input buffer or
using some key bindings.

#iKey Bindings#n

A tty user can interact with Eos by invoking directly the Eos
commands, evaluating elisp expressions, or through some key-bindings.
The expert user may provide her own key bindings.  Eos also provides two
set of global bindings, which are activated by evaluating the
expressions (eos::set-key-mode 'prefix) or (eos::set-key-mode
'function).

#bKnown Bugs#n

Due to a bug in the internal subprocess machinery of XEmacs 19.12, the
default prompt of dbx subprocesses will show the full path to the binary.
The prompt can be overridden using the ksh variable PS1\; one way to do
this is by adding the following line to your ~/.dbxrc:

	PS1='(dbx) '

#bFeedback#n

You are encouraged to send us feedback via the Comments button in
the About Box of either SPARCworks tool, or directly to
eos-comments@cs.uiuc.edu.

#bEnjoy.#n")
   (setq buffer-read-only t)
   (goto-char (point-min))
   (view-mode nil 'kill-buffer)		;; assume the new view-less
   ))

;;
;; Cheat Sheets for keyboard mappings
;;
;; This depends on the mapping being used!
;;

(defun eos::sw-cheat-sheet ()
  "Generate buffer that has a description of the key maps that can be
printed, cut and then taped somewhere (like on the keyboard or on your
monitor).  This is particularly useful for the function keys"
  (interactive)
  (let ((buffer1 (get-buffer-create " *Cheat Sheets*"))
	)
    (switch-to-buffer buffer1)
    (setq buffer-read-only nil)
    (delete-region (point-min) (point-max))
    (eos::insert "
		#bCheat Sheets for Eos#n

This buffer has a description of the key maps that can be printed, cut
and then taped somewhere (like on the keyboard or on your monitor).
This is particularly useful for the function keys since their numbers
don't any particular mnemonic value.


#bWhen using function keys#n #i[Options->SPARCworks->Use Function Keys]#n

----------------------------------------

F6      F7        F8             F9

Do      Print     Cont    ----   Next
Run     Print*    Stop   <Ctrl>  Step
Fix     Dismiss   Clear  <Shft>  Step Up


----------------------------------------

#bWhen using prefix map#n #i[Options->SPARCworks->Use C-c d Prefix Map]#n

----------------------------------------
Basic prefix: C-c d


	Do	 %
	Run	 r
	Fix	 f

	Print	 p
	Print*	 C-p

	Cont	 c
	Stop	 b (for breakpoint)
	Clear	 C-b

	Next	 n
	Step	 s
	Step up  C-s

	Up       u
	Down     d
----------------------------------------

")
   (setq buffer-read-only t)
   (goto-char (point-min))
   (view-mode nil 'kill-buffer)		;; assume the new view-less
   ))

;;
;; News files
;;

(defun eos::sw-news ()
  "Generate a News buffer."
  (interactive)
  (let ((buffer1 (get-buffer-create " *Eos News*"))
	)
    (switch-to-buffer buffer1)
    (setq buffer-read-only nil)
    (delete-region (point-min) (point-max))
    (eos::insert "
		#bEos News#n

See the #iHelp#n top-level menu for additional information on the
SPARCworks lightweight editor integration (Eos).  The current version
of Eos is available as the contents of the variable eos::version.

#bversion 1.5.2#n

	Support for 19.12 and 19.13.  Works on TTYs. Uses real ToolBar.
	Toolbars for debugger & content inspector are frame-local.
	Better icons and glyphs.  Support for (load-library \"eos\").
	Ease-of-use: startup for tools.
	Icon files are now defined \"in-line\" to simplify administration.

	Removed the following to simplify use:
	 - Textual toolbar (from 1.4).
	 - Option submenu to add keymaps for debugger use.
	 - Popup menu.
	 - Any pretenses to support SW3.0; use SW3.0.1 instead.

#bversion 1.4.1#n

	Added eos::add-button interface.

#bversion 1.4#n

	Added toolbar like in dbxtool.  Toolbar uses echo-help to show
	meaning of buttons, (setq inhibit-help-echo t) if you don't
	want it.

	Selection now remains after \"print\"-like commands.  Now it
	is possible to have the	*debugger* buffer in the frame selected
	for displaying debugged	sources.

	Added a command to relayout debugger buffers so they show in
	a layout similar to that of dbxtool.

#bversion 1.3#n

	Provided popup-menu bindings for those debugger actions
	that operate on the contents of the selection or its position;
	selectable via options.

	The *debugger* buffer now support M-p and M-n.

#bversion 1.2#n

	Better support for interactions via *debugger* buffer and directly
	using a prefix map and function keys.

	Converted to use new toggle and radio menus, reorganizing
	SPARCworks menu to factor out help and options into submenus,
	which are now available under the Options and Help top-level menus.

#bversion 1.1#n

	Some internal cleanup.

	Eos now provides basic machinery to drive the debugger
	engine directly using ToolTalk messages.  This feature is
	not yet very well polished. You can try using it at your own risk,
	or await for release 1.2 (soon to come) that will provide a better
	interface and improved functionality, as well as documentation
	for the interface.

#bversion 1.0#n

	First widely available release.  Supports simple #iselect and click#n model.

#bPossible Future Enhancements#n

* Add a \"peek-in-source\" mechanism to show the values of
  expressions in the sources.

* The comint package should be generalized to allow for TT-based
  interpreters and it should be used in Eos.

* Key & popup bindings should probably be a minor mode (currently
  it conflicts with cc-mode).

* Should support locking a print frame to force new print frames.  Also,
  should allow for following fields in print frames.


#bFeedback#n

	Send feedback to #ieos-comments@cs.uiuc.edu#n")
   (setq buffer-read-only t)
   (goto-char (point-min))
   (view-mode nil 'kill-buffer)		;; assume the new view-less
   ))

(provide 'eos-menubar)

;;; sun-eos-debugger.el ends here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.