scsh-0.5/scsh/tty-consts.scm

185 lines
6.7 KiB
Scheme

;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1995 by Brian Carlstrom.
;;; Largely rehacked by Olin.
;;; Values taken from HP-UX /usr/include/sys/termio.h.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;; POSIX
(define ttychar/intr 0) ; isig
(define ttychar/quit 1) ; isig
(define ttychar/erase 2) ; icanon
(define ttychar/kill 3) ; icanon
(define ttychar/eof 4) ; icanon
(define ttychar/eol 5) ; icanon
(define ttychar/min 11) ; !icanon ; Not exported
(define ttychar/time 12) ; !icanon ; Not exported
(define ttychar/susp 13) ; isig
(define ttychar/start 14) ; ixon, ixoff
(define ttychar/stop 15) ; ixon, ixoff
;; Number of Control Characters - *Not Exported*
(define num-ttychars 16)
;;; Flags controllling input processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; POSIX
(define ttyin/ignore-break #x00000001) ; ignbrk
(define ttyin/interrupt-on-break #x00000002) ; brkint
(define ttyin/ignore-bad-parity-chars #x00000004) ; ignpar
(define ttyin/mark-parity-errors #x00000008) ; parmrk
(define ttyin/enable-parity #x00000010) ; inpck
(define ttyin/strip-8th #x00000020) ; istrip
(define ttyin/nl->cr #x00000040) ; inlcr
(define ttyin/ignore-cr #x00000080) ; igncr
(define ttyin/cr->nl #x00000100) ; icrnl
(define ttyin/output-flow-ctl #x00000400) ; ixon
(define ttyin/input-flow-ctl #x00001000) ; ixoff
;; HP-UX
(define ttyin/xon-any #x00000800) ; _ixany: Any char will restart after stop.
(define ttyin/lowercase #x00002000) ; _iuclc: Map upper-case to lower-case.
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; POSIX
(define ttyout/process #x00000001) ; opost: enable output processing.
;; HP-UX
(define ttyout/nl->crnl #x00000002) ; onlcr: map nl to cr-nl
(define ttyout/uppercase ) ; olcuc
(define ttyout/cr->nl ) ; ocrnl
(define ttyout/no-col0-cr ) ; onocr
(define ttyout/nl-does-cr ) ; onlret
(define ttyout/delay-w/fill-char ) ; ofill
(define ttyout/fill-w/del ) ; ofdel
; use the same bits as old delay flags
(define ttyout/nl-delay #x00000300) ; \n delay
(define ttyout/nl-delay0 #x00000000)
(define ttyout/nl-delay1 #x00000100) ; tty 37
(define ttyout/nl-delay2 #x00000200) ; vt05
(define ttyout/nl-delay3 #x00000300)
(define ttyout/tab-delay #x00000c00) ; horizontal tab delay
(define ttyout/tab-delay0 #x00000000)
(define ttyout/tab-delay1 #x00000400) ; tty 37
(define ttyout/tab-delay2 #x00000800)
(define ttyout/expand-tabs #x00000c00) ; xtabs: expand tabs on output
(define ttyout/cr-delay #x00003000) ; \r delay
(define ttyout/cr-delay0 #x00000000)
(define ttyout/cr-delay1 #x00001000) ; tn 300
(define ttyout/cr-delay2 #x00002000) ; tty 37
(define ttyout/cr-delay3 #x00003000) ; concept 100
(define ttyout/vtab-delay #x00004000) ; vertical tab delay
(define ttyout/vtab-delay0 #x00000000)
(define ttyout/vtab-delay1 #x00004000) ; tty 37
(define ttyout/bs-delay #x00008000) ; \b delay
(define ttyout/bs-delay0 #x00000000)
(define ttyout/bs-delay1 #x00008000)
(define ttyout/all-delay (bitwise-ior
(bitwise-ior
(bitwise-ior ttyout/nl-delay ttyout/tab-delay)
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
ttyout/bs-delay))
;;; Control flags - hardware control of terminal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; POSIX
(define ttyc/char-size #x00000300) ; csize: character size mask
(define ttyc/char-size5 #x00000000) ; 5 bits (cs5)
(define ttyc/char-size6 #x00000100) ; 6 bits (cs6)
(define ttyc/char-size7 #x00000200) ; 7 bits (cs7)
(define ttyc/char-size8 #x00000300) ; 8 bits (cs8)
(define ttyc/2-stop-bits #x00000400) ; cstopb: Send 2 stop bits.
(define ttyc/read #x00000800) ; cread: Enable receiver.
(define ttyc/enable-parity #x00001000) ; parenb
(define ttyc/odd-parity #x00002000) ; parodd
(define ttyc/hup-on-close #x00004000) ; hupcl: Hang up on last close.
(define ttyc/no-modem-sync #x00008000) ; local: Ignore modem lines.
;; NeXT
(define ttyc/ignore #x00000001) ; ignore control flags
(define ttyc/stopb110 #x00010000) ; VAS IST DAS? -Olin
(define ttyc/mark-parity #x00020000) ; par1
(define ttyc/space-parity #x00040000) ; par0
;;; "Local" flags - dumping ground for other state
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Warning: some flags in this structure begin with the
;; letter "I" and look like they belong in the input flag.
;; POSIX
(define ttyl/echo-erase #x00000002) ; echoe: Visually erase chars.
(define ttyl/echo-kill #x00000004) ; echok: Echo nl after line kill.
(define ttyl/echo #x00000008) ; echo: Enable echoing.
(define ttyl/echo-nl #x00000010) ; echonl: Echo nl even if echo is off.
(define ttyl/icanon #x00000020) ; icanon: Canonicalize input.
(define ttyl/enable-signals #x00000040) ; isig: Enable ^c, ^z signalling.
(define ttyl/extended #x00000080) ; iexten: Enable extensions.
(define ttyl/ttou-signal #x00400000) ; itostop: Send SIGTTOU on background output.
(define ttyl/no-flush-on-interrupt #x80000000) ; noflsh: Don't flush after interrupt.
;; NeXT
(define ttyl/visual-echo-kill #x00000001) ; echoke: visually erase line kill
(define ttyl/echo-crt #x00000100) ; visual erase mode for crt
(define ttyl/echo-printer #x00000200) ; visual erase mode for hardcopy
(define ttyl/echo-ctl #x00000400) ; echo control chars as ^(char)
(define ttyl/alt-word-erase #x00000800) ; use alternate werase algorithm
(define ttyl/carrier-sync #x00100000) ; mdmbuf flow control output via carrier
(define ttyl/xlcase #x04000000) ; VAS IST DAS?
(define ttyl/xeucbksp #x08000000) ; VAS IST DAS?
;;; NOTE: altwerase xlcase and xeucbksp don't appear in the NeXT tty(4) man
;;; page. Where do they appear?
;;; 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/1200 9)
(define baud/1800 10)
(define baud/2400 11)
(define baud/4800 12)
(define baud/9600 13)
(define baud/19200 14)
(define baud/38400 15)
;;; tcflush magic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 0) ; TCIFLUSH
(define %flush-tty/output 1) ; TCOFLUSH
(define %flush-tty/both 2) ; TCIOFLUSH
;;; tcflow magic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/stop-out 0) ; TCOOFF
(define %tcflow/start-out 1) ; TCOON
(define %tcflow/stop-in 2) ; TCIOFF
(define %tcflow/start-in 3) ; TCION