-- File CIFDrcControl.mesa -- Written by Dan Fitzpatrick and Martin Newell, August 1980 -- Last updated: March 25, 1981 3:13 PM DIRECTORY AltoDevice: FROM "AltoDevice" USING [ScreenOrigin], CIFControlDefs: FROM "CIFControlDefs" USING [DrawCIF], CIFDevicesDefs: FROM "CIFDevicesDefs" USING [DeviceDescriptor, DeviceDescriptorRecord, RegisterDevice, GetCIFOutDevice], CIFDrcDefs: FROM "CIFDrcDefs", CIFDrcScanDefs: FROM "CIFDrcScanDefs" USING [DrcScanStart, DrcScanEnd, DrcTrigger, EnterEdge], CIFDrcUtilsDefs: FROM "CIFDrcUtilsDefs" USING [Edge, MakeEdge], CIFOutputDefs: FROM "CIFOutputDefs" USING [SetSorting], CIFUtilitiesDefs: FROM "CIFUtilitiesDefs" USING [Rectangle, SetClipRectangle, GetClipRectangle, DrawClipRectangle, SetDisplayContext, GetDisplayContext, MapRectangle], Graphics: FROM "Graphics" USING [DisplayContext, NewContext, PushContext, PopContext, CopyContext, Scale, ScreenToUser, UserToScreen], IODefs: FROM "IODefs" USING [WriteLine], IntDefs: FROM "IntDefs" USING[ILastBB], JaMDrcDefs: FROM "JaMDrcDefs" USING[JaMDrcStartUp], JaMFnsDefs: FROM "JaMFnsDefs" USING [PopString], Real: FROM "Real" USING [Fix], StringDefs: FROM "StringDefs" USING [AppendChar, AppendString], Vector: FROM "Vector" USING [Vec]; CIFDrcControl: PROGRAM IMPORTS AltoDevice, CIFControlDefs, CIFDevicesDefs, CIFDrcScanDefs, CIFDrcUtilsDefs, CIFOutputDefs, CIFUtilitiesDefs, Graphics, IODefs, IntDefs, JaMDrcDefs, JaMFnsDefs, Real, StringDefs = BEGIN OPEN AltoDevice, CIFControlDefs, CIFDevicesDefs, CIFDrcScanDefs, CIFDrcUtilsDefs, CIFOutputDefs, CIFUtilitiesDefs, Graphics, IODefs, IntDefs, JaMDrcDefs, JaMFnsDefs, Real, StringDefs, Vector; -- CIF DRC procedures DrcDeviceRecord: DeviceDescriptorRecord _ [ next: NIL, name: "drc", deviceSelect: DrcSelect, deviceDrawFrame: DrcDrawFrame, deviceSetScale: DrcSetScale, deviceSetClipRegion: DrcSetClipRegion, deviceOutput: DrcOutput, deviceLayer: DrcLayer, deviceLoadLayer: DrcLoadLayer, deviceRectangle: DrcRectangle, deviceStartPoly: DrcStartPoly, devicePolyVertex: DrcPolyVertex, deviceEndPoly: DrcEndPoly, deviceText: DrcText ]; DrcSelect: PROCEDURE RETURNS[BOOLEAN] = BEGIN -- DrcSetClipRegion[GetClipRectangle[]]; RETURN[TRUE]; END; DrcDrawFrame: PROCEDURE = BEGIN DrawClipRectangle[]; END; DrcSetScale: PROCEDURE [factor: REAL] = BEGIN dc: DisplayContext _ GetDisplayContext[]; PopContext[dc]; PushContext[dc]; Scale[dc, [factor,factor]]; END; DrcSetClipRegion: PROCEDURE [rt: Rectangle] = BEGIN SetClipRectangle[rt]; END; DrcOutput: PROCEDURE = --expects (STRING) BEGIN baseName: STRING _ [100]; r: Rectangle _ GetClipRectangle[]; --clipping region in CIF units etop: REAL; SaveContext _ GetDisplayContext[]; PopString[baseName]; SetDisplayContext[drcContext]; SetClipRectangle[r]; drcClipRectangle _ MapRectangle[r,drcContext,identityContext]; etop _ drcClipRectangle.ury; DrcStart[baseName]; DrawCIF[Fix[r.llx],Fix[r.urx],Fix[r.lly],Fix[r.ury]]; DrcEnd[etop]; SetDisplayContext[SaveContext]; SetClipRectangle[r]; END; DrcStart: PROCEDURE[fileName: STRING] = BEGIN --Initialize EdgeList and ActiveList WriteLine["Start Drc"]; SetSorting[incy]; DrcCurrentLayer _ 32000; --i.e. not set DrcScanStart[fileName]; END; DrcEnd: PROCEDURE [ymax: REAL] = BEGIN DrcScanEnd[ymax]; END; DrcLayer: PROCEDURE [layer: CARDINAL] = --used to trigger scan conversion up to bottom of object about to be received BEGIN l,r,b,t: LONG INTEGER; bottom: REAL; rec: Rectangle; [l,r,b,t] _ ILastBB[]; --in chip coordinates --kludge - need bottom of current object in Extractor coords rec _ MapRectangle[[l,b,r,t], drcContext, identityContext]; --**may need to be in cifdrccontrol to get at drcContext (see CIFExtControl) bottom _ MIN[rec.lly,rec.ury]-1; -- -1 to be on safe side DrcTrigger[bottom]; DrcCurrentLayer _ layer; END; DrcLoadLayer: PROCEDURE[layer:CARDINAL, v0,v1,v2,v3: CARDINAL] = BEGIN END; --DrcTrapezoid: PUBLIC PROCEDURE [t:POINTER TO TrapezoidBlock] = --make two edges of appropriate types -- BEGIN OPEN t; -- edge: Edge; -- IF DrcCurrentLayer > 4 THEN RETURN; -- edge _ MakeEdge[xsleft,ystart,xeleft,yend,TRUE]; -- IF edge#NIL THEN EnterEdge[DrcCurrentLayer, edge]; -- edge _ MakeEdge[xsright,ystart,xeright,yend,FALSE]; -- IF edge#NIL THEN EnterEdge[DrcCurrentLayer, edge]; -- END; DrcRectangle: PROCEDURE [r: Rectangle] = --make two edges of appropriate types BEGIN edge: Edge; IF DrcCurrentLayer>4 THEN RETURN; edge _ MakeEdge[r.llx,r.lly, r.llx,r.ury, TRUE]; IF edge#NIL THEN EnterEdge[DrcCurrentLayer, edge]; edge _ MakeEdge[r.urx,r.lly, r.urx,r.ury, FALSE]; IF edge#NIL THEN EnterEdge[DrcCurrentLayer, edge]; END; x0,y0: REAL; xs,ys: REAL; DrcStartPoly: PROCEDURE [x,y: REAL] = BEGIN x0 _ xs _ x; y0 _ ys _ y; END; DrcPolyVertex: PROCEDURE [x,y: REAL] = BEGIN edge: Edge _ NIL; IF DrcCurrentLayer>4 THEN RETURN; SELECT TRUE FROM y>ys => edge _ MakeEdge[xs,ys, x,y,FALSE]; y edge _ MakeEdge[x,y, xs,ys,TRUE]; ENDCASE; IF edge#NIL THEN EnterEdge[DrcCurrentLayer, edge]; xs _ x; ys _ y; END; DrcEndPoly: PROCEDURE = BEGIN DrcPolyVertex[x0,y0]; END; DrcText: PROCEDURE[text: STRING, x,y: REAL] = BEGIN END; DefaultExtension: PROCEDURE[name,ext: STRING] RETURNS[STRING] = --set extension if not already present BEGIN i: CARDINAL; FOR i IN [0..name.length) DO IF name[i]='. THEN RETURN[name]; ENDLOOP; AppendChar[name,'.]; AppendString[name,ext]; RETURN[name]; END; mousex: POINTER TO CARDINAL = LOOPHOLE[424B]; mousey: POINTER TO CARDINAL = LOOPHOLE[425B]; MoveCursorTo: PUBLIC PROCEDURE[x,y: REAL] = BEGIN s: Vec _ ScreenToUser[mannContext, [x,y]]; p: Vec _ UserToScreen[SaveContext, s]; x0,y0: REAL; [x0,y0] _ ScreenOrigin[]; mousex^ _ FixC[p.x]; mousey^ _ FixC[p.y + y0]; END; --Drc Parameters drcClipRectangle: Rectangle; drcContext: DisplayContext _ NewContext[GetCIFOutDevice[]]; identityContext: DisplayContext _ CopyContext[drcContext]; SaveContext: DisplayContext; DrcCurrentLayer: CARDINAL; --set up context RegisterDevice[@DrcDeviceRecord]; JaMDrcStartUp[]; END.(635)\130b9B2b52B698b29B278b35B3b13B18b12B180b12B165b8B485b9B101b12B50b11B150b16B67b9B158b36B261b33B29b8B193b6B60b8B531b12B68b14B384b12B361b12B68b13B279b10B51b7B53b16B252b324B166b29B