-- File CIFPressControl.mesa -- Written by Martin Newell, June 1980 -- Last updated: April 23, 1981 3:33 PM DIRECTORY CIFControlDefs: FROM "CIFControlDefs" USING [DrawCIF], CIFDevicesDefs: FROM "CIFDevicesDefs" USING [DeviceDescriptor, DeviceDescriptorRecord, RegisterDevice, MaxLENGTHLayerArray, GetCIFOutDevice], CIFOutputDefs: FROM "CIFOutputDefs" USING [SetSorting], CIFUtilitiesDefs: FROM "CIFUtilitiesDefs" USING [Rectangle, SetClipRectangle, GetClipRectangle, SetUniformView, DrawClipRectangle, SetDisplayContext, GetDisplayContext, MoveTo, DrawTo], FileOpDefs: FROM "FileOpDefs" USING[SetUserAndPassword, StoreFile, FileOpFailed], Graphics: FROM "Graphics" USING [DisplayContext, NewContext, PushContext, PopContext, Scale], IODefs: FROM "IODefs" USING [WriteString, WriteLine, WriteDecimal, WriteChar], JaMFnsDefs: FROM "JaMFnsDefs" USING [PopString, PopInteger], OsStaticDefs: FROM "OsStaticDefs" USING [OsStatics], PressDefs: FROM "PressDefs" USING[InitPressFileDescriptor, ClosePressFile, PressFileDescriptor, PutRectangle, SetColor, PutText, StartOutline, PutDrawTo, EndOutline], Real: FROM "Real" USING [FixC, Fix], StringDefs: FROM "StringDefs" USING[AppendString, BcplToMesaString, AppendDecimal, AppendChar]; CIFPressControl: PROGRAM IMPORTS CIFControlDefs, CIFDevicesDefs, CIFOutputDefs, CIFUtilitiesDefs, FileOpDefs, Graphics, IODefs, JaMFnsDefs, PressDefs, Real, StringDefs = BEGIN OPEN CIFControlDefs, CIFDevicesDefs, CIFOutputDefs, CIFUtilitiesDefs, FileOpDefs, Graphics, IODefs, JaMFnsDefs, OsStaticDefs, PressDefs, Real, StringDefs; -- Press procedures PressDeviceRecord: DeviceDescriptorRecord _ [ next: NIL, name: "press", deviceSelect: PressSelect, deviceDrawFrame: PressDrawFrame, deviceSetScale: PressSetScale, deviceSetClipRegion: PressSetClipRegion, deviceOutput: PressOutput, deviceLayer: PressLayer, deviceLoadLayer: PressLoadLayer, deviceRectangle: PressRectangle, deviceStartPoly: PressStartPoly, devicePolyVertex: PressPolyVertex, deviceEndPoly: PressEndPoly, deviceText: PressText ]; PressSelect: PROCEDURE RETURNS[BOOLEAN] = BEGIN --expects (INTEGERs) PagesAcross _ PopInteger[]; PagesDown _ PopInteger[]; PressSetClipRegion[GetClipRectangle[]]; RETURN[TRUE]; END; PressDrawFrame: PROCEDURE = BEGIN r: Rectangle _ GetClipRectangle[]; DrawClipRectangle[]; BEGIN OPEN r; --show pages width: REAL _ (urx-llx)/PagesAcross; height: REAL _ (ury-lly)/PagesDown; x: REAL _ llx; y: REAL _ lly; THROUGH [1..PagesAcross) DO x _ x + width; MoveTo[x,lly]; DrawTo[x,ury]; ENDLOOP; THROUGH [1..PagesDown) DO y _ y + height; MoveTo[llx,y]; DrawTo[urx,y]; ENDLOOP; END; END; PressSetScale: PROCEDURE [factor: REAL] = BEGIN dc: DisplayContext _ GetDisplayContext[]; PopContext[dc]; PushContext[dc]; Scale[dc, [factor,factor]]; END; PressSetClipRegion: PROCEDURE [rt: Rectangle] = BEGIN --fit to shape of pages cx,cy,scale,halfwidth,halfheight: REAL; pagesWidth: REAL _ PagesAcross*(pressClipRectangle.urx - pressClipRectangle.llx); pagesHeight: REAL _ PagesDown*(pressClipRectangle.ury - pressClipRectangle.lly); r: Rectangle _ GetClipRectangle[]; cx _ (r.urx + r.llx)/2; cy _ (r.ury + r.lly)/2; scale _ MIN[(rt.urx-rt.llx)/pagesWidth, (rt.ury-rt.lly)/pagesHeight]/2; halfwidth _ scale*pagesWidth; halfheight _ scale*pagesHeight; SetClipRectangle[[llx: cx-halfwidth,lly: cy-halfheight, urx: cx+halfwidth,ury: cy+halfheight]]; END; PressOutput: PROCEDURE = --expects -- Generate pages i1-j1 through i2-j2 inclusive BEGIN fileName: STRING _ [100]; i,j,i1,j1,i2,j2: CARDINAL; PopString[fileName]; j2 _ PopInteger[]; i2 _ PopInteger[]; j1 _ PopInteger[]; i1 _ PopInteger[]; FOR i IN [MinMax[1,i1,PagesDown]..MinMax[1,i2,PagesDown]] DO FOR j IN [IF i=i1 THEN MinMax[1,j1,PagesAcross] ELSE 1 .. IF i=i2 THEN MinMax[1,j2,PagesAcross] ELSE PagesAcross] DO OutPressPage[fileName,i,j]; ENDLOOP; ENDLOOP; END; OutPressPage: PROCEDURE[fileName: STRING, pageDown,pageAcross: CARDINAL] = -- Generate single page BEGIN overlapRatio: REAL _ 68; --1/8 inch on 8.5 width,height,x,y,ovlap: REAL; saveContext: DisplayContext _ GetDisplayContext[]; r,ru: Rectangle; pageName: STRING _ [50]; r _ GetClipRectangle[]; --whole region in CIF units width _ (r.urx-r.llx)/PagesAcross; --width of single page height _ (r.ury-r.lly)/PagesDown; --height of single page ovlap _ width/overlapRatio; --inter-page overlap x _ r.llx + width*(pageAcross - 1); --x coord of top left corner of page y _ r.ury - height*(pageDown - 1); --y coord of top left corner of page -- draw page [x,y-height, x+width,y] extended by ovlap ru _ [llx: x-ovlap, lly: y-height-ovlap, urx: x+width+ovlap, ury: y+ovlap]; PushContext[pressContext]; SetDisplayContext[pressContext]; SetClipRectangle[pressClipRectangle]; SetUniformView[ru,pressClipRectangle]; pageName.length _ 0; AppendString[pageName,fileName]; AppendChar[pageName,'-]; AppendDecimal[pageName,pageDown]; AppendChar[pageName,'-]; AppendDecimal[pageName,pageAcross]; AppendString[pageName,".press"]; PressStart[pageName, pageDown,pageAcross]; DrawCIF[Fix[ru.llx],Fix[ru.urx],Fix[ru.lly],Fix[ru.ury]]; PressEnd[pageName]; SetDisplayContext[saveContext]; PopContext[pressContext]; SetClipRectangle[r]; END; PressStart: PROCEDURE[pageName: STRING, pageDown,pageAcross: CARDINAL] = BEGIN title: STRING _ [256]; user: STRING _ [20]; WriteString["Page "]; WriteDecimal[pageDown]; WriteChar[',]; WriteDecimal[pageAcross]; WriteString[". Press File: "]; WriteLine[pageName]; localName.length _ 0; IF pageName[0]='[ THEN BEGIN AppendString[localName,localFileBufferName]; WriteString["...buffered on "]; WriteLine[localFileBufferName]; END ELSE AppendString[localName,pageName]; InitPressFileDescriptor[@pressFileDescriptor,localName]; AppendString[title,"Page "]; AppendDecimal[title, pageDown]; AppendChar[title, ',]; AppendDecimal[title, pageAcross]; AppendString[title," of "]; AppendDecimal[title, PagesDown]; AppendChar[title, ',]; AppendDecimal[title, PagesAcross]; AppendString[title," from file "]; AppendString[title,pageName]; AppendString[title," for "]; BcplToMesaString[OsStatics^.UserName,user]; AppendString[title,user]; PutText[@pressFileDescriptor,title,635,254]; SetSorting[none]; PressCurrentLayer _ 7; --i.e. not set END; localName: STRING _ [50]; --in global frame since press shares it PressEnd: PROCEDURE[pageName: STRING] = BEGIN ClosePressFile[@pressFileDescriptor]; --check if need to write it to a file server IF pageName[0]='[ THEN BEGIN ENABLE FileOpFailed => BEGIN WriteString[" ---Store failed: "]; WriteLine[reason]; CONTINUE; END; user: STRING _ [40]; password: STRING _ [40]; WriteString["Transferring "]; WriteString[localFileBufferName]; WriteString[" to "]; WriteLine[pageName]; BcplToMesaString[OsStatics^.UserName,user]; BcplToMesaString[OsStatics^.UserPassword,password]; SetUserAndPassword[user,password]; StoreFile[localFileBufferName,pageName,binary]; END; END; PressLayer: PROCEDURE [layer: CARDINAL] = BEGIN IF layer#PressCurrentLayer THEN BEGIN SetColor[@pressFileDescriptor, Color[layer][hue], Color[layer][sat], Color[layer][bright]]; PressCurrentLayer _ layer; END; END; PressLoadLayer: PROCEDURE[layer:CARDINAL, v0,v1,v2,v3: CARDINAL] = -- v0,v1,v2 are hue,sat,bri, v3 ignored BEGIN Color[layer] _ [v0,v1,v2]; END; PressText: PROCEDURE[text: STRING, x,y: REAL] = BEGIN SetColor[@pressFileDescriptor, 0,0,0]; PutText[@pressFileDescriptor,text,FixC[x],FixC[y]]; SetColor[@pressFileDescriptor, Color[PressCurrentLayer][hue], Color[PressCurrentLayer][sat], Color[PressCurrentLayer][bright]]; END; --Private procedures-- PressRectangle: PROCEDURE [r: Rectangle] = --make two edges of appropriate types BEGIN left: CARDINAL _ FixC[r.llx]; bottom: CARDINAL _ FixC[r.lly]; right: CARDINAL _ FixC[r.urx]; top: CARDINAL _ FixC[r.ury]; PutRectangle[@pressFileDescriptor, left, bottom, right-left, top-bottom]; END; PressStartPoly: PROCEDURE [x,y: REAL] = BEGIN StartOutline[@pressFileDescriptor, FixC[x], FixC[y]]; END; PressPolyVertex: PROCEDURE [x,y: REAL] = BEGIN PutDrawTo[@pressFileDescriptor, FixC[x], FixC[y]]; END; PressEndPoly: PROCEDURE = BEGIN EndOutline[@pressFileDescriptor]; END; MinMax: PROCEDURE[lower,value,upper: CARDINAL] RETURNS[CARDINAL] = BEGIN RETURN[MIN[MAX[lower,value],upper]]; END; --Press parameters PagesAcross: CARDINAL _ 1; PagesDown: CARDINAL _ 1; pressClipRectangle: Rectangle _ [llx: 635, lly: 635, urx: 21590-635, ury: 27940-635]; pressContext: DisplayContext _ NewContext[GetCIFOutDevice[]]; PressCurrentLayer: CARDINAL; pressFileDescriptor: PressFileDescriptor; localFileBufferName: STRING _ "CIF.press$"; ColorComponent: TYPE = {hue,sat,bright}; Color: ARRAY [0..MaxLENGTHLayerArray) OF ARRAY ColorComponent OF CARDINAL _ ALL[[ 15, 255, 150]]; --undef --set up context --Set up default colors Color[0] _ [ 40, 220, 255]; --implant Color[1] _ [ 80, 150, 255]; --diffusion Color[2] _ [ 200, 190, 255]; --poly Color[3] _ [ 0, 0, 64]; --contact Color[4] _ [ 140, 170, 255]; --metal Color[5] _ [ 130, 220, 255]; --buried Color[6] _ [ 0, 220, 255]; --glass Color[7] _ [ 0, 0, 0]; --undef RegisterDevice[@PressDeviceRecord]; END. (635)\110b9B847f1 23f0 1f1 18f0 68f1 10f0 150b15B825b11B203b14B420b13B150b18B607b11B504b12B1348b10B1130b8B651b10B220b14B135b9B302b14B214f1 20f0 53b14B47f1 20f0 28b15B44f1 20f0 28b12B33f1 20f0 10b6B