CharDisplays:
CEDAR
DEFINITIONS = {
ROPE: TYPE = Rope.ROPE;
Viewer: TYPE = ViewerClasses.Viewer;
DisplayDestroyed: ERROR [cd: CharDisplay];
CharDisplay: TYPE = REF CharDisplayRep;
CharDisplayRep:
TYPE =
RECORD [
class: CharDisplayClass,
det: DisplayDetails,
name: ROPE,
viewer: Viewer ← NIL,
fromDisplay: IO.STREAM ← NIL,
line, col: INT ← 0,
emphs: Emphs,
otherInstanceData: REF ANY ← NIL];
DisplayDetails:
TYPE =
RECORD [
lines: NAT ← 24,
columns: NAT ← 80,
autoMargins, scrolls: BOOL ← TRUE,
autoMarginsVariable, scrollsVariable: BOOL ← FALSE];
CharDisplayClass: TYPE = REF CharDisplayClassRep;
CharDisplayClassRep:
TYPE =
RECORD [
name: ROPE,
Init: PROC [cd: CharDisplay, initData: REF ANY],
ChangeDetails: PROC [cd: CharDisplay, new: DisplayDetails],
DeleteChar: PROC [cd: CharDisplay],
TakeChar: PROC [cd: CharDisplay, char: CHAR, insert: BOOL --← FALSE--],
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],
SetEmph: PROC [cd: CharDisplay, emph: Emph, on: BOOL],
Emphasize:
PROC [cd: CharDisplay, emph: Emph, on:
BOOL],
Apply to char at cursor
SetFont: PROC [cd: CharDisplay, font: ROPE],
Beep: PROC [cd: CharDisplay],
Flush:
PROC [cd: CharDisplay] ←
NIL,
Notifes display that nothing more will be done to it for a while.
Flush may be falsely called, but must be called when it becomes true.
Destroyed: PROC [cd: CharDisplay] RETURNS [BOOL]
];
SimplyChange: PROC [cd: CharDisplay, new: DisplayDetails];
Where: TYPE = {EndOfLine, EndOfScreen};
Emph: TYPE = {underline, bold, italic, inverse};
Emphs: TYPE = ARRAY Emph OF BoolDefaultsFalse;
BoolDefaultsFalse: TYPE = BOOL ← FALSE;
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;
}.