Function: idlwave-shell-scan-for-state

idlwave-shell-scan-for-state is a byte-compiled function defined in idlw-shell.el.gz.

Signature

(idlwave-shell-scan-for-state)

Documentation

Scan for state info.

Looks for messages in output from last IDL command indicating where IDL has stopped. The types of messages we are interested in are execution halted, stepped, breakpoint, interrupted at and trace messages. For breakpoint messages process any attached count or command parameters. Update the stop line if a message is found. The variable idlwave-shell-current-state is set to error, halt, or breakpoint, which describes the status, or nil for none of the above.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlw-shell.el.gz
(defvar idlwave-shell-electric-debug-mode) ; defined by easy-mmode

(defun idlwave-shell-scan-for-state ()
  "Scan for state info.
Looks for messages in output from last IDL command indicating where
IDL has stopped.  The types of messages we are interested in are
execution halted, stepped, breakpoint, interrupted at and trace
messages.  For breakpoint messages process any attached count or
command parameters.  Update the stop line if a message is found.
The variable `idlwave-shell-current-state' is set to `error', `halt',
or `breakpoint', which describes the status, or nil for none of
the above."
  (let (trace)
    (cond
     ;; Make sure we have output
     ((not idlwave-shell-command-output))

     ;; First Priority: Syntax and other errors
     ((or
       (string-match idlwave-shell-syntax-error
		     idlwave-shell-command-output)
       (string-match idlwave-shell-other-error
		     idlwave-shell-command-output))
      (with-current-buffer
	  (get-buffer-create idlwave-shell-error-buffer)
	(erase-buffer)
	(insert idlwave-shell-command-output)
	(goto-char (point-min))
	(setq idlwave-shell-error-last (point)))
      (setq idlwave-shell-current-state 'error)
      (idlwave-shell-goto-next-error))

     ;; Second Priority: Halting errors
     ((string-match idlwave-shell-halting-error
		    idlwave-shell-command-output)
      ;; Grab the file and line state info.
      (setq idlwave-shell-calling-stack-index 0)
      (setq idlwave-shell-halt-frame
	    (idlwave-shell-parse-line
	     (substring idlwave-shell-command-output
			(match-beginning 2)))
	    idlwave-shell-current-state 'error)
      (idlwave-shell-display-line (idlwave-shell-pc-frame)))

     ;; Third Priority: Various types of innocuous HALT and
     ;; TRACEBACK messages.
     ((or (setq trace (string-match idlwave-shell-trace-message-re
				    idlwave-shell-command-output))
	  (string-match idlwave-shell-halt-messages-re
			idlwave-shell-command-output))
      ;; Grab the file and line state info.
      (setq idlwave-shell-calling-stack-index 0)
      (setq idlwave-shell-halt-frame
	    (idlwave-shell-parse-line
	     (substring idlwave-shell-command-output (match-end 0))))
      (setq idlwave-shell-current-state 'halt)
      ;; Don't debug trace messages
      (idlwave-shell-display-line
       (idlwave-shell-pc-frame) nil
       (if trace 'disable
	 (if idlwave-shell-electric-debug-mode 'force))))

     ;; Fourth Priority: Breakpoints
     ((string-match idlwave-shell-break-message
		    idlwave-shell-command-output)
      (setq idlwave-shell-calling-stack-index 0)
      (setq idlwave-shell-halt-frame
	    (idlwave-shell-parse-line
	     (substring idlwave-shell-command-output (match-end 0))))
      ;; We used to count hits on breakpoints
      ;; this is no longer supported since IDL breakpoints
      ;; have learned counting.
      ;; Do breakpoint command processing
      (let ((bp (assoc
		 (list
		  (nth 0 idlwave-shell-halt-frame)
		  (nth 1 idlwave-shell-halt-frame))
		 idlwave-shell-bp-alist)))
	;(message "Scanning with %s" bp)
	(if bp
	    (let ((cmd (idlwave-shell-bp-get bp 'cmd)))
	      (if cmd ;; Execute any breakpoint command
		  (if (functionp cmd) (funcall cmd) (eval cmd t))))
	  ;; A breakpoint that we did not know about - perhaps it was
	  ;; set by the user...  Let's update our list.
	  (idlwave-shell-bp-query)))
      (setq idlwave-shell-current-state 'breakpoint)
      (idlwave-shell-display-line (idlwave-shell-pc-frame)))

     ;; Last Priority: Can't Step errors
     ((string-match idlwave-shell-cant-continue-error
		    idlwave-shell-command-output)
      (setq idlwave-shell-current-state 'breakpoint))

     ;; Otherwise, no particular state
     (t (setq idlwave-shell-current-state nil)))))