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

 
Output of file : OPAQUETY.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 13 - Program 8 *)
IMPLEMENTATION MODULE OpaqueType;

FROM Storage IMPORT ALLOCATE;
FROM SYSTEM IMPORT TSIZE;

TYPE BoxStyle = RECORD
Length : CARDINAL;
Width : CARDINAL;
Height : CARDINAL;
END;

BoxType = POINTER TO BoxStyle;

PROCEDURE MakeBox(Length, Width, Height : CARDINAL) : BoxType;
VAR TempBox : BoxType;
BEGIN
ALLOCATE(TempBox,TSIZE(BoxStyle));
TempBox^.Length := Length;
TempBox^.Width := Width;
TempBox^.Height := Height;
RETURN TempBox;
END MakeBox;


PROCEDURE Volume(Box : BoxType) : CARDINAL;
BEGIN
RETURN Box^.Length * Box^.Width * Box^.Height;
END Volume;


PROCEDURE Area(Box : BoxType) : CARDINAL;
BEGIN
RETURN 2 * (Box^.Length * Box^.Width +
Box^.Length * Box^.Height +
Box^.Width * Box^.Height);
END Area;

END OpaqueType.



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : OPAQUETY.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/