Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
SysTermIO


NAME

SysTermIO - interface to the terminal driver (UNIX System V version)

SYNOPSIS

CONST
   (* input modes *)
   ignbrk = { 31 };     (* ignore break condition *)
   brkint = { 30 };     (* signal interrupt on break *)
   ignpar = { 29 };     (* ignore characters with parity errors *)
   parmrk = { 28 };     (* mark parity errors *)
   inpck = { 27 };      (* enable input parity check *)
   istrip = { 26 };     (* strip character *)
   inlcr = { 25 };      (* map NL to CR on input *)
   igncr = { 24 };      (* ignore CR *)
   icrnl = { 23 };      (* map CR to NL on input *)
   iuclc = { 22 };      (* map upper-case to lower-case on input *)
   ixon = { 21 };       (* enable start/stop output control *)
   ixany = { 20 };      (* enable any character to restart output *)
   ixoff = { 19 };      (* enable start/stop input control *)

   (* output modes *)
   opost = { 31 };      (* postprocess output *)
   olcuc = { 30 };      (* map lower case to upper on output *)
   onlcr = { 29 };      (* map NL to CR-NL on output *)
   ocrnl = { 28 };      (* map CR to NL on output *)
   onocr = { 27 };      (* no CR output at column 0 *)
   onlret = { 26 };     (* NL performs CR function *)
   ofill = { 25 };      (* use fill characters for delay *)
   ofdel = { 24 };      (* fill is DEL, else NUL *)
   (* delays for newline *)
   nldly = { 23 };      (* mask for new-line delays *)
   nl0 = { };
   nl1 = { 23 };
   (* delays for carriage return *)
   crdly = { 21, 22 };  (* mask *)
   cr0 = { };
   cr1 = { 22 };
   cr2 = { 21 };
   cr3 = { 21, 22 };
   (* delays for tabs *)
   tabdly = { 19, 20 }; (* mask *)
   tab1 = { 20 };
   tab2 = { 19 };
   tab3 = { 19, 20 };   (* expand tabs to spaces *)
   (* delays for backspaces *)
   bsdly = { 18 };      (* mask *)
   bs0 = { };
   bs1 = { 18 };
   (* delays for vertical tabs *)
   vtdly = { 17 };      (* mask *)
   vt0 = { };
   vt1 = { 17 };
   (* delays for form feeds *)
   ffdly = { 16 };
   ff0 = { };
   ff1 = { 16 };

   (* control modes *)
   cbaud = { 28..31 };  (* mask *)
   b0 = {};
   b50 = { 31 };
   b75 = { 30 };
   b110 = { 29, 30 };
   b134 = { 29 };
   b150 = { 29, 31 };
   b200 = { 29, 30 };
   b300 = { 29..31 };
   b600 = { 28 };
   b1200 = { 28, 31 };
   b1800 = { 28, 30 };
   b2400 = { 28, 30, 31 };
   b4800 = { 28, 29 };
   b9600 = { 28, 29, 31 };
   exta = { 28..30 };
   extb = { 28..31 };
   csize = { 26, 27 };  (* mask for character size *)
   cs5 = {};
   cs6 = { 27 };
   cs7 = { 26 };
   cs8 = { 26, 27 };
   cstopb = { 25 };     (* send two stop bits, else one *)
   cread = { 24 };      (* enable receiver *)
   parenb = { 23 };     (* parity enable *)
   parodd = { 22 };     (* odd parity, else even *)
   hupcl = { 21 };      (* hang up on last close *)
   clocal = { 20 };     (* local line, else dial-up *)
   
   (* line modes *)
   isig = { 31 };       (* enable signals *)
   icanon = { 30 };     (* canonical input (erase and kill processing) *)
   xcase = { 29 };      (* canonical upper/lower presentation *)
   echo = { 28 };       (* enable echo *)
   echoe = { 27 };      (* echo erase character as BS-SP-BS *)
   echok = { 26 };      (* echo NL after kill character *)
   echonl = { 25 };     (* echo NL *)
   noflsh = { 24 };     (* disable flush after interrupt or quit *)

TYPE ControlChars = (vintr, vquit, verase, vkill,
                     veof, veol, veol2, vswtch);

CONST vmin = veof; vtime = veol;

TYPE ControlCharsRange = [MIN(ControlChars)..MAX(ControlChars)];
TYPE InputModes = BITSET;
TYPE OutputModes = BITSET;
TYPE ControlModes = BITSET;
TYPE LineModes = BITSET;
TYPE TermIO =
        RECORD
           inputmodes: InputModes;
           outputmodes: OutputModes;
           controlmodes: ControlModes;
           linemodes: LineModes;
           linedisc: CHAR;
           cc: ARRAY ControlCharsRange OF CHAR;
        END;

PROCEDURE SetTermIO(fd: CARDINAL;
                    termio: TermIO) : BOOLEAN;

PROCEDURE GetTermIO(fd: CARDINAL;
                    VAR termio: TermIO) : BOOLEAN;

PROCEDURE Baudrate(termio: TermIO) : CARDINAL;

DESCRIPTION

SetTermIO and GetTermIO realize the TCSETA and TCGETA ioctl-calls with type conversion for Modula-2. Baudrate converts the baudrate information in termio into a cardinal.

CAVEAT

SysIoctl is to be used instead on BSD-systems (including SunOS 4.1.x).

SEE ALSO

ioctl(2), termio(7i)
Edited by: borchert, last change: 1997/02/25, revision: 1.2, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine