-- File CIFDrcUtilsDefs.mesa
-- Written by Dan Fitzpatrick and Martin Newell, June 1980
-- Last updated: March 24, 1981 4:14 PM

-- CIF Circuit DRC utility procedures

DIRECTORY

MergeDefs: FROM "MergeDefs" USING [MergeValue];

CIFDrcUtilsDefs: DEFINITIONS =

BEGIN


DisplayTrap:PUBLIC PROCEDURE [trap:Trapezoid];

Tag: PUBLIC PROCEDURE[this,that: STRING] RETURNS [STRING];

MakeTrap: PUBLIC PROCEDURE [left,right:Edge, start,end:REAL, layer:CARDINAL, type:TrapType]
RETURNS[trap: Trapezoid];

CopyTrap: PUBLIC PROCEDURE [oldTrap: Trapezoid]RETURNS[trap: Trapezoid];

AllocTrap:PUBLIC PROCEDURE RETURNS[trap:Trapezoid];

FreeTrap:PUBLIC PROCEDURE [trap:Trapezoid];

XatY: PUBLIC PROCEDURE[edge: Edge, y: REAL] RETURNS[x: REAL];

MakeEdge: PROCEDURE [xstart,ystart,xend,yend: REAL, up: BOOLEAN] RETURNS[edge: Edge];

CopyEdge:PUBLIC PROCEDURE [oldEdge:Edge] RETURNS[newEdge:Edge];

AllocEdge: PUBLIC PROCEDURE RETURNS[Edge];

FreeEdge: PUBLIC PROCEDURE[edge: Edge];

PrintTrapList: PUBLIC PROCEDURE[trapList: Trapezoid];

PrintAlloc: PUBLIC PROCEDURE;

Visible: PUBLIC PROCEDURE;

InVisible: PUBLIC PROCEDURE [i:CARDINAL];

InitUtils: PUBLIC PROCEDURE;

WriteFloat: PUBLIC PROCEDURE[r: REAL];

WriteLongOctal: PUBLIC PROCEDURE[e: LONG POINTER];

Trapezoid: TYPE = LONG POINTER TO TrapezoidRecord;
TrapType: TYPE = {mask, inclusion, exclusion, sanctuary};
TrapezoidRecord: TYPE = RECORD [
front,back: Trapezoid,
left,right: Edge,
minx,maxx,miny,maxy: LONG INTEGER,
layer: CARDINAL,
type: TrapType,
number: MergeDefs.MergeValue
];

Edge: TYPE = LONG POINTER TO EdgeRecord;
EdgeRecord: TYPE = RECORD [
next: Edge,
xstart: REAL,
ystart: REAL,
yend: REAL,
lastouty: REAL,--y value where edge of deferred trapezoid was last output
refs:CARDINAL,-- number of references to this edge
mate: Edge,--other edge making up a deferred trapezoid
up: BOOLEAN,--TRUE if edge defined in increasing y
flagout: BOOLEAN,--TRUE if edge will need to be output at ycurr
vert: BOOLEAN,--TRUE if edge vertical - used to SELECT variant
var:SELECT COMPUTED EdgeAngle FROM --use COMPUTED to save the whole WORD that Mesa
--otherwise allocates for the tag
oblique => [
xend: REAL,
slope: REAL],
vertical => NULL,
ENDCASE
];
EdgeAngle: TYPE = {oblique,vertical};

END.