<> <> <> <> <<>> DIRECTORY CD USING [Object, Design, FetchTechnology, Position, Instance, InstanceList, RegisterTechnology, Technology], CDOps USING [CreateDesign, IncludeObjectI, InstList], CDOrient, CDRemote USING [Get], CDViewer USING [CreateViewer], Jasmine, JasmineMonitor, Rope USING [Cat, ROPE], SymTab USING [Fetch, Ref], ViewerClasses USING [Viewer], ViewerOps USING [DestroyViewer, FindViewer]; <<>> JasmineMonitorImpl: CEDAR PROGRAM IMPORTS CD, CDOps, CDRemote, CDViewer, Jasmine, Rope, SymTab, ViewerOps EXPORTS JasmineMonitor = BEGIN DisplayModel: PUBLIC PROC [model: SymTab.Ref, name: Rope.ROPE _ NIL] RETURNS [viewer: ViewerClasses.Viewer] = { PositionIcon: PROC [mapX, mapY: INT, icon: CD.Object, aspect: Jasmine.AspectType] = { <<>> AssignSchematicCoords: PROC [mapX, mapY: INT] RETURNS [cdX, cdY: INT] = { gridSize: INT _ 15*8; scaleFactor: NAT; SELECT Jasmine.resolution FROM high => {scaleFactor _ 5}; medium => {}; low => {}; ENDCASE => NULL; cdX _ mapX*gridSize/scaleFactor; cdY _ mapY*gridSize/scaleFactor; }; <<>> <<--Original = vertical in Jasmine library.>> <<--Use rotation of 270 to abide by CDOrient algorithms.>> loc: CD.Position; <<--Fetch previous included object>> instances: CD.InstanceList _ CDOps.InstList[design: design]; instance: CD.Instance; IF instances=NIL THEN { [loc.x, loc.y] _ AssignSchematicCoords[mapX, mapY]; } ELSE { instance _ instances.first; loc _ instance.location; SELECT instance.orientation FROM CDOrient.original => { [loc.x, loc.y] _ AssignSchematicCoords[mapX, mapY]; }; CDOrient.rotate270 => { --cross object coords [loc.x, loc.y] _ AssignSchematicCoords[mapX, mapY]; }; ENDCASE => ERROR; }; CDOps.IncludeObjectI[design: design, ob: icon, location: loc, orientation: IF aspect=vert THEN CDOrient.original ELSE CDOrient.rotate270]; }; --PositionIcon BuildSchematic: PROC [library: Rope.ROPE] = { icon: CD.Object; thereIs: BOOL; val: REF ANY; aspect: Jasmine.AspectType; FOR indices: LIST OF Jasmine.MacroLocation _ Jasmine.locations, indices.rest UNTIL indices=NIL DO [thereIs, val] _ SymTab.Fetch[model, Jasmine.MapConvert[indices.first]]; IF thereIs THEN { macro: Jasmine.JasmineMacro _ NARROW[val]; SELECT macro.macroType FROM m1Wire, m2Wire, nDifWire, pDifWire, polyWire => { icon _ CDRemote.Get[design, library, "Resistor.icon"]; }; nDifCont => { icon _ CDRemote.Get[design, library, "nDiffCont.icon"]; SELECT macro.branch FROM leftT, rightT, straight => {aspect _ horiz}; inverseT, T, L, reverseL, inverseL, inverseRevL => { aspect _ vert; }; fourWay=> {aspect _ vert}; ENDCASE => NULL; }; pDifCont => { icon _ CDRemote.Get[design, library, "nDiffCont.icon"]; SELECT macro.branch FROM leftT, rightT, straight => {aspect _ horiz}; inverseT, T, L, reverseL, inverseL, inverseRevL => { aspect _ vert; }; fourWay=> {aspect _ vert}; ENDCASE => NULL; }; polyCont => { icon _ CDRemote.Get[design, library, "PolyCont.icon"]; SELECT macro.branch FROM leftT, rightT, straight => {aspect _ horiz}; inverseT, T, L, reverseL, inverseL, inverseRevL => { aspect _ vert; }; fourWay=> {aspect _ vert;}; ENDCASE => NULL; }; Via => { icon _ CDRemote.Get[design, library, "Via.icon"]; SELECT macro.branch FROM leftT, rightT, straight => {aspect _ horiz}; inverseT, T, L, reverseL, inverseL, inverseRevL => { aspect _ vert; }; fourWay=> {aspect _ vert}; ENDCASE => NULL; }; nTran, nTranL, pTran, pTranL => { aspect _ IF macro.xtorAspect=gateTied THEN horiz ELSE vert; SELECT macro.xtorType FROM nE => { icon _ CDRemote.Get[design, library, "nETran.icon"]; }; pE => { icon _ CDRemote.Get[design, library, "pETran.icon"]; }; ENDCASE => NULL; }; ENDCASE => ERROR; PositionIcon[indices.first.mapX, indices.first.mapY, icon, aspect]; }; ENDLOOP; }; design: CD.Design; prevMapX: INT _ 0; prevMapY: INT _ 0; runningX: INT _ 0; runningY: INT _ 0; jasmineTechnology: CD.Technology _ CD.FetchTechnology[key: $cmosB]; IF jasmineTechnology=NIL THEN jasmineTechnology _ CD.RegisterTechnology[key: $JasmineMonitorTech, name: "JasmineMonitor", lambda: 1]; design_ CDOps.CreateDesign[technology: jasmineTechnology]; design.name _ IF name#NIL THEN name ELSE "Jasmine Model"; viewer _ CDViewer.CreateViewer[design]; BuildSchematic[library: "Jasmine.dale"]; DestroyCDPanel[Rope.Cat[design.name, " ", "CMosB", " ", "top level"]]; --krok!!!! }; --DisplayModel DestroyCDPanel: PROC [caption: Rope.ROPE] = { <> <> ViewerOps.DestroyViewer[ViewerOps.FindViewer[caption]]; }; END.