Copyright | (c) The University of Glasgow 2002 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | provisional |
Portability | non-portable (requires POSIX) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
System.Posix.Terminal.PosixString
Description
POSIX Terminal support
Synopsis
- dataTerminalAttributes
- getTerminalAttributes :: Fd -> IOTerminalAttributes
- dataTerminalState
- setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
- dataTerminalMode
- = InterruptOnBreak
- | MapCRtoLF
- | IgnoreBreak
- | IgnoreCR
- | IgnoreParityErrors
- | MapLFtoCR
- | CheckParity
- | StripHighBit
- | RestartOnAny
- | StartStopInput
- | StartStopOutput
- | MarkParityErrors
- | ProcessOutput
- | MapLFtoCRLF
- | OutputMapCRtoLF
- | NoCRAtColumnZero
- | ReturnMeansLF
- | TabDelayMask0
- | TabDelayMask3
- | LocalMode
- | ReadEnable
- | TwoStopBits
- | HangupOnClose
- | EnableParity
- | OddParity
- | EnableEcho
- | EchoErase
- | EchoKill
- | EchoLF
- | ProcessInput
- | ExtendedFunctions
- | KeyboardInterrupts
- | NoFlushOnInterrupt
- | BackgroundWriteInterrupt
- withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
- withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
- terminalMode :: TerminalMode -> TerminalAttributes -> Bool
- bitsPerByte :: TerminalAttributes -> Int
- withBits :: TerminalAttributes -> Int -> TerminalAttributes
- dataControlCharacter
- controlChar :: TerminalAttributes -> ControlCharacter -> MaybeChar
- withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
- withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
- inputTime :: TerminalAttributes -> Int
- withTime :: TerminalAttributes -> Int -> TerminalAttributes
- minInput :: TerminalAttributes -> Int
- withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
- newtypeBaudRatewhere
- BaudRateCSpeed
- patternB0 :: BaudRate
- patternB50 :: BaudRate
- patternB75 :: BaudRate
- patternB110 :: BaudRate
- patternB134 :: BaudRate
- patternB150 :: BaudRate
- patternB200 :: BaudRate
- patternB300 :: BaudRate
- patternB600 :: BaudRate
- patternB1200 :: BaudRate
- patternB1800 :: BaudRate
- patternB2400 :: BaudRate
- patternB4800 :: BaudRate
- patternB9600 :: BaudRate
- patternB19200 :: BaudRate
- patternB38400 :: BaudRate
- patternB57600 :: BaudRate
- patternB115200 :: BaudRate
- patternB230400 :: BaudRate
- patternB460800 :: BaudRate
- patternB500000 :: BaudRate
- patternB576000 :: BaudRate
- patternB921600 :: BaudRate
- patternB1000000 :: BaudRate
- patternB1152000 :: BaudRate
- patternB1500000 :: BaudRate
- patternB2000000 :: BaudRate
- patternB2500000 :: BaudRate
- patternB3000000 :: BaudRate
- patternB3500000 :: BaudRate
- patternB4000000 :: BaudRate
- inputSpeed :: TerminalAttributes -> BaudRate
- withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
- outputSpeed :: TerminalAttributes -> BaudRate
- withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
- sendBreak :: Fd -> Int -> IO ()
- drainOutput :: Fd -> IO ()
- dataQueueSelector
- discardData :: Fd -> QueueSelector -> IO ()
- dataFlowAction
- controlFlow :: Fd -> FlowAction -> IO ()
- getTerminalProcessGroupID :: Fd -> IOProcessGroupID
- setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()
- queryTerminal :: Fd -> IOBool
- getTerminalName :: Fd -> IOPosixPath
- getControllingTerminalName :: IOPosixPath
- openPseudoTerminal :: IO (Fd, Fd)
- getSlaveTerminalName :: Fd -> IOPosixPath
Terminal support
Terminal attributes
getTerminalAttributes :: Fd -> IOTerminalAttributesSource#
getTerminalAttributes fd
calls tcgetattr
to obtain the TerminalAttributes
associated with Fd
fd
.
Constructors
Immediately | |
WhenDrained | |
WhenFlushed |
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO () Source#
setTerminalAttributes fd attr ts
calls tcsetattr
to change the TerminalAttributes
associated with Fd
fd
to attr
, when the terminal is in the state indicated by ts
.
Constructors
InterruptOnBreak |
|
MapCRtoLF |
|
IgnoreBreak |
|
IgnoreCR |
|
IgnoreParityErrors |
|
MapLFtoCR |
|
CheckParity |
|
StripHighBit |
|
RestartOnAny |
|
StartStopInput |
|
StartStopOutput |
|
MarkParityErrors |
|
ProcessOutput |
|
MapLFtoCRLF |
Since: 2.8.0.0 |
OutputMapCRtoLF |
Since: 2.8.0.0 |
NoCRAtColumnZero |
Since: 2.8.0.0 |
ReturnMeansLF |
Since: 2.8.0.0 |
TabDelayMask0 |
Since: 2.8.0.0 |
TabDelayMask3 |
Since: 2.8.0.0 |
LocalMode |
|
ReadEnable |
|
TwoStopBits |
|
HangupOnClose |
|
EnableParity |
|
OddParity |
|
EnableEcho |
|
EchoErase |
|
EchoKill |
|
EchoLF |
|
ProcessInput |
|
ExtendedFunctions |
|
KeyboardInterrupts |
|
NoFlushOnInterrupt |
|
BackgroundWriteInterrupt |
|
Serial line baudrate. The set of supported speeds is system-dependent. Portable use of the provided pattern synonyms that are outside the list mandated by POSIX requires #ifdef
guards.
Applications may need to be prepared to encounter speeds not known at compile time, these can be handled generically via the BaudRate
constructor. In other words, the provided pattern synonyms are not necessarily a COMPLETE
set.
All non-zero pseudo-terminal baud rates are functionally equivalent, and the pty
driver may accept any speed within a suitable range. Requested speeds may be rounded up or down to fit into the supported range.
Bundled Patterns
patternB0 :: BaudRate | Hang up |
patternB50 :: BaudRate | 50 baud |
patternB75 :: BaudRate | 75 baud |
patternB110 :: BaudRate | 110 baud |
patternB134 :: BaudRate |
|
patternB150 :: BaudRate | 150 baud |
patternB200 :: BaudRate | 200 baud |
patternB300 :: BaudRate | 300 baud |
patternB600 :: BaudRate | 600 baud |
patternB1200 :: BaudRate | 1200 baud |
patternB1800 :: BaudRate | 1800 baud |
patternB2400 :: BaudRate | 2400 baud |
patternB4800 :: BaudRate | 4800 baud |
patternB9600 :: BaudRate | 9600 baud |
patternB19200 :: BaudRate | 19200 baud |
patternB38400 :: BaudRate | 38400 baud |
patternB57600 :: BaudRate | 57600 baud, non-POSIX system-dependent extension |
patternB115200 :: BaudRate | 115200 baud, non-POSIX system-dependent extension |
patternB230400 :: BaudRate | 230400 baud, non-POSIX system-dependent extension |
patternB460800 :: BaudRate | 460800 baud, non-POSIX system-dependent extension |
patternB500000 :: BaudRate | 500000 baud, non-POSIX system-dependent extension |
patternB576000 :: BaudRate | 576000 baud, non-POSIX system-dependent extension |
patternB921600 :: BaudRate | 921600 baud, non-POSIX system-dependent extension |
patternB1000000 :: BaudRate | 1000000 baud, non-POSIX system-dependent extension |
patternB1152000 :: BaudRate | 1152000 baud, non-POSIX system-dependent extension |
patternB1500000 :: BaudRate | 1500000 baud, non-POSIX system-dependent extension |
patternB2000000 :: BaudRate | 2000000 baud, non-POSIX system-dependent extension |
patternB2500000 :: BaudRate | 2500000 baud, non-POSIX system-dependent extension |
patternB3000000 :: BaudRate | 3000000 baud, non-POSIX system-dependent extension |
patternB3500000 :: BaudRate | 3500000 baud, non-POSIX system-dependent extension |
patternB4000000 :: BaudRate | 4000000 baud, non-POSIX system-dependent extension |
Instances
Terminal operations
sendBreak :: Fd -> Int -> IO () Source#
sendBreak fd duration
calls tcsendbreak
to transmit a continuous stream of zero-valued bits on Fd
fd
for the specified implementation-dependent duration
.
drainOutput :: Fd -> IO () Source#
drainOutput fd
calls tcdrain
to block until all output written to Fd
fd
has been transmitted.
Throws IOError
("unsupported operation") if platform does not provide tcdrain(3)
(use #if HAVE_TCDRAIN
CPP guard to detect availability).
Constructors
InputQueue | |
OutputQueue | |
BothQueues |
discardData :: Fd -> QueueSelector -> IO () Source#
discardData fd queues
calls tcflush
to discard pending input and/or output for Fd
fd
, as indicated by the QueueSelector
queues
.
Constructors
SuspendOutput | TCOOFF |
RestartOutput | TCOON |
TransmitStop | TCIOFF |
TransmitStart | TCION |
controlFlow :: Fd -> FlowAction -> IO () Source#
controlFlow fd action
calls tcflow
to control the flow of data on Fd
fd
, as indicated by action
.
Process groups
getTerminalProcessGroupID :: Fd -> IOProcessGroupIDSource#
getTerminalProcessGroupID fd
calls tcgetpgrp
to obtain the ProcessGroupID
of the foreground process group associated with the terminal attached to Fd
fd
.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO () Source#
setTerminalProcessGroupID fd pgid
calls tcsetpgrp
to set the ProcessGroupID
of the foreground process group associated with the terminal attached to Fd
fd
to pgid
.
Testing a file descriptor
queryTerminal :: Fd -> IOBoolSource#
queryTerminal fd
calls isatty
to determine whether or not Fd
fd
is associated with a terminal.
getTerminalName :: Fd -> IOPosixPathSource#
getTerminalName fd
calls ttyname
to obtain a name associated with the terminal for Fd
fd
. If fd
is associated with a terminal, getTerminalName
returns the name of the terminal.
getControllingTerminalName :: IOPosixPathSource#
getControllingTerminalName
calls ctermid
to obtain a name associated with the controlling terminal for the process. If a controlling terminal exists, getControllingTerminalName
returns the name of the controlling terminal.
Throws IOError
("unsupported operation") if platform does not provide ctermid(3)
(use #if HAVE_CTERMID
CPP guard to detect availability).