DisplayControllerStepsImpl:
CEDAR
PROGRAM
EXPORTS DisplayControllerSteps
= {OPEN DisplayControllers, DisplayControllerSteps;
Where: TYPE = CharDisplays.Where;
Emph: TYPE = CharDisplays.Emph;
CarriageReturn:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{dc.cd.class.CursorMove[dc.cd, 0, 0, FALSE, FALSE, TRUE]};
Home:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{dc.cd.class.CursorMove[dc.cd, 0, 0, FALSE, TRUE, TRUE]};
ScrollBack:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
oldLine: INT ← dc.cd.line;
oldCol: INT ← dc.cd.col;
dc.cd.class.CursorMove[dc.cd, dc.cd.det.lines-1, 0, FALSE, TRUE, TRUE];
dc.cd.class.Line[dc.cd, FALSE];
dc.cd.class.CursorMove[dc.cd, 0, 0, FALSE, TRUE, TRUE];
dc.cd.class.Line[dc.cd, TRUE];
dc.cd.class.CursorMove[dc.cd, oldLine, oldCol, FALSE, TRUE, TRUE];
};
ClearScreen:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
dc.cd.class.ClearAll[dc.cd];
dc.cd.class.CursorMove[dc.cd, 0, 0, FALSE, TRUE, TRUE];
};
DeleteChar:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{dc.cd.class.DeleteChar[dc.cd]};
UnderlineChar:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
dc.cd.class.Emphasize[dc.cd, underline, TRUE];
dc.cd.class.CursorMove[dc.cd, 0, 1, TRUE, TRUE, TRUE];
};
ClrTo:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{where: Where;
SELECT clientData
FROM
$eos => where ← EndOfScreen;
$eol => where ← EndOfLine;
ENDCASE => ERROR;
dc.cd.class.ClearTo[dc.cd, where]};
SkipCursor:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{dLine, dCol: INT ← 0;
SELECT clientData
FROM
$down => dLine ← 1;
$up => dLine ← -1;
$right => dCol ← 1;
$left => dCol ← -1;
ENDCASE => ERROR;
dc.cd.class.CursorMove[dc.cd, dLine, dCol, TRUE, TRUE, TRUE]};
JumpCursor:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{doLine, doCol: BOOL ← TRUE;
SELECT clientData
FROM
$h => doLine ← FALSE;
$v => doCol ← FALSE;
$hv => NULL;
ENDCASE => ERROR;
dc.cd.class.CursorMove[dc.cd, dc.cps.regs[line], dc.cps.regs[col], FALSE, doLine, doCol]};
Line:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
insert:
BOOL ←
SELECT clientData
FROM
$ins => TRUE,
$del => FALSE,
ENDCASE => ERROR;
dc.cd.class.Line[dc.cd, insert]};
SetEmph:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
emph: Emph;
on: BOOL;
SELECT clientData
FROM
$underlineOn => {emph ← underline; on ← TRUE};
$underlineOff => {emph ← underline; on ← FALSE};
$boldOn => {emph ← bold; on ← TRUE};
$boldOff => {emph ← bold; on ← FALSE};
$italicOn => {emph ← italic; on ← TRUE};
$italicOff => {emph ← italic; on ← FALSE};
$inverseOn => {emph ← inverse; on ← TRUE};
$inverseOff => {emph ← inverse; on ← FALSE};
ENDCASE => ERROR;
dc.cd.class.SetEmph[dc.cd, emph, on]};
InsertSpace:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
line: INT ← dc.cd.line;
col: INT ← dc.cd.col;
dc.cd.class.TakeChar[dc.cd, Ascii.SP, TRUE];
dc.cd.class.CursorMove[dc.cd, 0, -1, TRUE, TRUE, TRUE];
};
Beep:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] =
{dc.cd.class.Beep[dc.cd]};
Tab:
PUBLIC
PROC [dc: DisplayController, clientData:
REF
ANY] = {
delta: INT ← 8 - (((dc.cd.col MOD 8) + 8) MOD 8);
SELECT clientData
FROM
$blanken => {
FOR i:
INT
IN [0 .. delta)
DO
dc.cd.class.TakeChar[dc.cd, Ascii.SP, FALSE];
ENDLOOP;
};
$dontTouch => dc.cd.class.CursorMove[dc.cd, 0, delta, TRUE, TRUE, TRUE];
ENDCASE => ERROR;
};
}.