DEFINITION MODULE TypeConvert;

(* This module offers replacements for the normal type convertion 
   procedures that aren't acceptet by this Modula-2 system:
   
     CHAR(), BYTE(), CARDINAL(), INTEGER(), BITSET(), WORD(),
     LONGCARD(), LONGINT(), REAL(), and ADDRESS().
     
   The Long versions don't give error measages until run time if a
   varible of wrong size is attempted converted (ARRAY OF BYTE accepts
   any type of any size) *)

FROM SYSTEM IMPORT WORD, BYTE, ADDRESS;


PROCEDURE Char(x : BYTE) : CHAR;

PROCEDURE Byte(x : BYTE) : BYTE;

PROCEDURE Cardinal(x : WORD) : CARDINAL;

PROCEDURE Integer(x : WORD) : INTEGER;

PROCEDURE Bitset(x : WORD) : BITSET;

PROCEDURE Word(x : WORD) : WORD;

PROCEDURE LongCard(x : ARRAY OF BYTE) : LONGCARD;

PROCEDURE LongInt(x : ARRAY OF BYTE) : LONGINT;

PROCEDURE Real(x : ARRAY OF BYTE) : REAL;

PROCEDURE Address(x : ARRAY OF BYTE) : ADDRESS;

END TypeConvert.
