;;; Inertly recovered online-help source contexts.
;;; Original System 46 file: lispm2/step.45
;;; Exact source bytes follow each generated provenance comment.

;;; Source bytes 2370:5269; lines 69-148; sha256 fab2ae2ef4d94d7eba84617b74fa15995c4e202f60049254056d2894ba28c996
(defun step-cmdr (form values print-form-p)
  (prog (ch ch1
	 (standard-input query-io)
	 (standard-output query-io))
    (and print-form-p (step-print-form form step-level))
 pv (do ((l values (cdr l))
         (ch #/ #/))
        ((null l))
      (terpri-if-insufficient-space 80.)
      (tyo #\SP) (tyo ch) (tyo #\SP)
      (print-truncated (car l) 100.))
 rd (setq ch1 (funcall standard-input ':tyi))
    (setq ch (char-upcase ch1))
    (cond ((= ch #\CALL) (break call t))
          ((= ch #\SP) (setq step-max step-level) (return 'eval))
          ((= ch 525) (setq step-max (max 0 (1- step-level))) (return 'eval))
          ((= ch 516) (setq step-max (1+ step-level)) (return 'evalhook))
          ((= ch 530) (setq step-max -1) (return 'eval))
          ((= ch 502)
           (break step t)
           (setq ch 0)
           (as-1 step-form step-array step-level)
           (go redis1))
          ((= ch 505)
           (ed)
           (setq ch 10.)
           (go redisplay))
          ((or (= ch 214) (= ch 514))
           (setq ch 10.)
           (go redisplay))
	  ((= ch 1114)
	   (setq ch 10.)
	   (go redis1))
          ((= ch 1514)
           (setq ch step-level)
           (go redisplay))
          ((or (= ch 507) (= ch 524))
           (setq ch (cond ((= ch 507) (function grind-top-level)) ((function print))))
           (cond ((null values) (funcall ch form))
                 ((do l values (cdr l) (null l)
                    (funcall ch (car l)))))
           (go rd))
	  ((memq (logand ch 377) '(#/? #\HELP))
	   (terpri)
	   (princ
	     (cond ((null step-values) "You are about to evaluate the above form.")
		   (t "You have evaluated a form and are about to return the above values.")))
	   (terpri)
	   (princ "Commands are single characters, usually control, which don't echo:")
	   (terpri)
	   (princ "N to next thing evaled, <space> next thing at same level, U up a level")
	   (terpri)
	   (princ "X up all levels (exit), E escape to editor, T retype in full, G grind")
	   (terpri)
	   (princ "B break: STEP-FORM is the form, STEP-VALUES is the list of values,")
	   (terpri)
	   (princ "          STEP-VALUE is the first value.  If you change these, it wins.")
	   (terpri)
	   (princ "L or <form> clear & show last 10., L don't clear, L clear & show all")
	   (terpri)
	   (princ "Just type and it will be read, evaluated, and printed")
	   (terpri)
	   (princ "Magic flags:  form,  macro,  values,  next value")
	   (setq ch 0)
	   (go redis1))
	  ((< ch 200)
	   (funcall standard-input ':untyi ch1)
	   (princ " Eval: ")
	   (print (eval (read-for-top-level)))
	   (terpri)
	   (setq ch 0)
	   (go redis1))
          (t (beep)
             (go rd)))
 redisplay 
    (funcall standard-output ':clear-screen)
 redis1 
    (do i (max 0 (- step-level ch)) (1+ i) (> i step-level)
      (step-print-form (ar-1 step-array i) i))
    (go pv)))

