;;;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ;;; ;;; PACKAGE TO SET UP SPLIT SCREEN IN NEWIO ;;; ;;;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ;;; written by Charles Rich, RICH@AI June 4, 1976 ;;; (declare (special top-tty bottom-tty tyo tyi) (fixnum i pagel)) ;; TOP-TTY holds tty object for top half of screen ;; or NIL if screen not split ;; ;; BOTTOM-TTY holds tty object for bottom half of screen ;; ;; (SPLITSCREEN ) splits the screen with lines on bottom ;; if screen already split, readjusts boundary so ;; of lines on bottom. ;; ;; (SPLITSCREEN nil) or (SPLITSCREEN 0) returns to full screen ;; ;; note: ctl-K is enabled to clear the top half of screen, unless ;; it is has been set by user previously (setq top-tty nil bottom-tty tyo) (defun SPLITSCREEN (nlines) ;; split screen with nlines on bottom echo tty ;; or if NLINES = NIL or 0 go back to full screen ;; returns NLINES (cond ((and (fixp nlines)(not (zerop nlines))) (cond ((null top-tty) ;; top screen not currently open (setq top-tty (open '((tty)) '(tty out))) ;; preserve endpagefn for bottom (endpagefn bottom-tty (prog2 nil (endpagefn bottom-tty) (setq bottom-tty (open bottom-tty '(tty out echo))))) (sstatus ttycons tyi bottom-tty) ;; enable ctl-K to clear top half, unless already used (or (status ttyint 11.) (sstatus ttyint 11. 'clear-top-tty)))) (syscall 0 'scml bottom-tty nlines) (pagel top-tty (- (car (status ttysize bottom-tty)) nlines))) ((null top-tty)) ;already full screen (t ;nlines nil or 0 => make fullscreen (close top-tty) (setq top-tty nil) ;; preserve endpagefn for bottom (endpagefn bottom-tty (prog2 nil (endpagefn bottom-tty) (setq bottom-tty (open bottom-tty '(tty out))))) (sstatus ttycons tyi bottom-tty) (syscall 0 'scml bottom-tty 0))) nlines) (defun CLEAR-TOP-TTY (tty char) ;; used to clear top of screen line by line (cond (top-tty (cursorpos 'top top-tty) (do ((i 0 (1+ i)) (pagel (pagel top-tty))) ((equal i pagel) (cursorpos 'top top-tty)) (cursorpos 'l top-tty) (cursorpos 'd top-tty))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Unwindable Splitscreen ;;; by BYRONL@ML (13 November 1979) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;;SPLIOTA, patterned after IOTA, sets up an environment in which ;;; the screen is split, and then returns to the previous ;;; environment on exit. Thus, the SPLITness property of the ;;; screen can be "lambda bound" (and unbound). ;;; ;;;e.g. (spliota n (print 'foo top-tty) (print 'bar bottom-tty)) ;;; will split the screen with n lines on the bottom, print 'foo on ;;; the top-tty and 'bar on the bottom-tty, and exit with the screen ;;; unsplit, assuming the screen was unsplit on entry. If the screen ;;; was already split on entry, SPLIOTA will return it to that state ;;; on exit. ;;; (defmacro SPLIOTA (nlines . body) `(let ((old-nlines (and top-tty (- (status ttysize bottom-tty) (pagel top-tty))))) (unwind-protect (progn (splitscreen ,nlines) ,@body) (splitscreen old-nlines))))