home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
modu1096.zip
/
GPMsym
/
termdevice.def
< prev
next >
Wrap
Text File
|
1996-10-10
|
6KB
|
171 lines
(*
* =========== macro processed output from MPP ==========
*
* input file : termdevice.dpp
* time stamp : 1996 Sep 03 13:51:21
*
* output file : termdevice.def
* created at : 1996 Oct 10 16:21:31
*
* options ... : -Dos2
*
* =======================================================
*)
FOREIGN DEFINITION MODULE TermDevice;
IMPORT IMPLEMENTATION FROM "termdevice.o & stddevice.o";
(* The low-level interface to channels connected to the Terminal device *)
IMPORT IOConsts, ChanConsts, SYSTEM;
FROM IOChan IMPORT ChanId;
FROM IOLink IMPORT DeviceData, DeviceTablePtr;
CONST
(* Device Errors - implementation dependent *)
InvalidChannel = -1; (* channel not connected to this device *)
NoError = 0;
MaxSoftDevErr = 18; (* soft device errors in range 1..18 *)
MinHardDevErr = 19; (* hard device errors >= 19 *)
TYPE
OpenResults = ChanConsts.OpenResults;
ReadResults = IOConsts.ReadResults;
(* Text operations - these perform any required translation between
the internal and external representation of text. *)
PROCEDURE Look ( dtp : DeviceTablePtr;
VAR ch : CHAR;
VAR res : ReadResults);
(* If there is a character as the next item in the given input stream,
assigns its value to the parameter ch without removing it from the stream.
Otherwise, the value of the parameter ch is not defined.
The parameter res, and the stored read result, is set to the value
allRight, endOfLine, or endOfInput. *)
PROCEDURE Skip (dtp : DeviceTablePtr);
(* If the input has ended, the exception skipAtEnd is raised,
otherwise, the next character or line mark in the input is removed. *)
PROCEDURE SkipLook ( dtp : DeviceTablePtr;
VAR ch : CHAR;
VAR res : ReadResults);
(* If the stream has ended, the exception skipAtEnd is raised,
otherwise, the next character or line mark is removed.
If there is a character as the next item in the given input stream,
assigned its value to the parameter ch without removing it from the stream.
Otherwise, the value of the parameter ch is not defined.
The parameter res, and the stored read result, is set to the value
allRight, endOfLine or endOfInput. *)
PROCEDURE TextRead ( dtp : DeviceTablePtr;
to : SYSTEM.ADDRESS;
maxChars : CARDINAL;
VAR charsRead : CARDINAL);
(* Reads at most maxChars characters from the current line and assigns
corresponding values to successive locations, starting at the address
given by the parameter to, and continuing at increments corresponding
to the address difference between successive components of an ARRAY OF
CHAR. The number of characters read is assigned to the parameter
charsRead. *)
PROCEDURE TextWrite (dtp : DeviceTablePtr;
from : SYSTEM.ADDRESS;
chars : CARDINAL);
(* Writes a number of characters given by the value of the parameter chars,
starting as the address given by the parameter from and continuing at
increments corresponding to the address difference between successive
components of an ARRAY OF CHAR. *)
PROCEDURE WriteLn (dtp : DeviceTablePtr);
(* Writes a line mark over the channel *)
(* Binary operations *)
PROCEDURE BinRead ( dtp : DeviceTablePtr;
to : SYSTEM.ADDRESS;
maxLocs : CARDINAL;
VAR locsRead : CARDINAL);
(* Reads at most maxLocs items and assigns corresponding values to
successive locations, starting at the address given by the parameter to.
The number of items read is assigned to the parameter locsRead. *)
PROCEDURE BinWrite (dtp : DeviceTablePtr;
from : SYSTEM.ADDRESS;
locs : CARDINAL);
(* Writes a number of items given by the value of the parameter locs from
successive locations starting as the address given by the parameter from. *)
(* Common operations *)
PROCEDURE GetName ( dtp : DeviceTablePtr;
VAR s : ARRAY OF CHAR);
(* Copies to the parameter s a name associated with the channel,
possibly truncated depending on the capacity of s. *)
PROCEDURE Reset (dtp : DeviceTablePtr);
(* Reset to a state defined by the device module *)
PROCEDURE Flush (dtp : DeviceTablePtr);
(* Flush any data buffered by the device module out to the destination *)
(* Channel operations *)
PROCEDURE OpenChannel ( dtp : DeviceTablePtr;
VAR res : OpenResults);
(* If a channel can be opened to the terminal, then the fields
dtp^.cd and dtp^.errNum are initialized, and res is set to opened.
Otherwise, the value of the parameter res indicates
the reason for the failure. *)
PROCEDURE Free (dtp : DeviceTablePtr);
(* Carries out the operations involved in closing the
corresponding channel, including flushing buffers, but do
not unmake the channel. *)
PROCEDURE LookKey ( dtp : DeviceTablePtr;
VAR ok : BOOLEAN;
VAR ch : CHAR;
VAR res : ReadResults);
(* Performs 'no-wait' input:
If there is a character available on TermFile channel cid, return ok TRUE
and the results of a Look(cid/dtp, ch, res);
otherwise return ok FALSE. *)
PROCEDURE Echo ();
(* Enable echo for all terminal channels.
Echoing is on by default, and can be controlled by use of
TextIO.Read (echo) cf IOChan.Look/Skip (no echo).
However NoEcho truns off echoing globally, and this procedure
allows it to be turned back on. *)
PROCEDURE NoEcho ();
(* Disable echoing for all terminal channels.
LookKey disables echo when it checks for (and reads) a character;
however a typical LookKey loop will often be outside LookKey when a key is
pressed, and default operating system echo will occur.
This procedure allows echoing to be globally suppressed, so that LookKey
echo is entirely under user control. *)
END TermDevice.