ProgramRec:
TYPE =
RECORD [
instances: ProgramInstances ← NIL,
tiles: ArrayPositions ← NIL,
coordinates: Coordinates ← MinorArray,
object: CD.Object ← NIL];
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.
ROPE ←
NIL];
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];