-- File: DisjointGraphics.mesa -- Routines for generating graphical output for Disjoint -- Written by Martin Newell/Dan Fitzpatrick February 1981 -- Last edited (Pilot): July 20, 1981 5:31 PM DIRECTORY CIFUtilitiesDefs: FROM "CIFUtilitiesDefs" USING [DrawRectangleOutline, GetClipRectangle, Rectangle, ScreenParams], DisjointTypes: FROM "DisjointTypes" USING [DisCell, Instance, Symbol, Rectangle, Geometry], DisjointAllocDefs: FROM "DisjointAllocDefs" USING [EnumerateSymbols], DisjointGraphicsDefs: FROM "DisjointGraphicsDefs", GSysPressDefs USING [ScreenToPress], JaMFnsDefs: FROM "JaMFnsDefs" USING [GetJaMBreak], MoreCIFUtilitiesDefs: FROM "MoreCIFUtilitiesDefs" USING [DrawRectangleArea, DrawStringAt, SetStipple]; DisjointGraphics: PROGRAM IMPORTS CIFUtilitiesDefs, DisjointAllocDefs, GSysPressDefs, JaMFnsDefs, MoreCIFUtilitiesDefs EXPORTS DisjointGraphicsDefs = BEGIN OPEN CIFUtilitiesDefs, DisjointTypes, DisjointAllocDefs, GSysPressDefs, JaMFnsDefs, MoreCIFUtilitiesDefs; DrawInstance: PUBLIC PROCEDURE[inst: Instance] = BEGIN OPEN inst; window: DisjointTypes.Rectangle; FOR window _ symbol.windows,window.next UNTIL window=NIL DO left: REAL _ window.l+xOffset; bottom: REAL _ window.b+yOffset; right: REAL _ window.r+xOffset; top: REAL _ window.t+yOffset; DrawRectangleOutline[[left, bottom, right, top]]; DrawStringAt[symbol.name, (left+right)/2,(bottom+top)/2]; ENDLOOP; END; DrawDisCell: PUBLIC PROCEDURE[disCell: DisCell, stipple: CARDINAL] = BEGIN r: DisjointTypes.Rectangle; FOR r _ disCell.windows, r.next UNTIL r=NIL DO DrawRectangle[r.l,r.b,r.r,r.t, stipple]; ENDLOOP; END; DrawCellOffset: PUBLIC PROCEDURE[us: Symbol, x,y: REAL, stipple: CARDINAL] = BEGIN r: DisjointTypes.Rectangle; FOR r _ us.windows, r.next UNTIL r=NIL DO DrawRectangle[r.l+x,r.b+y,r.r+x,r.t+y, stipple]; ENDLOOP; END; DrawGeomOffset: PUBLIC PROCEDURE[us: Symbol, x,y: REAL] = BEGIN w: DisjointTypes.Rectangle; FOR w _ us.windows, w.next UNTIL w=NIL DO DrawRectangleOutline[[w.l+x,w.b+y,w.r+x,w.t+y]]; ENDLOOP; FOR g:Geometry _ us.geom, g.next UNTIL g=NIL DO DrawRectangle[g.l+x,g.b+y,g.r+x,g.t+y, Stipple[g.layer]]; ENDLOOP; END; DrawSymbol: PUBLIC PROCEDURE[s: Symbol, callOnce: BOOLEAN, level: INTEGER] = --draw all instances of s at given level of hierarchy --level=0 is top level --level=-1 will draw all geometry --callOnce=TRUE will allow only the first call to each symbol BEGIN Mark: PROC[s: Symbol] RETURNS[BOOLEAN] = BEGIN --here .mark means symbol can still be called s.mark _ TRUE; RETURN[FALSE]; END; count: CARDINAL _ 0; r: CIFUtilitiesDefs.Rectangle; -- mark all the symbols [] _ EnumerateSymbols[Mark]; r _ GetClipRectangle[]; [ClipL,ClipB,ClipR,ClipT] _ r; DrawSymbolR[s, callOnce, 0,0, level]; END; DrawSymbolR: PROCEDURE[s: Symbol, callOnce: BOOLEAN, x,y: REAL, level: INTEGER] = -- draw all instances of s at given level of hierarchy -- level=0 is top level BEGIN IF OutsideClipRegion[s, x,y] THEN RETURN; IF level=0 THEN DrawCellOffset[s, x,y, s.data] ELSE { IF level=1 OR level<0 THEN DrawGeomOffset[s, x,y]; FOR i:Instance _ s.insts, i.next UNTIL i=NIL DO IF GetJaMBreak[] THEN EXIT; IF i.symbol.mark THEN DrawSymbolR[i.symbol, callOnce, x+i.xOffset,y+i.yOffset, level-1]; IF callOnce THEN i.symbol.mark _ FALSE; ENDLOOP; }; END; OutsideClipRegion: PROCEDURE[s: Symbol, x,y: REAL] RETURNS[BOOLEAN] = BEGIN l,b,r,t: REAL; [l,b,r,t] _ BoundBox[s]; IF l+xClipL AND t+y>ClipB THEN RETURN[FALSE]; RETURN[TRUE]; END; ClipL,ClipB,ClipR,ClipT: REAL; BoundBox: PUBLIC PROCEDURE[s: Symbol] RETURNS[l,b,r,t: REAL] = BEGIN rec: DisjointTypes.Rectangle; l _ s.windows.l; b _ s.windows.b; r _ s.windows.r; t _ s.windows.t; --always at least one window FOR rec _ s.windows.next, rec.next UNTIL rec=NIL DO l _ MIN[l,rec.l]; b _ MIN[b,rec.b]; r _ MAX[r,rec.r]; t _ MAX[t,rec.t]; ENDLOOP; END; DrawRectangle: PUBLIC PROCEDURE[l,b,r,t: REAL, stipple: CARDINAL] = BEGIN SetStipple[stipple]; DrawRectangleArea[[l,b,r,t]]; END; ScreenToPress: PUBLIC PROCEDURE [name: STRING] = BEGIN base: LONG POINTER; raster,height: CARDINAL; [base,raster,height] _ ScreenParams[]; GSysPressDefs.ScreenToPress[name, base,raster,height]; END; Stipple: ARRAY [0..16) OF CARDINAL _ ALL[177777B]; --undef --Set up default stipples Stipple[0] _ 000020B; --implant Stipple[1] _ 040501B; --diffusion Stipple[2] _ 014102B; --poly Stipple[3] _ 165627B; --contact Stipple[4] _ 000050B; --metal Stipple[5] _ 001110B; --buried Stipple[6] _ 001122B; --glass Stipple[7] _ 177777B; --undef END. e6(635)\185b10B780b16B273b12B468b11B202b14B210b14B312b10B250b4B47i43I101i20I134b11B76i51I4i20I403b17B231b8B345b13B280b13B410b15B478b13B139b8B e6(635)\1081b16B273b12B468b11B202b14B210b14B312b10B250b4B47i43I101i20I134b11B76i51I4i20I403b17B231b8B345b13B280b13B