{ Computer Systems Research Group
  University of Toronto

  File:   IO4 Coneuc Standard IO Level 4  V1.13
  Author: James R. Cordy
  Date:   31 March 1980  (Revised 30 July 1981)			}

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

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

{ String length limits }
pervasive const maxStringLength := 128;
pervasive const maxArgLength := 64;

{ 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;

{ File position indices }
pervasive type FileIndex = LongInt

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,
	    Assign, Deassign, Delete, FetchArg, SysExit,
	    Write, Read, Tell, Seek, Error);
	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;
	procedure Assign (var f: File, s: packed array 1..parameter of Char) = external;
	procedure Deassign (f: File) = external;
	procedure Delete (f: File) = external;
	procedure FetchArg (n: 1..maxArgs, var s: packed array 1..parameter of Char) = external;
	procedure SysExit (r: SignedInt) = external;
	procedure Write (f: File, u: universal, n: SignedInt) = external;
	procedure Read (f: File, var u: universal, n: SignedInt) = external;
	procedure Tell (f: File, var x: FileIndex) = external;
	procedure Seek (f: File, x: FileIndex) = external;
	function Error (f: File) returns b: Boolean = external;
    end module;
