TEditLocksPrivateImpl.mesa Edited by Paxton on October 11, 1982 10:27 am
DIRECTORY
TEditLocks,
TEditLocksPrivate,
TextNode,
NodeProps;
TEditLocksPrivateImpl: CEDAR MONITOR
IMPORTS NodeProps, TextNode
EXPORTS TEditLocksPrivate = BEGIN OPEN TEditLocks, TEditLocksPrivate;
lastRoot: TextNode.Ref;
lastLock: LockRef;
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 ← TextNode.pZone.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..