{ Computer Systems Research Group
  University of Toronto

  File:   IO2 ConEuc Standard IO Level 2  V1.08
  Author: James R. Cordy
  Date:   31 March 1980	(Revised 18 June 1981)			}

{ Copyright (C) 1980, The University of Toronto }

{ Global character constants }
pervasive const newLine := $$N;
pervasive const endOfFile := $$E;

{ String length limit }
pervasive const maxStringLength := 128;

{ File number assignments }
pervasive const stdInput := -2;
pervasive const stdOutput := -1;
pervasive const stdError := 0;
pervasive const maxArgs := 9;
pervasive const maxFiles := 14;
pervasive type File = stdInput..maxFiles;

{ File input/output modes }
pervasive const inFile := 0;
pervasive const outFile := 1;
pervasive const inOutFile := 2;
pervasive type FileMode = inFile..inOutFile;

var IO:
    external module
	exports (PutChar, PutInt, PutString, PutLong,
	    GetChar, GetInt, GetString, GetLong,
	    Open, Close, FPutChar, FPutInt, FPutString, FPutLong,
	    FGetChar, FGetInt, FGetString, FGetLong,
	    WriteChar, WriteInt, WriteString, WriteLong,
	    ReadChar, ReadInt, ReadString, ReadLong, EndFile);
	procedure Open (f: File, m: FileMode) = external;
	procedure Close (f: File) = external;
	procedure WriteChar (f: File, c: Char) = external;
	procedure WriteInt (f: File, i: SignedInt) = external;
	procedure WriteLong (f: File, l: LongInt) = external;
	procedure WriteString (f: File, s: packed array 1..parameter of Char) = external;
	procedure ReadChar (f: File, var c: Char) = external;
	procedure ReadInt (f: File, var i: SignedInt) = external;
	procedure ReadLong (f: File, var l: LongInt) = external;
	procedure ReadString (f: File, var s: packed array 1..parameter of Char) = external;
	procedure FPutChar (f: File, c: Char) = external;
	procedure FPutInt (f: File, i: SignedInt, w: SignedInt) = external;
	procedure FPutLong (f: File, l: LongInt, w: SignedInt) = external;
	procedure FPutString (f: File, s: packed array 1..parameter of Char)=
	    external;
	procedure FGetChar (f: File, var c: Char) = external;
	procedure FGetInt (f: File, var i: SignedInt) = external;
	procedure FGetLong (f: File, var l: LongInt) = external;
	procedure FGetString (f: File,
	    var s: packed array 1..parameter of Char) = external;
	procedure PutChar (c: Char) = external;
	procedure PutInt (i: SignedInt, w: SignedInt) = external;
	procedure PutLong (l: LongInt, w: SignedInt) = external;
	procedure PutString (s: packed array 1..parameter of Char) = external;
	procedure GetChar (var c: Char) = external;
	procedure GetInt (var i: SignedInt) = external;
	procedure GetLong (var l: LongInt) = external;
	procedure GetString (var s: packed array 1..parameter of Char) =  external;
	function EndFile (f: File) returns b: Boolean = external;
    end module;
