<> <> <> <> <> <<>> DIRECTORY Pipal, PipalCore, PipalInt, PipalMos, PipalSinix, RefTab; PipalSinixCMosB: CEDAR PROGRAM IMPORTS Pipal, PipalCore, PipalInt, PipalMos, PipalSinix, RefTab = BEGIN <> mode: PipalSinix.Mode _ NEW [PipalSinix.ModeRec _ [ extractMethod: Pipal.RegisterMethod["CMosBExtraction"], extractProcProp: $CMosBExtractProc, decoration: PipalCore.CreateDecoration["CMosB"], objectEqualProc: PipalSinix.AlwaysTrue, nbOfLayers: nbOfInterestingLayers, objectLayer: ObjectLayer, touchProc: Touch, nameProc: PipalSinix.DefaultName ]]; <> Touch: PipalCore.TouchProc = { IsRect: PROC [object: Pipal.Object, layer: PipalMos.Layer] RETURNS [BOOL] = INLINE { IF NOT ISTYPE [object, PipalMos.Box] THEN RETURN [FALSE]; RETURN [NARROW [object, PipalMos.Box].layer=layer]; }; ChangeRect: PROC [object: Pipal.Object, layer: PipalMos.Layer] RETURNS [Pipal.Object] = { box: PipalMos.Box = NARROW [object]; RETURN [PipalMos.CreateBox[box.size, layer]]; }; IF IsRect[object1, $PwellCont] THEN RETURN [ touch[touch, trans1, ChangeRect[object1, $Pwell], trans2, object2] OR touch[touch, trans1, ChangeRect[object1, $Pdif], trans2, object2] ]; IF IsRect[object1, $NwellCont] THEN RETURN [ touch[touch, trans1, ChangeRect[object1, $Nwell], trans2, object2] OR touch[touch, trans1, ChangeRect[object1, $Ndif], trans2, object2] ]; IF IsRect[object2, $PwellCont] THEN RETURN [ touch[touch, trans2, ChangeRect[object2, $Pwell], trans1, object1] OR touch[touch, trans2, ChangeRect[object2, $Pdif], trans1, object1] ]; IF IsRect[object2, $NwellCont] THEN RETURN [ touch[touch, trans2, ChangeRect[object2, $Nwell], trans1, object1] OR touch[touch, trans2, ChangeRect[object2, $Ndif], trans1, object1] ]; IF IsRect[object1, $Met2] AND IsRect[object2, $Ovg] THEN RETURN [ PipalInt.IsInsideRectangle[PipalInt.BBox[object1, trans1], PipalInt.BBox[object2, trans2]] ]; IF IsRect[object1, $Ovg] AND IsRect[object2, $Met2] THEN RETURN [ PipalInt.IsInsideRectangle[PipalInt.BBox[object2, trans2], PipalInt.BBox[object1, trans1]] ]; RETURN PipalCore.Touch[touch, trans1, object1, trans2, object2]; }; nbOfInterestingLayers: NAT = 10; defaultLayerRange: PipalSinix.LayerRange = [min: 0, max: nbOfInterestingLayers-1]; interestingLayers: RefTab.Ref _ RefTab.Create[]; < REF PipalSinix.LayerRange]>> Interestinglayers: PROC [layer: PipalMos.Layer] RETURNS [PipalSinix.LayerRange] = { refLayerRange: REF PipalSinix.LayerRange _ NARROW [RefTab.Fetch[interestingLayers, layer].val]; RETURN [IF refLayerRange=NIL THEN defaultLayerRange ELSE refLayerRange^]; }; SetInterestinglayers: PROC [layer: PipalMos.Layer, range: PipalSinix.LayerRange] = { [] _ RefTab.Store[interestingLayers, layer, NEW [PipalSinix.LayerRange _ range]]; }; ObjectLayer: PROC [object: Pipal.Object] RETURNS [layerRange: PipalSinix.LayerRange] = { EachChild: PipalInt.EachChildProc = { thisLayerRange: PipalSinix.LayerRange _ WITH child SELECT FROM box: PipalMos.Box => Interestinglayers[box.layer], marker: PipalMos.Marker => Interestinglayers[marker.layer], text: PipalMos.Text => [nbOfInterestingLayers-1, 0], picture: PipalMos.Picture => [nbOfInterestingLayers-1, 0], ENDCASE => ERROR; layerRange _ [min: MIN [thisLayerRange.min, layerRange.min], max: MAX [thisLayerRange.max, layerRange.max]]; IF layerRange=defaultLayerRange THEN quit _ TRUE; }; layerRange _ [nbOfInterestingLayers-1, 0]; [] _ PipalMos.EnumerateAtomic[object, EachChild]; IF layerRange.min>layerRange.max THEN layerRange _ defaultLayerRange; }; <> Set: PROC [class: Pipal.Class, proc: PipalSinix.ExtractProc] = INLINE { Pipal.PutClassMethod[class, mode.extractMethod, NEW [PipalSinix.ExtractProc _ proc]]; }; <> <> <> <<[] _ CDOps.IncludeObjectI[comm.design,>> <> <> <> <> <> <<};>> <<>> <> SetInterestinglayers[$Met2, [0, 0]]; SetInterestinglayers[$Met, [1, 1]]; SetInterestinglayers[$Pol, [2, 2]]; SetInterestinglayers[$Pdif, [3, 3]]; SetInterestinglayers[$Ndif, [4, 4]]; SetInterestinglayers[$Pwell, [5, 5]]; SetInterestinglayers[$Nwell, [6, 6]]; SetInterestinglayers[$Ovg, [0, 7]]; SetInterestinglayers[$PwellCont, [8, 8]]; SetInterestinglayers[$NwellCont, [9, 9]]; SetInterestinglayers[$Cut2, [0, 1]]; SetInterestinglayers[$Cut, [1, 4]]; <> <> <> PipalCore.RegisterRoutingLayer[$Ndif]; PipalCore.RegisterRoutingLayer[$Pdif]; PipalCore.RegisterRoutingLayer[$Pol]; PipalCore.RegisterRoutingLayer[$Met]; PipalCore.RegisterRoutingLayer[$Met2]; PipalCore.RegisterRoutingLayer[$Ovg]; Set[Pipal.overlayClass, PipalSinix.ExtractEnumerate]; Set[Pipal.annotationClass, PipalSinix.ExtractAnnotation]; Set[PipalInt.abutClass, PipalSinix.ExtractAbut]; Set[PipalInt.transformClass, PipalSinix.ExtractTransform]; Set[PipalInt.translationClass, PipalSinix.ExtractTransform]; Set[PipalInt.orientClass, PipalSinix.ExtractTransform]; Set[PipalMos.boxClass, PipalSinix.ExtractBox]; Set[PipalMos.starClass, PipalSinix.ExtractStar]; Set[PipalMos.routingClass, PipalSinix.ExtractRouting]; Set[PipalMos.tilingClass, PipalSinix.ExtractTiling]; Set[PipalMos.markerClass, PipalSinix.ExtractAtomic]; Set[PipalMos.textClass, PipalSinix.ExtractNull]; Set[PipalMos.pictureClass, PipalSinix.ExtractNull]; PipalSinix.layoutMode _ mode; PipalCore.RegisterDecorationIO[mode.decoration]; END.