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;
};