CharDisplays:
CEDAR
DEFINITIONS = {
ROPE: TYPE = Rope.ROPE;
Viewer: TYPE = ViewerClasses.Viewer;
CharDisplay: TYPE = REF CharDisplayRep;
CharDisplayRep:
TYPE =
RECORD [
class: CharDisplayClass,
det: DisplayDetails,
name: ROPE,
viewer: Viewer ← NIL,
fromDisplay: IO.STREAM ← NIL,
line, col: INT ← 0,
modes: Modes,
otherInstanceData: REF ANY ← NIL];
DisplayDetails:
TYPE =
RECORD [
lines: NAT ← 24,
columns: NAT ← 80,
autoMargins: BOOL ← TRUE];
CharDisplayClass: TYPE = REF CharDisplayClassRep;
CharDisplayClassRep:
TYPE =
RECORD [
name: ROPE,
Init: PROC [cd: CharDisplay, initData: REF ANY],
DeleteChar: PROC [cd: CharDisplay],
TakeChar: PROC [cd: CharDisplay, char: CHAR],
CursorMove: PROC [cd: CharDisplay, line, col: INT, relative: BOOL ← FALSE, doLine, doCol: BOOL ← TRUE],
Line:
PROC [cd: CharDisplay, insert:
BOOL],
Insert/Delete
ClearTo: PROC [cd: CharDisplay, where: Where],
ClearAll: PROC [cd: CharDisplay],
SetMode: PROC [cd: CharDisplay, mode: Mode, on: BOOL],
Emphasize:
PROC [cd: CharDisplay, emph: Emph, on:
BOOL],
Apply to char at cursor
Flash: PROC [cd: CharDisplay]
];
Where: TYPE = {EndOfLine, EndOfScreen};
Mode: TYPE = {insertChar, underline, standout};
Modes: TYPE = ARRAY Mode OF BoolDefaultsFalse;
BoolDefaultsFalse: TYPE = BOOL ← FALSE;
Emph: TYPE = Mode[underline .. standout];
EmphOp: TYPE = {add, subtract, set};
GetClass: PROC [name: ROPE] RETURNS [cdc: CharDisplayClass];
RegClass: PROC [cdc: CharDisplayClass];
Create: PROC [class: CharDisplayClass, name: ROPE ← NIL, det: DisplayDetails ← [], initData: REF ANY ← NIL] RETURNS [cd: CharDisplay];
Split: PROC [l: CharDisplayList, name: ROPE ← NIL] RETURNS [s: CharDisplay];
CharDisplayList: TYPE = LIST OF CharDisplay;
}.