-- CharIO.Mesa
-- last edited by Johnsson on Jan 30, 1981 9:56 AM 
-- last edited by Satterthwaite on 18-Jan-82 15:10:29 

DIRECTORY
  Format: TYPE USING [NumberFormat],
  Stream: TYPE USING [Handle],
  Strings: TYPE USING [String, SubString];

CharIO: DEFINITIONS = {

  Handle: TYPE = Stream.Handle;

 -- some control characters

  NUL: CHARACTER = 0c;
  BS: CHARACTER = 'H - 100b;
  TAB: CHARACTER = 'I - 100b;
  LF: CHARACTER = 'J - 100b;
  FF: CHARACTER = 'L - 100b;
  CR: CHARACTER = 'M - 100b;
  ControlZ: CHARACTER = 'Z - 100b;
  ESC: CHARACTER = 33c;
  SP: CHARACTER = ' ;
  DEL: CHARACTER = 177c;

 -- numerical formats

  NumberFormat: TYPE = Format.NumberFormat;

 -- input/output

  GetChar: PROC [in: Handle] RETURNS [CHARACTER];

  PutChar: PROC [out: Handle, c: CHARACTER];

  GetString: PROC [Handle, Strings.String, PROC [CHARACTER] RETURNS [BOOLEAN]];
  PutString: PROC [Handle, Strings.String];
  PutSubString: PROC [Handle, Strings.SubString];

  GetID, GetLine: PROC [Handle, Strings.String];
  PutLine: PROC [out: Handle, s: Strings.String];

  GetNumber: PROC [in: Handle, radix: CARDINAL] RETURNS [UNSPECIFIED];
  PutNumber: PROC [Handle, UNSPECIFIED, NumberFormat];

  GetOctal: PROC [in: Handle] RETURNS [UNSPECIFIED] = INLINE {
    RETURN [GetNumber[in, 8]]};
  PutOctal: PROC [Handle, UNSPECIFIED];

  GetDecimal: PROC [in: Handle] RETURNS [INTEGER] = INLINE {
    RETURN [GetNumber[in, 10]]};
  PutDecimal: PROC [Handle, INTEGER];

  }.