1995-10-19 04:22:56 -04:00
|
|
|
;;; Constant definitions for tty control code (POSIX termios).
|
|
|
|
;;; Copyright (c) 1995 by Brian Carlstrom.
|
|
|
|
;;; Largely rehacked by Olin.
|
|
|
|
|
|
|
|
;;; These constants are for HP-UX,
|
|
|
|
;;; and are taken from /usr/include/sys/termio.h.
|
|
|
|
|
|
|
|
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
|
|
|
|
;;; - Some of the baud rates.
|
|
|
|
|
|
|
|
|
|
|
|
;;; Special Control Characters
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;; Indices into the c_cc[] character array.
|
|
|
|
|
|
|
|
;;; Name Subscript Enabled by
|
|
|
|
;;; ---- --------- ----------
|
|
|
|
;;; POSIX
|
|
|
|
(define ttychar/eof 4) ; ^d icanon
|
|
|
|
(define ttychar/eol 5) ; icanon
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttychar/delete-char 2) ; ^? icanon
|
|
|
|
(define ttychar/delete-line 3) ; ^u icanon
|
|
|
|
(define ttychar/interrupt 0) ; ^c isig
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttychar/quit 1) ; ^\ isig
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttychar/suspend 13) ; ^z isig
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttychar/start 14) ; ^q ixon, ixoff
|
|
|
|
(define ttychar/stop 15) ; ^s ixon, ixoff
|
|
|
|
(define ttychar/min 11) ; !icanon ; Not exported
|
|
|
|
(define ttychar/time 12) ; !icanon ; Not exported
|
|
|
|
|
|
|
|
;;; SVR4 & 4.3+BSD
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttychar/delete-word #f) ; ^w icanon
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttychar/reprint #f) ; ^r icanon
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttychar/literal-next #f) ; ^v iexten
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttychar/discard #f) ; ^o iexten
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttychar/delayed-suspend #f) ; ^y isig
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttychar/eol2 #f) ; icanon
|
|
|
|
|
|
|
|
;;; 4.3+BSD
|
|
|
|
(define ttychar/status #f) ; ^t icanon
|
|
|
|
|
|
|
|
;;; Length of control-char string -- *Not Exported*
|
|
|
|
(define num-ttychars 16)
|
|
|
|
|
|
|
|
;;; Magic "disable feature" tty character
|
|
|
|
(define disable-tty-char (ascii->char #xff)) ; _POSIX_VDISABLE
|
|
|
|
|
1995-10-21 05:25:15 -04:00
|
|
|
;;; HP-UX brain death:
|
|
|
|
;;; HP-UX defines NCCS to be 16, then sneaks the DSUSP char (^y) in as
|
|
|
|
;;; a seventeenth char -- there's another non-standard NLDCC constant
|
|
|
|
;;; defined to be 1+16 that's used elsewhere. Since the scsh interface
|
|
|
|
;;; to tcsetattr() uses a char vec of size NCCS, you can't get at this
|
|
|
|
;;; hidden char. So we do not support the delayed-suspension char; sorry.
|
|
|
|
;;;
|
|
|
|
;;; If you are an HP-UX hacker, and know a way to fix this, let me know.
|
1995-10-19 04:22:56 -04:00
|
|
|
|
|
|
|
;;; Flags controllling input processing
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;; POSIX
|
|
|
|
(define ttyin/ignore-break #o00001) ; ignbrk
|
|
|
|
(define ttyin/interrupt-on-break #o00002) ; brkint
|
|
|
|
(define ttyin/ignore-bad-parity-chars #o00004) ; ignpar
|
|
|
|
(define ttyin/mark-parity-errors #o00010) ; parmrk
|
|
|
|
(define ttyin/check-parity #o00020) ; inpck
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttyin/7bits #o00040) ; istrip
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttyin/nl->cr #o00100) ; inlcr
|
|
|
|
(define ttyin/ignore-cr #o00200) ; igncr
|
|
|
|
(define ttyin/cr->nl #o00400) ; icrnl
|
|
|
|
(define ttyin/output-flow-ctl #o02000) ; ixon
|
|
|
|
(define ttyin/input-flow-ctl #o10000) ; ixoff
|
|
|
|
|
|
|
|
;;; SVR4 & 4.3+BSD
|
|
|
|
(define ttyin/xon-any #o4000) ; ixany: Any char restarts after stop
|
|
|
|
(define ttyin/beep-on-overflow #f) ; imaxbel: queue full => ring bell
|
|
|
|
|
|
|
|
;;; SVR4
|
|
|
|
(define ttyin/lowercase #o1000) ; iuclc: Map upper-case to lower case
|
|
|
|
|
|
|
|
|
|
|
|
;;; Flags controlling output processing
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;; POSIX
|
|
|
|
(define ttyout/enable #o000001) ; opost: enable output processing
|
|
|
|
|
|
|
|
;;; SVR4 & 4.3+BSD
|
|
|
|
(define ttyout/nl->crnl #o000004) ; onlcr: map nl to cr-nl
|
|
|
|
|
|
|
|
;;; 4.3+BSD
|
|
|
|
(define ttyout/discard-eot #f) ; onoeot
|
|
|
|
(define ttyout/expand-tabs #f) ; oxtabs (NOT xtabs)
|
|
|
|
|
|
|
|
;;; SVR4
|
|
|
|
(define ttyout/cr->nl #o000010) ; ocrnl
|
|
|
|
(define ttyout/fill-w/del #o000200) ; ofdel
|
|
|
|
(define ttyout/delay-w/fill-char #o000100) ; ofill
|
|
|
|
(define ttyout/uppercase #o000002) ; olcuc
|
|
|
|
(define ttyout/nl-does-cr #o000040) ; onlret
|
|
|
|
(define ttyout/no-col0-cr #o000020) ; onocr
|
|
|
|
|
|
|
|
;;; Newline delay
|
|
|
|
(define ttyout/nl-delay #o000400) ; mask (nldly)
|
|
|
|
(define ttyout/nl-delay0 #o000000)
|
|
|
|
(define ttyout/nl-delay1 #o000400) ; tty 37
|
|
|
|
|
|
|
|
;;; Horizontal-tab delay
|
|
|
|
(define ttyout/tab-delay #o014000) ; mask (tabdly)
|
|
|
|
(define ttyout/tab-delay0 #o000000)
|
|
|
|
(define ttyout/tab-delay1 #o004000) ; tty 37
|
|
|
|
(define ttyout/tab-delay2 #o010000)
|
|
|
|
(define ttyout/tab-delayx #o014000) ; Expand tabs (xtabs, tab3)
|
|
|
|
|
|
|
|
;;; Carriage-return delay
|
|
|
|
(define ttyout/cr-delay #o003000) ; mask (crdly)
|
|
|
|
(define ttyout/cr-delay0 #o000000)
|
|
|
|
(define ttyout/cr-delay1 #o001000) ; tn 300
|
|
|
|
(define ttyout/cr-delay2 #o002000) ; tty 37
|
|
|
|
(define ttyout/cr-delay3 #o003000) ; concept 100
|
|
|
|
|
|
|
|
;;; Vertical tab delay
|
|
|
|
(define ttyout/vtab-delay #o040000) ; mask (vtdly)
|
|
|
|
(define ttyout/vtab-delay0 #o000000)
|
|
|
|
(define ttyout/vtab-delay1 #o040000) ; tty 37
|
|
|
|
|
|
|
|
;;; Backspace delay
|
|
|
|
(define ttyout/bs-delay #o020000) ; mask (bsdly)
|
|
|
|
(define ttyout/bs-delay0 #o000000)
|
|
|
|
(define ttyout/bs-delay1 #o020000)
|
|
|
|
|
|
|
|
;;; Form-feed delay
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttyout/ff-delay #o100000) ; mask (ffdly)
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttyout/ff-delay0 #o000000)
|
|
|
|
(define ttyout/ff-delay1 #o100000)
|
|
|
|
|
|
|
|
(define ttyout/all-delay
|
|
|
|
(bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
|
|
|
|
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
|
1995-10-21 05:25:15 -04:00
|
|
|
(bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
|
1995-10-19 04:22:56 -04:00
|
|
|
|
|
|
|
|
|
|
|
;;; Control flags - hacking the serial-line.
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;; POSIX
|
|
|
|
(define ttyc/char-size #o00140) ; csize: character size mask
|
|
|
|
(define ttyc/char-size5 #o00000) ; 5 bits (cs5)
|
|
|
|
(define ttyc/char-size6 #o00040) ; 6 bits (cs6)
|
|
|
|
(define ttyc/char-size7 #o00100) ; 7 bits (cs7)
|
|
|
|
(define ttyc/char-size8 #o00140) ; 8 bits (cs8)
|
|
|
|
(define ttyc/2-stop-bits #o00200) ; cstopb: Send 2 stop bits.
|
|
|
|
(define ttyc/enable-read #o00400) ; cread: Enable receiver.
|
|
|
|
(define ttyc/enable-parity #o01000) ; parenb
|
|
|
|
(define ttyc/odd-parity #o02000) ; parodd
|
|
|
|
(define ttyc/hup-on-close #o04000) ; hupcl: Hang up on last close.
|
|
|
|
(define ttyc/no-modem-sync #o10000) ; clocal: Ignore modem lines.
|
|
|
|
|
|
|
|
;;; 4.3+BSD
|
|
|
|
(define ttyc/ignore-flags #f) ; cignore: ignore control flags
|
|
|
|
(define ttyc/CTS-output-flow-ctl #f) ; ccts_oflow: CTS flow control of output
|
|
|
|
(define ttyc/RTS-input-flow-ctl #f) ; crts_iflow: RTS flow control of input
|
|
|
|
(define ttyc/carrier-flow-ctl #f) ; mdmbuf
|
|
|
|
|
|
|
|
;;; Local flags -- hacking the tty driver / user interface.
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;; POSIX
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttyl/visual-delete #o020) ; echoe: Visually erase chars
|
|
|
|
(define ttyl/echo-delete-line #o040) ; echok: Echo nl after line kill
|
|
|
|
(define ttyl/echo #o010) ; echo: Enable echoing
|
|
|
|
(define ttyl/echo-nl #o100) ; echonl: Echo nl even if echo is off
|
|
|
|
(define ttyl/canonical #o002) ; icanon: Canonicalize input
|
|
|
|
(define ttyl/enable-signals #o001) ; isig: Enable ^c, ^z signalling
|
|
|
|
(define ttyl/extended #o20000000000); iexten: Enable extensions
|
|
|
|
(define ttyl/ttou-signal #o10000000000); tostop: SIGTTOU on background output
|
1995-10-19 04:22:56 -04:00
|
|
|
(define ttyl/no-flush-on-interrupt #o200) ; noflsh
|
|
|
|
|
|
|
|
;;; SVR4 & 4.3+BSD
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttyl/visual-delete-line #f) ; echoke: visually erase a line-kill
|
|
|
|
(define ttyl/hardcopy-delete #f) ; echoprt: visual erase for hardcopy
|
|
|
|
(define ttyl/echo-ctl #f) ; echoctl: echo control chars as "^X"
|
|
|
|
(define ttyl/flush-output #f) ; flusho: output is being flushed
|
|
|
|
(define ttyl/reprint-unread-chars #f) ; pendin: retype pending input
|
1995-10-19 04:22:56 -04:00
|
|
|
|
|
|
|
;;; 4.3+BSD
|
1995-10-21 05:25:15 -04:00
|
|
|
(define ttyl/alt-delete-word #f) ; altwerase
|
|
|
|
(define ttyl/no-kernel-status #f) ; nokerninfo: no kernel status on ^T
|
1995-10-19 04:22:56 -04:00
|
|
|
|
|
|
|
;;; SVR4
|
|
|
|
(define ttyl/case-map #o4) ; xcase: canonical upper/lower presentation
|
|
|
|
|
|
|
|
|
|
|
|
;;; Baud Rates
|
|
|
|
(define baud/0 0)
|
|
|
|
(define baud/50 1)
|
|
|
|
(define baud/75 2)
|
|
|
|
(define baud/110 3)
|
|
|
|
(define baud/134 4)
|
|
|
|
(define baud/150 5)
|
|
|
|
(define baud/200 6)
|
|
|
|
(define baud/300 7)
|
|
|
|
(define baud/600 8)
|
|
|
|
(define baud/900 9) ; Non-standard
|
|
|
|
(define baud/1200 10)
|
|
|
|
(define baud/1800 11)
|
|
|
|
(define baud/2400 12)
|
|
|
|
(define baud/3600 13) ; Non-standard
|
|
|
|
(define baud/4800 14)
|
|
|
|
(define baud/7200 15) ; Non-standard
|
|
|
|
(define baud/9600 16)
|
|
|
|
(define baud/19200 17)
|
|
|
|
(define baud/38400 18)
|
|
|
|
(define baud/57600 19) ; Non-standard
|
|
|
|
(define baud/115200 20) ; Non-standard
|
|
|
|
(define baud/230400 21) ; Non-standard
|
|
|
|
(define baud/460800 22) ; Non-standard
|
|
|
|
(define baud/exta 30) ; Non-standard
|
|
|
|
(define baud/extb 31) ; Non-standard
|
|
|
|
|
|
|
|
;;; Rather cheesy mechanism here.
|
|
|
|
;;; Vector of lists because some OS's define EXTA and EXTB to be
|
|
|
|
;;; the same code as 19.2k and 38.4k baud.
|
|
|
|
|
|
|
|
(define baud-rates '#((0) (50) (75)
|
|
|
|
(110) (134) (150)
|
|
|
|
(200) (300) (600)
|
|
|
|
(900) (1200) (1800)
|
|
|
|
(2400) (3600) (4800)
|
|
|
|
(7200) (9600) (19200)
|
|
|
|
(38400) (57600) (115200)
|
|
|
|
(230400) (460800) #f
|
|
|
|
#f #f #f #f #f #f ; 24-29
|
|
|
|
(exta) (extb)))
|
|
|
|
|
|
|
|
|
|
|
|
;;; tcflush() constants
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(define %flush-tty/input 0) ; TCIFLUSH
|
|
|
|
(define %flush-tty/output 1) ; TCOFLUSH
|
|
|
|
(define %flush-tty/both 2) ; TCIOFLUSH
|
|
|
|
|
|
|
|
|
|
|
|
;;; tcflow() constants
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(define %tcflow/start-out 1) ; TCOON
|
|
|
|
(define %tcflow/stop-out 0) ; TCOOFF
|
|
|
|
(define %tcflow/start-in 3) ; TCION
|
|
|
|
(define %tcflow/stop-in 2) ; TCIOFF
|
|
|
|
|
|
|
|
|
|
|
|
;;; tcsetattr() constants
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(define %set-tty-info/now 0) ; TCSANOW Make change immediately.
|
|
|
|
(define %set-tty-info/drain 1) ; TCSADRAIN Drain output, then change.
|
|
|
|
(define %set-tty-info/flush 2) ; TCSAFLUSH Drain output, flush input.
|