DIRECTORY AMBridge USING [TVForATOM, TVForROPE, TVForReferent], AMTypes USING [TV], CD USING [Layer, NewLayer, Rect, Position, Design, Technology, RegisterTechnology, lambda], CDBasics USING [Intersection, SizeOfRect, BaseOfRect], CDColors, CDSimpleOps USING [SelectAll], CDOps USING [CreateDesign, AddAnObject, SetInstList, DelayedRedraw, DoTheDelayedRedraws], CDProperties USING [RegisterProperty, GetProp, PutProp], CDRects USING [CreateBareRect], CDSequencer USING [ImplementCommand, Command], CDTipEtc, CDViewer USING [CreateViewer, ViewerList, ViewersOf, ShowAndScale], CornerStitching USING [Tesselation, EnumerateArea, Value, TilePtr, TileAt, Rect, Area], CSMonitor, IO USING [STREAM, Put, PutRope, PutF, PutFR, int, rope, char, ROS, RopeFromROS], PrintTV USING [Print], Rope USING [ROPE], TerminalIO USING [WriteRope]; CSMonitorImpl: CEDAR PROGRAM IMPORTS AMBridge, CD, CDBasics, CDColors, CDSimpleOps, CDOps, CDProperties, CDRects, CDSequencer, CDTipEtc, CDViewer, CornerStitching, IO, PrintTV, TerminalIO EXPORTS CSMonitor = BEGIN csMonitor: CD.Technology; solid: CD.Layer; solidDark: CD.Layer; space: CD.Layer; tessProp: REF ATOM _ NEW[ATOM_$Tesselation]; depth: INT _ 4; width: INT _ 32; GetTesselation: PROC [d: CD.Design] RETURNS [plane: REF CornerStitching.Tesselation] = BEGIN plane _ NARROW[CDProperties.GetProp[from: d, prop: tessProp]] END; Monitor: PUBLIC PROCEDURE [plane: REF CornerStitching.Tesselation, name: Rope.ROPE _ NIL, paintDark: CSMonitor.PaintPredicate _ NIL] = BEGIN design: CD.Design = CDOps.CreateDesign[csMonitor]; design.name _ IF name#NIL THEN name ELSE "Tile World"; IF paintDark = NIL THEN paintDark _ DefaultPaintDark; CDProperties.PutProp[onto: design, prop: tessProp, val: plane]; CDProperties.PutProp[onto: design, prop: $PaintDark, val: NEW[CSMonitor.PaintPredicate _ paintDark]]; ReDisplay[design]; [] _ CDViewer.CreateViewer[design]; END; DefaultPaintDark: CSMonitor.PaintPredicate = BEGIN RETURN [ISTYPE[tileVal, ATOM]] END; ReDisplay: PROCEDURE [d: CD.Design] = BEGIN ChooseColor: PROCEDURE [val: REF ANY] RETURNS [CD.Layer] = BEGIN IF val=NIL THEN RETURN [space] ELSE IF paintDark^[val] THEN RETURN [solidDark] ELSE RETURN [solid]; END; IncludeTile: PROCEDURE [tile: CornerStitching.TilePtr, data: REF ANY] = BEGIN r: CornerStitching.Rect = CDBasics.Intersection[CornerStitching.Area[tile], displayRegion]; CDOps.AddAnObject[design: d, ob: CDRects.CreateBareRect[ size: CDBasics.SizeOfRect[r], l: ChooseColor[CornerStitching.Value[tile]] ], location: CDBasics.BaseOfRect[r] ] END; windowBound: INT = 100000; displayRegion: CD.Rect = [-windowBound, -windowBound, windowBound, windowBound]; plane: REF CornerStitching.Tesselation = GetTesselation[d]; paintDark: REF CSMonitor.PaintPredicate = NARROW[CDProperties.GetProp[from: d, prop: $PaintDark] ]; CDOps.SetInstList[d, NIL]; CDOps.DelayedRedraw[d]; [] _ CornerStitching.EnumerateArea[ plane: plane, rect: displayRegion, backgroundValue: $Nothing, perTile: IncludeTile ]; CDSimpleOps.SelectAll[d]; CDOps.DoTheDelayedRedraws[d] END; PrintingDepth: PROCEDURE [comm: CDSequencer.Command] = BEGIN SELECT comm.a FROM $SuccPrintingDepth => depth _ depth.SUCC; $PredPrintingDepth => IF depth > 1 THEN depth _ depth.PRED; ENDCASE; TerminalIO.WriteRope[IO.PutFR["%g CS Monitor printing depth = %d\n", IO.rope[ comm.design.name], IO.int[ depth]]]; END; PrintingWidth: PROCEDURE [comm: CDSequencer.Command] = BEGIN SELECT comm.a FROM $SuccPrintingWidth => width _ width.SUCC; $PredPrintingWidth => IF depth > 1 THEN width _ width.PRED; ENDCASE; TerminalIO.WriteRope[IO.PutFR["%g CS Monitor printing width = %d\n", IO.rope[ comm.design.name], IO.int[width]]]; END; PrintTile: PROCEDURE [comm: CDSequencer.Command] = BEGIN WriteWhere: PROCEDURE [strm: IO.STREAM, comm: CDSequencer.Command] = BEGIN IO.PutF[strm, "In %g At (%d,%d) ", IO.rope[comm.design.name], IO.int[comm.pos.x/CD.lambda], IO.int[comm.pos.y/CD.lambda]]; END; GetTV: PROCEDURE [ra: REF ANY] RETURNS [tv: AMTypes.TV] = BEGIN WITH ra SELECT FROM a: ATOM => TRUSTED {tv _ AMBridge.TVForATOM[a]}; r: Rope.ROPE => TRUSTED {tv _ AMBridge.TVForROPE[r]}; ENDCASE => TRUSTED {tv _ AMBridge.TVForReferent[ra]}; END; GetTile: PROCEDURE [d: CD.Design, at: CD.Position] RETURNS [CornerStitching.TilePtr] = BEGIN plane: REF CornerStitching.Tesselation = GetTesselation[comm.design]; tile: CornerStitching.TilePtr _ CornerStitching.TileAt[plane, comm.pos]; IF tile#NIL AND tile.Value=$Nothing THEN tile_NIL; RETURN [tile] END; ropeStream: IO.STREAM _ IO.ROS[]; tile: CornerStitching.TilePtr; WriteWhere[ropeStream, comm]; IO.PutRope[ropeStream, "Tile "]; IF comm.a=$PrintTileValue THEN IO.PutRope[ropeStream, "Value"]; IO.PutRope[ropeStream, " =\n "]; tile _ GetTile[comm.design, comm.pos]; IF tile=NIL THEN IO.PutRope[ropeStream, " background"] ELSE { tv: AMTypes.TV; IF comm.a=$PrintTileValue THEN tv _ GetTV[tile.Value] ELSE tv _ GetTV[tile]; PrintTV.Print[tv: tv, put: ropeStream, depth: depth, width: width]; }; IO.Put[ropeStream, IO.char['\n]]; TerminalIO.WriteRope[IO.RopeFromROS[ropeStream]]; END; RedisplayComm: PROCEDURE [comm: CDSequencer.Command] = BEGIN ReDisplay[comm.design] END; showRect: CD.Rect _ CD.Rect[x1: -10, y1: -10, x2: 100, y2: 100]; CenterComm: PROCEDURE [comm: CDSequencer.Command] = BEGIN vl: CDViewer.ViewerList _ CDViewer.ViewersOf[comm.design]; IF vl#NIL THEN { CDViewer.ShowAndScale[vl.first, showRect] }; END; Init: PROCEDURE = BEGIN csMonitor _ CD.RegisterTechnology[key: $CSMonitor, name: "CSMonitor"]; solid _ CD.NewLayer[technology: csMonitor, uniqueKey: $SOLID]; solidDark _ CD.NewLayer[technology: csMonitor, uniqueKey: $SOLIDATOM]; space _ CD.NewLayer[technology: csMonitor, uniqueKey: $SP]; [] _ CDProperties.RegisterProperty[tessProp, $IDontCare]; CDTipEtc.SetTipTable[csMonitor, "Standard"]; CDColors.DefineColor[lev: solid, brick: NEW[CDColors.Brick _ [125252B, 0, 52525B, 0]]]; CDColors.DefineColor[lev: solidDark, brick: NEW[CDColors.Brick _ [52525B, 125252B, 52525B, 125252B]]]; CDColors.DefineColor[lev: space, brick: NEW[CDColors.Brick _ [0, 0, 0, 0]]]; CDSequencer.ImplementCommand[$PrintTileValue, PrintTile, csMonitor, doQueue]; CDSequencer.ImplementCommand[$PrintTile, PrintTile, csMonitor, doQueue]; CDSequencer.ImplementCommand[$SuccPrintingDepth, PrintingDepth, csMonitor, doQueue]; CDSequencer.ImplementCommand[$PredPrintingDepth, PrintingDepth, csMonitor, doQueue]; CDSequencer.ImplementCommand[$SuccPrintingWidth, PrintingWidth, csMonitor, doQueue]; CDSequencer.ImplementCommand[$PredPrintingWidth, PrintingWidth, csMonitor, doQueue]; CDSequencer.ImplementCommand[$Redisplay, RedisplayComm, csMonitor, doQueue]; CDSequencer.ImplementCommand[$Center, CenterComm, csMonitor, dontQueue]; TerminalIO.WriteRope["Corner Stitching Monitor loaded\n"]; END; Init[]; END. ”CSMonitorImpl.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Written by Shand, September 20, 1983 11:40 pm Last Edited by: Shand, July 28, 1984 7:56:25 pm PDT Last Edited by: Beretta, October 30, 1984 10:31:53 am PST Last Edited by: Jacobi, May 29, 1985 6:36:50 pm PDT Last Edited by: March 6, 1985 9:58:51 am PST -- PROC [tileVal: REF ANY] RETURNS [BOOLEAN] --PrintTile Ê ÷˜™Jšœ Ïmœ7™BJ™-J™3J™9J™3J™,—J˜šÏk ˜ Jšœ žœ'˜5Jšœžœžœ˜JšžœžœS˜[Jšœ žœ(˜6Jšœ ˜ Jšœ žœ ˜JšœžœN˜YJšœ žœ&˜8Jšœžœ˜Jšœ žœ˜.Jšœ ˜ Jšœ žœ5˜CJšœžœB˜WJšœ ˜ Jšžœžœžœ.žœ˜PJšœžœ ˜Jšœžœžœ˜Jšœ žœ ˜—J˜šÏb œžœž˜Jšžœ žœsžœ˜žJšžœ ˜—Jšž˜J˜Jšœ žœ ˜J˜Jšœžœ˜Jšœ žœ˜Jšœžœ˜J˜Jšœ žœžœžœ˜,J˜Jšœžœ˜Jšœžœ˜J˜š Ÿœžœžœ žœ žœ˜VJšž˜Jšœžœ/˜=Jšžœ˜—J˜šÏnœžœž œ žœ)žœžœ(žœ˜‡Jšž˜Jšœžœ(˜2Jš œžœžœžœžœ˜6Jšžœ žœžœ˜5J•StartOfExpansion<[propList: Atom.PropList, prop: REF ANY, val: REF ANY]šœ?˜?J–<[propList: Atom.PropList, prop: REF ANY, val: REF ANY]šœ:žœ(˜eJšœ˜Jšœ#˜#Jšžœ˜—J˜šŸœ˜-Jšœ-™-Jšž˜Jšžœžœ žœ˜Jšžœ˜—J˜š  œž œžœ ˜%Jšž˜J˜š   œž œžœžœžœžœ ˜:Jšž˜Jšžœžœžœžœ˜Jšžœžœžœžœ ˜/Jšžœžœ ˜Jšžœ˜—J˜š  œž œ'žœžœ˜GJšž˜Jšœ[˜[–c[design: CD.Design, ob: CD.ObPtr, location: CD.DesignPosition, orientation: CD.Orientation]šœ˜šœ˜Jšœ˜Jšœ+˜+Jšœ˜—Jšœ ˜ Jšœ˜—Jšžœ˜—J˜Jšœ žœ ˜Jšœžœ?˜PJšœžœ1˜;Jšœ žœžœ3˜cJšœžœ˜Jšœ˜šœ#˜#Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜—Jšœ˜Jšœ˜Jšžœ˜—J˜š  œž œ˜6Jšž˜šžœž˜Jšœ$žœ˜)Jšœžœ žœžœ˜;Jšžœ˜—Jšœžœ.žœžœ˜rJšžœ˜—J˜š  œž œ˜6Jšž˜šžœž˜Jšœ$žœ˜)Jšœžœ žœžœ˜;Jšžœ˜—Jšœžœ.žœžœ˜qJšžœ˜—J˜š  œž œ˜2Jšž˜š  œž œžœžœ˜DJšž˜šžœ#˜%Jšžœ˜Jšžœžœ ˜Jšžœžœ ˜—Jšžœ˜—š  œž œžœžœžœžœ˜9Jšž˜šžœžœž˜Jšœžœžœ˜0Jšœžœžœ˜5Jšžœžœ#˜5—Jšžœ˜—š  œž œžœ žœ žœ˜VJ–,[propList: Atom.PropList, prop: REF ANY]šž˜Jšœžœ;˜EJšœH˜HJš žœžœžœžœžœ˜2Jšžœ˜ Jšžœ˜—Jšœ ™ Jš œ žœžœžœžœ˜!Jšœ˜Jšœ˜Jšžœ˜ Jšžœžœžœ˜?Jšžœ˜!J–W[tv: TV, put: STREAM, depth: INT _ 4, width: INT _ 32, verbose: BOOL _ FALSE]šœ&˜&Jšžœžœžœžœ#˜6šžœ˜Jšœ žœ˜šžœžœ˜Jšœ˜—šž˜Jšœ˜—JšœC˜CJ˜—Jšžœžœ ˜!Jšœžœ˜1Jšžœ˜—J˜š  œž œ˜6Jšž˜Jšœ˜Jšžœ˜—J˜Jšœ žœžœ*˜@J˜š  œž œ˜3Jšž˜Jšœ:˜:šžœžœžœ˜Jšœ)˜)Jšœ˜—Jšžœ˜—J˜š œž œ˜Jšž˜Jšœ žœ8˜FJ˜Jšœžœ4˜>Jšœ žœ8˜FJšœžœ1˜;J˜Jšœ:˜:Jšœ,˜,J–?[lev: CD.Level, bpp: CARDINAL, brick: CDTechnology.Brick]˜Jšœ(žœ,˜WJšœ,žœ7˜fJšœ(žœ!˜LJ˜JšœM˜MJšœH˜HJšœT˜TJšœT˜TJšœT˜TJšœT˜TJšœL˜LJšœH˜HJ˜Jšœ:˜:Jšžœ˜—J˜J˜Jšžœ˜—…—”&