Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : OPTYPE.MOD

 
Output of file : OPTYPE.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 13 - Program 9 *)
MODULE OpType;

FROM InOut IMPORT WriteString, WriteCard, WriteLn;
FROM OpaqueType IMPORT BoxType, MakeBox, Volume, Area;

VAR Big, Little, Tiny : BoxType;
TempVal : CARDINAL;

BEGIN

Big := MakeBox(12,8,11); (* Create and initialize a box *)
Little := MakeBox(2,4,3); (* Create and initialize a box *)
Tiny := MakeBox(1,1,1); (* Create and initialize a box *)

WriteString("The big box has a volume of ");
TempVal := Volume(Big);
WriteCard(TempVal,4);
WriteString(" units.");
WriteLn;

WriteString("The little box has an area of ");
WriteCard(Area(Little),4);
WriteString(" units.");
WriteLn;

(* This is comparing the opaque values, in this case pointers *)

IF Little # Big THEN
WriteString("The little box and the big box are not equal.");
WriteLn;
END;

END OpType.




(* Result of execution

The big box has a volume of 1056 units.
The little box has an area of 52 units.
The little box and the big box are not equal.

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : OPTYPE.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/