TEditLocksPrivateImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Edited by Paxton on October 11, 1982 10:27 am
Doug Wyatt, March 3, 1985 6:05:24 pm PST
DIRECTORY
TEditLocks,
TEditLocksPrivate,
TextNode,
NodeProps;
TEditLocksPrivateImpl: CEDAR MONITOR
IMPORTS NodeProps
EXPORTS TEditLocksPrivate
= BEGIN OPEN TEditLocks;
lastRoot: TextNode.Ref ← NIL;
lastLock: LockRef ← NIL;
GetLock: PUBLIC ENTRY PROC [root: TextNode.Ref] 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.