CMosBWellDifImpl.mesa (part of ChipNDale)
Copyright © 1983, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, September 10, 1983 9:34 pm
Last Edited by: Christian Jacobi, October 17, 1986 2:00:20 pm PDT
DIRECTORY
CD,
CDBasics,
CDBasicsInline,
CDRects,
CDIO,
CMosB,
Rope,
TokenIO;
CMosBWellDifImpl:
CEDAR
PROGRAM
IMPORTS CD, CDBasics, CDBasicsInline, CDIO, CDRects, CMosB, TokenIO
SHARES CDRects =
BEGIN
wellSurround: CD.Number = CMosB.wellSurround;
wpdifClass:
CD.ObjectClass =
CD.RegisterObjectClass[$C2PDifRect, [
drawMe: DrawWellPDiffRect,
interestRect: InsideWellDiffRect,
showMeSelected: ShowSelectedWellDiffRect,
internalRead: CDRects.bareRectClass.internalRead,
internalWrite: WriteWellDif,
wireTyped: TRUE,
description: "w-pdif",
technology: CMosB.cmosB
]];
wndifClass:
CD.ObjectClass =
CD.RegisterObjectClass[$C2NDifRect, [
drawMe: DrawWellNDiffRect,
interestRect: InsideWellDiffRect,
showMeSelected: ShowSelectedWellDiffRect,
internalRead: CDRects.bareRectClass.internalRead,
internalWrite: WriteWellDif,
wireTyped: TRUE,
description: "w-ndif",
technology: CMosB.cmosB
]];
dummySpecific: REF WellRectRep = NEW[WellRectRep];
WellRectRep: TYPE = RECORD [i: INT𡤀];
WriteWellDif:
CD.InternalWriteProc = {
sz: CD.Position ← CDBasics.SizeOfRect[ob.bbox];
TokenIO.WriteInt[h, sz.x-2*wellSurround];
TokenIO.WriteInt[h, sz.y-2*wellSurround];
CDIO.WriteLayer[h, ob.layer];
};
InsideWellDiffRect:
PROC [ob:
CD.Object]
RETURNS [
CD.Rect] = {
RETURN [CDBasics.Extend[ob.bbox, -wellSurround]]
};
ShowSelectedWellDiffRect: CD.DrawProc = {
pr.drawOutLine[pr, CDBasics.Extend[CDBasics.MapRect[ob.bbox, trans], -(wellSurround)], CD.selectionLayer]
};
CreateWellDiffRect:
PROC [size:
CD.Position, l:
CD.Layer]
RETURNS [ob:
CD.Object] = {
--we do not lru cache; CDRects caching is good enough
size ← CDBasics.MaxPoint[size, [1, 1]];
ob ← NEW[CD.ObjectRep ← [class: wpdifClass, specific: dummySpecific]];
IF l=CMosB.wpdif THEN ob.class ← wpdifClass
ELSE IF l=CMosB.wndif THEN ob.class ← wndifClass
ELSE {
--actally error, but try to correct
IF l=CMosB.ndif THEN {l ← CMosB.wndif; ob.class ← wndifClass}
ELSE IF l=CMosB.pdif THEN {l ← CMosB.wpdif; ob.class ← wpdifClass}
ELSE ERROR
};
ob.bbox ← [x1: -wellSurround, y1: -wellSurround, x2: size.x+wellSurround, y2: size.y+wellSurround];
ob.layer ← l;
};
DrawWellPDiffRect: CD.DrawProc = {
r: CD.Rect = CDBasicsInline.MapRect[ob.bbox, trans];
pr.drawRect[pr,CDBasics.Extend[r, -wellSurround], CMosB.pdif];
pr.drawRect[pr, r, CMosB.nwell];
};
DrawWellNDiffRect:
CD.DrawProc = {
r: CD.Rect = CDBasicsInline.MapRect[ob.bbox, trans];
pr.drawRect[pr, CDBasics.Extend[r, -wellSurround], CMosB.ndif];
pr.drawRect[pr, r, CMosB.pwell];
};
CDRects.UseAsCreateRect[CMosB.wpdif, CreateWellDiffRect, wpdifClass];
CDRects.UseAsCreateRect[CMosB.wndif, CreateWellDiffRect, wndifClass];
END.