<> <> <> <> DIRECTORY Pipal, PipalInt, PipalReal; PipalTextMutant: CEDAR DEFINITIONS = BEGIN <> <> <> pipalTextClass: Pipal.Class; PipalText: TYPE = REF PipalTextRec; PipalTextRec: TYPE = RECORD [ rope: Pipal.ROPE _ NIL, size: PipalReal.Size _ PipalReal.emptySize]; Location: TYPE = INT; CreatePipalText: PROC [rope: Pipal.ROPE, size: PipalReal.Size _ PipalReal.emptySize] RETURNS [text: PipalText]; GetIntervalArea: PROC [text: PipalText, interval: PipalInt.Interval] RETURNS [rectangle: PipalReal.Rectangle]; <> GetSelectionInterval: PROC [text: PipalText, position: PipalReal.Position, grain: SelectionGrain] RETURNS [interval: PipalInt.Interval, closerRight: BOOL]; <> <> textMutantClass: Pipal.Class; TextMutant: TYPE = REF TextMutantRec; TextMutantRec: TYPE = RECORD [ text: PipalText, selections: ARRAY Selections OF Selection, paste: Pipal.ROPE _ NIL]; Selections: TYPE = {primary, secondary}; Selection: TYPE = RECORD [ valid: BOOL _ FALSE, interval: PipalInt.Interval _ [0, 0], pendingDelete: BOOL _ FALSE, caretAfter: BOOL _ FALSE, -- invariant: caretAfter => interval.base interval.size=0 SelectionGrain: TYPE = {point, char, word}; <> InsertRope: PROC [tm: TextMutant, characters: Pipal.ROPE] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> InsertChar: PROC [tm: TextMutant, character: CHAR] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> Copy: PROC [tm: TextMutant] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> Transpose: PROC [tm: TextMutant] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> Delete: PROC [tm: TextMutant] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> Paste: PROC [tm: TextMutant] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> Erase: PROC [tm: TextMutant] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> <> <> SetSelection: PROC [tm: TextMutant, interval: PipalInt.Interval, selection: Selections _ primary, pendingDelete: BOOL _ FALSE, caretAfter: BOOL _ FALSE, granularity: SelectionGrain _ char] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; CancelSelection: PROC [tm: TextMutant, selection: Selections _ primary] RETURNS [message: Pipal.ROPE, changed: PipalInt.Interval, newtm: TextMutant]; <> END.