SoftHdwAssembly.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Barth, July 14, 1989 5:29:35 pm PDT
DIRECTORY CD, Rope, SoftHdwBasics, ViewerClasses;
SoftHdwAssembly: CEDAR DEFINITIONS = BEGIN
ArrayPositions: TYPE = SoftHdwBasics.ArrayPositions;
ArrayPosition: TYPE = SoftHdwBasics.ArrayPosition;
ArrayPositionRec: TYPE = SoftHdwBasics.ArrayPositionRec;
Orientation: TYPE = SoftHdwBasics.Orientation;
Position: TYPE = SoftHdwBasics.Position;
NodeType: TYPE = SoftHdwBasics.NodeType;
TileType: TYPE = NodeType[OToP..RAMOdd];
Programs: TYPE = LIST OF Program;
Program: TYPE = REF ProgramRec;
ProgramRec: TYPE = RECORD [
instances: ProgramInstances ← NIL,
tiles: ArrayPositions ← NIL,
object: CD.Object ← NIL];
ProgramInstances: TYPE = LIST OF ProgramInstance;
ProgramInstance: TYPE = REF ProgramInstanceRec;
ProgramInstanceRec: TYPE = RECORD [
program: Program,
chip: Position,
minorArray: Position];
Program Creation
Create: PROC [instances: ProgramInstances ← NIL, tiles: ArrayPositions ← NIL, object: CD.Object ← NIL] RETURNS [program: Program];
all tile.types must be in TileType.
Instance: PROC [program: Program, minorArray: Position ← [0, 0], chip: Position ← [0, 0]] RETURNS [instance: ProgramInstance];
CPI: PROC [old: ProgramInstances, program: Program, minorArray: Position ← [0, 0], chip: Position ← [0, 0]] RETURNS [new: ProgramInstances];
CTI: PROC [old: ArrayPositions, type: TileType, orientation: Orientation, grain: Position, minorArray: Position ← [0, 0], chip: Position ← [0, 0]] RETURNS [new: ArrayPositions];
AbutX: PROC [t1, t2, t3, t4, t5, t6: Program ← NIL] RETURNS [program: Program];
builds from left to right.
AbutY: PROC [t1, t2, t3, t4, t5, t6: Program ← NIL] RETURNS [program: Program];
builds from top to bottom.
ArrayX: PROC [program: Program, nx: INT] RETURNS [array: Program];
Aligns nx tiles in the X direction.
ArrayY: PROC [program: Program, ny: INT] RETURNS [array: Program];
Aligns ny tiles in the Y direction.
Parse And Print
Size: PROC [program: Program] RETURNS [size: Position];
The unit of size is minor array.
Parse: PROC [object: CD.Object] RETURNS [program: Program];
EnumerateTiles: PROC [program: Program, eachTile: EachTileProc];
EachTileProc: TYPE = PROC [position: ArrayPosition];
Print: PROC [program: Program] RETURNS [object: CD.Object];
PrintAndDraw: PROC [program: Program] RETURNS [design: CD.Design];
CDToArrayPosition: PROC [minorArrayHeight: INT, mouse: Position] RETURNS [ambiguous: BOOL, position: ArrayPosition];
Utilities
OpenDesign: PROC [designName: Rope.ROPE] RETURNS [design: CD.Design];
HighlightDesign: PROC [design: CD.Design, minorArrayHeight, minorArrayWidth: INT, positions: ArrayPositions ← NIL, viewer: ViewerClasses.Viewer ← NIL, label: Rope.ROPENIL];
If viewer is NIL then applies to all viewers of design. positions=NIL removes all previous highlight. Viewers scale to the best zoom on the highlighted area.
LoadTile: PROC [design: CD.Design, tileName: Rope.ROPE] RETURNS [program: Program];
Does PutSizes[object, NEW[ArrayPositionRec ← [
chip: [0, 0],
minorArray: Size[program],
grain: [4, 4]]]]
END.