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
|
;; Keyboard stream
(in-package "EXT")
(export '(with-keyboard *keyboard-input*))
(in-package "SYSTEM")
;;;--------------------------------------------------------------------------
(defvar *keyboard-input*)
(defmacro with-keyboard (&body body)
`(SYS::EXEC-WITH-KEYBOARD (FUNCTION (LAMBDA () (PROGN ,@body))))
)
(defun exec-with-keyboard (fun) ; ABI
#+WIN32 ; *keyboard-input* existiert schon
(funcall fun)
#+UNIX
(let ((mode nil))
(unless *keyboard-input*
(setq *keyboard-input* (sys::make-keyboard-stream))
)
(unwind-protect
(progn
(setq mode (sys::terminal-raw *keyboard-input* t))
(funcall fun)
)
(sys::terminal-raw *keyboard-input* mode)
) ) )
; Used by spvw.d.
(defun wait-keypress ()
(with-keyboard (read-char *keyboard-input*))
)
|