(* Copyright (C) 1990, Digital Equipment Corporation. *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* Last modified on Fri Jun 15 23:07:51 1990 by muller *) (* modified on Thu Apr 19 13:41:30 PDT 1990 by swart *) INTERFACE POSTerminal; FROM POS IMPORT FileImpl, Error, PID_T; FROM Thread IMPORT Alerted; (* General Terminal Interface *) TYPE ControlCharacters = {Interrupt, Quit, Erase, Kill, EOF, EOL, EOL2_NP, Switch_NP, Minimum, Time, Start, Stop, Suspend, DelayedSuspend_NP, Reprint_NP, Flush_NP, WordErase_NP, LiteralNext_NP, Quote_NP}; CONST (* The value of this constant is Ultrix dependent *) ControlDisable: CHAR = '\000'; TYPE InputFlags = {IgnoreBreak, (* Ignore break condition *) BreakInterrupt, (* Signal interupt on break *) IgnoreParity, (* Ignore characters with parity errors *) MarkParity, (* Mark Parity errors *) InputParity, (* Enable input parity check *) Strip, (* Strip character to 7 bits *) NL2CR, (* Map NL to CR on input *) IgnoreCR, (* Ignore CR *) CR2NL, (* Map CR to NL on input *) upperToLower_NP, (* Map upper-case to lower-case on input *) XOn, (* Enable start/stop output control *) XAny_NP, (* Enable any character to restart output *) XOff, (* Enable start/stop input control *) bad13_NP, bad14_NP, bad15_NP, PendingIn_NP, (* Retype pending input at next read or input. *) CanonicalBreak_NP (* Limited canonical processing *)}; InputMode = SET OF InputFlags; OutputFlags = {PostProcess, LowerToUpper_NP, NL2CR_NP, CR2NL_NP, NoCR_NP, NLMeansCR_NP, FillDelay_NP, FillIsDEL_NP}; SetOfOutputFlags = SET OF OutputFlags; OutputDelays_NP = RECORD newline: BITS 1 FOR [0 .. 1]; verticalTab: BITS 1 FOR [0 .. 1]; horizontalTab: BITS 2 FOR [0 .. 3]; carriageReturn: BITS 2 FOR [0 .. 3]; formFeed: BITS 1 FOR [0 .. 1]; backspace: BITS 1 FOR [0 .. 1]; END; ExtraOutputFlags_NP = {TildeConvert, FlushOutput, literalOut, NLType2_NP}; SetOfExtraOutputFlags_NP = SET OF ExtraOutputFlags_NP; OutputMode = RECORD mode: BITS 8 FOR SetOfOutputFlags; delays_NP: (*BITS 8 FOR*) OutputDelays_NP; extraMode_NP: BITS 16 FOR SetOfExtraOutputFlags_NP; END; BaudRate_NP = {B0 (* Hang up *), B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400}; CharacterSize = {CS5, CS6, CS7, CS8}; ControlFlags = {StopBits, (* Send two stop bits, else one. *) Read, (* Enable receiver *) ParityEnable, (* Parity enable *) ParityOdd, (* Odd parity, else even *) HangUpClose, (* Hang up on last close *) Local, (* Ignore modem status lines *) LowBlock_NP (* ??? *) }; SetOfControlFlags = SET OF ControlFlags; ControlMode = RECORD inputRate_NP: BITS 4 FOR BaudRate_NP; csize: BITS 2 FOR CharacterSize; mode: BITS 10 FOR SetOfControlFlags; outputRate_NP: BITS 4 FOR BaudRate_NP; autoflow_NP: BITS 1 FOR BOOLEAN; END; LocalFlags = {Signal, (* enable signals *) InputCanonical, (* Canonical input *) XCase_NP, (* Canonical upper/lower presentation *) Echo, (* Enable echo *) EchoErase, (* Echo ERASE as an error correcting backspace *) EchoKill, (* Echo KILL *) EchoNL, (* Echo NL *) NoFlush, (* Disable flush after interrupt *) bad8_NP, bad9_NP, bad10_NP, bad12_NP, bad13_NP, bad14_NP, bad15_NP, ControlEcho_NP, (* Echo input control chars as ^X *) PrintErase_NP, (* Hardcopy terminal erase mode using \c *) CRTBackSpace_NP, (* Backspace on erase *) CRTErase_NP, (* CRT Erase mode *) CRTKill_NP, (* BS-space-BS erase entire line on kill *) Raw_NP, (* Berkeley non-canonical I/O *) ToStop, (* Send SIGTTOU for bg output *) EnableExtension (* Enable local special characters *) }; LocalMode = SET OF LocalFlags; LineDiscipline_NP = {OldTty, (* old, v7 std tty driver *) NetLine, (* line discip for berk net *) NewTty, (* new tty discipline *) Tablet, (* hitachi tablet discipline *) NewTablet, (* gtco tablet discipline *) HalfCooked, (* half cooked discipline *) TermIO, (* termIO line discipline *) SLIP (* BSD Serial Line IP *) }; TermIOS = RECORD inputMode: BITS 32 FOR InputMode; outputMode: (*BITS 32 FOR*) OutputMode; controlMode: BITS 32 FOR ControlMode; localMode: BITS 32 FOR LocalMode; cc: ARRAY ControlCharacters OF CHAR; lineDiscipline_NP: BITS 8 FOR LineDiscipline_NP; END; TYPE SetAction = {Now, AfterDrain, AfterFlush}; Queue = SET OF {Input, Output}; FlowAction = {OutputOn, OutputOff, InputOff, InputOn}; (* The isatty operation of the C binding is replaced by a TYPECASE. *) TYPE T = FileImpl OBJECT METHODS getTerminalAttributes(VAR (* out *) termios: TermIOS) RAISES {Error}; setTerminalAttributes(READONLY termios: TermIOS; action: SetAction := SetAction.Now) RAISES {Error, Alerted}; sendBreak(duration: CARDINAL := 0) RAISES {Error}; drain() RAISES {Error, Alerted}; flush(queue: Queue) RAISES {Error}; flow(action: FlowAction) RAISES {Error}; setProcessGroup(group: PID_T) RAISES {Error}; getProcessGroup(): PID_T RAISES {Error}; ttyName(): TEXT RAISES {Error}; END; TImpl <: T; END POSTerminal.