RCMapEncode.mesa
Copyright Ó 1987, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) November 2, 1987 4:59:20 pm PST
DIRECTORY RCMap USING [Base, Index, Object];
RCMapEncode: DEFINITIONS = {
This set of routines provides a method for translating RCMap objects to/from a byte encoding suitable for file storage.
MapToDesc: PROC [base: RCMap.Base, first: RCMap.Index, text: REF TEXT]
RETURNS [REF TEXT];
Takes a base pointer, a starting RCMap.Index, and a buffer to use for the description, and produces a byte encoding of the information in the specified RC map.
DescToIndex: PROC [text: REF TEXT, uz: UNCOUNTED ZONE, lookup: LookupProc]
RETURNS [RCMap.Index];
Takes an RC map description produced by MapToDesc, a zone in which to perform allocations, and a lookup routine, and returns the RCMap.Index corresponding to the description according to the lookup routine.
This routine will allocate new RCMap.Object object using uz.NEW. If the lookup routine indicates that the object was previously seen then the object is freed (uz.FREE), otherwise the object is retained.
LookupProc: TYPE = PROC [rp: LONG POINTER TO RCMap.Object]
RETURNS [index: RCMap.Index, found: BOOL];
This is the type of a user-provided lookup routine for RCMap.Object. It takes a pointer to an RCMap.Object and determines the corresponding index for the object. If found = FALSE, then the index given is the index for the new object.
}.