File: keyboard.lisp

package info (click to toggle)
clisp 1%3A2.49-8.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 45,160 kB
  • sloc: lisp: 79,960; ansic: 48,257; xml: 26,814; sh: 12,846; fortran: 7,286; makefile: 1,456; perl: 164
file content (33 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (9)
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*))
)