(FILECREATED "24-Aug-84 17:12:51" {PHYLUM}<BLUEBONNET>DMRUSSELL>8200INTERFACE.;5 34139  

      changes to:  (FNS LoadPaperIntoTopPaperTray)

      previous date: " 4-NOV-83 17:05:48" {PHYLUM}<BLUEBONNET>DMRUSSELL>8200INTERFACE.;4)


(* Copyright (c)  by NIL. All rights reserved.)

(PRETTYCOMPRINT 8200INTERFACECOMS)

(RPAQQ 8200INTERFACECOMS [(FNS * 8200INTERFACEFNS)
	(MACROS * 8200INTERFACEMACROS)
	(PROP Settings CopyButton CopyModeButton OutputButton PaperTrayButton ReductionButton)
	(PROP Message A12 APLight AddPaper B01 B02 Bottom CBPTDLight CDCLight CollatedStapled 
	      CollatedUnstapled CopyButton CopyModeButton E10 FPBLPTLight FullSize Initialization 
	      LCITTLight LPBFPTLight LampTest NotReady OFDLight OFULight OneSidedCopies OutputButton 
	      PWLight PaperTrayButton Printing RDHLeftCover RDHRightCover RLight Ready 
	      ReductionButton RunNotPrint SCSILight STTTSLight TechRep Top TwoSidedCopies 
	      TwoSidedOriginalsAndCopies UOTLight UTPTLight)
	(RECORDS * 8200INTERFACERECORDS)
	(P (LOAD? 'EVALSERVER.DCOM))
	(VARS * 8200INTERFACEVARS)
	(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA)
									      (NLAML)
									      (LAMA])

(RPAQQ 8200INTERFACEFNS (CloseBottomPaperTray CloseDocumentCover CloseRDH CloseTopPaperTray 
					      CreateSimulate8200Menu Get8200 Get8200Copy 
					      Get8200CopyMode Get8200Led Get8200OpStatusCode 
					      Get8200Output Get8200PaperTray Get8200Reduction 
					      Get8200State Get8200TechStatusCodes GetAddPaperMsg 
					      GetMessage LoadPaperIntoTopPaperTray 
					      MoveCopiesFromOutputToRDH MoveOutputRDH 
					      OpenBottomPaperTray OpenDocumentCover OpenRDH 
					      OpenTopPaperTray ParseSimulate8200Menu Push8200Button 
					      PushSimulatedButton Put8200 PutOriginalInRDH 
					      PutOriginalOnGlass Read8200 RemoveCopiesFromOutputTray 
					      RemoveOriginalFromGlass RemoveOriginalFromRDH 
					      RemovePaperFromTopPaperTray ReverseOriginals 
					      Select8200Feature SelectNumberOfCopies SetBit SetBitOff)
)
(DEFINEQ

(CloseBottomPaperTray
  [LAMBDA NIL                                                (* edited: "26-SEP-83 16:03")
                                                             (* Simulate the closing of the bottom paper tray)
    (SetBitOff JobState:machineState 17 128])

(CloseDocumentCover
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:54")
                                                             (* Simulate the user closing the document cover)
    NIL])

(CloseRDH
  [LAMBDA NIL                                                (* edited: "26-SEP-83 10:42")
                                                             (* Indicate that the RDH is closed.
							     Used to simulate the RDH closing)
    (SetBitOff JobState:machineState 21 2])

(CloseTopPaperTray
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:52")
                                                             (* Used to simulate closing the top paper tray)
    ])

(CreateSimulate8200Menu
  [LAMBDA NIL                                                (* edited: "26-SEP-83 10:42")
                                                             (* Make a permanent menu that allows a clever user to 
							     simulate "hands-on" a real 8200.0)
    Simulate8200Menu←(ADDMENU (create MENU
				      ITEMS ←(QUOTE (("Open RDH" OpenRDH)
						      ("Close RDH" CloseRDH)
						      ("Open Top Paper Tray" OpenTopPaperTray)
						      ("Close Top Paper Tray" CloseTopPaperTray)
						      ("Open Bottom Paper Tray" OpenBottomPaperTray)
						      ("Close Bottom Paper Tray" CloseBottomPaperTray)
						      ("Open Document Cover" OpenDocumentCover)
						      ("Close Document Cover" CloseDocumentCover)
						      (" --- " OpenDocumentCover)
						      ("Move copies from output to RDH" MoveOutputRDH)
						      ("Put original on glass" PutOriginalOnGlass)
						      ("Remove original from glass" 
									  RemoveOriginalFromGlass)
						      ("Put original in RDH" PutOriginalInRDH)
						      ("Remove original from RDH" 
									    RemoveOriginalFromRDH)
						      ("Remove copies from output tray" 
								       RemoveCopiesFromOutputTray)
						      ("Reverse Originals" ReverseOriginals)
						      ("Load paper into Top Paper Tray" 
									LoadPaperIntoTopPaperTray)
						      ("Remove paper from Top Paper Tray" 
								      RemovePaperFromTopPaperTray)))
				      MENUOUTLINESIZE ← 6
				      MENUCOLUMNS ← 2
				      WHENSELECTEDFN ←(FUNCTION [LAMBDA (X)
					  (EVAL X::1])
				      TITLE ← "8200 User Actions")
			      NIL
			      (create POSITION
				      XCOORD ← 550
				      YCOORD ← 5])

(Get8200
  [LAMBDA (array prop)                                       (* edited: " 3-MAR-83 13:55")

          (* Get the value of property prop from array as obtained by Read8200. The properties are each of the feature types
	  selected by buttons on the main panel (e.g., CopyMode), each of the other lights on the main panel 
	  (e.g., AddPaper), each of the led's on the status panel (e.g., MainFeederLed), each of the sensors 
	  (e.g., DocumentInRDH), OperatorStatusCode, and TechStatusCode. Note: no provision is made in the code for dealing 
	  with blinking main panel lights.)


    (SELECTQ prop
	     ((AddPaper APLight)
	       (Get8200OnOffLight array 18 128))
	     (AddPaperLed (Get8200Led array 27 32))
	     (BSkiis (EltAnd array 23 1))
	     (BTransport (EltAnd array 23 2))
	     (BeltMistrackNOT (EltAnd array 20 8))
	     (CTransport (EltAnd array 23 4))
	     (CleanPopSensor (EltAnd array 22 16))
	     ((CloseBottomPaperTrayDoor CBPTDLight)
	       (Get8200OnOffLight array 17 128))
	     ((CloseDocumentCover CDCLight)
	       (Get8200OnOffLight array 16 1))
	     (ClosePaperDoorLed (Get8200Led array 24 128))
	     (CloseRDHLed (Get8200Led array 27 16))
	     (CompilerEntrySwitch (EltAnd array 19 16))
	     (CompilerExitSwitch (EltAnd array 19 32))
	     ((Copy CopyButton)
	       (Get8200Copy array))
	     ((CopyMode CopyModeButton)
	       (Get8200CopyMode array))
	     (DeveloperDoor (EltAnd array 23 128))
	     (DocumentInRDH (EltAnd array 19 128))
	     (EmptyTopTrayLed (Get8200Led array 27 1))
	     (FinisherCover (EltAnd array 20 2))
	     ((FirstPageBottomLastPageTop FPBLPTLight)
	       (Get8200OnOffLight array 18 8))
	     (FuserJamReset (EltAnd array 23 32))
	     (FuserOverTempNOT (EltAnd array 20 16))
	     (FuserUnderTemperature (EltAnd array 22 8))
	     (JamSwitch2 (EltAnd array 19 1))
	     (JamSwitch3 (EltAnd array 19 2))
	     (JamSwitch4 (EltAnd array 19 4))
	     (JamSwitch5 (EltAnd array 19 8))
	     ((LastPageBottomFirstPageTop LPBFPTLight)
	       (Get8200OnOffLight array 18 16))
	     ((LoadCopiesInTopTray LCITTLight)
	       (Get8200OnOffLight array 18 1))
	     (MainFeederLed (Get8200Led array 27 8))
	     (MainPaperTrayDoor (EltAnd array 20 64))
	     (MisStrip (EltAnd array 22 128))
	     (ModuleInterlockNOT (EltAnd array 20 32))
	     (OffsettingCatchTray (EltAnd array 19 64))
	     (OffsettingCatchTrayPosition (EltAnd array 21 16))
	     ((OperatorStatusCode OpStatusCode)
	       (Get8200OpStatusCode array))
	     ((OriginalsFaceDown OFDLight)
	       (Get8200OnOffLight array 18 4))
	     ((OriginalsFaceUp OFULight)
	       (Get8200OnOffLight array 18 2))
	     ((Output OutputButton)
	       (Get8200Output array))
	     ((PaperTray PaperTrayButton)
	       (Get8200PaperTray array))
	     (PaperUnderPopSensor (EltAnd array 22 32))
	     ((PleaseWait PWLight)
	       (Get8200OnOffLight array 16 32))
	     (PopJam (EltAnd array 22 64))
	     (PopReset (EltAnd array 23 8))
	     (PopSensorLed (Get8200Led array 24 8))
	     (ProcessorCover (EltAnd array 20 1))
	     (RDHLeftCover (EltAnd array 21 128))
	     (RDHMisfeed (EltAnd array 6 8))
	     (RDHMotor (EltAnd array 21 64))
	     (RDHMotorOff (EltAnd array 6 128))
	     (RDHOpen (EltAnd array 21 2))
	     (RDHReturnJam (EltAnd array 6 64))
	     (RDHRightCover (EltAnd array 21 32))
	     (RDHShingleFeed (EltAnd array 6 16))
	     (RDHSlowOffPlaten (EltAnd array 6 32))
	     (RDHStackingJam (EltAnd array 6 4))
	     (RXShroudOpen (EltAnd array 21 8))
	     ((Ready RLight)
	       (Get8200OnOffLight array 16 128))
	     ((Reduction ReductionButton)
	       (Get8200Reduction array))
	     (SetsTooThickLed (Get8200Led array 27 64))
	     ((SetsTooThickToStaple STTTSLight)
	       (Get8200OnOffLight array 17 64))
	     (ShadeOpen (EltAnd array 21 1))
	     (StandbyRelayNOT (EltAnd array 20 128))
	     (StaplerCover (EltAnd array 20 4))
	     (StaplerPresent (EltAnd array 22 4))
	     (State (Get8200State array))
	     ((StatusCodeSeeInstructions SCSILight)
	       (Get8200OnOffLight array 16 64))
	     (TechStatusCode (Get8200TechStatusCodes array))
	     (TopTrayFeederLed (Get8200Led array 27 4))
	     (TurnAroundTransport (EltAnd array 23 16))
	     (USShroudOpen (EltAnd array 21 4))
	     ((UnloadOutputTray UOTLight)
	       (Get8200OnOffLight array 18 64))
	     ((UnloadTopPaperTray UTPTLight)
	       (Get8200OnOffLight array 17 2))
	     (X2Led (Get8200Led array 24 1))
	     (X3Led (Get8200Led array 24 2))
	     (X4Led (Get8200Led array 24 4))
	     (X5Led (Get8200Led array 24 16))
	     (X6Led (Get8200Led array 24 32))
	     (X7Led (Get8200Led array 24 64))
	     (PROG [(fix (FIXSPELL prop NIL '(APLight AddPaper AddPaperLed BSkiis BTransport 
						      BeltMistrackNOT CBPTDLight CDCLight CTransport 
						      CleanPopSensor CloseBottomPaperTrayDoor 
						      CloseDocumentCover ClosePaperDoorLed 
						      CloseRDHLed CompilerEntrySwitch 
						      CompilerExitSwitch Copy CopyButton CopyMode 
						      CopyModeButton DeveloperDoor DocumentInRDH 
						      EmptyTopTrayLed FPBLPTLight FinisherCover 
						      FirstPageBottomLastPageTop FuserJamReset 
						      FuserOverTempNOT FuserUnderTemperature 
						      JamSwitch2 JamSwitch3 JamSwitch4 JamSwitch5 
						      LCITTLight LPBFPTLight 
						      LastPageBottomFirstPageTop LoadCopiesInTopTray 
						      MainFeederLed MainPaperTrayDoor MisStrip 
						      ModuleInterlockNOT OFDLight OFULight 
						      OffsettingCatchTray OffsettingCatchTrayPosition 
						      OpStatusCode OperatorStatusCode 
						      OriginalsFaceDown OriginalsFaceUp Output 
						      OutputButton PWLight PaperTray PaperTrayButton 
						      PaperUnderPopSensor PleaseWait PopJam PopReset 
						      PopSensorLed ProcessorCover RDHLeftCover 
						      RDHMisfeed RDHMotor RDHMotorOff RDHOpen 
						      RDHReturnJam RDHRightCover RDHShingleFeed 
						      RDHSlowOffPlaten RDHStackingJam RLight 
						      RXShroudOpen Ready Reduction ReductionButton 
						      SCSILight STTTSLight SetsTooThickLed 
						      SetsTooThickToStaple ShadeOpen StandbyRelayNOT 
						      StaplerCover StaplerPresent State 
						      StatusCodeSeeInstructions TechStatusCode 
						      TopTrayFeederLed TurnAroundTransport UOTLight 
						      USShroudOpen UTPTLight UnloadOutputTray 
						      UnloadTopPaperTray X2Led X3Led X4Led X5Led 
						      X6Led X7Led]
	           (RETURN (if fix
			       then (Get8200 array fix)
			     else (HELP "Unknown prop in Get8200:" prop])

(Get8200Copy
  [LAMBDA (array)                                            (* ref: " 5-MAR-82 16:32")
                                                             (* Get the value of property Copy from array as obtained
							     by Read8200. Return NIL if no setting is found for 
							     Copy.)
    (if (EltAnd array 17 32)
	then 'Normal
      elseif (EltAnd array 17 16)
	then 'Darker
      elseif (EltAnd array 17 8)
	then 'Lighter])

(Get8200CopyMode
  [LAMBDA (array)                                            (* ref: " 5-MAR-82 16:37")
                                                             (* Get the value of property Copy Mode from array as 
							     obtained by Read8200. Return NIL if no setting is found 
							     for Copy Mode.)
    (if (EltAnd array 17 4)
	then 'OneSidedCopies
      elseif (EltAnd array 17 1)
	then 'TwoSidedCopies
      elseif (EltAnd array 15 4)
	then 'TwoSidedOriginalsAndCopies])

(Get8200Led
  [LAMBDA (array elt mask)                                   (* ref: "10-MAR-82 12:34")
                                                             (* Get the status of the 8200 status panel led indicated
							     by array and elt. Return on, off, blink, or flash.)
    (if (EltAnd array elt mask)
	then 'on
      elseif (EltAnd array elt+1 mask)
	then 'blinking
      elseif (EltAnd array elt+2 mask)
	then 'flashing
      else 'off])

(Get8200OpStatusCode
  [LAMBDA (array)                                            (* ref: "24-MAR-82 16:54")
                                                             (* Return the operator status code indicated by the 
							     given 8200 status array.)
    (SELECTQ (for elt to 14 thereis (ELT array elt)
				    ~=0)
	     [1 (if (EltAnd array 1 32)
		    then 'B08
		  elseif (EltAnd array 1 16)
		    then 'B07
		  elseif (EltAnd array 1 8)
		    then 'B06
		  else (HELP "illegal 8200 fault, byte 1:" (ELT array 1]
	     [2 (if (EltAnd array 2 127)
		    then 'E10
		  else (HELP "illegal 8200 fault, byte 2:" (ELT array 2]
	     [3 (if (EltAnd array 3 143)
		    then 'E10
		  else (HELP "illegal 8200 fault, byte 3:" (ELT array 3]
	     [4 (if (EltAnd array 4 63)
		    then 'E10
		  else (HELP "illegal 8200 fault, byte 4:" (ELT array 4]
	     [5 (if (EltAnd array 5 16)
		    then 'C10
		  elseif (EltAnd array 5 8)
		    then 'C20
		  else (HELP "illegal 8200 fault, byte 5:" (ELT array 5]
	     (6 (if (EltAnd array 6 252)
		    then 'A10
		  elseif (EltAnd array 6 2)
		    then 'A11
		  else 'A17))
	     [7 (if (EltAnd array 7 128)
		    then 'D07
		  elseif (EltAnd array 7 8)
		    then 'D03
		  elseif (EltAnd array 7 2)
		    then 'D01
		  elseif (EltAnd array 7 1)
		    then 'D00
		  else (HELP "illegal 8200 fault, byte 7:" (ELT array 7]
	     (8 (if (EltAnd array 8 128)
		    then 'D15
		  elseif (EltAnd array 8 64)
		    then 'D14
		  elseif (EltAnd array 8 32)
		    then 'D13
		  elseif (EltAnd array 8 16)
		    then 'D12
		  elseif (EltAnd array 8 8)
		    then 'D11
		  elseif (EltAnd array 8 4)
		    then 'D10
		  elseif (EltAnd array 8 2)
		    then 'D09
		  else 'D08))
	     (9 (if (EltAnd array 9 128)
		    then 'D23
		  elseif (EltAnd array 9 64)
		    then 'D22
		  elseif (EltAnd array 9 32)
		    then 'D21
		  elseif (EltAnd array 9 16)
		    then 'D20
		  elseif (EltAnd array 9 8)
		    then 'D19
		  elseif (EltAnd array 9 4)
		    then 'D18
		  elseif (EltAnd array 9 2)
		    then 'D17
		  else 'D16))
	     (10 (if (EltAnd array 10 128)
		     then 'D31
		   elseif (EltAnd array 10 64)
		     then 'D30
		   elseif (EltAnd array 10 32)
		     then 'D29
		   elseif (EltAnd array 10 16)
		     then 'D28
		   elseif (EltAnd array 10 8)
		     then 'D27
		   elseif (EltAnd array 10 4)
		     then 'D26
		   elseif (EltAnd array 10 2)
		     then 'D25
		   else 'D24))
	     (11 (if (EltAnd array 11 128)
		     then 'E15
		   elseif (EltAnd array 11 64)
		     then 'C30
		   elseif (EltAnd array 11 32)
		     then 'F02
		   elseif (EltAnd array 11 16)
		     then 'F01
		   elseif (EltAnd array 11 8)
		     then 'E16
		   elseif (EltAnd array 11 4)
		     then 'F02
		   elseif (EltAnd array 11 2)
		     then 'F01
		   else 'E16))
	     [12 (if (EltAnd array 12 192)
		     then 'A12
		   elseif (EltAnd array 12 1)
		     then 'E15
		   else (HELP "illegal 8200 fault, byte 12:" (ELT array 12]
	     [13 (if (EltAnd array 13 8)
		     then 'A16
		   elseif (EltAnd array 13 4)
		     then 'A14
		   elseif (EltAnd array 13 3)
		     then 'A13
		   else (HELP "illegal 8200 fault, byte 13:" (ELT array 13]
	     (14 (if (EltAnd array 14 128)
		     then 'B03
		   elseif (EltAnd array 14 64)
		     then 'B05
		   elseif (EltAnd array 14 32)
		     then 'B04
		   elseif (EltAnd array 14 16)
		     then 'A18
		   elseif (EltAnd array 14 8)
		     then 'B02
		   elseif (EltAnd array 14 4)
		     then 'B01
		   elseif (EltAnd array 14 2)
		     then 'A15
		   else 'A19))
	     NIL])

(Get8200Output
  [LAMBDA (array)                                            (* ref: " 5-MAR-82 16:01")
                                                             (* Get the value of property Output from array as 
							     obtained by Read8200. Return NIL if no setting is found 
							     for Output.)
    (if (EltAnd array 15 128)
	then 'CollatedStapled
      elseif (EltAnd array 15 2)
	then 'Uncollated
      elseif (EltAnd array 15 1)
	then 'CollatedUnstapled])

(Get8200PaperTray
  [LAMBDA (array)                                            (* ref: " 5-MAR-82 16:40")
                                                             (* Get the value of property Paper Tray from array as 
							     obtained by Read8200. Return NIL if no setting is found 
							     for Paper Tray.)
    (if (EltAnd array 15 32)
	then 'Top
      elseif (EltAnd array 15 16)
	then 'Bottom])

(Get8200Reduction
  [LAMBDA (array)                                            (* ref: " 5-MAR-82 16:44")
                                                             (* Get the value of property Reduction from array as 
							     obtained by Read8200. Return NIL if no setting is found 
							     for Reduction.)
    (if (EltAnd array 16 16)
	then 'FullSize
      elseif (EltAnd array 16 8)
	then 98
      elseif (EltAnd array 16 4)
	then 74
      elseif (EltAnd array 16 2)
	then 65])

(Get8200State
  [LAMBDA (array)                                            (* edited: "16-MAR-82 16:58")
                                                             (* Get the value of property State from array as 
							     obtained by Read8200. Return NIL if no setting is found 
							     for State.)
    (CAR (NTH '(ComponentControl TechRep NotReady Ready Printing RunNotPrint LampTest Initialization)
	      (ELT array 30)+ 1])

(Get8200TechStatusCodes
  [LAMBDA (array)                                            (* edited: " 6-MAR-82 11:17")
                                                             (* Return a list of the tech status codes indicated by 
							     the given 8200 status array.)
    "not yet implemented"])

(GetAddPaperMsg
  [LAMBDA (addPaper array)                                   (* ref: "22-MAR-82 17:26")
                                                             (* The "Message" function for AddPaper.
							     Return a message that depends on which paper tray is 
							     selected.)
    (CONCAT "Add paper to " (SELECTQ (Get8200 array 'PaperTray)
				     (Top "top")
				     "bottom")
	    " paper tray."])

(GetMessage
  [LAMBDA (indicator array)                                  (* ref: "22-MAR-82 15:21")

          (* Get the message associated with indicator. If the value of property "Message" is a string, then return it.
	  If the value is an atom, treat the value as a function and apply the function with "indicator" and "array" as 
	  arguments. Otherwise, return "indicator" as a string.)


    (PROG [(message (SELECTQ indicator
			     (65 "65%%")
			     (74 "74%%")
			     (98 "98%%")
			     (GETPROP indicator 'Message]
          (RETURN (if (STRINGP message)
		      then message
		    elseif message and (ATOM message)
		      then (APPLY* message indicator array)
		    else (MKSTRING indicator])

(LoadPaperIntoTopPaperTray
  [LAMBDA NIL                                                (* JG "24-Aug-84 16:24")
                                                             (* Simulate the user putting a ream of paper into the 
							     TopPaperTray)
    (DECLARE USEDFREE JobState)
    (SetBitOff (fetch machineState of JobState)
	       18 1])

(MoveCopiesFromOutputToRDH
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:56")
                                                             (* Simulate the user moving his copies from the output 
							     tray to the RDH.)
    (RemoveCopiesFromOutputTray)                             (* Now, put the copies in the RDH)
    (BLOCK 3000)
    (PutOriginalInRDH])

(MoveOutputRDH
  [LAMBDA NIL                                                (* edited: "19-SEP-83 14:02")
                                                             (* Simulate that the user has moved copies from the 
							     ouput tray to the RDH)
    (PRINT "Move output from tray to RDH"])

(OpenBottomPaperTray
  [LAMBDA NIL                                                (* edited: "26-SEP-83 16:03")
                                                             (* Simulate the opening of the bottom paper tray)
    (SetBit JobState:machineState 17 128])

(OpenDocumentCover
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:54")
                                                             (* Simulate the user opening the document cover.)
    NIL])

(OpenRDH
  [LAMBDA NIL                                                (* edited: "26-SEP-83 10:42")
                                                             (* Simulate opening the RDH)
    (SetBit JobState:machineState 21 2])

(OpenTopPaperTray
  [LAMBDA NIL                                                (* edited: "26-SEP-83 16:00")
                                                             (* Used to simulate opening the top paper tray)
                                                             (* This REALLY is a NO-OP in the 8200! It can't detect 
							     this action!)
    NIL])

(ParseSimulate8200Menu
  [LAMBDA (X Y Z)                                            (* edited: " 7-SEP-83 11:22")
                                                             (* This function is called by selecting an item in the 
							     8200Simulation menu. It does the appropriate action if 
							     possible.)
    (EVAL X::1])

(Push8200Button
  [LAMBDA (button)                                           (* dmr: " 9-SEP-83 14:27")

          (* Send a signal to the "8200" that will have the effect of pushing the panel button specified by "button". 
"button" can be an integer 0,1,...,9, one of the globally specified buttons (e.g., CopyModeButton), or one of the atoms 
	  Blank, Clear, Copy, CopyMode, Output, PaperTray, Reduction, StartPrint, or StopPrint.)

                                                             (* This hooks the simulator into the system so it will 
							     do the right things when a button is pressed.)
    (PROG NIL
          (if Simulate8200
	      then (Simulate8200StateChange JobState:machineState button)
		   (RETURN (PushSimulatedButton button)))
          (if 8200Server
	      then (RETURN (REMOTEVAL <'ServerPush8200Button <'QUOTE button>> 8200Server))
	    else (RETURN (ServerPush8200Button button])

(PushSimulatedButton
  [LAMBDA (button)                                           (* edited: "19-SEP-83 15:28")
                                                             (* Push a button on the simulated 8200 and return the 
							     value of button.)
    (PROG NIL
          (SELECTQ button
		   ((1 2 3 4 5 6 7 8 9 0)
		     (RETURN button))
		   (Clear (RETURN button))
		   (CopyModeButton (RETURN button))
		   (StartPrint (RETURN button))
		   (PaperTrayButton (RETURN button))
		   (OutputButton (RETURN button))
		   (ReductionButton (RETURN button))
		   (HELP "Button of unknown type in PushSimulatedButton"])

(Put8200
  [LAMBDA (array field newvalue)                             (* DMR: "15-JUN-83 09:15")

          (* Updates the 30-byte array by changing the selected field to the new value. This is used by an ACCESSFN in 
	  JobState to allow the simulator to update JobState:State.)


    (SELECTQ field
	     (State (ELT array 30)
		    ←
		    (SELECTQ newvalue
			     (NotReady 2)
			     (Ready 3)
			     (Print 4)
			     (RunNotPrint 5)
			     (HELP "Illegal Value in Put8200")))
	     (HELP "2: Illegal Value in Put8200"])

(PutOriginalInRDH
  [LAMBDA NIL                                                (* JG " 4-NOV-83 17:03")
                                                             (* Simulate the user putting a document into the RDH %.)
    (DECLARE (USEDFREE JobState))
    (SetBit JobState:machineState 19 128)
    (if 'FaceUp = (MENU (create MENU
				ITEMS ← '(("Originals face up" 'FaceUp)
				 ("Originals face down" 'FaceDown))
				MENUOUTLINESIZE ← 10
				TITLE ← "Select One Orientation:"))
	then NIL
      else FaceDown←T])

(PutOriginalOnGlass
  [LAMBDA NIL                                                (* edited: "19-SEP-83 09:54")
                                                             (* This is a no-op)
    ])

(Read8200
  [LAMBDA (array jobstate)                                   (* edited: " 7-SEP-83 10:17")

          (* Read into array "array" a 30 byte status report from the 8200 copier. If "array" is NIL, create a 30 element 
	  array of type BYTE. Return the array.)


    (PROG (state)
          (if Simulate8200
	      then (RETURN JobState:machineState))           (* If the var 8200Server is not NIL, then get the 
							     machine state from that remote machine.
							     (e.g. 8200Server = 3#235#))
          (if 8200Server
	      then Reading8200Flg← <NIL> state←(REMOTEVAL (QUOTE (ServerRead8200))
							  8200Server)
		   (for exp in Reading8200Flg do (EVAL exp))
	    else state←(ServerRead8200))
          (Reading8200Flg←NIL)
          (if (LISTP state)
	      then (if ~array
		       then array←(ARRAY 30 (QUOTE BYTE)))
		   (for i to 30 as b in state do ((ELT array i)←b))
	    else (HELP "Error from 8200 server:" state))
          (RETURN array])

(RemoveCopiesFromOutputTray
  [LAMBDA NIL
    (DECLARE (USEDFREE JobState))                            (* JG " 4-NOV-83 17:04")
    (SetBitOff JobState:machineState 19 64])

(RemoveOriginalFromGlass
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:57")
                                                             (* Simulate the user removing the original from the 
							     glass. A No-Op.)
    (BLOCK 2000])

(RemoveOriginalFromRDH
  [LAMBDA NIL
    (DECLARE (USEDFREE JobState))                            (* JG " 4-NOV-83 17:04")
    (SetBitOff JobState:machineState 19 128])

(RemovePaperFromTopPaperTray
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:59")
                                                             (* Simulate the user removing the paper from the top 
							     paper tray)
    NIL])

(ReverseOriginals
  [LAMBDA NIL                                                (* edited: "19-SEP-83 13:58")
                                                             (* Simulate the user reversing the originals)
    NIL])

(Select8200Feature
  [LAMBDA (feature)                                          (* edited: " 7-SEP-83 10:14")
                                                             (* Select one of the features on the 8200 main control 
							     panel (e.g., OneSidedCopies).)
    (PROG (current array button)
          (array←(Read8200))
          (button←((for b in (QUOTE (OutputButton PaperTrayButton CopyButton CopyModeButton 
						  ReductionButton))
		      thereis feature MEMB (GETPROP b (QUOTE Settings)))
	       or (for b in (QUOTE (OutputButton PaperTrayButton CopyButton CopyModeButton 
						 ReductionButton))
		     bind fix
		     thereis [fix←(FIXSPELL feature NIL (GETPROP b (QUOTE Settings]
			     (if fix
				 then feature←fix))
	       or (HELP "Unknown button in Select8200Feature" feature)))
          (while (Get8200 array (QUOTE State))=(QUOTE ComponentControl) do (Read8200 array))
          [current←((Get8200 array button)
	     MEMB
	     (GETPROP button (QUOTE Settings]
          (if ~current
	      then (HELP "No current selection for " button))
          [until current:1=feature
	     do (Push8200Button button)
		(current←(current::1 or (GETPROP button (QUOTE Settings]
          (RETURN button])

(SelectNumberOfCopies
  [LAMBDA (noc)                                              (* ref: "18-JUN-82 12:50")
                                                             (* Select noc number of copies on the 8200.0)
    (Push8200Button 'Clear)
    (PROG ((x noc))
          (while (x GT 0) do (Push8200Button (IREMAINDER x 10))
			     (x←x/10])

(SetBit
  [LAMBDA (array elt bit)                                    (* edited: " 7-SEP-83 11:18")
    (ELT array elt)←(LOGOR (ELT array elt)
			   bit])

(SetBitOff
  [LAMBDA (array elt bit)                                    (* dmr: " 9-SEP-83 11:57")
    (ELT array elt)←(LOGAND (ELT array elt)
			    (LOGNOT bit])
)

(RPAQQ 8200INTERFACEMACROS (EltAnd Get8200OnOffLight))
(DECLARE: EVAL@COMPILE 

(PUTPROPS EltAnd MACRO ((array elt mask)
			(GREATERP (LOGAND (ELT array elt)
					  mask)
				  0)))

(PUTPROPS Get8200OnOffLight MACRO [(array elt mask)
				   (COND
				     ((EltAnd array elt mask)
				       'on)
				     (T 'off])
)

(PUTPROPS CopyButton Settings (Normal Darker Lighter))

(PUTPROPS CopyModeButton Settings (OneSidedCopies TwoSidedCopies TwoSidedOriginalsAndCopies))

(PUTPROPS OutputButton Settings (CollatedUnstapled CollatedStapled Uncollated))

(PUTPROPS PaperTrayButton Settings (Bottom Top))

(PUTPROPS ReductionButton Settings (FullSize 98 74 65))

(PUTPROPS A12 Message "Document handler (RDH) cover open.")

(PUTPROPS APLight Message GetAddPaperMsg)

(PUTPROPS AddPaper Message GetAddPaperMessage)

(PUTPROPS B01 Message "B01: Two-sided copies should not be selected.")

(PUTPROPS B02 Message "B02: Stapled output should not be selected.")

(PUTPROPS Bottom Message "Standard Paper")

(PUTPROPS CBPTDLight Message "Close bottom paper tray door")

(PUTPROPS CDCLight Message "Close document cover")

(PUTPROPS CollatedStapled Message "Collated and Stapled")

(PUTPROPS CollatedUnstapled Message "Collated and Unstapled")

(PUTPROPS CopyButton Message "Copy")

(PUTPROPS CopyModeButton Message "Copy Mode")

(PUTPROPS E10 Message (of a paper jam.))

(PUTPROPS FPBLPTLight Message "First page bottom, last page top")

(PUTPROPS FullSize Message "Full Size")

(PUTPROPS Initialization Message "The 8200 is initializing")

(PUTPROPS LCITTLight Message "Load copies in top tray")

(PUTPROPS LPBFPTLight Message "Last page bottom, first page top")

(PUTPROPS LampTest Message "The 8200 is doing a lamp test.")

(PUTPROPS NotReady Message "The 8200 is not ready.")

(PUTPROPS OFDLight Message "Originals face down")

(PUTPROPS OFULight Message "Place originals in RDH, face up")

(PUTPROPS OneSidedCopies Message "One-Sided Copies")

(PUTPROPS OutputButton Message "Output")

(PUTPROPS PWLight Message "Please wait")

(PUTPROPS PaperTrayButton Message "Make Copies On")

(PUTPROPS Printing Message "The 8200 is Printing")

(PUTPROPS RDHLeftCover Message "RDH left cover is open")

(PUTPROPS RDHRightCover Message "RDH right cover is open")

(PUTPROPS RLight Message "Ready")

(PUTPROPS Ready Message "The 8200 is Ready")

(PUTPROPS ReductionButton Message "Reduction")

(PUTPROPS RunNotPrint Message "The 8200 is running but not printing")

(PUTPROPS SCSILight Message "Status code, see instructions")

(PUTPROPS STTTSLight Message "Sets too thick to staple")

(PUTPROPS TechRep Message "The 8200 is in Tech Rep status ")

(PUTPROPS Top Message "Paper Supplied by Operator")

(PUTPROPS TwoSidedCopies Message "Two-Sided Copies")

(PUTPROPS TwoSidedOriginalsAndCopies Message "Two-Sided Originals and Copies")

(PUTPROPS UOTLight Message "Unload output tray")

(PUTPROPS UTPTLight Message "Unload top paper tray")

(RPAQQ 8200INTERFACERECORDS (8200Status))
[DECLARE: EVAL@COMPILE 

(DATATYPE 8200Status (array))
]
(/DECLAREDATATYPE '8200Status '(POINTER))
(LOAD? 'EVALSERVER.DCOM)

(RPAQQ 8200INTERFACEVARS (8200Server NotReadyReasons (SimulationStatusWindow NIL)))

(RPAQQ 8200Server NIL)

(RPAQQ NotReadyReasons NIL)

(RPAQQ SimulationStatusWindow NIL)
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA )

(ADDTOVAR NLAML )

(ADDTOVAR LAMA )
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2078 30506 (CloseBottomPaperTray 2088 . 2373) (CloseDocumentCover 2375 . 2617) (
CloseRDH 2619 . 2926) (CloseTopPaperTray 2928 . 3165) (CreateSimulate8200Menu 3167 . 4863) (Get8200 
4865 . 11527) (Get8200Copy 11529 . 12015) (Get8200CopyMode 12017 . 12551) (Get8200Led 12553 . 13048) (
Get8200OpStatusCode 13050 . 17109) (Get8200Output 17111 . 17627) (Get8200PaperTray 17629 . 18074) (
Get8200Reduction 18076 . 18618) (Get8200State 18620 . 19077) (Get8200TechStatusCodes 19079 . 19396) (
GetAddPaperMsg 19398 . 19841) (GetMessage 19843 . 20597) (LoadPaperIntoTopPaperTray 20599 . 20980) (
MoveCopiesFromOutputToRDH 20982 . 21411) (MoveOutputRDH 21413 . 21727) (OpenBottomPaperTray 21729 . 
22010) (OpenDocumentCover 22012 . 22254) (OpenRDH 22256 . 22502) (OpenTopPaperTray 22504 . 22894) (
ParseSimulate8200Menu 22896 . 23254) (Push8200Button 23256 . 24225) (PushSimulatedButton 24227 . 24868
) (Put8200 24870 . 25415) (PutOriginalInRDH 25417 . 25970) (PutOriginalOnGlass 25972 . 26182) (
Read8200 26184 . 27254) (RemoveCopiesFromOutputTray 27256 . 27444) (RemoveOriginalFromGlass 27446 . 
27738) (RemoveOriginalFromRDH 27740 . 27924) (RemovePaperFromTopPaperTray 27926 . 28210) (
ReverseOriginals 28212 . 28449) (Select8200Feature 28451 . 29788) (SelectNumberOfCopies 29790 . 30168)
 (SetBit 30170 . 30331) (SetBitOff 30333 . 30504)))))
STOP