(FILECREATED "30-Jan-84 23:56:35" {PHYLUM}<BLUEBONNET>DMRUSSELL>MONITOR.;6 29494  

      changes to:  (FNS InitializeDoPlanWindows DoPlan)

      previous date: "28-Jan-84 20:43:52" {PHYLUM}<BLUEBONNET>DMRUSSELL>MONITOR.;5)


(PRETTYCOMPRINT MONITORCOMS)

(RPAQQ MONITORCOMS ((FNS * MONITORFNS)
		    (RECORDS * MONITORRECORDS)
		    (VARS (IAssume (create Paragraph text ← '(Assumptions:)
					   lookY ← 1))
			  [WeAreNow (create Paragraph text ← '(We are now:]
			  [CommentHeader (create Paragraph text ← '(Comment:]
			  [Overview (create Paragraph text ← '(Overview:]
			  [SavedJobState (create JobState machineState ← (ARRAY 30 'BYTE]
			  (JobStateRecord (RECLOOK 'JobState))
			  (JobState NIL)
			  (SimulationArray NIL))
		    [DECLARE: EVAL@COMPILE (P (LOADCOMP? 'LOADBLUEBONNET]
		    (* Note that JobState is now a global VAR so that other processes can reach it as 
		       well.)))

(RPAQQ MONITORFNS (BYE ClearOpStatusCode CompletePrintingStep DisplayStartButton DisplayStopButton 
		       DoAddPaperStep DoPlan DoPlanStep DoSelectNumberOfCopiesStep EvalKernelEntry 
		       EvalWhenNotReading8200 HelpFromUserInstruction InitializeDoPlanWindows 
		       InitializePlan MakeReady PrintInstructions PrintParagraph SaveJobState 
		       SearchHelp ShowPlanSummary SimulationOn TellUser UpdateMachineState 
		       UpdateStatusWindow WaitForStateChange))
(DEFINEQ

(BYE
  [LAMBDA NIL                                                (* edited: "16-MAR-83 09:36")
    (LOGOUT)
    (\DSPRATE 139)
    (CLOSEW (TTYDISPLAYSTREAM))
    (while T do (\BACKGROUND])

(ClearOpStatusCode
  [LAMBDA (job)                                              (* edited: " 6-FEB-83 21:51")
                                                             (* Create and perform a plan to clear an op status 
							     code.)
    (PROG [(planGenerator (GETPROP JobState:OpStatusCode (QUOTE PlanGenerator]
          (DoPlan (if planGenerator
		      then (APPLY* planGenerator job)
		    else (PlanStatusCodeMessage JobState:OpStatusCode))
		  job)
          (WINDOWPROP StatusWindow (QUOTE PlanSummary)
		      NIL])

(CompletePrintingStep
  [LAMBDA NIL                                                (* edited: "15-MAR-83 17:44")

          (* The plan step that monitors printing. Its preconditions are that the 8200 is in the printing state.
	  It returns with the 8200 in Ready State. If the printing completes without error, then it sets CopiesMade to T and
	  returns T.)


    (DisplayStopButton)
    (if (MakeReady)
	then (JobState:CopiesMade←T])

(DisplayStartButton
  [LAMBDA NIL                                                (* edited: "15-MAR-83 17:42")
    (ADDMENU (WINDOWPROP UserInstructionWindow (QUOTE StartMenu))
	     UserInstructionWindow
	     (create POSITION
		     XCOORD ← 186
		     YCOORD ← 10])

(DisplayStopButton
  [LAMBDA NIL                                                (* edited: "15-MAR-83 18:04")
    (ADDMENU (WINDOWPROP UserInstructionWindow (QUOTE StopMenu))
	     UserInstructionWindow
	     (create POSITION
		     XCOORD ← 284
		     YCOORD ← 10])

(DoAddPaperStep
  [LAMBDA NIL                                                (* ref: "25-AUG-82 10:22")
    NIL])

(DoPlan
  [LAMBDA (plan job)                                         (* JG "30-Jan-84 23:55")
                                                             (* Perform and monitor a plan for a copy job.
							     Return non-NIL if the goal kernel of the plan is 
							     achieved.)
    (PROG (entry helpMenu goals assumptions (kernel (fetch (Plan goal) of plan)))
                                                             (* JobState used to be a local to DoPlan.
							     I made it global because other processes in the world 
							     need it. DMR)
                                                             (* kernel is the list of wffs that are the prerequisites
							     to execution)
          (SETQ PlanStepper (THIS.PROCESS))                  (* *JG Save a handle to the current process so that it 
							     can receive a wake from the WHENSELECTEDFN in 
							     restartMenu)
          (SETQ JobState (create JobState
				 job ← job))
          (InitializeDoPlanWindows plan)
          (ShowPlanSummary job)
          (UpdateMachineState)
          (InitializePlan plan)                              (* this loop cycles until the kernel = T)
          [while (type? Kernel kernel)
	     do                                              (* collect the english text on the var goals)
                                                             (* *JG Unwind is returned when "Change Task Description"
							     is selected)
		[COND
		  ((EQ (BLOCK 100)
		       'Unwind)
		    (RETFROM 'ProceedFromPanel]
		[COND
		  ((fetch (PlanStep goal) of (fetch step of kernel))
		    (push goals (fetch (PlanStep goal) of (fetch step of kernel]
		(PAGEHEIGHT 0) 

          (* Get the first entry in the kernel that has NOT been satisfied. While you%'re CDRing down the list, push each of
	  the completed kernel entry%'s assumptions onto the assumptions stack.)


		[SETQ entry (for e in (fetch entries of kernel)
			       thereis (NOT (COND
					      ((EvalKernelEntry e)
						[COND
						  ((fetch assumption of e)
						    (push assumptions (fetch assumption of e]
						T]

          (* Is there an entry kernel defined? If so, then get the kernel that produced the entry kernel and cycle thru loop
	  again. Otherwise, we%'ve reached the end of the chain -- save the job state and execute the plan step.)


		(COND
		  [entry (SETQ kernel (COND
			     ((fetch producer of entry)
			       (fetch kernel of (fetch producer of entry]
		  (T                                         (* Come here only if there is no entry kernel.)
		     (SaveJobState)
		     (DoPlanStep (fetch step of kernel)
				 goals
				 (DREVERSE assumptions)
				 job)

          (* if the kernel is EQ to the goal of the original plan, then break out of the DoPlan loop and exit to top level, 
	  else reset kernel to the original goal of the plan.)


		     (SETQ kernel (COND
			 ((EQ kernel (fetch (Plan goal) of plan))
			   T)
			 (T (SETQ goals NIL)
			    (SETQ assumptions NIL)
			    (WaitForStateChange)
			    (fetch (Plan goal) of plan]
          (RETURN kernel])

(DoPlanStep
  [LAMBDA (step goals assumptions job)                       (* edited: " 4-MAR-83 15:32")
                                                             (* Perform the given plan step.)
    (PrintInstructions step)
    (UpdateStatusWindow goals assumptions job)
    (SearchHelp step:keywords)
    (EVAL step:action])

(DoSelectNumberOfCopiesStep
  [LAMBDA (numberOfCopies)                                   (* ref: "25-AUG-82 10:22")
                                                             (* Select the given number of copies and indicate the 
							     change in the job state.)
    (DECLARE (USEDFREE JobState))
    (SelectNumberOfCopies numberOfCopies)
    JobState:numberOfCopiesSelected←numberOfCopies])

(EvalKernelEntry
  [LAMBDA (entry)                                            (* edited: "10-MAR-83 13:51")
                                                             (* Evaluate the entry's wff.)
    (PROG ((val (EvalWff entry:KernelEntry.wff JobState)))
          (\TraceIt BluebonnetTrace "ke:  " (WffToList entry:KernelEntry.wff)
		    " = " val)
          (RETURN val])

(EvalWhenNotReading8200
  [LAMBDA (exp)                                              (* edited: "10-MAR-83 14:29")
                                                             (* If Reading8200Flg is set, then assume it is a list 
							     and add exp to it. Otherwise, eval exp)
    (if Reading8200Flg
	then (Reading8200Flg::-1::1← <exp>)
      else (EVAL exp])

(HelpFromUserInstruction
  [LAMBDA (menu)                                             (* edited: "10-MAR-83 15:39")
                                                             (* Provide user with help about the currently displayed 
							     plan step.)
    (CLEARW StatusWindow)
    (for p
       in (fetch help of (WINDOWPROP (WFROMMENU menu)
				     (QUOTE CurrentStep)))
	    or (QUOTE ((No help available for this step.)))
       do (PrintParagraph StatusWindow (if (type? Paragraph p)
					   then p
					 else (create Paragraph
						      text ← p])

(InitializeDoPlanWindows
  [LAMBDA (plan)                                             (* JG "30-Jan-84 23:50")
                                                             (* Initialize the windows used to instruct the user 
							     during the performance of a plan.)
    (PROG (restartMenu)
          [COND
	    ((NOT (AND (BOUNDP 'UserInstructionWindow)
		       (WINDOWP UserInstructionWindow)))
	      (SETQ UserInstructionWindow
		(CREATEW (create REGION
				 HEIGHT ← 410
				 LEFT ← 10
				 BOTTOM ← 10
				 WIDTH ← 490)
			 "Instructions"))
	      (DSPFONT Gacha12Bold UserInstructionWindow)
	      (WINDOWPROP UserInstructionWindow 'RIGHTBUTTONFN (FUNCTION [LAMBDA NIL NIL]))
	      (ADDMENU [create MENU
			       MENUFONT ← Gacha12Bold
			       ITEMS ← '("" % HELP%  "")
			       WHENSELECTEDFN ← (FUNCTION (LAMBDA (item menu)
				   (HelpFromUserInstruction menu]
		       UserInstructionWindow
		       (create POSITION
			       XCOORD ← 382
			       YCOORD ← 10))
	      [SETQ restartMenu (create MENU
					MENUFONT ← Gacha12Bold
					ITEMS ← '("" Change% Task Description "")
					WHENSELECTEDFN ← (FUNCTION (LAMBDA (item menu)
					    (CLOSEW UserInstructionWindow)
					    (CLOSEW StatusWindow)
					    (CLOSEW HelpWindow)
					    (COND
					      (HelpWindow (DELETEMENU (WINDOWPROP HelpWindow
										  'HelpMenu)
								      T)))
					    (UpdateJobDescriptionPanel (fetch descriptionPanel
									  of CopyJob)
								       T)
					    (WAKE.PROCESS PlanStepper 'Unwind)
                                                             (* *JG This WHENSELECTEDFN is executed in the mouse 
							     process. We have to tell the other process 
							     (blocking in DoPlan) to RETFROM)
					    (PROCESS.RETURN]
	      (ADDMENU restartMenu UserInstructionWindow (create POSITION
								 XCOORD ← 78
								 YCOORD ← 10))
	      [WINDOWPROP UserInstructionWindow 'StartMenu
			  (create MENU
				  MENUFONT ← Gacha12Bold
				  ITEMS ← '("" % START%  "")
				  WHENSELECTEDFN ← (FUNCTION (LAMBDA NIL
				      (EvalWhenNotReading8200 '(Push8200Button 'StartPrint]
	      [WINDOWPROP UserInstructionWindow 'StopMenu
			  (create MENU
				  MENUFONT ← Gacha12Bold
				  ITEMS ← '("" % STOP%  "")
				  WHENSELECTEDFN ← (FUNCTION (LAMBDA NIL
				      (EvalWhenNotReading8200 '(Push8200Button 'StopPrint]
	      (WINDOWPROP UserInstructionWindow 'InstructionRegion
			  (create REGION
				  LEFT ← 0
				  BOTTOM ← (IPLUS 11 (fetch IMAGEHEIGHT of restartMenu))
				  WIDTH ← (WINDOWPROP UserInstructionWindow 'WIDTH)
				  HEIGHT ← (WINDOWPROP UserInstructionWindow 'HEIGHT]
          [COND
	    ((NOT (AND (BOUNDP 'StatusWindow)
		       (WINDOWP StatusWindow)))
	      (SETQ StatusWindow
		(CREATEW (create REGION
				 HEIGHT ← 360
				 LEFT ← 10
				 BOTTOM ← 430
				 WIDTH ← 490)
			 "Current Status"))
	      (DSPFONT Gacha12Bold StatusWindow)
	      (WINDOWPROP StatusWindow 'RIGHTBUTTONFN (FUNCTION (LAMBDA NIL NIL]
          (WINDOWPROP StatusWindow 'PlanSummary (fetch summary of plan])

(InitializePlan
  [LAMBDA (plan)                                             (* edited: " 3-MAR-83 14:58")
                                                             (* Establish the plan's initial state in JobState.)
    (for pair in plan:initialState do (RECORDACCESS (if (LISTP pair)
							then pair:1
						      else pair)
						    JobState JobStateRecord 'replace
						    (if (LISTP pair)
							then pair:2])

(MakeReady
  [LAMBDA (job)                                              (* edited: " 6-FEB-83 21:22")
                                                             (* A plan step to monitor a printing step and then 
							     respond to any op status codes or add paper problems..)
    (repeatwhile JobState:State=(QUOTE Printing) do (UpdateMachineState))
    (if JobState:OpStatusCode
	then (ClearOpStatusCode job)
	     NIL
      elseif JobState:AddPaper=(QUOTE on)
	then (DoAddPaperStep job)
	     NIL
      else T])

(PrintInstructions
  [LAMBDA (step)                                             (* edited: "13-MAR-83 22:54")
                                                             (* Print the step's instructions in the user instruction
							     window after clearing it.)
    (DSPFILL (WINDOWPROP UserInstructionWindow (QUOTE InstructionRegion))
	     NIL NIL UserInstructionWindow)
    (for m in (QUOTE (StartMenu StopMenu)) bind menu
       do (menu←(WINDOWPROP UserInstructionWindow m))
	  (if (WFROMMENU menu)
	      then (DELETEMENU menu NIL UserInstructionWindow)))
    (MOVETOUPPERLEFT UserInstructionWindow)
    (WINDOWPROP UserInstructionWindow (QUOTE CurrentStep)
		step)
    (if step:instructions
	then [PrintParagraph UserInstructionWindow (create Paragraph
							   text ←(QUOTE (Instructions:]
	     (printout UserInstructionWindow T))
    (for para in step:instructions do (PrintParagraph UserInstructionWindow para])

(PrintParagraph
  [LAMBDA (window para)                                      (* edited: "26-JAN-83 15:09")
                                                             (* Print paragraph para in window.)
    (printout window .SKIP ((para:lookY or 0)+ 1)
	      .SP
	      (para:leftMargin or 0)
	      .PARA para:leftMargin (para:rightMargin or (LINELENGTH NIL window))
	      para:Paragraph.text])

(SaveJobState
  [LAMBDA NIL                                                (* DMR: "15-JUN-83 11:41")
                                                             (* Save a copy of JobState in SavedJobState.
							     Assumes that the eval is in the scope of a 
							     GLOBALRESOURCE.)
    (DECLARE (USEDFREE SavedJobState JobState))
    (PROG ((savedms (SavedJobState:machineState))
	   (ms (JobState:machineState)))
          (SavedJobState:FirstPageCopied←JobState:FirstPageCopied)
          (SavedJobState:CopiesMade←JobState:CopiesMade)
          (SavedJobState:numberOfCopiesSelected←JobState:numberOfCopiesSelected)
          (SavedJobState:Pass1Done←JobState:Pass1Done)
          (for i to 30 do ((ELT savedms i)←(ELT ms i])

(SearchHelp
  [LAMBDA NIL                                                (* JG "28-Jan-84 20:30")
                                                             (* Dummy function that is replaced by another one when 
							     the help package is loaded)
    ])

(ShowPlanSummary
  [LAMBDA (job)                                              (* edited: " 6-FEB-83 20:17")
                                                             (* Print the summary of the job's plan in the status 
							     window.)
    (PROG [(summary (WINDOWPROP StatusWindow (QUOTE PlanSummary]
          (CLEARW StatusWindow)
          (if summary
	      then (PrintParagraph StatusWindow Overview)
		   summary:leftMargin←5
		   (PrintParagraph StatusWindow summary)
		   (printout StatusWindow T T])

(SimulationOn
  [LAMBDA NIL                                                (* edited: "20-JUL-83 10:41")
                                                             (* A function that activates the 8200 simulation 
							     system.)
    8200Server←NIL
    Simulate8200←T
    SimulationArray←(ARRAY 30 30 0)
    (PRIN1 "I've turned on the simulator!"])

(TellUser
  [LAMBDA (msg waitSecs)                                     (* ref: "30-AUG-82 18:16")

          (* Present msg to the user as an instruction in the PlanDisplayWindow. Msg is either a paragraph or a list of 
	  paragraphs. If waitSecs is nonNIL, cause a wait of that many seconds before returning.)


    (DECLARE (USEDFREE PlanDisplayWindow))
    (printout PlanDisplayWindow T T T)
    (for para in (if (type? Paragraph msg)
		     then <msg>
		   else msg)
       do (PrintParagraph PlanDisplayWindow para))
    (if waitSecs
	then (DISMISS waitSecs*1000])

(UpdateMachineState
  [LAMBDA NIL                                                (* dmr: "13-SEP-83 16:36")
                                                             (* Update the machine state field of JobStatus by doing 
							     a new Read8200. (or calling Simulate8200StateChange))
    (DECLARE (USEDFREE JobState))
    (BLOCK)
    (repeatwhile ~(JobState : State) or JobState:State=(QUOTE ComponentControl)
       do (if Simulate8200
	      then (Simulate8200StateChange JobState)
	    else (JobState:machineState←(Read8200 JobState:machineState])

(UpdateStatusWindow
  [LAMBDA NIL                                                (* edited: "26-SEP-83 12:45")
    (if SimulationStatusWindow=NIL
	then SimulationStatusWindow←(CREATEW (create REGION
						     LEFT ← 859
						     BOTTOM ← 138
						     WIDTH ← 100
						     HEIGHT ← 100)
					     TITLE← "Status"))
    (CLEARW SimulationStatusWindow)
    (PRINT JobState:State SimulationStatusWindow)
    (PRINT NotReadyReasons SimulationStatusWindow])

(WaitForStateChange
  [LAMBDA NIL                                                (* dmr: "13-SEP-83 16:36")
                                                             (* Continually update the machine state of JobState 
							     until it changes.)
    (PROG ((savedms (SavedJobState:machineState))
	   (ms (JobState:machineState)))
          (UpdateMachineState)
          (if Simulate8200
	      then (RETURN))
          (if JobState:FirstPageCopied=SavedJobState:FirstPageCopied and 
						     JobState:CopiesMade=SavedJobState:CopiesMade
		and JobState:numberOfCopiesSelected=SavedJobState:numberOfCopiesSelected
		and JobState:Pass1Done=SavedJobState:Pass1Done and 
				       JobState:OriginalsReversed=SavedJobState:OriginalsReversed
		and JobState:LeftChecked=SavedJobState:LeftChecked and 
						 JobState:RightChecked=SavedJobState:RightChecked
		and JobState:GlassChecked=SavedJobState:GlassChecked
	      then (repeatwhile (for i to 30
				   always (ELT savedms i)=(ELT ms i))
		      do (UpdateMachineState])
)

(RPAQQ MONITORRECORDS (JobState))
[DECLARE: EVAL@COMPILE 

(DATATYPE JobState (FirstPageCopied CopiesMade machineState job numberOfCopiesSelected Pass1Done 
				    OriginalsReversed LeftChecked RightChecked GlassChecked 
				    MasterMade)
		   [ACCESSFNS ((APLight (Get8200 (fetch machineState of DATUM)
						 'APLight))
			       (AddPaper (Get8200 (fetch machineState of DATUM)
						  'AddPaper))
			       (AddPaperLed (Get8200 (fetch machineState of DATUM)
						     'AddPaperLed))
			       (BSkiis (Get8200 (fetch machineState of DATUM)
						'BSkiis))
			       (BTransport (Get8200 (fetch machineState of DATUM)
						    'BTransport))
			       (BeltMistrackNOT (Get8200 (fetch machineState of DATUM)
							 'BeltMistrackNOT))
			       (CBPTDLight (Get8200 (fetch machineState of DATUM)
						    'CBPTDLight))
			       (CDCLight (Get8200 (fetch machineState of DATUM)
						  'CDCLight))
			       (CTransport (Get8200 (fetch machineState of DATUM)
						    'CTransport))
			       (CleanPopSensor (Get8200 (fetch machineState of DATUM)
							'CleanPopSensor))
			       (CloseBottomPaperTrayDoor (Get8200 (fetch machineState of DATUM)
								  'CloseBottomPaperTrayDoor))
			       (CloseDocumentCover (Get8200 (fetch machineState of DATUM)
							    'CloseDocumentCover))
			       (ClosePaperDoorLed (Get8200 (fetch machineState of DATUM)
							   'ClosePaperDoorLed))
			       (CloseRDHLed (Get8200 (fetch machineState of DATUM)
						     'CloseRDHLed))
			       (CompilerEntrySwitch (Get8200 (fetch machineState of DATUM)
							     'CompilerEntrySwitch))
			       (CompilerExitSwitch (Get8200 (fetch machineState of DATUM)
							    'CompilerExitSwitch))
			       (Copy (Get8200 (fetch machineState of DATUM)
					      'Copy))
			       (CopyButton (Get8200 (fetch machineState of DATUM)
						    'CopyButton))
			       (CopyMode (Get8200 (fetch machineState of DATUM)
						  'CopyMode))
			       (CopyModeButton (Get8200 (fetch machineState of DATUM)
							'CopyModeButton))
			       (DeveloperDoor (Get8200 (fetch machineState of DATUM)
						       'DeveloperDoor))
			       (DocumentInRDH (Get8200 (fetch machineState of DATUM)
						       'DocumentInRDH))
			       (EmptyTopTrayLed (Get8200 (fetch machineState of DATUM)
							 'EmptyTopTrayLed))
			       (FPBLPTLight (Get8200 (fetch machineState of DATUM)
						     'FPBLPTLight))
			       (FinisherCover (Get8200 (fetch machineState of DATUM)
						       'FinisherCover))
			       (FirstPageBottomLastPageTop (Get8200 (fetch machineState of DATUM)
								    'FirstPageBottomLastPageTop))
			       (FuserJamReset (Get8200 (fetch machineState of DATUM)
						       'FuserJamReset))
			       (FuserOverTempNOT (Get8200 (fetch machineState of DATUM)
							  'FuserOverTempNOT))
			       (FuserUnderTemperature (Get8200 (fetch machineState of DATUM)
							       'FuserUnderTemperature))
			       (JamSwitch2 (Get8200 (fetch machineState of DATUM)
						    'JamSwitch2))
			       (JamSwitch3 (Get8200 (fetch machineState of DATUM)
						    'JamSwitch3))
			       (JamSwitch4 (Get8200 (fetch machineState of DATUM)
						    'JamSwitch4))
			       (JamSwitch5 (Get8200 (fetch machineState of DATUM)
						    'JamSwitch5))
			       (LCITTLight (Get8200 (fetch machineState of DATUM)
						    'LCITTLight))
			       (LPBFPTLight (Get8200 (fetch machineState of DATUM)
						     'LPBFPTLight))
			       (LastPageBottomFirstPageTop (Get8200 (fetch machineState of DATUM)
								    'LastPageBottomFirstPageTop))
			       (LoadCopiesInTopTray (Get8200 (fetch machineState of DATUM)
							     'LoadCopiesInTopTray))
			       (MainFeederLed (Get8200 (fetch machineState of DATUM)
						       'MainFeederLed))
			       (MainPaperTrayDoor (Get8200 (fetch machineState of DATUM)
							   'MainPaperTrayDoor))
			       (MisStrip (Get8200 (fetch machineState of DATUM)
						  'MisStrip))
			       (ModuleInterlockNOT (Get8200 (fetch machineState of DATUM)
							    'ModuleInterlockNOT))
			       (OFDLight (Get8200 (fetch machineState of DATUM)
						  'OFDLight))
			       (OFULight (Get8200 (fetch machineState of DATUM)
						  'OFULight))
			       (OffsettingCatchTray (Get8200 (fetch machineState of DATUM)
							     'OffsettingCatchTray))
			       (OffsettingCatchTrayPosition (Get8200 (fetch machineState
									of DATUM)
								     'OffsettingCatchTrayPosition))
			       (OpStatusCode (Get8200 (fetch machineState of DATUM)
						      'OpStatusCode))
			       (OperatorStatusCode (Get8200 (fetch machineState of DATUM)
							    'OperatorStatusCode))
			       (OriginalsFaceDown (Get8200 (fetch machineState of DATUM)
							   'OriginalsFaceDown))
			       (OriginalsFaceUp (Get8200 (fetch machineState of DATUM)
							 'OriginalsFaceUp))
			       (Output (Get8200 (fetch machineState of DATUM)
						'Output))
			       (OutputButton (Get8200 (fetch machineState of DATUM)
						      'OutputButton))
			       (PWLight (Get8200 (fetch machineState of DATUM)
						 'PWLight))
			       (PaperTray (Get8200 (fetch machineState of DATUM)
						   'PaperTray))
			       (PaperTrayButton (Get8200 (fetch machineState of DATUM)
							 'PaperTrayButton))
			       (PaperUnderPopSensor (Get8200 (fetch machineState of DATUM)
							     'PaperUnderPopSensor))
			       (PleaseWait (Get8200 (fetch machineState of DATUM)
						    'PleaseWait))
			       (PopJam (Get8200 (fetch machineState of DATUM)
						'PopJam))
			       (PopReset (Get8200 (fetch machineState of DATUM)
						  'PopReset))
			       (PopSensorLed (Get8200 (fetch machineState of DATUM)
						      'PopSensorLed))
			       (ProcessorCover (Get8200 (fetch machineState of DATUM)
							'ProcessorCover))
			       (RDHLeftCover (Get8200 (fetch machineState of DATUM)
						      'RDHLeftCover))
			       (RDHMotor (Get8200 (fetch machineState of DATUM)
						  'RDHMotor))
			       (RDHOpen (Get8200 (fetch machineState of DATUM)
						 'RDHOpen))
			       (RDHRightCover (Get8200 (fetch machineState of DATUM)
						       'RDHRightCover))
			       (RLight (Get8200 (fetch machineState of DATUM)
						'RLight))
			       (RXShroudOpen (Get8200 (fetch machineState of DATUM)
						      'RXShroudOpen))
			       (Ready (Get8200 (fetch machineState of DATUM)
					       'Ready))
			       (Reduction (Get8200 (fetch machineState of DATUM)
						   'Reduction))
			       (ReductionButton (Get8200 (fetch machineState of DATUM)
							 'ReductionButton))
			       (SCSILight (Get8200 (fetch machineState of DATUM)
						   'SCSILight))
			       (STTTSLight (Get8200 (fetch machineState of DATUM)
						    'STTTSLight))
			       (SetsTooThickLed (Get8200 (fetch machineState of DATUM)
							 'SetsTooThickLed))
			       (SetsTooThickToStaple (Get8200 (fetch machineState of DATUM)
							      'SetsTooThickToStaple))
			       (ShadeOpen (Get8200 (fetch machineState of DATUM)
						   'ShadeOpen))
			       (StandbyRelayNOT (Get8200 (fetch machineState of DATUM)
							 'StandbyRelayNOT))
			       (StaplerCover (Get8200 (fetch machineState of DATUM)
						      'StaplerCover))
			       (StaplerPresent (Get8200 (fetch machineState of DATUM)
							'StaplerPresent))
			       (State (Get8200 (fetch machineState of DATUM)
					       'State)
				      (Put8200 (fetch machineState of DATUM)
					       'State NEWVALUE))
			       (StatusCodeSeeInstructions (Get8200 (fetch machineState of DATUM)
								   'StatusCodeSeeInstructions))
			       (TechStatusCode (Get8200 (fetch machineState of DATUM)
							'TechStatusCode))
			       (TopTrayFeederLed (Get8200 (fetch machineState of DATUM)
							  'TopTrayFeederLed))
			       (TurnAroundTransport (Get8200 (fetch machineState of DATUM)
							     'TurnAroundTransport))
			       (UOTLight (Get8200 (fetch machineState of DATUM)
						  'UOTLight))
			       (USShroudOpen (Get8200 (fetch machineState of DATUM)
						      'USShroudOpen))
			       (UTPTLight (Get8200 (fetch machineState of DATUM)
						   'UTPTLight))
			       (UnloadOutputTray (Get8200 (fetch machineState of DATUM)
							  'UnloadOutputTray))
			       (UnloadTopPaperTray (Get8200 (fetch machineState of DATUM)
							    'UnloadTopPaperTray))
			       (X2Led (Get8200 (fetch machineState of DATUM)
					       'X2Led))
			       (X3Led (Get8200 (fetch machineState of DATUM)
					       'X3Led))
			       (X4Led (Get8200 (fetch machineState of DATUM)
					       'X4Led))
			       (X5Led (Get8200 (fetch machineState of DATUM)
					       'X5Led))
			       (X6Led (Get8200 (fetch machineState of DATUM)
					       'X6Led))
			       (X7Led (Get8200 (fetch machineState of DATUM)
					       'X7Led])
]
(/DECLAREDATATYPE 'JobState '(POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
				      POINTER POINTER))

(RPAQ IAssume (create Paragraph text ← '(Assumptions:)
		      lookY ← 1))

(RPAQ WeAreNow (create Paragraph text ← '(We are now:)))

(RPAQ CommentHeader (create Paragraph text ← '(Comment:)))

(RPAQ Overview (create Paragraph text ← '(Overview:)))

(RPAQ SavedJobState (create JobState machineState ← (ARRAY 30 'BYTE)))

(RPAQ JobStateRecord (RECLOOK 'JobState))

(RPAQQ JobState NIL)

(RPAQQ SimulationArray NIL)
(DECLARE: EVAL@COMPILE 
(LOADCOMP? 'LOADBLUEBONNET)
)



(* Note that JobState is now a global VAR so that other processes can reach it as well.)

(DECLARE: DONTCOPY
  (FILEMAP (NIL (1390 19295 (BYE 1400 . 1606) (ClearOpStatusCode 1608 . 2172) (CompletePrintingStep 2174
 . 2646) (DisplayStartButton 2648 . 2928) (DisplayStopButton 2930 . 3208) (DoAddPaperStep 3210 . 3331)
 (DoPlan 3333 . 6690) (DoPlanStep 6692 . 7039) (DoSelectNumberOfCopiesStep 7041 . 7459) (
EvalKernelEntry 7461 . 7849) (EvalWhenNotReading8200 7851 . 8244) (HelpFromUserInstruction 8246 . 8872
) (InitializeDoPlanWindows 8874 . 12007) (InitializePlan 12009 . 12474) (MakeReady 12476 . 13052) (
PrintInstructions 13054 . 14058) (PrintParagraph 14060 . 14474) (SaveJobState 14476 . 15251) (
SearchHelp 15253 . 15530) (ShowPlanSummary 15532 . 16084) (SimulationOn 16086 . 16457) (TellUser 16459
 . 17092) (UpdateMachineState 17094 . 17696) (UpdateStatusWindow 17698 . 18176) (WaitForStateChange 
18178 . 19293)))))
STOP