home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 30 - Program 3
- with Text_IO;
- use Text_IO;
-
- procedure PackItIn is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- type LITTLE1 is range 1..57;
-
- type LITTLE_REC1 is
- record
- A,B,C : LITTLE1;
- end record;
-
- type LIST1 is array(1..5) of LITTLE_REC1;
-
- type LITTLE2 is range 1..57;
-
- type LITTLE_REC2 is
- record
- A,B,C : LITTLE2;
- end record;
- pragma PACK(LITTLE_REC2);
-
- type LIST2 is array(1..5) of LITTLE_REC2;
- pragma PACK(LIST2);
-
- type LITTLE3 is range 1..57;
- for LITTLE3'SIZE use 8;
-
- type LITTLE_REC3 is
- record
- A,B,C : LITTLE3;
- end record;
- pragma PACK(LITTLE_REC3);
-
- type LIST3 is array(1..5) of LITTLE_REC3;
- pragma PACK(LIST3);
-
- begin
- Put("Type LITTLE1 uses ");
- Put(LITTLE1'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LITTLE_REC1 uses ");
- Put(LITTLE_REC1'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LIST1 uses ");
- Put(LIST1'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LITTLE2 uses ");
- Put(LITTLE2'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LITTLE_REC2 uses ");
- Put(LITTLE_REC2'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LIST2 uses ");
- Put(LIST2'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LITTLE3 uses ");
- Put(LITTLE3'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LITTLE_REC3 uses ");
- Put(LITTLE_REC3'SIZE);
- Put_Line(" bits for its representation.");
-
- Put("Type LIST3 uses ");
- Put(LIST3'SIZE);
- Put_Line(" bits for its representation.");
-
- end PackItIn;
-
- -- Result of execution, Compiler 1. (Did not support Line 31)
-
- -- Type LITTLE1 uses 16 bits for its representation.
- -- Type LITTLE_REC1 uses 48 bits for its representation.
- -- Type LIST1 uses 240 bits for its representation.
- -- Type LITTLE2 uses 16 bits for its representation.
- -- Type LITTLE_REC2 uses 32 bits for its representation.
- -- Type LIST2 uses 160 bits for its representation.
- -- Type LITTLE3 uses 16 bits for its representation.
- -- Type LITTLE_REC3 uses 32 bits for its representation.
- -- Type LIST3 uses 160 bits for its representation.
-
- -- Result of execution, Compiler 2. (Did not support Line 31)
-
- -- Type LITTLE1 uses 16 bits for its representation.
- -- Type LITTLE_REC1 uses 48 bits for its representation.
- -- Type LIST1 uses 240 bits for its representation.
- -- Type LITTLE2 uses 16 bits for its representation.
- -- Type LITTLE_REC2 uses 48 bits for its representation.
- -- Type LIST2 uses 240 bits for its representation.
- -- Type LITTLE3 uses 16 bits for its representation.
- -- Type LITTLE_REC3 uses 48 bits for its representation.
- -- Type LIST3 uses 240 bits for its representation.
-
-