-- RopeEditingAlloc.mesa -- written by Bill Paxton, March 1981 -- last edit by Bill Paxton, December 22, 1981 10:06 am DIRECTORY RopeReader, Rope; RopeEditingAlloc: DEFINITIONS = BEGIN CharsArray: TYPE = RopeReader.CharsArray; Chars: TYPE = REF CharsArray; ROPE: TYPE = Rope.ROPE; AllocChars: PROC [len: NAT] RETURNS [chars: Chars, start: NAT, base: ROPE]; -- for use by routines in RopeFrom. not for general use. -- allocates room for len characters -- chars is the array to hold them starting at start -- base is rope pointing to the entire chars array AllocWords: PROC [nwords: NAT] RETURNS [chars: Chars, start: NAT, base: ROPE]; -- for use by routines in RopeFrom. not for general use. -- ensures that start is even, i.e., start on word boundary TryAllocAdjacent: PROC [base: ROPE, start: NAT, len: NAT] RETURNS [ok: BOOLEAN, chars: Chars]; -- for use by routines in RopeFrom. not for general use. -- if base is current CharsArray -- and start is current next free loc in base -- and there are at least len free chars remaining -- then allocates those chars and returns true -- these provide a cache of text buffers GetBlock: PROC RETURNS [blk: REF TEXT]; FreeBlock: PROC [blk: REF TEXT]; -- ***** Initialization Start: PROC; -- for initialization only END.