DIRECTORY Atom USING [PropList], Rope USING [ROPE], TEditFormat USING [LineBreak], Tioga USING [Node, Location, Looks, noLooks, CharSet, PropList], TiogaOpsDefs USING [SelectionGrain, WhichSelection], ViewerClasses USING [Viewer]; TEditDocument: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; TEditDocumentData: TYPE = REF TEditDocumentDataRec; TEditDocumentDataRec: TYPE = RECORD [ text: Tioga.Node, -- the underlying text data lineTable: LineTable, -- displayed line information clipLevel: ClipCount ¬ maxClip, -- controls level clipping for this viewer scrollGlitch: BOOL ¬ FALSE, -- if true then try to glitch when scroll scrollSelectionId: SelectionId ¬ primary, -- scroll to make this visible fixStart: BOOL ¬ FALSE, -- fix it so it starts after CR or at start of node readOnly: BOOL ¬ FALSE, -- user edits inhibited movedOut: BOOL ¬ FALSE, -- have moved nodes out of document since last screen refresh movedIn: BOOL ¬ FALSE, -- have moved nodes into document since last screen refresh dirty: BOOL ¬ FALSE, -- haven't refreshed since last edit invisible: BOOL ¬ FALSE, -- refresh won't happen because iconic or obscured or ... tsInfo: TSInfo ¬ NIL, -- special procs when in typescript mode lockProcess: PROCESS ¬ NIL, -- process holding lock on this data structure who: ROPE, -- who locked the tdd lock: [0..64) ¬ 0, -- locking for put/get/paints etc. interrupt: [0..64) ¬ 0, -- number of processes waiting for lock and asking for interrupt scroll: Scroll ¬ no, -- controls scrolling after refresh commentFilter: CommentFilter ¬ includeComments, -- controls showing of comment nodes propList: Atom.PropList ¬ NIL ]; SelectionId: TYPE = TiogaOpsDefs.WhichSelection; -- {primary, secondary, feedback} ClipCount: TYPE = [0..1024); -- use 10 bits for this maxClip: ClipCount = ClipCount.LAST; CommentFilter: TYPE = { includeComments, excludeComments, onlyComments }; Scroll: TYPE = { no, endofdoc, endofsel }; LineTable: TYPE = REF LineTableRec; LineTableRec: TYPE = RECORD [ lastLine: INTEGER ¬ 0, lastY: INTEGER ¬ 0, lines: SEQUENCE maxLines: INTEGER OF LineRec ]; LineRec: TYPE = PACKED RECORD [ pos: Tioga.Location, -- first character in line valid: BOOL ¬ TRUE, -- metrics valid for this line end: LineBreak ¬ eon, -- reason for line break ascent: NAT ¬ 0, -- dy above baseline descent: NAT ¬ 0, -- dy below baseline nChars: NAT ¬ 0, -- number of characters in line yOffset: INTEGER ¬ 0, -- baseline from top of viewer xOffset: INTEGER ¬ 0, -- line offset from left edge of viewer width: INTEGER ¬ 0 -- width of displayed bits ]; maxAscent: NAT ~ NAT.LAST; maxDescent: NAT ~ NAT.LAST; LineBreak: TYPE = TEditFormat.LineBreak; -- { eon, cr, wrap } ttyChars: CARDINAL = 128; TSInfo: TYPE = REF TSInfoRec; TSInfoRec: TYPE = RECORD [ iIncr: CONDITION, -- raised whenever add to input looks: Tioga.Looks ¬ Tioga.noLooks, -- for PutChar charSet: Tioga.CharSet ¬ 0, charProps: Tioga.PropList ¬ NIL, inputRope: ROPE, -- for overflow from input array inputLoc: INT ¬ 0, -- index of next char to read from rope input: PACKED ARRAY [0..ttyChars) OF CHAR, iQp, oQp: [0..ttyChars) ¬ 0, -- read and write indexes for input buffer intParam: INT, -- parameter from TIP waitingInGetChar: BOOL ¬ FALSE, abort: BOOL ¬ FALSE ]; Selection: TYPE = REF SelectionRec; SelectionRec: TYPE = RECORD [ viewer: ViewerClasses.Viewer, data: TEditDocumentData, start: SelectionPoint, end: SelectionPoint, caretX, caretY: INTEGER, granularity: SelectionGrain, punctuation: PunctuationPosition, -- whether spaces are part of the selection insertion: BeforeAfter, looks: Tioga.Looks ¬ Tioga.noLooks, -- caret looks pendingDelete: BOOL ¬ FALSE -- Laurel-style pending deletion of selection ]; SelectionPoint: TYPE = RECORD [ pos: Tioga.Location, line: INTEGER ¬ 0, x: INTEGER ¬ 0, y: INTEGER ¬ 0, w: INTEGER ¬ 0, h: INTEGER ¬ 0, clipped: BOOL ¬ FALSE, metricsValid: BOOL ¬ FALSE ]; SelectionGrain: TYPE = TiogaOpsDefs.SelectionGrain; -- {point, char, word, node, branch} PunctuationPosition: TYPE = {none, leading, trailing} ¬ none; BeforeAfter: TYPE = {before, after} ¬ before; fatalTiogaError: ERROR; SpinAndLock: PROC [tdd: TEditDocumentData, who: ROPE, interrupt, defer: BOOL ¬ FALSE] RETURNS [ok: BOOL]; Unlock: PROC [tdd: TEditDocumentData]; RecordViewerForRoot: PROC [viewer: ViewerClasses.Viewer, root: Tioga.Node]; ForgetViewer: PROC [viewer: ViewerClasses.Viewer]; GetViewerForRoot: PROC [root: Tioga.Node] RETURNS [viewer: ViewerClasses.Viewer]; END.   TEditDocument.mesa Copyright Σ 1985, 1986, 1989, 1991 by Xerox Corporation. All rights reserved. Edited by Paxton on December 28, 1982 2:07 pm Michael Plass, October 4, 1989 1:24:59 am PDT Doug Wyatt, February 27, 1992 5:53 pm PST display refresh will terminate if notices interrupt > 0 size of input buffer for TS; overflow goes to rope if caller is not the original locking process, waits for other process to unlock first if interrupt is true, increments tdd.interrupt to ask repaint of viewer to terminate if defer is true and interrupt is true and tdd.interrupt > 0, returns false without locking. give up the lock remove this from the root => viewer mapping ΚΟ–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ ΟeœC™NKšœ-™-K™-K™)—K˜šΟk ˜ Kšœžœ ˜Kšœžœžœ˜Kšœ žœ ˜Kšœžœ5˜@Kšœ žœ"˜4Kšœžœ ˜—K˜KšΟn œžœž œž˜(K˜Kšžœžœžœ˜K˜Kšœžœžœ˜3šœžœžœ˜%KšœΟc˜-Kšœ ˜3Kšœ  *˜JKšœžœžœ )˜EKšœ* ˜HKšœ žœžœ 3˜KKšœ žœžœ ˜/Kšœ žœžœ =˜UKšœ žœžœ ;˜RKšœžœžœ $˜9Kšœ žœžœ 9˜RKšœžœ (˜>Kšœ žœžœ .˜JKšœžœ ˜!Kšœ "˜5šœ @˜XKšœ7™7—Kšœ #˜9Kšœ0 $˜TKšœž˜K˜K˜—Kšœ žœ  !˜RK˜Kšœ žœ ˜4Kšœžœ˜$K˜Kšœžœ6˜IKšœžœ˜*K˜Kšœ žœžœ˜#šœžœžœ˜Kšœ žœ˜Kšœžœ˜Kšœžœ žœžœ˜,K˜K˜—šœ žœžœžœ˜Kšœ ˜/Kšœžœžœ ˜2Kšœ ˜.Kšœžœ ˜%Kšœ žœ ˜&Kšœžœ ˜0Kšœ žœ ˜4Kšœ žœ '˜=Kšœžœ ˜-K˜K˜—Kšœ žœžœžœ˜šœ žœžœžœ˜K˜—Kšœ žœ ˜=K˜šœ žœ˜Kšœ2™2—K˜Kšœžœžœ ˜šœ žœžœ˜Kšœž œ ˜1Kšœ$ ˜2Kšœ˜Kšœžœ˜ Kšœ žœ  ˜1Kšœ žœ '˜:Kš œžœžœžœžœ˜*Kšœ *˜GKšœ žœ ˜$Kšœžœžœ˜Kšœžœž˜K˜K˜—Kšœ žœžœ˜#šœžœžœ˜K˜K˜K˜K˜Kšœžœ˜K˜Kšœ" +˜MK˜Kšœ$ ˜2Kšœžœžœ -˜IK˜K˜—šœžœžœ˜K˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ žœžœ˜Kšœžœž˜Kšœ˜K˜—Kšœžœ  $˜XK˜Kšœžœ$˜=K˜Kšœ žœ˜-K˜Kšœžœ˜K˜šŸ œžœžœžœžœžœžœ˜jKšœV™VKšœT™TKšœ\™\—K˜šŸœžœ˜&Kšœ™—K˜KšŸœžœ2˜KK˜šŸ œžœ ˜2Kšœ+™+K˜—šŸœžœžœ ˜QK˜—K˜Kšžœ˜—…—rα