(FILECREATED " 7-Feb-85 18:31:43" {PHYLUM}<BLUEBONNET>ORIGINAL>MONITOR.;21 33018  

      changes to:  (FNS DisplayStartButton DisplayStopButton)

      previous date: "10-Jan-85 17:13:29" {PHYLUM}<BLUEBONNET>ORIGINAL>MONITOR.;20)


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

(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.)
		    (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA)
											  (NLAML)
											  (LAMA])

(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) (* JG "13-Oct-84 22:32") (* 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) (SETQ 
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
    (DECLARE (GLOBALVARS DISPLAY.CHANGED.ITEM.ONLY in.Trillium))
                                                             (* JG " 7-Feb-85 18:03")
    (if in.Trillium
	then (PROG ((runframe (FIND.FRAME CURRENT.INTERFACE 'BbRun))
		    (newitem (Get.Item 'Start))
		    (oldvalue DISPLAY.CHANGED.ITEM.ONLY))
	           (if (NOT (MEMBER newitem (GET.FIELDQ runframe ITEMS)))
		       then (Restore.Item newitem runframe)
			    (SETTOPVAL 'DISPLAY.CHANGED.ITEM.ONLY T)
			    (UPDATE&DISPLAY.FRAME runframe newitem)
			    (SETTOPVAL 'DISPLAY.CHANGED.ITEM.ONLY oldvalue)))
      else (ADDMENU (WINDOWPROP UserInstructionWindow 'StartMenu)
		    UserInstructionWindow
		    (create POSITION
			    XCOORD ← 186
			    YCOORD ← 10])

(DisplayStopButton
  [LAMBDA NIL
    (DECLARE (GLOBALVARS DISPLAY.CHANGED.ITEM.ONLY in.Trillium))
                                                             (* JG " 7-Feb-85 18:04")
    (if in.Trillium
	then (PROG ((runframe (FIND.FRAME CURRENT.INTERFACE 'BbRun))
		    (newitem (Get.Item 'Stop))
		    (oldvalue DISPLAY.CHANGED.ITEM.ONLY))
	           (if (NOT (MEMBER newitem (GET.FIELDQ runframe ITEMS)))
		       then (Restore.Item newitem runframe)
			    (SETTOPVAL 'DISPLAY.CHANGED.ITEM.ONLY T)
			    (UPDATE&DISPLAY.FRAME runframe newitem)
			    (SETTOPVAL 'DISPLAY.CHANGED.ITEM.ONLY oldvalue)))
      else (ADDMENU (WINDOWPROP UserInstructionWindow 'StopMenu)
		    UserInstructionWindow
		    (create POSITION
			    XCOORD ← 284
			    YCOORD ← 10])

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

(DoPlan
  [LAMBDA (plan job)                                         (* JG "10-Oct-84 20:37")
                                                             (* 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))
          (SETQ PlanSummary (fetch summary of plan))
          (if (NOT in.Trillium)
	      then (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) (* JG "13-Oct-84 22:34") (* Perform the given plan step.) (SETQ 
CurrentStep step) (PrintInstructions step) (if (NOT in.Trillium) then (UpdateStatusWindow goals 
assumptions job)) (SearchHelp (fetch keywords of step)) (EVAL (fetch action of step))))

(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)
    (replace numberOfCopiesSelected of JobState with numberOfCopies])

(EvalKernelEntry
  [LAMBDA (entry)                                            (* edited: "10-MAR-83 13:51")
                                                             (* Evaluate the entry%'s wff.)
    (PROG ((val (EvalWff (fetch (KernelEntry wff) of entry)
			 JobState)))
          (\TraceIt BluebonnetTrace "ke:  " (WffToList (fetch (KernelEntry wff) of entry))
		    " = " 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)                                             (* JG "10-Oct-84 20:48")
                                                             (* Provide user with help about the currently displayed
							     plan step.)
    (if in.Trillium
	then (CHANGE.CELL StatusWindow.Cell (OR (fetch help of CurrentStep)
						"No help available for this step"))
      else (CLEARW StatusWindow)
	   (for p
	      in (fetch help of CurrentStep) or '((No help available for this step.))
	      do (PrintParagraph StatusWindow (if (type? Paragraph p)
						  then p
						else (create Paragraph
							     text ← p])

(InitializeDoPlanWindows
  [LAMBDA (plan)                                             (* JG "10-Oct-84 20:34")
                                                             (* 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])

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

(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= 'Printing do (UpdateMachineState))
    (if JobState:OpStatusCode
	then (ClearOpStatusCode job)
	     NIL
      elseif JobState:AddPaper= 'on
	then (DoAddPaperStep job)
	     NIL
      else T])

(PrintInstructions
  [LAMBDA (step)                                             (* JG "10-Jan-85 16:58")
                                                             (* Print the step%'s instructions in the user 
							     instruction window after clearing it.)
    (DECLARE (GLOBALVARS in.Trillium))
    (PROG [(frame (FIND.FRAME CURRENT.INTERFACE 'BbRun]
          (if in.Trillium
	      then (BbTr.DeleteButton 'Start frame)
		   (BbTr.DeleteButton 'Stop frame)
		   [if (fetch instructions of step)
		       then (CHANGE.CELL UserInstructionWindow.Cell (for par
								       in (fetch instructions
									     of step)
								       collect (fetch (Paragraph
											text)
										  of par]
	    else (DSPFILL (WINDOWPROP UserInstructionWindow 'InstructionRegion)
			  NIL NIL UserInstructionWindow)
		 (for m in '(StartMenu StopMenu) bind menu
		    do (SETQ menu (WINDOWPROP UserInstructionWindow m))
		       (if (WFROMMENU menu)
			   then (DELETEMENU menu NIL UserInstructionWindow)))
		 (MOVETOUPPERLEFT UserInstructionWindow)
		 (if (fetch instructions of step)
		     then [PrintParagraph UserInstructionWindow (create Paragraph
									text ← '(Instructions:]
			  (printout UserInstructionWindow T))
		 (for para in (fetch instructions of step) do (PrintParagraph UserInstructionWindow 
									      para])

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

(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 (fetch machineState of SavedJobState))
	   (ms (fetch machineState of JobState)))
          (replace FirstPageCopied of SavedJobState with (fetch FirstPageCopied of JobState))
          (replace CopiesMade of SavedJobState with (fetch CopiesMade of JobState))
          (replace numberOfCopiesSelected of SavedJobState with (fetch numberOfCopiesSelected
								   of JobState))
          (replace Pass1Done of SavedJobState with (fetch Pass1Done of JobState))
          (for i to 30 do (SETA 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)                                              (* JG "10-Jan-85 17:00")
                                                             (* Print the summary of the job%'s plan in the status 
							     window.)
    (DECLARE (GLOBALVARS in.Trillium))
    (PROG ((summary PlanSummary))
          (if in.Trillium
	      then (CHANGE.CELL StatusWindow.Cell (fetch (Paragraph text) of summary))
	    else (CLEARW StatusWindow)
		 (if summary
		     then (PrintParagraph StatusWindow Overview)
			  (replace leftMargin of summary with 5)
			  (PrintParagraph StatusWindow summary)
			  (printout StatusWindow T T])

(SimulationOn
  [LAMBDA NIL                                                (* edited: "15-Aug-84 15:21")
                                                             (* A function that activates the 8200 simulation 
							     system.)
    (SETQ 8200Server NIL)
    (SETQ Simulate8200 T)
    (SETQ SimulationArray (ARRAY 30 30 0))
    (PRIN1 "I've turned on the simulator!")
    T])

(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 (OR (NOT (fetch State of JobState))
		     (EQ (fetch State of JobState)
			 'ComponentControl))
       do (if Simulate8200
	      then (Simulate8200StateChange JobState)
	    else (replace machineState of JobState with (Read8200 (fetch machineState of JobState])

(UpdateStatusWindow
  [LAMBDA NIL                                                (* edited: "26-SEP-83 12:45")
    [if (NULL SimulationStatusWindow)
	then (SETQ SimulationStatusWindow
	       (CREATEW (create REGION
				LEFT ← 859
				BOTTOM ← 138
				WIDTH ← 100
				HEIGHT ← 100)
			(SETQ TITLE "Status"]
    (CLEARW SimulationStatusWindow)
    (PRINT (fetch State of JobState)
	   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 (fetch machineState of SavedJobState))
	   (ms (fetch machineState of JobState)))
          (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: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA )

(ADDTOVAR NLAML )

(ADDTOVAR LAMA )
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1571 22303 (BYE 1581 . 1807) (ClearOpStatusCode 1809 . 2150) (CompletePrintingStep 2152
 . 2625) (DisplayStartButton 2627 . 3478) (DisplayStopButton 3480 . 4328) (DoAddPaperStep 4330 . 4451)
 (DoPlan 4453 . 8006) (DoPlanStep 8008 . 8310) (DoSelectNumberOfCopiesStep 8312 . 8767) (
EvalKernelEntry 8769 . 9224) (EvalWhenNotReading8200 9226 . 9623) (HelpFromUserInstruction 9625 . 
10356) (InitializeDoPlanWindows 10358 . 13591) (InitializePlan 13593 . 14119) (MakeReady 14121 . 14685
) (PrintInstructions 14687 . 16226) (PrintParagraph 16228 . 16798) (SaveJobState 16800 . 17823) (
SearchHelp 17825 . 18102) (ShowPlanSummary 18104 . 18829) (SimulationOn 18831 . 19250) (TellUser 19252
 . 19893) (UpdateMachineState 19895 . 20616) (UpdateStatusWindow 20618 . 21133) (WaitForStateChange 
21135 . 22301)))))
STOP