DisplayControllers.Mesa
Last Edited by: Spreitzer, March 11, 1985 10:40:22 am PST
DIRECTORY CharDisplays, IO, Rope;
DisplayControllers: CEDAR DEFINITIONS = {
REFTEXT: TYPE = REF TEXT;
ROPE: TYPE = Rope.ROPE;
CharDisplay: TYPE = CharDisplays.CharDisplay;
DisplayController: TYPE = REF DisplayControllerRep;
DisplayControllerRep: TYPE = RECORD [
cd: CharDisplay,
cp: ControlProgram,
cps: ControlProgramState,
toDisplay, fromDisplay: IO.STREAM];
Create: PROC [cd: CharDisplay, cp: ControlProgram] RETURNS [dc: DisplayController];
ControlProgram: TYPE = REF ControlProgramRep;
ControlProgramRep: TYPE = RECORD [
start: Vertex,
clientData: REF ANY
];
Vertex: TYPE = REF VertexRep;
VertexRep: TYPE = RECORD [
repStyle: VertexRepStyle,
t: Transition ← [[NIL, NIL], NIL],
edgeList: EdgeList ← NIL,
edgeArray: TransitionArray ← NIL];
VertexRepStyle: TYPE = {epsilon, list, array};
TransitionArray: TYPE = REF TransitionArrayRep;
TransitionArrayRep: TYPE = ARRAY CHAR OF Transition;
EdgeList: TYPE = LIST OF Edge;
Edge: TYPE = RECORD [
char: CHAR,
transition: Transition
];
Transition: TYPE = RECORD [
action: Action,
newVertex: Vertex];
Action: TYPE = RECORD [
proc: PROC [dc: DisplayController, clientData: REF ANY],
clientData: REF ANYNIL];
ControlProgramState: TYPE = REF ControlProgramStateRep;
ControlProgramStateRep: TYPE = RECORD [
curVertex: Vertex ← NIL,
regs: ARRAY RegID OF INTALL[0],
chars--since last in start state--: REFTEXT
];
RegID: TYPE = {line, col};
NewControlProgram: PROC [clientData: REF ANYNIL] RETURNS [cp: ControlProgram];
AddInstruction: PROC [cp: ControlProgram, steps: StepList, final: Action];
naught: Action;
StepList: TYPE = LIST OF Step;
Step: TYPE = REF ANY --actually UNION [ROPE, REFTEXT, Decode]--;
Decode: TYPE = REF DecodeRep;
DecodeRep: TYPE = RECORD [
reg: RegID,
base: NAT ← 10,
org: CHAR ← '0,
offset: INT ← 0,
len: NAT ← 0 --=0 means variable length, #0 means fixed--];
decodes (char - org) by base, then adds offset
}.