Compiler Controllers/n
Stone, May 2, 1981 12:41 PM
implementing module for griffin file controllers
Last Edited by: Stone, July 13, 1983 6:29 pm
DIRECTORY
ControllerDefs: FROM "ControllerDefs",
Real: FROM "Real",
StyleDefs USING[Color];
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Controllers: CEDAR PROGRAM
IMPORTS Real
EXPORTS ControllerDefs =
BEGIN OPEN ControllerDefs;
this section describes the hardcopy controller data
hController: HardcopyController;
this section describes the display controller data
dController: DisplayController;
ControlPair: TYPE = RECORD [next: ControlPairHandle, color: StyleDefs.Color, grey: [0 .. 255]];
lControlPair: CARDINAL = SIZE [ControlPair];
ControlPairHandle: TYPE = REF ControlPair;
firstControlPair, lastControlPair: ControlPairHandle ← NIL;
PixelsToMicas: REAL;
SetHardcopyController: PUBLIC PROCEDURE [hc: HardcopyController] =
BEGIN hController ←hc END;
SetDisplayController: PUBLIC PROCEDURE [dc: DisplayController] =
BEGIN dController ← dc END;
ReadDisplayController: PUBLIC PROCEDURE RETURNS [DisplayController] =
BEGIN RETURN [dController] END;
ReadHardcopyController: PUBLIC PROCEDURE RETURNS [HardcopyController] =
BEGIN RETURN [hController] END;
DefaultControllers: PUBLIC PROCEDURE = BEGIN OPEN StyleDefs;
c: ControlPairHandle;
set up the conversion from alto pixels to micas (press)
PixelsToMicas ← 635; PixelsToMicas ← PixelsToMicas/18;
PixelsToMicas ← 32;
this section resets the hardcopy controller data
hController ← [hxcenter: 304*PixelsToMicas, hycenter: 404*PixelsToMicas, hwidth: 608*PixelsToMicas, hheight: 808*PixelsToMicas,
pressxcenter: Real.RoundC[304*PixelsToMicas], pressycenter: Real.RoundC[404*PixelsToMicas], hscale: 1];
this section resets the display controller data
dController ← [dxcenter: 304, dycenter: 404, dwidth: 608, dheight: 808, dxscale: 1.0/PixelsToMicas,
dyscale: 1.0/PixelsToMicas, dxorigin: 0, dyorigin: 0, dgridsize: 8];
UNTIL firstControlPair = NIL DO
c ← firstControlPair.next;
firstControlPair.next ← NIL;
firstControlPair ← c;
ENDLOOP;
END;
ForAllControlPairs: PUBLIC PROCEDURE [proc: PROC [h, s, v: [0 .. 255], grey: [0 .. 255]]] = BEGIN
rover: ControlPairHandle ← firstControlPair;
UNTIL rover = NIL DO
proc [rover.color, rover.grey];
rover ← rover.next;
ENDLOOP;
END;
ControllerError: PUBLIC SIGNAL = CODE;
END.