-- file: ProtectionDefs.mesa
-- edited by McCreight September 11, 1980 10:24 AM
-- edited by Brotz November 19, 1981 11:46 AM

DIRECTORY
prA: FROM "ProtectionAbstractions" USING [ProtectedFieldPtr],
vmD: FROM "VirtualMgrDefs" USING [CharIndex, MessageRange];

prD: DEFINITIONS =

BEGIN

-- Purpose: governs protected fields of messages by preventing the selector from
-- selecting into a protected field.


ProtectionBug: SIGNAL;


FindUnprotectedSubrange: PROCEDURE [pfp: prA.ProtectedFieldPtr,
rangePtr: POINTER TO vmD.MessageRange, fixStart: BOOLEAN ← TRUE];
-- Restricts range to
-- lie within an unprotected field. fixStart=TRUE causes the restriction to
-- be limited to that unprotected field in which the range start lies; otherwise
-- the restriction is limited to that unprotected field in which the range end
-- lies.


AdjustProtFields: PROCEDURE [pfpp: POINTER TO prA.ProtectedFieldPtr,
actionIndex: vmD.CharIndex, deletedChars, insertedChars: CARDINAL];
-- Adjusts the indexes of protected fields to reflect an editing
-- operation. Signals ProtectionBug if the editing operation overlapped
-- a protected field.


ProtectNewField: PROCEDURE [pfpp: POINTER TO prA.ProtectedFieldPtr,
range: vmD.MessageRange];
-- Protects a new field. If this field overlaps with an existing protected
-- field, the existing field is stretched. If it overlaps with multiple existing
-- protected fields, they are merged.


InitProtection: PROCEDURE [pfpp: POINTER TO prA.ProtectedFieldPtr];
-- Sets protected fields to empty.


UnprotectAllFields: PROCEDURE [pfpp: POINTER TO prA.ProtectedFieldPtr];
-- Removes all protection and reclaims the storage for the
-- field protectors.


END. -- of ProtectionDefs --