[ivy]<Satterthwaite>Modula>M2DImpl.mesa!4

FILE: M2DImpl.mesa
Modula-2 Data-Structure
Last Edited by: Gutknecht, September 18, 1985 0:13:55 am PDT
Satterthwaite December 10, 1985 10:04:03 am PST
DIRECTORY
M2D: TYPE USING [SET, WordSize, ModulePtr, StrPtr];
M2DImpl : CEDAR PROGRAM
EXPORTS M2D =
BEGIN OPEN M2D;
mainmod, sysmod: PUBLIC ModulePtr;
undftyp, booltyp, chartyp, inttyp, cardtyp, bitstyp, dbltyp, realtyp, lrltyp,
proctyp, stringtyp, notyp, addrtyp, wordtyp: PUBLIC StrPtr;
UNION: PUBLIC PROC [r, s: SET] RETURNS [R: SET] =
{ FOR i: CARDINAL IN [0..WordSize) DO
R[i] ← r[i] OR s[i];
ENDLOOP };
INTERSECTION: PUBLIC PROC [r, s: SET] RETURNS [R: SET] =
{ FOR i: CARDINAL IN [0..WordSize) DO
R[i] ← r[i] AND s[i];
ENDLOOP };
SETDIFF: PUBLIC PROC [r, s: SET] RETURNS [R: SET] =
{ FOR i: CARDINAL IN [0..WordSize) DO
R[i] ← r[i] AND NOT s[i];
ENDLOOP };
SYMMDIFF: PUBLIC PROC [r, s: SET] RETURNS [R: SET] =
{ FOR i: CARDINAL IN [0..WordSize) DO
R[i] ← r[i] # s[i];
ENDLOOP };
SUBSET: PUBLIC PROC [r, s: SET] RETURNS [B: BOOL] =
{ i: CARDINAL ← 0;
DO B ← NOT r[i] OR s[i];
IF NOT B OR (i = WordSize-1) THEN EXIT;
i ← i + 1
ENDLOOP };
InitData: PUBLIC PROC = { };-- forces START trap
END.