commit 10e66c58047b985b82525a8857f11335e70a3e90 Author: frese Date: Thu Jul 15 17:34:49 2004 +0000 *** empty log message *** diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da8168b --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# CVS default ignores begin +tags +TAGS +.make.state +.nse_depinfo +*~ +\#* +.#* +,* +_$* +*$ +*.old +*.bak +*.BAK +*.orig +*.rej +.del-* +*.a +*.olb +*.o +*.obj +*.so +*.exe +*.Z +*.elc +*.ln +core +# CVS default ignores end diff --git a/pkg-def.scm b/pkg-def.scm new file mode 100644 index 0000000..7452873 --- /dev/null +++ b/pkg-def.scm @@ -0,0 +1,12 @@ +(define-package "expect" (0 1) + ((install-lib-version (1 1))) + + (install-file "COPYING" 'doc) + (install-file "README" 'doc) + (install-directory-contents "doc" 'doc) + + (write-to-load-script + `((config) + (load ,(absolute-file-name "packages.scm" + (get-directory 'scheme #f))))) + (install-directory-contents "scheme" 'scheme)) diff --git a/scheme/tty-utils.scm b/scheme/tty-utils.scm new file mode 100644 index 0000000..180a1d9 --- /dev/null +++ b/scheme/tty-utils.scm @@ -0,0 +1,46 @@ +;;; Some scsh utilities to mung the tty. +;;; Designed and implemented by David Fisher and Olin Shivers. +;;; Copyright (C) 1998 by the Scheme Underground. + +;;; (modify-tty proc [tty-fd/port/fname]) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Get the tty's current tty-info record. Apply PROC to the record; +;;; set the tty's mode to the result tty-info record returned by PROC. +;;; Return the original, unmodified tty-info record. + +;;; RAW RAW-INITIALIZE ECHO-ON ECHO-OFF CANONICAL +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; These are tty-info -> tty-info functions. They can be used as the PROC +;;; parameter to MODIFY-TTY. + +(define (modify-tty proc . maybe-tty) + (let* ((tty (:optional maybe-tty (current-input-port))) + (info0 (tty-info tty))) + (set-tty-info/now tty (proc (copy-tty-info info0))) + info0)) + +;;; Make a proc that frobs the :local-flags field of a tty-info record. +(define (local-flags-modifier modifier) + (lambda (ti) + (modify-tty-info:local-flags ti modifier) + ti)) + +(define echo-off + (let ((no-echo (bitwise-not ttyl/echo))) + (local-flags-modifier (lambda (lf) (bitwise-and lf no-echo))))) + +(define echo-on + (local-flags-modifier (lambda (lf) (bitwise-ior lf ttyl/echo)))) + +(define raw + (let ((no-canon (bitwise-not ttyl/canonical))) + (local-flags-modifier (lambda (lf) (bitwise-and lf no-canon))))) + +(define (raw-initialize tty-info) + ;; min and time can't be set until the terminal is in raw mode. Really. + (set-tty-info:min tty-info 0) + (set-tty-info:time tty-info 0) + tty-info) + +(define canonical + (local-flags-modifier (lambda (lf) (bitwise-ior lf ttyl/canonical))))