DIRECTORY Rope USING [Fetch, MakeRope, ROPE, Size], TextNode, TEditDocumentRope USING []; TEditDocumentRopeImpl: CEDAR PROGRAM IMPORTS Rope, TextNode EXPORTS TEditDocumentRope = BEGIN Fetch: PROC [data: REF, index: INT] RETURNS [CHAR] = { doc: TextNode.Ref ¬ NARROW[data]; loc: TextNode.Location = TextNode.LocRelative[[doc,0], index]; n: TextNode.RefTextNode = TextNode.NarrowToTextNode[loc.node]; IF n=NIL THEN ERROR; IF loc.where >= Rope.Size[n.rope] THEN RETURN ['\n]; RETURN [Rope.Fetch[n.rope, loc.where]] }; Create: PUBLIC PROC [doc: TextNode.Ref] RETURNS [r: Rope.ROPE] = { docSize: INT = TextNode.LocOffset[[doc,0], TextNode.LastLocWithin[doc]]; RETURN[Rope.MakeRope[base: doc, size: docSize, fetch: Fetch]]; }; END. δ TEditDocumentRopeImpl.mesa Copyright Σ 1985, 1991 by Xerox Corporation. All rights reserved. written by Bill Paxton. March 31, 1983 last written by Paxton. March 31, 1983 9:22 am Doug Wyatt, March 3, 1985 4:12:16 pm PST Κs•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ6™BKšœ&™&Kšœ.™.K™(—K˜šΟk ˜ Kšœžœžœ˜)Kšœ ˜ Kšœžœ˜—K˜KšΠblœžœž˜$Kšžœ˜Kšžœ˜Kšœž˜K˜š Οnœžœžœ žœžœžœ˜6Kšœžœ˜!K˜>K˜>Kšžœžœžœžœ˜Kšžœ žœžœ˜4Kšžœ ˜&Kšœ˜K˜—š  œžœžœžœ žœ˜BKšœ žœ<˜HKšžœ8˜>K˜K˜—K˜Kšžœ˜—…—ά3