TEditLocksPrivateImpl.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Edited by Paxton on October 11, 1982 10:27 am
Doug Wyatt, September 2, 1986 4:38:16 pm PDT
DIRECTORY
NodeProps USING [GetProp, NullCopy, NullRead, NullWrite, PutProp, Register],
TEditLocks USING [LockRecord, LockRef],
TEditLocksPrivate USING [],
TextNode USING [Node];
TEditLocksPrivateImpl: CEDAR MONITOR
IMPORTS NodeProps
EXPORTS TEditLocksPrivate
= BEGIN OPEN TEditLocks;
lastRoot: TextNode.Node ← NIL;
lastLock: LockRef ← NIL;
GetLock: PUBLIC ENTRY PROC [root: TextNode.Node] RETURNS [lock: LockRef] = {
ENABLE UNWIND => NULL;
IF root = NIL THEN RETURN [NIL];
IF root = lastRoot THEN RETURN [lastLock];
lastRoot ← root;
lock ← lastLock ← NARROW[NodeProps.GetProp[root, $DocumentLock]];
IF lastLock # NIL THEN RETURN;
lock ← lastLock ← NEW[LockRecord];
NodeProps.PutProp[root, $DocumentLock, lock];
};
NodeProps.Register[$DocumentLock, NodeProps.NullRead, NodeProps.NullWrite, NodeProps.NullCopy];
Don't copy document lock or big trouble.
END.