FILE: FuglemanImpl.mesa
Last Edited by Mitchell, August 16, 1982 2:01 pm
DIRECTORY
Fugleman;
FuglemanStdImpl: CEDAR PROGRAM
EXPORTS Fugleman =
BEGIN OPEN Fugleman;
Implementation types
Handle: TYPE = REF Rep; -- declare the concrete type locally
Rep: PUBLIC TYPE = RECORD[
count: INT,
flag: BOOLEANTRUE,
mumble: INT];
FugleFailure: PUBLIC ERROR = CODE;
NewFugleman: PUBLIC PROCEDURE RETURNS [Handle] = BEGIN
RETURN [NEW[Rep ← [count: 5, mumble: -10]]];
END;
Operations on a Fugleman
Print: PUBLIC PROCEDURE [h: Handle] = BEGIN
-- some body would go here
END;
Check: PUBLIC PROCEDURE [h: Handle] = BEGIN
IF h.count>100 OR h.mumble<0 AND NOT h.flag THEN ERROR FugleFailure; -- example only
END;
SomeProc: PUBLIC PROCEDURE [h: Handle, otherArgument: INT] RETURNS [r: INT] = BEGIN
IF otherArgument>100 THEN otherArgument ← 100;
h.count ← otherArgument;
r ← 17;
END;
END. -- FuglemanStdImpl
CHANGE LOG
Created by Mitchell: March 17, 1980 11:33 AM
Exemplary template
Changed by Horning: June 7, 1982 6:17 pm
Use Mesa.abbreviations
Changed by Horning: June 8, 1982 2:15 pm
Fix the use of the exported opaque type, add CEDAR prefix
Changed by Mitchell: August 15, 1982 8:55 pm
added needed declaration of FugleFailure
Changed by YourName: DateTime
DescriptionOfChange