WPDirectoryImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Doug Terry, July 13, 1987 5:51:12 pm PDT
WPDirectoryImpl:
CEDAR
PROGRAM
IMPORTS Rope, FinchSmarts, FinchTool, IO, MBQueue, NodeProps, TiogaButtons, TiogaOps, ViewerTools, VoiceUtils
EXPORTS WPDirectory = {
ROPE: TYPE ~ Rope.ROPE;
Entry: TYPE ~ WPDirectory.Entry;
Cursor: TYPE ~ WPDirectory.ComplexCursor;
AttributePatterns: TYPE ~ WPDirectory.AttributePatterns;
Operations on entries
tName: LoganBerry.AttributeType = $name;
tRname: LoganBerry.AttributeType = $rname;
tOffice: LoganBerry.AttributeType = $officenumber;
tHome: LoganBerry.AttributeType = $homenumber;
tRemarks: LoganBerry.AttributeType = $remarks;
GetName:
PUBLIC PROC [entry: Entry]
RETURNS [
ROPE] ~ {
RETURN[GetAttributeValue[entry, tName]];
};
GetRName:
PUBLIC PROC [entry: Entry]
RETURNS [
ROPE] ~ {
RETURN[GetAttributeValue[entry, tRname]];
};
GetHomePhone:
PUBLIC PROC [entry: Entry]
RETURNS [
ROPE] ~ {
RETURN[GetAttributeValue[entry, tHome]];
};
GetOfficePhone:
PUBLIC PROC [entry: Entry]
RETURNS [
ROPE] ~ {
RETURN[GetAttributeValue[entry, tOffice]];
};
GetRemarks:
PUBLIC PROC [entry: Entry]
RETURNS [
ROPE] ~ {
RETURN[GetAttributeValue[entry, tRemarks]];
};
GetAttributeValue:
PROC [entry: LoganBerry.Entry, type: LoganBerry.AttributeType]
RETURNS [LoganBerry.AttributeValue] ~ {
FOR e: LoganBerry.Entry ← entry, e.rest
WHILE e #
NIL
DO
IF e.first.type = type
THEN
RETURN[e.first.value];
ENDLOOP;
RETURN[NIL];
};
}.