
(require (quote comint))

(provide (quote rexx-debug))

(defvar rxdb-lineno-regexp "^ +[0-9]+ +\\*\\-\\* " "\
A regexp to recognize a linenumber in the rexx debugger output stream.")

(defvar rxdb-prompt-pattern "^>\\+> " "\
A regexp to recognize the rexx debugger prompt.")

(defvar rxdb-command-name "rx" "\
Pathname for REXX interpreter.")

(defvar rxdb-mode-map nil "\
Keymap for rexx-debug-mode.")

(if rxdb-mode-map nil (setq rxdb-mode-map (full-copy-sparse-keymap comint-mode-map)) (define-key rxdb-mode-map "" (quote rxdb-refresh)))

(defun rxdb-mode nil "\
Major mode for interacting with an inferior rexx process.

Commands:

\\{rxdb-mode-map}

Variable:
    rxdb-command-name  contains the name of the REXX interpretator.
		       Default is \"RX\", which is used by ARexx.

Customisation: Entry to this mode runs the hooks comint-mode-hook and
rxdb-mode-hook (in that order).

For example:
(setq rxdb-mode-hook '(lambda ()
		        (setq rxdb-command-name \"/usr/local/bin/rexx\")
			(define-local-key \"key\" 'favorite-command)
			))

will set the command so it can be used in many UNIX environments." (interactive) (byte-code "ÇˆË ˆÌ‰ˆÍ‰ˆÎ‰ˆÏ!ˆ‰ˆÐÆ!ˆÇ‰ˆÐÈ!ˆÉ‰ˆÐÊ!ˆÇ‰
ˆÑÒ!‡" [major-mode mode-name mode-line-process rxdb-mode-map comint-prompt-regexp rxdb-prompt-pattern rxdb-last-frame nil rxdb-last-frame-displayed-p t rxdb-delete-prompt-marker comint-mode rxdb-mode "Inferior REXX" (": %s") use-local-map make-local-variable run-hooks rxdb-mode-hook] 7))

(defun rexx-debug (path args) "\
Run a rexx program FILE in buffer *rexx-FILE*.
The directory containing FILE becomes the initial working directory
and source-file directory.
(Type \\[describe-mode] in the process buffer for a list of commands.)" (interactive "FDebug file (return for current buffer): 
sArguments:") (byte-code "ÄˆÈ!‰ˆÉ!Ê	ËQÌ
!ƒ Í!‚\" Î
!ˆÏ
!ƒ- Ä‚^ Ð!‰ˆn†9 Ñ ˆÒÓÔ#ˆÕÖ	PÄ	×Q$ˆØ ˆÙÚp!Û\"ˆÜÚp!Ý\"ˆÞ!+‡" [path file rxdb-buffer rxdb-window nil default-directory rxdb-command-name args expand-file-name file-name-nondirectory "*rexx-" "*" get-buffer-window select-window switch-to-buffer comint-check-proc file-name-directory newline insert "Current directory is " "
" make-comint "rexx-" " " rxdb-mode set-process-filter get-buffer-process rxdb-filter set-process-sentinel rxdb-sentinel rxdb-set-buffer] 17))

(defun rxdb-set-buffer (&optional path) (byte-code "Ä=… p‰ˆ
… 
‰‡" [major-mode current-rxdb-buffer path current-rxdb-file rxdb-mode] 2))

(defun rxdb-filter (proc string) (byte-code "ÁÄ
\")‡" [inhibit-quit t proc string rxdb-filter-accumulate-marker] 3))

(defun rxdb-filter-accumulate-marker (proc string) (byte-code "Á…> ÈÉ
\"‰ˆ…: È
\"…( Ê
ËÈÌ
Í#O!‰ˆÆ‰ˆÎ
ËTO\"ˆ
TÆO‰ˆ‚ ˆÏ
Ð\"ƒJ Æ‚O Î
\")‡" [end t string rxdb-lineno-regexp rxdb-last-frame rxdb-last-frame-displayed-p nil proc string-match "
" string-to-int 0 "\\*\\-\\*" 1 rxdb-filter-insert equal ""] 10))

(defun rxdb-filter-insert (proc string) (byte-code "`Ç	!U`Ç	!WpÈÉ	!qˆÊŽŠÇ	!bˆ`‰ˆcˆËÇ	!`\"ˆÌ ˆÍ
†7 Îp!?Æ\"))ˆ…D Ç	!b,‡" [moving proc output-after-point old-buffer start string t process-mark nil process-buffer ((byte-code "q‡" [old-buffer] 1)) set-marker rxdb-maybe-delete-prompt rxdb-display-frame get-buffer-window] 11))

(defun rxdb-sentinel (proc msg) (byte-code "ÇÈ!!?ƒ Â‰ˆÉÂ\"‚X Ê!Ë>…X Â‰ˆÌÍÊ!!P‰ˆpÎŽÈ!qˆÏÐ !ˆmƒF ÑÒÓ$‚R ŠdbˆÑÒÓ$)ˆÔ!))‡" [proc overlay-arrow-position nil mode-line-process obuf mode-name msg buffer-name process-buffer set-process-buffer process-status (signal exit) ": " symbol-name ((byte-code "q‡" [obuf] 1)) set-buffer-modified-p buffer-modified-p insert 10 " " delete-process] 15))

(defun rxdb-refresh nil "\
Fix up a possibly garbled display, and redraw the arrow." (interactive) (byte-code "ÀˆÁ ˆÂ ‡" [nil redraw-display rxdb-display-frame] 3))

(defun rxdb-display-frame (&optional nodisplay noauto) "\
Display the last line executed in another window." (interactive) (byte-code "ÆˆÇ ˆ…  	?…  
?† ?…  È\"ˆÅ‰‡" [rxdb-last-frame nodisplay rxdb-last-frame-displayed-p noauto current-rxdb-file t nil rxdb-set-buffer rxdb-display-line] 4))

(defun rxdb-display-line (true-file line) (byte-code "É	!ÊÃ\"ÅŠqˆŒË ˆÌ!ˆ`‰ˆÍ‰ˆ†+ Î ‰ˆÏ`p#)ˆeW†= dV…E Ë ˆb)ˆÐ
\"+‡" [buffer true-file window t pos nil line overlay-arrow-string overlay-arrow-position find-file-noselect display-buffer widen goto-line "=>" make-marker set-marker set-window-point] 10))

(defun rxdb-call (command) "\
Invoke rexx debug COMMAND displaying source in other window." (interactive) (byte-code "ÃˆdbˆÄ ‰ˆÅ ˆÆÇ	!
ÈP\"‡" [rxdb-delete-prompt-marker current-rxdb-buffer command nil point-marker rxdb-set-buffer send-string get-buffer-process "
"] 7))

(defun rxdb-maybe-delete-prompt nil (byte-code "…	 dÃ!V…! Âbˆ`‰ˆÄ ˆÅ`	\"ˆÂ‰)‡" [rxdb-delete-prompt-marker start nil marker-position beginning-of-line delete-region] 5))

(defvar rxdb-commands nil "\
List of strings or functions used by send-rxdb-command.
It is for customization by you.")

(defun send-rxdb-command (arg) "\
This command reads the core-address where the cursor is positioned.  It
 then inserts this ADDR at the end of the rxdb buffer.  A numeric arg
 selects the ARG'th member COMMAND of the list rxdb-commands.  If
 COMMAND is a string, (format COMMAND ADDR) is inserted, otherwise
 (funcall COMMAND ADDR) is inserted.  eg. \"p (rtx)%s->fld[0].rtint\"
 is a possible string to be a member of rxdb-commands.  " (interactive "P") (byte-code "ÆˆÆÆ
… 
8‰ˆÇ ‰ˆp=… È`!ˆƒ8 ;ƒ/ É	\"‚3 Ê	\"‰‚; 	‰ˆË!ˆdbˆÌ!*‡" [comm addr arg rxdb-commands current-rxdb-buffer t nil rxdb-read-address set-mark format funcall switch-to-buffer insert-string] 7))

(defvar rxdb-load-hook nil "\
This hook is run when rxdb is loaded in.
This is a good place to put keybindings.")

(run-hooks (quote rxdb-load-hook))
