(*
    Title: 	BinaryIO - Definitions
    LastEdit:	"Sat Nov 10 14:49:16 1984"
    Author: 	Mick Jordan
		Acorn Research Centre

    Binary input/output of basic language types.
    Objects are output as a sequence of bytes,
    in the most efficient, implementation dependent representation.
    Objects output with WriteTYPE can be recovered with ReadTYPE.
    Do not use this module to transfer data between different
    implementations of Modula-2.
*)

DEFINITION MODULE BinaryIO;
FROM SYSTEM IMPORT WORD;
FROM Streams IMPORT Stream;

EXPORT QUALIFIED 
    ReadCHAR, ReadINTEGER, ReadCARDINAL, ReadBOOLEAN,
    ReadREAL, ReadBITSET,
    WriteCHAR, WriteINTEGER, WriteCARDINAL, WriteBOOLEAN, 
    WriteREAL, WriteBITSET, ReadWORD, WriteWORD;

PROCEDURE WriteCHAR(s: Stream; ch: CHAR);
PROCEDURE ReadCHAR(s: Stream): CHAR;

PROCEDURE WriteINTEGER(s : Stream;  i : INTEGER);
PROCEDURE ReadINTEGER(s: Stream): INTEGER;

PROCEDURE WriteCARDINAL(s : Stream;  c : CARDINAL);
PROCEDURE ReadCARDINAL(s: Stream): CARDINAL;
PROCEDURE WriteBOOLEAN(s : Stream;  bool : BOOLEAN);
PROCEDURE ReadBOOLEAN(s: Stream): BOOLEAN;

PROCEDURE WriteREAL(s : Stream;  real : REAL);
PROCEDURE ReadREAL(s: Stream): REAL;

PROCEDURE WriteBITSET(s: Stream; b: BITSET);
PROCEDURE ReadBITSET(s: Stream): BITSET;

PROCEDURE WriteWORD(s: Stream; w: WORD);
PROCEDURE ReadWORD(s: Stream): WORD;

END BinaryIO.
