DIRECTORY Parquet, TerminalIO, CDOrient USING [rotate90, mirrorX, rotate270, ComposeOrient], Rope USING [ROPE]; Mirror: CEDAR PROGRAM IMPORTS Parquet, TerminalIO, CDOrient = BEGIN MirrorProc: Parquet.ModuleGeneratorProc = BEGIN tileSetName, tileName: Rope.ROPE; tile: Parquet.Tile; technology: Parquet.Technology; flipRows, flipCols: BOOL; numRows, numCols: NAT; tiles: Parquet.Design; module: Parquet.Module; prevTile: Parquet.PlacedTile; -- the previous tile placed prevRow: Parquet.PlacedTile; -- the first tile in the previous row orient: Parquet.Orientation _ Parquet.IdentityOrient; mirrorY: Parquet.Orientation _ CDOrient.ComposeOrient[CDOrient.ComposeOrient[CDOrient.rotate90, CDOrient.mirrorX], CDOrient.rotate270]; tileSetName _ TerminalIO.RequestRope["What file contains the tiles? "]; [tiles, technology, ] _ Parquet.ReadDesign[tileSetName]; IF tiles = NIL THEN GOTO BadFile; tileName _ TerminalIO.RequestRope["What cell do you want to array? "]; tile _ Parquet.GetTile[tiles, tileName]; IF tile = NIL THEN GOTO BadTile; numRows _ TerminalIO.RequestInt["How many rows? "]; numCols _ TerminalIO.RequestInt["How many columns? "]; flipRows _ TerminalIO.UserSaysYes["Flip alternate rows? "]; flipCols _ TerminalIO.UserSaysYes["Flip alternate columns? "]; [module, prevTile] _ Parquet.NewModule[technology]; prevRow _ prevTile; FOR y: NAT IN [0..numRows) DO lastOrient: Parquet.Orientation; lastOrient _ orient; FOR x: NAT IN [0..numCols) DO IF x = 0 THEN prevRow _ prevTile _ Parquet.AdjacentTile[prevRow, tile, below, orient] ELSE prevTile _ Parquet.AdjacentTile[prevTile, tile, rightOf, orient]; IF flipCols THEN orient _ CDOrient.ComposeOrient[orient, CDOrient.mirrorX]; ENDLOOP; orient _ lastOrient; IF flipRows THEN orient _ CDOrient.ComposeOrient[orient, mirrorY]; ENDLOOP; TerminalIO.WriteRope["Mirror done.\n"]; RETURN[module]; EXITS BadFile => BEGIN TerminalIO.WriteRope["Could not load tiles -- goodbye!\n"]; RETURN[NIL]; END; BadTile => BEGIN TerminalIO.WriteRope["Could not find that tile -- goodbye!\n"]; RETURN[NIL]; END; END; [] _ Parquet.RegisterCommand["Mirror", MirrorProc]; END. 8File: Mirror.mesa Copyright c 1984 by Xerox Corporation. All rights reserved. Created by: Bob Mayo, June 8, 1984 12:35:52 pm PDT Last Edited by: Mayo, July 27, 1984 12:53:47 pm PDT -- This is a sample of a module generator built using Parquet. It creates an array of tiles in which alternate rows and columns are flipped. -- user parameters -- state information -- constants -- query user for parameters -- initialize data structures -- main body of module generator -- pass result back to Parquet -- error exits -- register this generator with Parquet ΚΚ˜– "Cedar" stylešœ™Jšœ Οmœ1™˜>J˜J™J˜3J˜J˜J™ šžœžœžœž˜Jšœ ˜ Jšœ˜šžœžœžœž˜šžœž˜ JšœG˜G—šž˜JšœA˜A—Jšžœ žœ;˜KJšžœ˜—Jšœ˜Jšžœ žœ2˜BJšžœ˜—J˜J™Jšœ'˜'Jšžœ ˜J˜J™šž˜šœ ž˜Jšœ;˜;Jšžœžœ˜ Jšžœ˜—šœ ž˜Jšœ?˜?Jšžœžœ˜ Jšžœ˜——Jšžœ˜—J˜J™'Jšœ4˜4Jšžœ˜——…—R T