DIRECTORY BasicTime, Convert, CommandTool, Interpress, Interpreter, PupDefs, IO, ImagerPixelMap, Terminal, InterminalBackdoor, ImagerSmooth, ImagerOps, DicentraRS232CAsync, MessageWindow, JaM, JaMIPrivate, Imager, Rope; JaMIDunnImpl: CEDAR MONITOR IMPORTS BasicTime, Convert, CommandTool, Interpreter, Interpress, IO, PupDefs, ImagerPixelMap, Rope, Terminal, InterminalBackdoor, ImagerSmooth, ImagerOps, DicentraRS232CAsync, MessageWindow, Imager, JaM, JaMIPrivate ~ BEGIN DunnHost: Rope.ROPE _ "York"; DunnWS: Rope.ROPE _ "Reprisal"; s: IO.STREAM; Map: TYPE = ARRAY [0..255] OF NAT; red, grn, blu: Map; copies: NAT _ 1; simulate: BOOLEAN _ FALSE; cmdCode: TYPE = MACHINE DEPENDENT { videoInvertHigh (2EH), videoInvertLow (2FH), readyTest (3AH), statusRequest (3BH), expose8x5TimeReq (3CH), exposeAuxTimeReq (3DH), exposeAdjFactorReq (3EH), advAuxFrameCnt (3FH), reset8x10ExposeStat (40H), restoreFilterWheel (41H), recovDefaultVals (42H), select8x10Mode (43H), selectAuxMode (44H), selectBW (45H), selectColor (46H), selectNrmSeqMode (47H), selectSepSeqMode (48H), exposeSeq (49H), selectVidAndExpose (4AH), set8x10ExposeTimes (4BH), setAuxExposeTimes (4CH), setExposeAdjFactors (4DH), openAuxShutter (4EH), closeAuxShutter (4FH), unblankMonitor (50H), blankMonitor (51H), selectVideoChannel (52H), positionFilterWheel (53H), immExposeNoVidSw (54H), yAxisRasterCompOn (55H), yAxisRasterCompOff (56H), clearYAxisOffset (57H), stepYAxisOffset (58H), clearXAxisOffset (59H), stepXAxisOffset (5AH), select35mmAuxCam (5BH), select16mmAuxCam (5CH), select4x5AuxCam (5DH), selectSX70AuxCam (5EH), setNumPadChars (5FH), resetAuxNoFilmStats (60H), fastOn (61H), fastOff (62H) }; ApplyLinearMap: PROC [self: JaM.State] ~ { FOR i: NAT IN [0..255] DO red[i] _ grn[i] _ blu[i] _ i; ENDLOOP; }; ApplyForceClose: PROC [self: JaM.State] ~ { IF NOT simulate THEN Close[s]; }; ApplySetCopies: PROC [self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; copies _ JaM.PopInt[self]; }; ApplyInterpret: PROC [self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; command: Rope.ROPE _ JaM.PopRope[self]; errorRope: Rope.ROPE _ NIL; [ , errorRope, ] _ Interpreter.Evaluate[command]; JaM.PushRope[self, errorRope]; }; ApplyDate: PROC [self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; JaM.PushRope[self, Convert.RopeFromTime[from:BasicTime.Now[], start:months, end:seconds, includeDayOfWeek:TRUE, includeZone:FALSE]]; }; IpOpenFailed: ERROR[msg: Rope.ROPE] = CODE; LogError: Interpress.LogProc ~ { ERROR IpOpenFailed[Rope.Concat["Interpress error: ", explanation]]; }; ApplyShowIP: PROC [self: JaM.State] ~ { GetContext: PROC [self: JaM.State] RETURNS [Imager.Context] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; IF info = NIL THEN ERROR; IF info.ipenabled THEN RETURN [info.ipdc]; RETURN[info.vdc]; }; Action: PROC ~ { Imager.ScaleT[context, 1.0/Imager.metersPerPoint]; Interpress.DoPage[master: master, page: page, context: context] }; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; context: Imager.Context ~ GetContext[self]; file: Rope.ROPE _ JaM.PopRope[self]; page: INT _ JaM.PopInt[self]; master: Interpress.OpenMaster; master _ Interpress.Open[file, LogError ! IpOpenFailed => { ERROR JaM.Error[type: OpenFailed, msg: msg] }]; page _ MAX[1, MIN[page, master.pages]]; Imager.DoSaveAll[context, Action]; }; ApplyCommand: PROC [self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; JaM.Push[self, CommandTool.DoCommand[JaM.PopRope[self], NIL]]; }; ApplyDunnSnap: ENTRY PROC [self: JaM.State] ~ { saveR, saveG, saveB: Map; vt: Terminal.Virtual _ InterminalBackdoor.terminal; { -- extra block to make vt in scope for abort ENABLE UNWIND => { FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, saveR[i], saveG[i], saveB[i]]; ENDLOOP; IF NOT simulate THEN Close[s]; }; s _ Open[DunnHost]; FOR i: NAT IN [0..255] DO [saveR[i], saveG[i], saveB[i]] _ Terminal.GetColor[vt, i, 0]; ENDLOOP; Snap[s, vt, self]; Close[s]; FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, saveR[i], saveG[i], saveB[i]]; ENDLOOP; }; }; Open: PROC [host: Rope.ROPE _ NIL] RETURNS [stream: IO.STREAM] ~ { simulate _ TRUE; MessageWindow.Clear[]; IF PupDefs.GetMyName[].Equal[DunnWS, FALSE] THEN { MessageWindow.Append[" Opening connection.."]; stream _ DicentraRS232CAsync.CreateStream[host: host ! IO.Error, IO.EndOfStream => ERROR; DicentraRS232CAsync.CommError => ERROR; DicentraRS232CAsync.CommBusy => ERROR; ]; MessageWindow.Append[" Open"]; simulate _ FALSE } ELSE MessageWindow.Append[" Simulation"]; }; Close: PROC [stream: IO.STREAM] ~ { IF NOT simulate THEN { MessageWindow.Append[" Closing"]; IO.Flush[stream]; IO.Close[stream]; }; MessageWindow.Append[" Done"]; }; Cmd: PROC [code: cmdCode] ~ { IF simulate THEN RETURN []; IO.PutChar[s, LOOPHOLE[code, CHAR]]; IO.Flush[s]; IF NOT CheckReady[s] THEN ERROR; }; CheckReady: PROC [s: IO.STREAM] RETURNS [ok:BOOL _ TRUE] ~ { IO.PutChar[s, LOOPHOLE[cmdCode[readyTest], CHAR]]; IO.Flush[s]; IF IO.GetChar[s] # 'R THEN { MessageWindow.Append[" Not Ready"]; RETURN [FALSE]; }; IF IO.GetChar[s] # '\n THEN { MessageWindow.Append[" Not OK"]; RETURN [FALSE]; }; }; Snap: PROC [s: IO.STREAM, vt: Terminal.Virtual, self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; x: JaM.Any ~ JaM.Pop[self]; pm: ImagerPixelMap.PixelMap _ ImagerOps.PixelMapFromFrameBuffer[Terminal.GetColorFrameBufferA[vt]]; oldScreen: ImagerPixelMap.PixelMap _ pm.Copy[]; redScreen, grnScreen, bluScreen: ImagerPixelMap.PixelMap; action: PROC [] ~ { pm.Fill[[0,0,pm.sSize, pm.fSize], 255]; Imager.ScaleT[ctx, 0.0254/72]; { ENABLE UNWIND => { info.ipenabled_ FALSE }; info.ipenabled_ TRUE; info.ipdc_ ctx; JaM.Execute[self, x]; info.ipenabled_ FALSE; }; }; ctx: Imager.Context _ ImagerSmooth.Create[ pm, $Intensity, ImagerSmooth.LikeScreen[vt.colorHeight], 72/0.0254]; IF info = NIL THEN ERROR; { ENABLE UNWIND => { Cmd[cmdCode[selectNrmSeqMode]]; Cmd[cmdCode[exposeSeq]]; Cmd[cmdCode[restoreFilterWheel]]; MessageWindow.Append[" aborted"]; pm.Transfer[oldScreen]; pm.refRep.ref _ NIL; pm.refRep _ NIL; IF redScreen.refRep # NIL THEN redScreen.refRep.ref _ NIL; redScreen.refRep _ NIL; IF grnScreen.refRep # NIL THEN grnScreen.refRep.ref _ NIL; grnScreen.refRep _ NIL; IF bluScreen.refRep # NIL THEN bluScreen.refRep.ref _ NIL; bluScreen.refRep _ NIL; }; -- set up red color map, build image and cache bits MessageWindow.Append[" Building separations"]; FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, red[i], 0, 0]; ENDLOOP; ImagerSmooth.SetComponent[ctx, $Red]; ctx.DoSaveAll[action]; redScreen _ pm.Copy[]; MessageWindow.Append[" R"]; -- set up green color map, build image and cache bits FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, 0, grn[i], 0]; ENDLOOP; ImagerSmooth.SetComponent[ctx, $Green]; ctx.DoSaveAll[action]; grnScreen _ pm.Copy[]; MessageWindow.Append["G"]; -- set up blue color map, build image and cache bits FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, 0, 0, blu[i]]; ENDLOOP; ImagerSmooth.SetComponent[ctx, $Blue]; ctx.DoSaveAll[action]; bluScreen _ pm.Copy[]; MessageWindow.Append["B"]; MessageWindow.Append[" Snapping "]; Cmd[cmdCode[closeAuxShutter]]; Cmd[cmdCode[restoreFilterWheel]]; Cmd[cmdCode[selectSepSeqMode]]; THROUGH [1..copies] DO IF JaM.GetAbort[self] THEN EXIT; FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, red[i], 0, 0]; ENDLOOP; pm.Transfer[redScreen]; Cmd[cmdCode[exposeSeq]]; MessageWindow.Append[" R"]; FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, 0, grn[i], 0]; ENDLOOP; ImagerSmooth.SetComponent[ctx, $Green]; pm.Transfer[grnScreen]; Cmd[cmdCode[exposeSeq]]; MessageWindow.Append["G"]; FOR i: NAT IN [0..255] DO Terminal.SetColor[vt, i, 0, 0, 0, blu[i]]; ENDLOOP; ImagerSmooth.SetComponent[ctx, $Blue]; pm.Transfer[bluScreen]; Cmd[cmdCode[exposeSeq]]; MessageWindow.Append["B"]; ENDLOOP; pm.Transfer[oldScreen]; pm.refRep.ref _ NIL; pm.refRep _ NIL; redScreen.refRep.ref _ NIL; redScreen.refRep _ NIL; grnScreen.refRep.ref _ NIL; grnScreen.refRep _ NIL; bluScreen.refRep.ref _ NIL; bluScreen.refRep _ NIL; }; }; ApplySetMap: PROC [self: JaM.State] ~ { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; map: JaM.Array ~ JaM.PopArray[self]; length: NAT _ map.length; nEntries:NAT _ map.length / 4; IF nEntries > 256 THEN ERROR; FOR i: NAT IN [0..255] DO red[i] _ grn[i] _ blu[i] _ 0; ENDLOOP; FOR i: NAT IN [0..nEntries) DO index: NAT _ NatFromAny[JaM.AGet[map, i*4+0]]; red[index] _ NatFromAny[JaM.AGet[map, i*4+1]]; grn[index] _ NatFromAny[JaM.AGet[map, i*4+2]]; blu[index] _ NatFromAny[JaM.AGet[map, i*4+3]]; ENDLOOP; }; NatFromAny: PROC [x: JaM.Any] RETURNS [NAT] ~ { i:INT _ WITH x SELECT FROM x: REF INT => x^, ENDCASE => ERROR JaM.Error[WrongType, "color map should contain CARDINALS [0-255]"]; IF i IN [0..255] THEN RETURN [i] ELSE ERROR JaM.Error[WrongType, "color map should contain CARDINALS [0-255]"] }; RegisterDunn: PUBLIC PROC [self: JaM.State] ~ { JaM.Register[self, ".dunnsnap", ApplyDunnSnap]; JaM.Register[self, ".preparecolormaps", ApplySetMap]; JaM.Register[self, ".linearmaps", ApplyLinearMap]; JaM.Register[self, ".forcedunnclosed", ApplyForceClose]; JaM.Register[self, ".copies", ApplySetCopies]; JaM.Register[self, ".interpret", ApplyInterpret]; JaM.Register[self, ".command", ApplyCommand]; JaM.Register[self, ".date", ApplyDate]; JaM.Register[self, ".showip", ApplyShowIP]; }; Init: PROC [] RETURNS [] ~ { FOR i: NAT IN [0..255] DO red[i] _ grn[i] _ blu[i] _ i; ENDLOOP; JaM.RegisterInit["JaMIDunnImpl", RegisterDunn]; }; Init[]; END. `JaMIDunnImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by: Mik Lamming - April 9, 1986 12:56:29 pm PST from RS232 Interface Specs for Dunn Models 631 and 632 Color Camera Systems -- Open a stream to the Dunn camera -- set up the color map as per user's spec. -- make three spearations. -- Close down the Dunn channel -- Reset the color maps as we found them -- set up red color map, restore image and expose it -- set up green color map, restore image and expose it -- set up blue color map, restore image and expose it -- called with (JaMIDunnImpl) .callinit Ê u˜™Icodešœ Ïmœ1™˜CJšœ˜J˜—š  œžœ˜'J˜š  œžœžœ˜?Kšœ3˜3Kšžœžœžœžœ˜Kšžœžœžœ ˜*Kšžœ ˜K˜K˜—š¡œžœ˜Jšœ2˜2Jšœ?˜?Jšœ˜—J˜Kšœ3˜3K˜+Kšœ žœ˜$Kšœžœ˜Jšœ˜šœ;˜;Jšžœ&˜+Jšœ˜——˜Kšœžœžœ˜'K˜Jšœ"˜"K˜K˜—š  œžœ˜(Kšœ3˜3Jšœ8žœ˜>K˜K˜—š  œž œ˜/Jšœ˜Jšœ3˜3J˜šœÏc,˜.šžœžœ˜šžœžœžœ ž˜Kšœ:˜:Kšžœ˜Kšžœžœ žœ ˜K˜K˜——J™#šœ˜K˜—K™+šžœžœžœ ž˜Kšœ=˜=Kšžœ˜K˜—K™J˜J˜K™Kšœ ˜ K˜K™(šžœžœžœ ž˜Kšœ:˜:Kšžœ˜—K˜—K˜K˜š œžœ žœžœžœ žœžœ˜BKšœ žœ˜Kšœ˜šžœ#žœžœ˜3Kšœ.˜.šœ6˜6Kšžœžœžœ˜"Kšœ!žœ˜'Kšœ žœ˜&J˜—Kšœ˜Jšœ ž˜J˜—šžœ˜Kšœ$˜$—Kšœ˜K˜—š œžœ žœžœ˜#šžœžœ žœ˜Kšœ!˜!Jšžœ˜Kšžœ˜K˜—Kšœ˜Kšœ˜—K˜š œžœžœ ˜Kšžœ žœžœ˜Kšžœ žœžœ˜%Kšžœ ˜ Kšžœžœžœžœ˜ K˜K˜—K˜š  œžœžœžœžœžœžœ˜