Tty-hacking procs now default to stdio when a tty isn't specified.

You may now apply them to a file-name as well as a port or fdes.
This commit is contained in:
shivers 1997-11-10 02:45:44 +00:00
parent 61cdf20586
commit 2baee835a2
1 changed files with 44 additions and 22 deletions

View File

@ -213,20 +213,22 @@ being copied, so you may mutate it freely.
\end{desc}
\defun{tty-info}{fd/port}{tty-info-record}
\defun{tty-info}{[fd/port/fname]}{tty-info-record}
\begin{desc}
The \var{fd/port} parameter is an integer file descriptor or Scheme I/O port
opened on a terminal device.
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device; it defaults to the current input port.
This procedure returns a \ex{tty-info} record describing the terminal's
current mode.
\end{desc}
\defun {set-tty-info/now} {fd/port info}{no-value}
\defunx{set-tty-info/drain}{fd/port info}{no-value}
\defunx{set-tty-info/flush}{fd/port info}{no-value}
\defun {set-tty-info/now} {fd/port/fname info}{no-value}
\defunx{set-tty-info/drain}{fd/port/fname info}{no-value}
\defunx{set-tty-info/flush}{fd/port/fname info}{no-value}
\begin{desc}
The \var{fd/port} parameter is an integer file descriptor or Scheme I/O port
opened on a terminal device.
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device.
The procedure chosen determines when and how the terminal's mode is altered:
\begin{center}
\begin{tabular}{|ll|} \hline
@ -236,13 +238,17 @@ Procedure & Meaning \\ \hline \hline
\ex{set-tty-info/flush} & Drain output, flush input, then change. \\ \hline
\end{tabular}
\end{center}
\oops{If I had defined these with the parameters in the reverse order,
I could have made \var{fd/port/fname} optional. Too late now.}
\end{desc}
\subsection{Other terminal-device procedures}
\defun{send-tty-break}{fd/port [duration]}{no-value}
\defun{send-tty-break}{[fd/port/fname duration]}{no-value}
\begin{desc}
Send a break signal on the terminal associated with file descriptor
or Scheme I/O port \var{fd/port}.
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device; it defaults to the current output port.
Send a break signal to the designated terminal.
A break signal is a sequence of continuous zeros on the terminal's transmission
line.
@ -253,29 +259,44 @@ other values determine a period in a manner that will depend upon local
community standards.
\end{desc}
\defun{drain-tty}{fd/port}{no-value}
\defun{drain-tty}{[fd/port/fname]}{no-value}
\begin{desc}
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device; it defaults to the current output port.
This procedure waits until all the output written to the
terminal device has been transmitted to the device.
If \var{fd/port} is an output port with buffered I/O
If \var{fd/port/fname} is an output port with buffered I/O
enabled, then the port's buffered characters are flushed before
waiting for the device to drain.
\end{desc}
\defun {flush-tty/input} {fd/port}{no-value}
\defunx{flush-tty/output}{fd/port}{no-value}
\defunx{flush-tty/both} {fd/port}{no-value}
\defun {flush-tty/input} {[fd/port/fname]}{no-value}
\defunx{flush-tty/output}{[fd/port/fname]}{no-value}
\defunx{flush-tty/both} {[fd/port/fname]}{no-value}
\begin{desc}
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device; it defaults to the current input
port (\ex{flush-tty/input} and \ex{flush-tty/both}),
or output port (\ex{flush-tty/output}).
These procedures discard the unread input chars or unwritten
output chars in the tty's kernel buffers.
\end{desc}
\defun {start-tty-output}{fd/port} {no-value}
\defunx{stop-tty-output} {fd/port} {no-value}
\defunx{start-tty-input} {fd/port} {no-value}
\defunx{stop-tty-input} {fd/port} {no-value}
\defun {start-tty-output}{[fd/port/fname]} {no-value}
\defunx{stop-tty-output} {[fd/port/fname]} {no-value}
\defunx{start-tty-input} {[fd/port/fname]} {no-value}
\defunx{stop-tty-input} {[fd/port/fname]} {no-value}
\begin{desc}
These procedures can be used to control a terminal's input and output flow.
The \var{fd/port/fname} parameter is an integer file descriptor or
Scheme I/O port opened on a terminal device,
or a file-name for a terminal device; it defaults to the current input
or output port.
The \ex{stop-tty-output} and \ex{start-tty-output} procedures suspend
and resume output from a terminal device.
The \ex{stop-tty-input} and \ex{start-tty-input} procedures transmit
@ -283,6 +304,7 @@ the special STOP and START characters to the terminal with the intention
of stopping and starting terminal input flow.
\end{desc}
% --- Obsolete ---
% \defun {encode-baud-rate}{speed}{code}
% \defunx{decode-baud-rate}{code}{speed}
% \begin{desc}
@ -357,8 +379,8 @@ after forking.
\end{desc}
\defun {tty-process-group}{fd/port}{\integer}
\defunx{set-tty-process-group}{fd/port pgrp}{\undefined}
\defun {tty-process-group}{fd/port/fname}{\integer}
\defunx{set-tty-process-group}{fd/port/fname pgrp}{\undefined}
\begin{desc}
This pair of procedures gets and sets the process group of a given
terminal.