DEFINITION MODULE K32baseTypes;

(*
 *	Everything defined in this module is fundamental and should
 *	not be changed without a great amount of forethought.
 *)

EXPORT QUALIFIED

	bits16, bits32, bits8, byte, cardinal16, cardinal32,
	cardinal8, integer16, integer32, integer8, maxCardinal16,
	maxCardinal32, maxCardinal8, maxInteger16, maxInteger32,
	maxInteger8, minInteger16, minInteger32, minInteger8,
	nullBits16, nullBits32, nullBits8, nullByte, nullCardinal16,
	nullCardinal32, nullCardinal8, nullChar, nullInteger16,
	nullInteger32, nullInteger8;

CONST
	maxCardinal8  = 255;		(* (2**8)-1 *)
	maxCardinal16 = 65535;		(* (2**16)-1 *)
	maxCardinal32 = 4294967295;	(* (2**32)-1 *)

	minInteger8  = -128;		(* -(2**7) *)
	maxInteger8  = 127;		(* (2**7)-1 *)
	minInteger16 = -32768;		(* -(2**15) *)
	maxInteger16 = 32767;		(* (2**15)-1 *)
	minInteger32 = -2147483648;	(* -(2**31) *)
	maxInteger32 = 2147483647;	(* (2**31)-1 *)

TYPE
	bits8  = SET OF [0..7];
	bits16 = SET OF [0..15];
	bits32 = BITSET;		(* SET OF [0..31] *)

	byte = CHAR;			(* an 8-bit object *)

	cardinal8  = [0..maxCardinal8];
	cardinal16 = [0..maxCardinal16];
	cardinal32 = CARDINAL;		(* [0..maxCardinal32] *)

	integer8  = [minInteger8..maxInteger8];
	integer16 = [minInteger16..maxInteger16];
	integer32 = INTEGER;		(* [minInteger32..maxInteger32] *)

CONST
	nullBits8  = bits8{};
	nullBits16 = bits16{};
	nullBits32 = bits32{};

	nullChar = 0C;
	nullByte = nullChar;		(* an 8-bit object of zero-bits *)

	nullCardinal8  = 0;
	nullCardinal16 = 0;
	nullCardinal32 = 0;

	nullInteger8  = 0;
	nullInteger16 = 0;
	nullInteger32 = 0;

END K32baseTypes.
