(FILECREATED "16-Oct-85 11:47:54" {ERIS}<LISPCORE>PROLOG>OPCODEMENU.;9 5070   

      changes to:  (FNS MAKE.OPCODE.MENU MAKE.RESET.MENU RESET.SELECTFN)
		   (VARS OPCODEMENUCOMS)

      previous date: " 8-Aug-85 11:59:15" {ERIS}<LISPCORE>PROLOG>OPCODEMENU.;7)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT OPCODEMENUCOMS)

(RPAQQ OPCODEMENUCOMS ((FNS MAKE.OPCODE.MENU OPCODE.MENU.SELECTFN MAKE.DEBUG.MENU DEBUG.SELECTFN 
			      MAKE.RESET.MENU RESET.SELECTFN)
			 (VARS (OPCODE.MENU.FONT (FONTCREATE (QUOTE GACHA)
							     10
							     (QUOTE MRR)))
			       SELECTSHADE OPCODE.MENU.POSITION)))
(DEFINEQ

(MAKE.OPCODE.MENU
  [LAMBDA (POSITION)                                       (* hdj "16-Oct-85 11:45")
    (DECLARE (GLOBALVARS SELECTSHADE QP.opcode PROLOG.ENABLE.PUFN.TABLE OPCODE.MENU.FONT))
    (PROG (TOBESHADED)
	    (RESETFORM
	      (CURSOR WAITINGCURSOR)
	      (printout T "Building opcode menu - please wait...")
	      (LET* ((MENU (create MENU
				       ITEMS ←(for OP# from 0 to 254
						 join
						  (LET* [(OPNAME (ELT QP.opcode OP#))
							 (ITEM (AND (NEQ OPNAME (QUOTE SHOULDNT)
									     )
								      (LIST (LIST (CONCAT
											OP# ": " 
											OPNAME)
										      OP#]
						        (if (NEQ (ELT PROLOG.ENABLE.PUFN.TABLE 
									    OP#)
								     0)
							    then (push TOBESHADED (CAR ITEM)))
						    ITEM))
				       MENUCOLUMNS ← 1
				       MENUFONT ← OPCODE.MENU.FONT
				       MENUOUTLINESIZE ← 0
				       WHENSELECTEDFN ←(FUNCTION OPCODE.MENU.SELECTFN)))
		     (W (CREATEW (if POSITION
				       then (CREATEREGION (fetch (POSITION XCOORD)
								 of POSITION)
							      (fetch (POSITION YCOORD)
								 of POSITION)
							      (WIDTHIFWINDOW (fetch (MENU
											  IMAGEWIDTH)
										  of MENU))
							      700)
				     else (GETREGION (WIDTHIFWINDOW (fetch (MENU IMAGEWIDTH)
									     of MENU))
							 100))
				   "Prolog opcodes"))
		     (DEBUG.MENU (MAKE.DEBUG.MENU))
		     (RESET.MENU (MAKE.RESET.MENU)))
		    (ADDMENU MENU W)
		    (for ITEM in TOBESHADED do (SHADEITEM ITEM MENU SELECTSHADE))
		    (ATTACHMENU DEBUG.MENU W (QUOTE TOP))
		    (ATTACHMENU RESET.MENU W (QUOTE TOP))
		    (SHADEITEM (CAR (fetch (MENU ITEMS) of DEBUG.MENU))
				 DEBUG.MENU
				 (if (ReadPrologPtr Debug)
				     then SELECTSHADE
				   else WHITESHADE)))
	      (printout T " done." T])

(OPCODE.MENU.SELECTFN
  [LAMBDA (ITEM MENU BUTTON)                                 (* hdj "17-Jul-85 16:02")
    (DECLARE (GLOBALVARS SELECTSHADE))
    (LET* ((OP# (CADR ITEM))
       (OLDSTATE (ELT PROLOG.ENABLE.PUFN.TABLE OP#)))
      (printout PROMPTWINDOW "Microcode for opcode " OP# " now " (if (EQ OLDSTATE 1)
								     then (PROG1 "enabled"
										 (SETA 
									 PROLOG.ENABLE.PUFN.TABLE OP# 
										       0)
										 (SHADEITEM ITEM MENU 
										      SELECTSHADE))
								   else (PROG1 "disabled"
									       (SETA 
									 PROLOG.ENABLE.PUFN.TABLE OP# 
										     1)
									       (SHADEITEM ITEM MENU 
										       WHITESHADE)))
		"." T])

(MAKE.DEBUG.MENU
  [LAMBDA NIL                                                (* hdj "16-Jul-85 11:39")
    (create MENU
	    ITEMS ←(QUOTE ("Careful mode"))
	    WHENSELECTEDFN ←(FUNCTION DEBUG.SELECTFN)
	    TITLE ← "Debug mode"])

(DEBUG.SELECTFN
  [LAMBDA (ITEM MENU BUTTON)                                 (* hdj "17-Jul-85 16:02")
    (DECLARE (GLOBALVARS SELECTSHADE))
    (printout PROMPTWINDOW "Debug mode is now " (if (NULL (ReadPrologPtr Debug))
						    then (WritePrologPtrAnd0Tag Debug 17)
							 (SHADEITEM ITEM MENU SELECTSHADE)
							 "careful"
						  else (WritePrologPtrAnd0Tag Debug 0)
						       (SHADEITEM ITEM MENU WHITESHADE)
						       "zero")
	      "." T])

(MAKE.RESET.MENU
  [LAMBDA NIL                                                (* hdj "16-Oct-85 11:39")
    (create MENU
	      ITEMS ←(QUOTE ("Reset counters"))
	      WHENSELECTEDFN ←(FUNCTION DEBUG.SELECTFN)
	      TITLE ← "Debug mode"])

(RESET.SELECTFN
  [LAMBDA (ITEM MENU BUTTON)                                 (* hdj "16-Oct-85 11:39")
    (for OP# from 0 to 255 do (if (NEQ (ELT PROLOG.ENABLE.PUFN.TABLE OP#)
						   0)
					  then (SETA PROLOG.ENABLE.PUFN.TABLE OP# 1)))
    (printout PROMPTWINDOW "Counters cleared"])
)

(RPAQ OPCODE.MENU.FONT (FONTCREATE (QUOTE GACHA)
				     10
				     (QUOTE MRR)))

(RPAQQ SELECTSHADE 1025)

(RPAQQ OPCODE.MENU.POSITION (314 . 1))
(PUTPROPS OPCODEMENU COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (653 4826 (MAKE.OPCODE.MENU 663 . 2700) (OPCODE.MENU.SELECTFN 2702 . 3459) (
MAKE.DEBUG.MENU 3461 . 3713) (DEBUG.SELECTFN 3715 . 4228) (MAKE.RESET.MENU 4230 . 4490) (
RESET.SELECTFN 4492 . 4824)))))
STOP