CDRemote.mesa (part of ChipNDale)
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, June 5, 1985 8:02:35 pm PDT
Last edited by: Christian Jacobi, October 20, 1986 12:51:12 pm PDT
DIRECTORY
CD,
CDGenerate,
Rope;
CDRemote: CEDAR DEFINITIONS =
BEGIN
This module implements transfering (copying) objects from one design into an other.
Transfered objects are cached; Transfering two objects in the same ChipNDale session (while the design stays in memory) will not create duplicate copies of the children objects. To guarantee correct cacheing, a copy of the source design is needed and the source design is specified with its name only.
GetContext: PROC [remoteDesign: Rope.ROPE] RETURNS [CDGenerate.Context];
--Creates a generator context, "generating" = fetching an object from the remote design.
--Generating objects with the context will cause reading remoteDesign if it
--is not loaded; the design read will then be cached for the destination design.
DesignName: PROC [context: CDGenerate.Context] RETURNS [Rope.ROPE];
--Returns design name of remote design, if context was generated using GetContext
Get: PROC [for: CD.Design, remoteDesign: Rope.ROPE, object: Rope.ROPE] RETURNS [CD.Object];
--Transferes object (and its children) from other remoteDesign.
--Reads remoteDesign if necessary.
--Returns NIL if object not found.
IsCached: PROC [for: CD.Design, remoteDesign: Rope.ROPE] RETURNS [BOOL];
--returns whether a version of remoteDesign is cached for "for"
ForgetCache: PROC [for: CD.Design, remoteDesign: Rope.ROPE];
--forgets cacheing of remoteDesign
LoadCache: PROC [for: CD.Design, remoteDesign: Rope.ROPE, remoteFile: Rope.ROPE NIL, reload: BOOLFALSE] RETURNS [loaded: BOOL];
--loads remoteDesign into cache
--remoteFilefile name; make up name if NIL
--reload
-- if true: discards previous cache contents
-- if false: skips loading if remoteDesign is already cached
MakupName: PROC [for: CD.Design, remoteDesign: Rope.ROPE] RETURNS [Rope.ROPE];
--checks whether for wants a special file name to be used for remoteDesign
--returns remoteDesign if no file name could be made up
--might use properties, user profile, or magic to find a name
CacheDesign: PRIVATE PROC [for: CD.Design, remote: CD.Design];
--caller MUST guarantee: remote will NEVER be changed
-- (but a different design with the same name might be cached later...)
--CDRemote guarantees: it will never change remote
FetchDesign: PRIVATE PROC [for: CD.Design, name: Rope.ROPE] RETURNS [remote: CD.Design];
--NIL if no design cached
--caller MUST guarantee: caller will NEVER change remote
--CDRemote guarantees: CDRemote will never change remote
-- (but a different design with the same name might be cached later...)
END.