SoftHdwAssembly.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Barth, July 27, 1989 6:17:08 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];
Coordinates: TYPE = {Grain, MinorArray, Chip};
Rotation: TYPE = {None, Rotate90FlipX};
Programs: TYPE = LIST OF Program;
Program: TYPE = REF ProgramRec;
ProgramRec: TYPE = RECORD [
instances: ProgramInstances ← NIL,
tiles: ArrayPositions ← NIL,
coordinates: Coordinates ← MinorArray,
object: CD.Object ← NIL];
ProgramInstances: TYPE = LIST OF ProgramInstance;
ProgramInstance: TYPE = REF ProgramInstanceRec;
ProgramInstanceRec: TYPE = RECORD [
program: Program,
rotation: Rotation,
chip: Position,
minorArray: Position];
Program Creation
All of the abut routines check that the coordinate systems of the arguments are identical. They call Size to determine the distance to add between instances.
Create: PROC [instances: ProgramInstances ← NIL, tiles: ArrayPositions ← NIL, coordinates: Coordinates ← MinorArray, 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], rotation: Rotation ← None] RETURNS [instance: ProgramInstance];
CPI: PROC [old: ProgramInstances, program: Program, minorArray: Position ← [0, 0], chip: Position ← [0, 0], rotation: Rotation ← None] 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.
AbutXList: PROC [subPrograms: Programs] RETURNS [program: Program];
builds from left to right.
AbutY: PROC [t1, t2, t3, t4, t5, t6: Program ← NIL] RETURNS [program: Program];
builds from bottom to top.
AbutYList: PROC [subPrograms: Programs] RETURNS [program: Program];
builds from bottom to top.
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
Parse: PROC [object: CD.Object] RETURNS [program: Program];
CDToArrayPosition: PROC [sizes: ArrayPosition, coordinates: Coordinates, mouse: Position] RETURNS [ambiguous: BOOL, position: ArrayPosition];
Print: PROC [sizes: ArrayPosition, program: Program] RETURNS [object: CD.Object];
PrintAndDraw: PROC [sizes: ArrayPosition, program: Program] RETURNS [design: CD.Design];
Utilities
Size: PROC [program: Program] RETURNS [size: Position];
computes the size in terms of the coordinate system of the program
EnumerateTiles: PROC [program: Program, eachTile: EachTileProc];
EachTileProc: TYPE = PROC [position: ArrayPosition];
OpenDesign: PROC [designName: Rope.ROPE] RETURNS [design: CD.Design];
HighlightDesign: PROC [design: CD.Design, sizes: ArrayPosition, positions: ColoredArrayPositions ← 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.
ColoredArrayPositions: TYPE = LIST OF ColoredArrayPositionRec;
ColoredArrayPositionRec: TYPE = RECORD [
color: HighlightColor,
position: ArrayPosition];
HighlightColor: TYPE = {red, green, blue, yellow, black};
LoadTile: PROC [design: CD.Design, tileName: Rope.ROPE] RETURNS [program: Program];
END.