LoganBerryCommands.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Doug Terry, October 20, 1986 4:24:29 pm PDT
Operations used by LoganBerry CommandTool commands that may be of use to others (such as the LoganBerryBrowserTool).
DIRECTORY
IO USING [STREAM],
LoganBerry USING [Attribute, EntryProc, OpenDB],
Rope USING [ROPE];
LoganBerryCommands: CEDAR DEFINITIONS
~ BEGIN
Attribute patterns are lists of LoganBerry attributes that may optionally contain a pattern type. The currently supported types of patterns include "exact", "prefix", "wildcard", "reg. exp.", and "soundex" (see LoganQuery.mesa). The following data structure is the internal representation of an attribute pattern list. In addition, attribute patterns have an external (character string) representation that can be printed or typed in. A basic LoganBerry attribute is represented in the form:
 <attribute type>: <attribute value>
In this case, since a pattern is not explicitly specified, the value is taken to be the exact value of the attribute. That is, a missing pattern defaults to "exact". The attribute value may be either a token or a rope literal.

An explicit pattern type may be given in parenthesis immediately following the attribute type. Thus, an attribute pattern is given in the form
 <attribute type>(<pattern>): <attribute value>
Several of these may be concatenated together to get a list of attribute patterns. For example,
 Name: "Douglas B. Terry" Phone(prefix): 494-44 Office(wildcard): 35-2*
AttributePattern: TYPE = REF AttributePatternRec;
AttributePatternRec: TYPE = RECORD [
attr: LoganBerry.Attribute,
ptype: Rope.ROPENIL
];
AttributePatterns: TYPE = LIST OF AttributePattern;
SyntaxError: ERROR [explanation: Rope.ROPENIL];
ReadAttributePatterns: PROC [s: IO.STREAM] RETURNS [ap: AttributePatterns];
Reads an externalized list of attribute patterns from the given stream and builds the appropriate data structure. Raises ! SyntaxError if the stream does not contain a validly formed list of attributes.
WriteAttributePatterns: PROC [s: IO.STREAM, ap: AttributePatterns] RETURNS [];
Writes a list of attribute patterns to the given stream.
FilteredQuery: PROC [db: LoganBerry.OpenDB, patterns: AttributePatterns, proc: LoganBerry.EntryProc] RETURNS [];
Retrieves entries in the LoganBerry database that match the attribute patterns and calls the given procedure for each one.
END.
Doug Terry, October 20, 1986 4:24:29 pm PDT
changes to: DIRECTORY, LoganBerryCommands, ~