<> <> <> <> <<>> DIRECTORY WPDirectory; 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; <> <> <<(): ... { at { home | office } } { in }>> <> < is taken to be:>> <<"officenumber" if starts with a digit and "at home" is not specified,>> <<"homenumber" if starts with a digit and "at home" is specified,>> <<"rname" if does not start with a digit but contains a ".",>> <<"name" if does not start with a digit and contains no ".".>> < is taken to be:>> <<"SimpleDWIM" (without subrange or date parsing).>> < is taken to be:>> <> <> <> <> <> 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]; }; }.