DIRECTORY CharDisplays, DisplayControllers, DisplayControllerSteps, Rope, TermProgs; EmDM2500: CEDAR PROGRAM IMPORTS DisplayControllers, DisplayControllerSteps, Rope, TermProgs = {OPEN DisplayControllers, DisplayControllerSteps, TermProgs; DisplayDetails: TYPE = CharDisplays.DisplayDetails; DMState: TYPE = REF DMStateRep; DMStateRep: TYPE = RECORD [ didCRLF: BOOL ฌ FALSE, colData: SEQUENCE cols: NAT OF ColData]; ColData: TYPE = RECORD [ tabStopHere: BOOL ฌ FALSE]; InitDM2500: PROC [dc: DisplayController] = { dms: DMState ฌ NEW [DMStateRep[dc.cd.det.columns]]; dc.cps.clientData ฌ dms; FOR c: NAT IN [0 .. dms.cols) DO dms.colData[c] ฌ []; ENDLOOP; }; InitDMWaits: PROC [dc: DisplayController] = { InitDM2500[dc]; dc.cd.class.SetFont[dc.cd, "SAIL"]; }; MakeDM: PROC [flavor: ATOM, autoMargins: BOOL] RETURNS [t: Term] = { t ฌ NEW [TermRep ฌ [ det: [autoMargins: autoMargins, scrollsVariable: TRUE], cp: NewControlProgram[ Init: SELECT flavor FROM $waits => InitDMWaits, $Twenty500 => InitDM2500, ENDCASE => ERROR, bits: 7 ] ]]; FOR c: CHAR IN CHAR DO AddInstruction[t.cp, LIST[Rope.FromChar[c]], [DMPrint, flavor, TRUE]]; ENDLOOP; AddInstruction[t.cp, LIST["\000"], [Naught]]; AddInstruction[t.cp, LIST["\002"], [DMHome]]; AddInstruction[t.cp, LIST["\014\002"], [DMHome]]; AddInstruction[t.cp, LIST["\007"], [DMBeep]]; AddInstruction[t.cp, LIST["\010"], [DMBackspace]]; AddInstruction[t.cp, LIST["\011"], [DMTab]]; AddInstruction[t.cp, LIST["\012"], [DMLinefeed]]; AddInstruction[t.cp, LIST["\013"], [DMTabSet, $clear]]; AddInstruction[t.cp, LIST["\014", NEW [DecodeRep ฌ [reg: col, base: 96, org: 0C, xor: 0140B, len: 1]], NEW [DecodeRep ฌ [reg: line, base: 96, org: 0C, xor: 0140B, len: 1]] ], [DMJumpCursor, $hv]]; AddInstruction[t.cp, LIST["\014\014", NEW [DecodeRep ฌ [reg: col, base: 96, org: 0C, xor: 0140B, len: 1]], NEW [DecodeRep ฌ [reg: line, base: 96, org: 0C, xor: 0140B, len: 1]] ], [DMJumpCursor, $hv]]; AddInstruction[t.cp, LIST["\015"], [DMCarriageReturn]]; AddInstruction[t.cp, LIST["\016"], [DMSetEmph, $boldOn]]; AddInstruction[t.cp, LIST["\017"], [DMSetEmph, $italicOn]]; AddInstruction[t.cp, LIST["\020"], [DMSetMode, $insdel]]; AddInstruction[t.cp, LIST["\027"], [DMClrTo, $eol]]; AddInstruction[t.cp, LIST["\030"], [DMCancel, $cancel]]; AddInstruction[t.cp, LIST["\014\030"], [DMCancel, $cancel]]; AddInstruction[t.cp, LIST["\031"], [DMTabSet, $set]]; AddInstruction[t.cp, LIST["\032"], [DMCtlZ]]; AddInstruction[t.cp, LIST["\033"], [Naught]]; AddInstruction[t.cp, LIST["\034"], [DMRight, flavor]]; AddInstruction[t.cp, LIST["\035"], [DMSetMode, $roll]]; AddInstruction[t.cp, LIST["\036"], [DMCancel, $masterClear]]; AddInstruction[t.cp, LIST["\014\036"], [DMCancel, $masterClear]]; AddInstruction[t.cp, LIST["\037"], [DMCancel, $eraseScreen]]; AddInstruction[t.cp, LIST["\014\037"], [DMCancel, $eraseScreen]]; AddInstruction[t.cp, LIST["\177"], [Naught]]; AddInstruction[t.cp, LIST["\200"], [Naught]]; AddInstruction[t.cp, LIST["\377"], [Naught]]; }; MakeDMDD: PROC RETURNS [t: Term] = { t ฌ MakeDM[$Twenty500, FALSE]; t.det.lines ฌ 38; }; DMPrint: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; dc.cd.class.TakeChar[ dc.cd, dc.cps.chars[dc.cps.chars.length-1], SELECT clientData FROM $waits => FALSE, $Twenty500 => dc.cps.modes[insert], ENDCASE => ERROR]; }; DMHome: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; Home[dc, clientData]}; DMBeep: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; Beep[dc, clientData]}; DMBackspace: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; IF dc.cps.modes[insert] THEN dc.cd.class.DeleteChar[dc.cd] ELSE { IF dc.cd.col > 0 THEN dc.cd.class.CursorMove[dc.cd, 0, -1, TRUE, TRUE, TRUE]; }; }; DMTab: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; c: NAT; dms.didCRLF ฌ FALSE; FOR c ฌ dc.cd.col+1, c+1 WHILE c < dc.cd.det.columns AND NOT dms.colData[c].tabStopHere DO NULL ENDLOOP; dc.cd.class.CursorMove[dc.cd, 0, c, FALSE, FALSE, TRUE]; }; DMLinefeed: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; IF dc.cps.modes[insert] THEN Line[dc, $ins] ELSE IF NOT dms.didCRLF THEN SkipCursor[dc, $down]; dms.didCRLF ฌ FALSE; }; DMTabSet: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; set: BOOL ฌ SELECT clientData FROM $clear => FALSE, $set => TRUE, ENDCASE => ERROR; dms.didCRLF ฌ FALSE; dms.colData[dc.cd.col].tabStopHere ฌ set; }; DMJumpCursor: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; JumpCursor[dc, clientData]}; DMCarriageReturn: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; CarriageReturn[dc, NIL]; SkipCursor[dc, $down]; dms.didCRLF ฌ TRUE; }; DMSetEmph: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; SetEmph[dc, clientData]}; DMSetMode: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; SELECT clientData FROM $insdel => dc.cps.modes[insert] ฌ dc.cps.modes[delete] ฌ TRUE; $roll => {det: DisplayDetails ฌ dc.cd.det; det.scrolls ฌ TRUE; dc.cd.class.ChangeDetails[dc.cd, det]; }; ENDCASE => ERROR; }; DMCancel: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; clearRoll: BOOL ฌ FALSE; clearScreen: BOOL ฌ TRUE; clearTabs: BOOL ฌ FALSE; dms.didCRLF ฌ FALSE; SELECT clientData FROM $cancel => {clearRoll ฌ TRUE; clearScreen ฌ FALSE}; $masterClear => {clearTabs ฌ TRUE}; $eraseScreen => {}; ENDCASE => ERROR; dc.cps.modes[insert] ฌ dc.cps.modes[delete] ฌ FALSE; dc.cd.class.SetEmph[dc.cd, bold, FALSE]; dc.cd.class.SetEmph[dc.cd, italic, FALSE]; IF clearRoll THEN {det: DisplayDetails ฌ dc.cd.det; det.scrolls ฌ FALSE; dc.cd.class.ChangeDetails[dc.cd, det]}; IF clearTabs THEN { FOR c: NAT IN [0 .. dms.cols) DO dms.colData[c].tabStopHere ฌ FALSE ENDLOOP; }; IF clearScreen THEN ClearScreen[dc, clientData]; }; DMClrTo: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; ClrTo[dc, clientData]}; DMCtlZ: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; IF dc.cps.modes[insert] THEN Line[dc, $del] ELSE SkipCursor[dc, $up]; }; DMRight: ActionProc = { dms: DMState ฌ NARROW[dc.cps.clientData]; dms.didCRLF ฌ FALSE; IF dc.cps.modes[insert] THEN { dc.cd.class.TakeChar[dc.cd, ' , TRUE]; dc.cd.class.CursorMove[dc.cd, 0, -1, TRUE, TRUE, TRUE]} ELSE SkipCursor[dc, $right]; }; RegTerm["dm2500", MakeDM[$Twenty500, FALSE]]; RegTerm["dm2500w", MakeDM[$Twenty500, TRUE]]; RegTerm["dmwaits", MakeDM[$waits, FALSE]]; RegTerm["dmdd", MakeDMDD[]]; }. d EmDM2500.Mesa Copyright ำ 1986, 1992 by Xerox Corporation. All rights reserved. Last Edited by: Spreitzer, February 19, 1986 8:48:33 pm PST Mike Spreitzer August 26, 1986 8:53:05 pm PDT Emulates Datamedia 2500's and friends. FOR c: CHAR IN CHAR DO AddInstruction[t.cp, LIST[Rope.Cat["\033", Rope.FromChar[c]]], [DMPrint, flavor, FALSE]]; ENDLOOP; สิ•NewlineDelimiter –(cedarcode) style™code™ Kšœ ฯeœ6™BJ™;K™-—K˜Kšฯk œK˜TK˜K™&K˜šะbxœžœž˜Kšžœ<˜CK˜Kšœžœ7˜?K˜Kšœžœ˜3K˜Kšœ žœžœ ˜šœ žœžœ˜Kšœ žœžœ˜Kšœ žœžœžœ ˜(—K˜šœ žœžœ˜Kšœ žœžœ˜—K˜K˜šฯn œžœ˜,Kšœžœ!˜3K˜šžœžœžœž˜ K˜Kšžœ˜—K˜—K˜š  œžœ˜-Kšœ˜K˜#K˜—K˜š  œžœ žœžœžœ˜Dšœžœ ˜Kšœ1žœ˜7šœ˜š œžœž˜Kšœ˜Kšœ˜Kšžœžœ˜—K˜Kšœ˜—Kšœ˜—š žœžœžœžœž˜Kšœžœ&žœ˜FKšžœ˜—š žœžœžœžœž™Kšœžœ8žœ™YKšžœ™—Kšœžœ˜-Kšœžœ˜-Kšœžœ˜1Kšœžœ˜-Kšœžœ˜2Kšœžœ˜,Kšœžœ˜1Kšœžœ˜7˜šžœ˜ KšžœA˜DKšžœD˜G—Kšœ˜—˜šžœ ˜KšžœA˜DKšžœD˜G—Kšœ˜—Kšœžœ˜7Kšœžœ ˜9Kšœžœ"˜;Kšœžœ ˜9Kšœžœ˜4Kšœžœ˜8Kšœžœ#˜˜*Kšœžœ˜K˜&K˜—Kšžœžœ˜—K˜—K˜šœ˜Kšœžœ˜)Kšœ žœžœ˜Kšœ žœžœ˜Kšœ žœžœ˜Kšœžœ˜šžœ ž˜Kšœžœžœ˜3Kšœžœ˜#Kšœ˜Kšžœžœ˜—Kšœ.žœ˜4Kšœ!žœ˜(Kšœ#žœ˜*šžœ žœ"˜3Kšœžœ˜K˜'—šžœ žœ˜Kš žœžœžœžœžœžœ˜LK˜—Kšžœ žœ˜0K˜—K˜šœ˜Kšœžœ˜)Kšœžœ˜Kšœ˜—K˜šœ˜Kšœžœ˜)Kšœžœ˜Kšžœžœžœ˜EKšœ˜—K˜šœ˜Kšœžœ˜)Kšœžœ˜šžœ˜šžœ˜Kšœ žœ˜&Kšœ%žœžœžœ˜7—Kšžœ˜—Kšœ˜—K˜Kšœ%žœ˜-Kšœ&žœ˜-Kšœ"žœ˜*Kšœ˜K˜K˜——…—š#า