DIRECTORY RunRegressions, XMesaProcs; XMesaCmplr3: PROGRAM IMPORTS RunRegressions, XMesaProcs = BEGIN filename: LONG STRING ¬ "XMesaCmplr3"L; XMesaCall3: PROCEDURE = { XMesaProcs.PrintS[filename]; XMesaProcs.PrintCR; XMesa3a[]; --assignment , IF statements Xmesa3b[]; --IF expressions Xmesa3c[]; --SELECT statements,expressions Xmesa3d[]; --BLOCKs Xmesa3e[]; --LOOPs XMesaProcs.PrintS["Done"L]; XMesaProcs.PrintCR; }; --end of XMesaCall3 XMesa3a: PROCEDURE = { --assignment , IF statements r: RECORD [a, b, c, d: INTEGER ¬ 0]; e: INTEGER ¬ 5; new, old: INTEGER; array: ARRAY [0..10] OF INTEGER ¬ ALL[0]; f, g: BOOL; r.a ¬ r.b ¬ r.c ¬ r.d ¬ e; XMesaProcs.Isboolequal[r = [5, 5, 5, 5], TRUE, 1700, filename]; new ¬ 0; FOR new IN [0..9] DO array[new ¬ new + 1] ¬ 5; ENDLOOP; new ¬ 1; XMesaProcs.Isequal[array[new], 5, 1710, filename]; new ¬ 3; XMesaProcs.Isequal[array[new], 5, 1712, filename]; new ¬ 5; XMesaProcs.Isequal[array[new], 5, 1712, filename]; new ¬ 7; XMesaProcs.Isequal[array[new], 5, 1712, filename]; new ¬ 9; XMesaProcs.Isequal[array[new], 5, 1712, filename]; new ¬ 5; f ¬ TRUE; g ¬ FALSE; IF new # 5 THEN XMesaProcs.PutFailMessage[1720, filename]; IF f # TRUE THEN XMesaProcs.PutFailMessage[1721, filename]; IF g # FALSE THEN XMesaProcs.PutFailMessage[1722, filename]; IF (g = TRUE) OR (new = 5) THEN new ¬ 5 ELSE XMesaProcs.PutFailMessage[1740, filename]; IF new = 6 THEN XMesaProcs.PutFailMessage[1750, filename]; IF new >= 0 THEN IF new > 0 THEN old ¬ 1 ELSE old ¬ 0; XMesaProcs.Isequal[old, 1, 1760, filename]; }; Xmesa3b: PROCEDURE = { --IF expressions x, y, z: INTEGER ¬ 5; a, b, c: INTEGER ¬ 10; x ¬ IF y = 0 THEN a / b ELSE a / y; XMesaProcs.Isnotequal[x, 1, 1770, filename]; x ¬ IF y >= 0 THEN (IF y > 0 THEN 1 ELSE 0) ELSE -1; XMesaProcs.Isequal[x, 1, 1780, filename]; y ¬ 0; x ¬ IF y >= 0 THEN (IF y > 0 THEN 1 ELSE 0) ELSE -1; XMesaProcs.Isequal[x, 0, 1790, filename]; y ¬ -5; x ¬ IF y >= 0 THEN (IF y > 0 THEN 1 ELSE 0) ELSE -1; XMesaProcs.Isequal[x, -1, 1800, filename]; }; Xmesa3c: PROCEDURE = { --SELECT statements x, y, z: INTEGER; a, b, c: CHAR; x ¬ 8; SELECT x FROM = 0 => XMesaProcs.PutFailMessage[1810, filename]; = 8 => NULL; IN [0..10] => NULL; ENDCASE; x ¬ 10; y ¬ 6; z ¬ 3; SELECT x + y - z FROM IN [0..20] => NULL; 0 => XMesaProcs.PutFailMessage[1850, filename]; ENDCASE => XMesaProcs.PutFailMessage[1860, filename]; a ¬ 'A; b ¬ 'B; c ¬ 'C; SELECT a FROM 'A => NULL; IN ['A..'Z] => NULL; 'B => XMesaProcs.PutFailMessage[1890, filename]; ENDCASE; SELECT (a = 'A) AND (b = 'C) FROM TRUE => XMesaProcs.PutFailMessage[1900, filename]; FALSE => NULL; ENDCASE; x ¬ 0; SELECT a FROM IN ['A..'Z] => x ¬ x + 1; IN ['a..'z] => NULL; ENDCASE; XMesaProcs.Isequal[x, 1, 1920, filename]; x ¬ 0; x ¬ SELECT (y + z) FROM IN [0..10] => x + 1, = 9 => x + 1, = 10 => 99, ENDCASE => x + 1; XMesaProcs.Isequal[x, 1, 1930, filename]; }; Xmesa3d: PROCEDURE = { --BLOCKS input: RECORD [ status: {open, closed}, fileHandle: {default, null}, fileNumber: INTEGER]; x: INTEGER ¬ 0; y: INTEGER ¬ 1; IF y > x THEN BEGIN x ¬ 2; END; XMesaProcs.Isequal[x, 2, 1940, filename]; input ¬ [closed, null, 5]; IF input.status # open THEN BEGIN x ¬ 1234; IF input.fileHandle = null THEN GOTO usefileHandle; x ¬ 4321; EXITS usefileHandle => y ¬ 1234; END; XMesaProcs.Isequal[y, 1234, 1950, filename]; XMesaProcs.Isequal[x, 1234, 1960, filename]; IF input.status # open THEN BEGIN IF input.fileHandle = default THEN GOTO usefileHandle; x ¬ 5678; IF input.fileNumber = 5 THEN BEGIN IF x = 5678 THEN GOTO useexit; END; EXITS usefileHandle => XMesaProcs.PutFailMessage[1970, filename]; useexit => NULL; END; }; Xmesa3e: PROCEDURE = { --LOOP's m: INTEGER ¬ 100; n: INTEGER ¬ 28; i: INTEGER ¬ 0; r: INTEGER; y: INTEGER; vec: ARRAY [0..9] OF INTEGER ¬ ALL[0]; low: INTEGER ¬ 5; high: INTEGER ¬ 20; NodeLink: TYPE = POINTER TO Node; node, headOfList: NodeLink; Node: TYPE = RECORD [value: INTEGER, next: NodeLink]; node1, node2, node3, node4: Node; interest: BOOL ¬ FALSE; vec[0] ¬ 0; vec[1] ¬ 1; vec[2] ¬ 2; vec[3] ¬ 3; vec[4] ¬ 4; vec[5] ¬ 5; vec[6] ¬ 6; vec[7] ¬ 7; vec[8] ¬ 8; vec[9] ¬ 9; UNTIL n = 0 DO r ¬ m MOD n; m ¬ n; n ¬ r; i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 4, 1990, filename]; m ¬ 100; n ¬ 0; i ¬ 0; UNTIL n = 0 DO i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 0, 2000, filename]; m ¬ 100; n ¬ 28; i ¬ 0; WHILE n > 0 DO n ¬ n - 1; i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 28, 2010, filename]; n ¬ -28; i ¬ 0; WHILE n > 0 DO n ¬ n - 1; i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 0, 2020, filename]; FOR i IN [1..LENGTH[vec]] DO IF i < 10 THEN vec[i - 1] ¬ vec[i]; ENDLOOP; XMesaProcs.Isequal[vec[0], 1, 2030, filename]; XMesaProcs.Isequal[vec[4], 5, 2040, filename]; XMesaProcs.Isequal[vec[9], 9, 2050, filename]; XMesaProcs.Isnotequal[vec[3], 3, 2060, filename]; FOR i DECREASING IN [1..LENGTH[vec]] DO IF i < 10 THEN vec[i] ¬ vec[i - 1]; ENDLOOP; XMesaProcs.Isequal[vec[0], 1, 2070, filename]; XMesaProcs.Isequal[vec[1], 1, 2080, filename]; XMesaProcs.Isequal[vec[2], 2, 2090, filename]; i ¬ 9; y ¬ 0; THROUGH [low..high] WHILE vec[i] > 0 DO y ¬ y + 1; ENDLOOP; XMesaProcs.Isequal[y, 16, 2110, filename]; high ¬ 10; i ¬ 9; THROUGH [low..high] WHILE vec[i] > 0 DO i ¬ i - 1; y ¬ y + 1; ENDLOOP; XMesaProcs.Isequal[i, 3, 2120, filename]; headOfList ¬ @node1; node1 ¬ Node[1, @node2]; node2 ¬ Node[2, @node3]; node3 ¬ Node[3, @node4]; node4 ¬ Node[4, NIL]; i ¬ 0; FOR node ¬ headOfList, node.next UNTIL node = NIL DO i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 4, 2130, filename]; i ¬ 0; interest ¬ TRUE; FOR y IN [0..9] DO i ¬ i + 1; IF i = 5 THEN interest ¬ FALSE; IF ~interest THEN LOOP; ENDLOOP; XMesaProcs.Isequal[i, 10, 2140, filename]; XMesaProcs.Isequal[y, 9, 2145, filename]; i ¬ 1; DO IF i >= 10 THEN GOTO quit; i ¬ i + 1; REPEAT quit => NULL; ENDLOOP; XMesaProcs.Isequal[i, 10, 2150, filename]; i ¬ 0; DO IF i >= 5 THEN EXIT; i ¬ i + 1; ENDLOOP; XMesaProcs.Isequal[i, 5, 2160, filename]; }; RunRegressions.RegisterTest[XMesaCall3, "test3"]; END... < File: XMesaCmplr3.mesa - created by MW. Last edit: JKF 23-Jul-87 13:05:36 MW 24-Mar-87 10:36:22 Jim Foote February 3, 1988 3:47:36 pm PST Mna, April 17, 1991 5:37 pm PDT Copyright (C) 1987 by Xerox Corporation. All rights reserved. ordinary statements IF statements mainline Ê$•NewlineDelimiter ™J™2J™&J™'J™)J™J˜J™=J˜J™J˜šÏk ˜ J˜J˜ J˜J˜—šÏn œœœ˜9Jš˜Jšœ œœ˜'J˜Jšž œ œ˜˜J˜J˜Jšœ Ïc˜(Jšœ Ÿ˜Jšœ Ÿ˜+Jšœ Ÿ˜Jšœ Ÿ˜J˜J˜J˜JšœŸ˜J˜—šžœ œŸ˜4Jšœœœ˜%Jšœœ˜Jšœ œ˜Jš œœ œœœ˜)Jšœœ˜ J˜Jšœ)œ˜AJ˜J˜Jšœœœœ˜7J˜J˜J˜2J˜J˜2J˜J˜2J˜J˜2J˜J˜2J˜J˜J™ J˜J˜Jšœœ˜ Jšœœ˜ Jšœ œ+˜:Jšœœœ+˜;Jšœœœ+˜