DIRECTORY Atom, BasicTime, CDBasics, CDMEBES, CDMEBESScan, CStitching, FS, IO, Rope; CDMEBESDropInImpl: CEDAR PROGRAM IMPORTS Atom, BasicTime, CDBasics, CDMEBES, CDMEBESScan, CStitching, FS, IO EXPORTS CDMEBES = BEGIN OPEN CDMEBES; InsertDropIn: PUBLIC PROC [ ms: MaskState, rects: Tesselation, di: DropIn, data: REF ] RETURNS [ newData: REF ] = BEGIN IF data = NIL THEN newData _ InsertDropIn[ms, rects, di, CDMEBESScan.ScanMebesPatternFile[ IO.PutFR[di.fileNamePattern, IO.rope[NARROW[ms.toolingSpec.GetPropFromList[ms.curMask.maskId], ToolingMaskSpec].maskNo]]]] ELSE WITH data SELECT FROM fileName: Rope.ROPE => newData _ InsertDropIn[ms, rects, di, CDMEBESScan.ScanMebesPatternFile[fileName]]; dd: CDMEBESScan.DropInDescriptor => { did: CDMEBESScan.DropInDescriptor _ dd; scaleFactor: Rational = [num: 1, denom: ms.mebesPixelPitch]; -- from Nm to MEBESPixels dropInClip: MEBESRect; -- the current output stripe, translated to drop-in space and clipped to drop-in boundary dropInOffsetToReticleClip: MEBESPosition; -- position of drop-in file's [0,0] in reticleClip mebesStripeClipFromDropIn: MEBESRect; IF BasicTime.Period[did.lastChecked, BasicTime.Now[]] > 5*60 THEN { WHILE FS.FileInfo[did.fileName].created # did.created DO did _ CDMEBESScan.ScanMebesPatternFile[did.fileName]; -- needs updating ENDLOOP; did.lastChecked _ BasicTime.Now[]; }; IF ms.mebesPixelPitch -- nm -- *1.0E-9 > did.pixelSize -- Meters -- +5.0E-10 OR ms.mebesPixelPitch*1.0E-9 < did.pixelSize-5.0E-10 THEN ERROR; -- pixel sizes incompatible dropInOffsetToReticleClip _ ScalePoint[CDBasics.AddPoints[CDBasics.AddPoints[di.pos, ms.dieOffset], CDBasics.BaseOfRect[ms.nmReticleClip]], scaleFactor]; mebesStripeClipFromDropIn _ CDBasics.MoveRect[ms.mebesStripeClip, CDBasics.NegOffset[dropInOffsetToReticleClip]]; dropInClip _ CDBasics.Intersection[did.clip, mebesStripeClipFromDropIn]; IF CDBasics.NonEmpty[dropInClip] THEN { s: IO.STREAM; IF di.clearBackground THEN rects.ChangeRect[CDBasics.MoveRect[dropInClip, dropInOffsetToReticleClip], NIL]; FOR segment: CARDINAL _ dropInClip.x1/CDMEBES.maskWidth, segment+1 WHILE segment*CDMEBES.maskWidth < dropInClip.x2 DO FOR stripe: CARDINAL _ dropInClip.y1/did.stripeHeight, stripe+1 WHILE stripe*did.stripeHeight < dropInClip.y2 DO offset: MEBESPosition = [x: segment*CDMEBES.maskWidth, y: stripe*did.stripeHeight]; IF did[segment][stripe] = [0, 0] THEN LOOP; IF s = NIL THEN s _ FS.StreamOpen[fileName: did.fileName, remoteCheck: FALSE]; s.SetIndex[CDMEBES.mebesBlockSize*(did[segment][stripe].firstBlock-1)+2*(did[segment][stripe].firstWordWithinBlock-1)]; ProcessStripe[source: s, dest: ms.s, stripeClip: CDBasics.Intersection[ [x1: 0, y1: 0, x2: CDMEBES.maskWidth, y2: did.stripeHeight], CDBasics.MoveRect[r: dropInClip, offset: CDBasics.NegOffset[offset]] ], destTrans: CDBasics.AddPoints[offset, CDBasics.SubPoints[dropInOffsetToReticleClip, CDBasics.BaseOfRect[ms.mebesStripeClip]]] ]; ENDLOOP; -- stripe ENDLOOP; -- segment s.Close[]; s _ NIL; }; newData _ did; }; ENDCASE => ERROR; END; ProcessStripe: PROC [ source, dest: IO.STREAM, stripeClip: MEBESRect, destTrans: MEBESPosition ] = BEGIN rectCmd: REF DrawRectangle = NEW[DrawRectangle]; DO t1: CARDINAL _ CDMEBESScan.ReadMebesWord[source]; SELECT t1 MOD 100B FROM 16 => { -- Manhattan Rectangle destRect: MEBESRect; x, width, y, height: INT; height _ t1/100B + 1; width _ CDMEBESScan.ReadMebesWord[source]; x _ CDMEBESScan.ReadMebesWord[source]; y _ CDMEBESScan.ReadMebesWord[source]; destRect _ CDBasics.Intersection[stripeClip, [x1: x, y1: y, x2: x+width, y2: y+height]]; IF CDBasics.NonEmpty[destRect] THEN { rectCmd.h _ destRect.y2-destRect.y1; rectCmd.w _ destRect.x2-destRect.x1; rectCmd.x _ destRect.x1+destTrans.x; rectCmd.y _ destRect.y1+destTrans.y; SendCommand[dest, rectCmd]; }; }; 17, 18, 19 => { -- Parallelogram, Trapezoid 1/2 UnimplementedGeom[]; source.SetIndex[source.GetIndex[]+10]; }; 20 => { -- Trapezoid 3 UnimplementedGeom[]; source.SetIndex[source.GetIndex[]+12]; }; 10, 7 => NULL; -- start of segment or small stripe number 2 => [] _ CDMEBESScan.ReadMebesWord[source]; -- start of large stripe number 8 => RETURN; -- end of stripe 4 => RETURN; -- end of drawing 9 => { -- end of buffer i: INT = source.GetIndex[]+CDMEBES.mebesBlockSize-1; source.SetIndex[i - (i MOD CDMEBES.mebesBlockSize)]; }; ENDCASE => ERROR CDMEBESScan.NotMEBESFormat; ENDLOOP; END; warnIfUnimplGeom: BOOL _ TRUE; UnimplementedGeom: PROC = {IF warnIfUnimplGeom THEN SIGNAL UnImplementedGeometry}; UnImplementedGeometry: SIGNAL = CODE; END. -- of CDMEBESDropInImpl ΊCDMEBESDropInImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. written by E. McCreight, November 2, 1983 6:03 pm McCreight, June 25, 1986 4:48:55 pm PDT This module drops a MEBES file into another MEBES file, one stripe at a time. This procedure incorporates the mask information referenced in data, translated by di.pos and then clipped to ms.mebesStripeClip, into the MEBES stream in ms.s. Module START code... ΚΒ˜šœ™Icodešœ Οmœ1™—Jšœw˜wšœ$˜$šœ"˜"Jšœ<˜