home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / modu1096.zip / GPMsym / termdevice.def < prev    next >
Text File  |  1996-10-10  |  6KB  |  171 lines

  1. (*
  2.  * =========== macro processed output from MPP  ==========
  3.  *
  4.  * input file  : termdevice.dpp
  5.  * time stamp  : 1996 Sep 03 13:51:21
  6.  *
  7.  * output file : termdevice.def
  8.  * created at  : 1996 Oct 10 16:21:31
  9.  *
  10.  * options ... :  -Dos2
  11.  *
  12.  * =======================================================
  13.  *)
  14.  
  15. FOREIGN DEFINITION MODULE TermDevice;
  16.   IMPORT IMPLEMENTATION FROM "termdevice.o & stddevice.o";
  17.  
  18. (* The low-level interface to channels connected to the Terminal device *)
  19.  
  20.  
  21. IMPORT IOConsts, ChanConsts, SYSTEM;
  22. FROM IOChan   IMPORT ChanId;
  23. FROM IOLink   IMPORT DeviceData, DeviceTablePtr;
  24.  
  25.  
  26. CONST
  27.   (* Device Errors - implementation dependent *)
  28.   InvalidChannel = -1;    (* channel not connected to this device *)
  29.   NoError        =  0;
  30.   MaxSoftDevErr  = 18;    (* soft device errors in range 1..18 *)
  31.   MinHardDevErr  = 19;    (* hard device errors >= 19 *)
  32.  
  33.  
  34. TYPE
  35.   OpenResults = ChanConsts.OpenResults;
  36.   ReadResults = IOConsts.ReadResults;
  37.  
  38.  
  39. (* Text operations - these perform any required translation between
  40.    the internal and external representation of text. *)
  41.  
  42. PROCEDURE Look (    dtp : DeviceTablePtr;
  43.                 VAR ch  : CHAR;
  44.                 VAR res : ReadResults);
  45. (* If there is a character as the next item in the given input stream,
  46.    assigns its value to the parameter ch without removing it from the stream.
  47.    Otherwise, the value of the parameter ch is not defined.
  48.    The parameter res, and the stored read result, is set to the value
  49.    allRight, endOfLine, or endOfInput. *)
  50.  
  51.  
  52. PROCEDURE Skip (dtp : DeviceTablePtr);
  53. (* If the input has ended, the exception skipAtEnd is raised,
  54.    otherwise, the next character or line mark in the input is removed. *)
  55.  
  56.  
  57. PROCEDURE SkipLook (    dtp : DeviceTablePtr;
  58.                     VAR ch  : CHAR;
  59.                     VAR res : ReadResults);
  60. (* If the stream has ended, the exception skipAtEnd is raised,
  61.    otherwise, the next character or line mark is removed.
  62.    If there is a character as the next item in the given input stream,
  63.    assigned its value to the parameter ch without removing it from the stream.
  64.    Otherwise, the value of the parameter ch is not defined.
  65.    The parameter res, and the stored read result, is set to the value
  66.    allRight, endOfLine or endOfInput. *)
  67.  
  68.  
  69. PROCEDURE TextRead (    dtp      : DeviceTablePtr;
  70.                         to       : SYSTEM.ADDRESS;
  71.                         maxChars : CARDINAL;
  72.                     VAR charsRead : CARDINAL);
  73. (* Reads at most maxChars characters from the current line and assigns
  74.    corresponding values to successive locations, starting at the address
  75.    given by the parameter to, and continuing at increments corresponding
  76.    to the address difference between successive components of an ARRAY OF
  77.    CHAR. The number of characters read is assigned to the parameter
  78.    charsRead. *)
  79.  
  80.  
  81. PROCEDURE TextWrite (dtp   : DeviceTablePtr;
  82.                      from  : SYSTEM.ADDRESS;
  83.                      chars : CARDINAL);
  84. (* Writes a number of characters given by the value of the parameter chars,
  85.    starting as the address given by the parameter from and continuing at
  86.    increments corresponding to the address difference between successive
  87.    components of an ARRAY OF CHAR. *)
  88.  
  89.  
  90. PROCEDURE WriteLn (dtp : DeviceTablePtr);
  91. (* Writes a line mark over the channel *)
  92.  
  93.  
  94.  
  95. (* Binary operations *)
  96.  
  97. PROCEDURE BinRead (    dtp      : DeviceTablePtr;
  98.                        to       : SYSTEM.ADDRESS;
  99.                        maxLocs  : CARDINAL;
  100.                    VAR locsRead : CARDINAL);
  101. (* Reads at most maxLocs items and assigns corresponding values to
  102.    successive locations, starting at the address given by the parameter to.
  103.    The number of items read is assigned to the parameter locsRead. *)
  104.  
  105.  
  106. PROCEDURE BinWrite (dtp  : DeviceTablePtr;
  107.                     from : SYSTEM.ADDRESS;
  108.                     locs : CARDINAL);
  109. (* Writes a number of items given by the value of the parameter locs from
  110.    successive locations starting as the address given by the parameter from. *)
  111.  
  112.  
  113.  
  114. (* Common operations *)
  115.  
  116. PROCEDURE GetName (    dtp : DeviceTablePtr;
  117.                    VAR s   : ARRAY OF CHAR);
  118. (* Copies to the parameter s a name associated with the channel,
  119.    possibly truncated depending on the capacity of s. *)
  120.  
  121.  
  122. PROCEDURE Reset (dtp : DeviceTablePtr);
  123. (* Reset to a state defined by the device module *)
  124.  
  125.  
  126. PROCEDURE Flush (dtp : DeviceTablePtr);
  127. (* Flush any data buffered by the device module out to the destination *)
  128.  
  129.  
  130.  
  131. (* Channel operations *)
  132. PROCEDURE OpenChannel (    dtp     : DeviceTablePtr;
  133.                        VAR res     : OpenResults);
  134. (* If a channel can be opened to the terminal, then the fields
  135.    dtp^.cd and dtp^.errNum are initialized, and res is set to opened.
  136.    Otherwise, the value of the parameter res indicates
  137.    the reason for the failure. *)
  138.  
  139.  
  140. PROCEDURE Free (dtp : DeviceTablePtr);
  141. (* Carries out the operations involved in closing the
  142.    corresponding channel, including flushing buffers, but do
  143.    not unmake the channel. *)
  144.  
  145.  
  146. PROCEDURE LookKey (    dtp : DeviceTablePtr;
  147.                    VAR ok  : BOOLEAN;
  148.            VAR ch  : CHAR;
  149.            VAR res : ReadResults);
  150. (* Performs 'no-wait' input:
  151.    If there is a character available on TermFile channel cid, return ok TRUE
  152.    and the results of a Look(cid/dtp, ch, res);
  153.    otherwise return ok FALSE. *)
  154.  
  155. PROCEDURE Echo ();
  156. (* Enable echo for all terminal channels.
  157.    Echoing is on by default, and can be controlled by use of
  158.    TextIO.Read (echo) cf IOChan.Look/Skip (no echo).
  159.    However NoEcho truns off echoing globally, and this procedure
  160.    allows it to be turned back on. *)
  161.  
  162. PROCEDURE NoEcho ();
  163. (* Disable echoing for all terminal channels.
  164.    LookKey disables echo when it checks for (and reads) a character;
  165.    however a typical LookKey loop will often be outside LookKey when a key is
  166.    pressed, and default operating system echo will occur.
  167.    This procedure allows echoing to be globally suppressed, so that LookKey
  168.    echo is entirely under user control. *)
  169.  
  170. END TermDevice.
  171.