File: DBIcons.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Implemented By: DBIconsImpl
Last edited by
Widom, June 18, 1984 8:55:28 am PDT
Donahue, June 17, 1985 9:00:10 am PDT
DIRECTORY
DB,
Icons USING [IconFlavor],
IO USING[STREAM],
Rope USING [ROPE];
DBIcons: CEDAR DEFINITIONS = BEGIN
EstablishIconDB: PROC [file: Rope.ROPE];
Close:
PROC[];
Close the database connection. When the next interrogation or update operation occurs, the database will be reopened (and the cache flushed, if necessary).
IconDB: READONLY Rope.ROPE;
defaultDatabase: Rope.
ROPE;
The default database to be used if no user profile entry for "Icons.Segment" exists
readOnly: READONLY BOOLEAN;
Failed: ERROR [why: Failure, reason: Rope.ROPE];
Failure: TYPE = {badSegment, noSuchIcon, fileNotFound, invalidIndex};
RegisterIcon:
PROC [iconName: Rope.
ROPE, fileName: Rope.
ROPE, index:
CARDINAL];
The file name provided can be either a full path name or a simple name. The simple names are interpreted relative to the working directory from which DBIconsImpl was run.
Registration:
PROC[iconName: Rope.
ROPE]
RETURNS[file: Rope.
ROPE, index:
CARDINAL];
Return the registration information for the named icon
Exists:
PROC[iconName: Rope.
ROPE]
RETURNS[yes:
BOOL];
Does the icon currently exist in the database
GetIcon:
PROC [iconName: Rope.
ROPE, default: Icons.IconFlavor ← unInit]
RETURNS [Icons.IconFlavor];
GetIcon uses the icon name to attempt to find a registration. If it finds one, the search rules are used to find the file in which the icon resides and then Icons.NewIconFromFile is used to create a new icon. If the icon has been previously fetched, then GetIcon will simply return the icon flavor found in the cache (unless, of course, the cache has been flushed!) InvalidIcon will be raised if either the icon name doesn't exist or the file cannot be found
FlushCache:
PROC [iconName: Rope.
ROPE ←
NIL];
If iconName is NIL, the entire cache is flushed
WriteCatalogue: PROC[ file: Rope.ROPE ];
ReadCatalogue: PROC[ file: Rope.ROPE, errlog: IO.STREAM ← NIL ];
END.