XMesaCall14: PROCEDURE = {
LPI: TYPE = LONG POINTER TO INTEGER;
LPC: TYPE = LONG POINTER TO CARDINAL;
BLP: TYPE = LONG POINTER TO T1;
T1:
TYPE =
RECORD [
SELECT tag: *
FROM
a1 => [c: CARDINAL],
a2 => [
i, j: INTEGER,
f:
SELECT a2Tag: *
FROM
a21 => [p: LPI],
a22 => [q, r: LPI]
ENDCASE],
ENDCASE];
i1,i2,i3,i4,i5,i6,i7,i8,i9: INTEGER ¬ 0;
p1: LPI ¬ @i1;
p2: LPI ¬ @i2;
p3: LPI ¬ @i3;
p4: LPI ¬ @i4;
p5: LPI ¬ @i5;
p6: LPI ¬ @i6;
p7: LPI ¬ @i7;
p8: LPI ¬ @i8;
p9: LPI ¬ @i9;
t1: T1 ¬ [a1[c: 101]];
t2: T1 ¬ [a2[i: 1, j: 2, f: a21[p: p1]]];
t3: T1 ¬ [a2[i: 3, j: 4, f: a22[q: p2, r: p3]]];
bp1: BLP ¬ @t1;
bp2: BLP ¬ @t2;
bp3: BLP ¬ @t3;
IsT1equal: PROCEDURE [rec: T1, copy: T1, testnum: CARDINAL] = {
same: BOOLEAN ¬ FALSE;
same ¬
WITH r1: rec
SELECT
FROM
a1 =>
WITH r2: copy
SELECT
FROM
a1 => r1.c = r2.c,
ENDCASE => FALSE,
a2 =>
WITH r2: copy
SELECT
FROM
a2 => ((r1.i = r2.i)
AND (r1.j = r2.j)
AND
(WITH rr1: r1 SELECT FROM
a21 =>
WITH rr2: r2
SELECT
FROM
a21 => rr1.p = rr2.p,
ENDCASE => FALSE,
a22 =>
WITH rr2: r2
SELECT
FROM
a22 => ((rr1.q = rr2.q) AND (rr1.r = rr2.r)),
ENDCASE => FALSE,
ENDCASE => FALSE)),
ENDCASE => FALSE,
ENDCASE => FALSE;
IF ~same THEN XMesaProcs.PutFailMessage[testnum, "Mod I"];
};
XMesaProcs.PrintCR[];
XMesaProcs.PrintS["ModI compiler tests."L];
XMesaProcs.PrintCR[];
WITH t1
SELECT
FROM
d1: a1
T1 => {
IsT1equal[t1,d1,1000];
d1.c ¬ 102;};
d2: a2
T1 => {
IsT1equal[t1,d2,1001];
d2.i ¬ 5;
d2.j ¬ 6;
WITH d2
SELECT
FROM
d21: a21 a2 T1 => d21.p ¬ p4;
d22: a22 a2 T1 => { d22.q ¬ p5; d22.r ¬ p6};
ENDCASE;};
ENDCASE;
WITH r: t1
SELECT
FROM
a1 => XMesaProcs.IsCardequal[r.c, 101, 1002, "ModI"];
ENDCASE => XMesaProcs.PutFailMessage[1003, "Mod I"];
WITH t2
SELECT
FROM
d1: a1
T1 => {
IsT1equal[t2,d1,1004];
d1.c ¬ 102;};
d2: a2
T1 => {
IsT1equal[t2,d2,1005];
d2.i ¬ 5;
d2.j ¬ 6;
WITH d2
SELECT
FROM
d21: a21 a2 T1 => d21.p ¬ p4;
d22: a22 a2 T1 => { d22.q ¬ p5; d22.r ¬ p6};
ENDCASE;};
ENDCASE;
WITH r: t2
SELECT
FROM
a2 => {
XMesaProcs.Isequal[r.i, 1, 1006, "ModI"];
XMesaProcs.Isequal[r.j, 2, 1007, "ModI"];
WITH rr: r
SELECT
FROM
a21 => XMesaProcs.Ispointerequal[rr.p, p1, 1008, " ModI"];
ENDCASE => XMesaProcs.PutFailMessage[1009, "Mod I"];
};
ENDCASE => XMesaProcs.PutFailMessage[1010, "Mod I"];
WITH t3
SELECT
FROM
d1: a1
T1 => {
IsT1equal[t3,d1,1011];
d1.c ¬ 102;};
d2: a2
T1 => {
IsT1equal[t3,d2,1012];
d2.i ¬ 7;
d2.j ¬ 8;
WITH d2
SELECT
FROM
d21: a21 a2 T1 => d21.p ¬ p4;
d22: a22 a2 T1 => { d22.q ¬ p5; d22.r ¬ p6};
ENDCASE;};
ENDCASE;
WITH r: t3
SELECT
FROM
a2 => {
XMesaProcs.Isequal[r.i, 3, 1013, "ModI"];
XMesaProcs.Isequal[r.j, 4, 1014, "ModI"];
WITH rr: r
SELECT
FROM
a22 => {
XMesaProcs.Ispointerequal[rr.q, p2, 1015, " ModI"];
XMesaProcs.Ispointerequal[rr.r, p3, 1016, " ModI"];
};
ENDCASE => XMesaProcs.PutFailMessage[1017, "Mod I"];
};
ENDCASE => XMesaProcs.PutFailMessage[1018, "Mod I"];
WITH bp1
SELECT
FROM
cbp1:
LONG
POINTER
TO a1
T1 => {
XMesaProcs.Ispointerequal[bp1,cbp1,1050, " ModI"];
cbp1.c ¬ 152;
XMesaProcs.Ispointerequal[bp1,cbp1,1080, " ModI"];
};
cbp2:
LONG
POINTER
TO a2
T1 => {
XMesaProcs.Ispointerequal[bp1,cbp2,1051, " ModI"];
cbp2.i ¬ 55;
cbp2.j ¬ 56;
WITH cbp2
SELECT
FROM
cbp21: LONG POINTER TO a21 a2 T1 => cbp21.p ¬ p7;
cbp22: LONG POINTER TO a22 a2 T1 => { cbp22.q ¬ p8; cbp22.r ¬ p9};
ENDCASE;
XMesaProcs.Ispointerequal[bp1,cbp2,1080, " ModI"];
};
ENDCASE;
WITH r: bp1
SELECT
FROM
a1 => XMesaProcs.IsCardequal[r.c, 152, 1052, "ModI"];
ENDCASE => XMesaProcs.PutFailMessage[1053, "Mod I"];
WITH bp2
SELECT
FROM
cbp1:
LONG
POINTER
TO a1
T1 => {
XMesaProcs.Ispointerequal[bp2,cbp1,1054, " ModI"];
cbp1.c ¬ 152;
XMesaProcs.Ispointerequal[bp2,cbp1,1084, " ModI"];
};
cbp2:
LONG
POINTER
TO a2
T1 => {
XMesaProcs.Ispointerequal[bp2,cbp2,1055, " ModI"];
cbp2.i ¬ 55;
cbp2.j ¬ 56;
WITH cbp2
SELECT
FROM
cbp21: LONG POINTER TO a21 a2 T1 => cbp21.p ¬ p7;
cbp22: LONG POINTER TO a22 a2 T1 => { cbp22.q ¬ p8; cbp22.r ¬ p9};
ENDCASE;
XMesaProcs.Ispointerequal[bp2,cbp2,1085, " ModI"];
};
ENDCASE;
WITH r: bp2
SELECT
FROM
a2 => {
XMesaProcs.Isequal[r.i, 55, 1056, "ModI"];
XMesaProcs.Isequal[r.j, 56, 1057, "ModI"];
WITH rr: r
SELECT
FROM
a21 => XMesaProcs.Ispointerequal[rr.p, p7, 1058, " ModI"];
ENDCASE => XMesaProcs.PutFailMessage[1059, "Mod I"];
};
ENDCASE => XMesaProcs.PutFailMessage[1060, "Mod I"];
WITH bp3
SELECT
FROM
cbp1:
LONG
POINTER
TO a1
T1 => {
XMesaProcs.Ispointerequal[bp3,cbp1,1061, " ModI"];
cbp1.c ¬ 152;
XMesaProcs.Ispointerequal[bp3,cbp1,1091, " ModI"];
};
cbp2:
LONG
POINTER
TO a2
T1 => {
XMesaProcs.Ispointerequal[bp3,cbp2,1062, " ModI"];
cbp2.i ¬ 57;
cbp2.j ¬ 58;
WITH cbp2
SELECT
FROM
cbp21: LONG POINTER TO a21 a2 T1 => cbp21.p ¬ p7;
cbp22: LONG POINTER TO a22 a2 T1 => { cbp22.q ¬ p8; cbp22.r ¬ p9};
ENDCASE;
XMesaProcs.Ispointerequal[bp3,cbp2,1092, " ModI"];
};
ENDCASE;
WITH r: bp3
SELECT
FROM
a2 => {
XMesaProcs.Isequal[r.i, 57, 1063, "ModI"];
XMesaProcs.Isequal[r.j, 58, 1064, "ModI"];
WITH rr: r
SELECT
FROM
a22 => {
XMesaProcs.Ispointerequal[rr.q, p8, 1065, " ModI"];
XMesaProcs.Ispointerequal[rr.r, p9, 1066, " ModI"];
};
ENDCASE => XMesaProcs.PutFailMessage[1067, "Mod I"];
};
ENDCASE => XMesaProcs.PutFailMessage[1068, "Mod I"];
XMesaProcs.PrintS["Done."];
};
mainline
RunRegressions.RegisterTest[XMesaCall14, "test14"];