3 with Ada
.Text_IO
; use Ada
.Text_IO
;
5 procedure Rep_Clause1
is
7 type Int_16
is range 0 .. 65535;
8 for Int_16
'Size use 16;
10 ----------------------------------------------
22 Int_1
at 0 range 0 .. 15;
23 Int_2
at 2 range 0 .. 15;
24 Int_3
at 4 range 0 .. 15;
25 Int_4
at 6 range 0 .. 15;
28 Rec_A_Size
: constant := 4 * 16;
30 for Rec_A
'Size use Rec_A_Size
;
32 ----------------------------------------------
34 type Rec_B_Version_1
is
41 for Rec_B_Version_1
use record
42 Rec_1
at 0 range 0 .. 63;
43 Rec_2
at 8 range 0 .. 63;
44 Int_1
at 16 range 0 .. 15;
47 Rec_B_Size
: constant := 2 * Rec_A_Size
+ 16;
49 for Rec_B_Version_1
'Size use Rec_B_Size
;
50 for Rec_B_Version_1
'Alignment use 2;
52 ----------------------------------------------
54 type Rec_B_Version_2
is
61 for Rec_B_Version_2
use record
62 Int_1
at 0 range 0 .. 15;
63 Rec_1
at 2 range 0 .. 63;
64 Rec_2
at 10 range 0 .. 63;
67 for Rec_B_Version_2
'Size use Rec_B_Size
;
69 ----------------------------------------------
71 Arr_A_Length
: constant := 2;
72 Arr_A_Size
: constant := Arr_A_Length
* Rec_B_Size
;
74 type Arr_A_Version_1
is array (1 .. Arr_A_Length
) of Rec_B_Version_1
;
75 type Arr_A_Version_2
is array (1 .. Arr_A_Length
) of Rec_B_Version_2
;
77 pragma Pack
(Arr_A_Version_1
);
78 pragma Pack
(Arr_A_Version_2
);
80 for Arr_A_Version_1
'Size use Arr_A_Size
;
81 for Arr_A_Version_2
'Size use Arr_A_Size
;
83 ----------------------------------------------
86 -- Put_Line ("Arr_A_Size =" & Arr_A_Size'Img);
88 if Arr_A_Version_1
'Size /= Arr_A_Size
then
90 ("Version 1 Size mismatch! " &
91 "Arr_A_Version_1'Size =" & Arr_A_Version_1
'Size'Img);
94 if Arr_A_Version_2'Size /= Arr_A_Size then
96 ("Version 2 Size mismatch! " &
97 "Arr_A_Version_2'Size =" & Arr_A_Version_2'Size'Img
);