racket-ansi/ansi/private/tty-raw-extension.rkt

30 lines
663 B
Racket

#lang racket/base
(require ffi/unsafe
ffi/unsafe/global
ffi/unsafe/define)
(provide (protect-out tty-raw!
tty-restore!))
(define libtty_raw
(ffi-lib "libtty_raw"))
(define-ffi-definer define-tty libtty_raw
#:default-make-fail make-not-available)
(define-tty tty-raw!
(_fun #:in-original-place? #t
-> _stdbool)
#:c-id tty_raw)
(define-tty tty-restore!
(_fun #:in-original-place? #t
-> _stdbool)
#:c-id tty_restore)
(unless (register-process-global #"ansi-private-tty-raw-has-set-restore-at-exit" #"")
(define-tty tty_set_restore_at_exit
(_fun -> _void))
(tty_set_restore_at_exit))