(FILECREATED "17-Mar-87 16:39:13" {DSK}<LISPFILES2>H.BETA>HENV.;7 23674  

      changes to:  (FNS H.NullW H.PrintInfo H.BUTTONFN HMenuFunction)
		   (VARS HENVCOMS HMIDDLEMENU HMENUITEMS)

      previous date: "25-Feb-87 15:27:15" {DSK}<LISPFILES2>H.BETA>HENV.;5)


(PRETTYCOMPRINT HENVCOMS)

(RPAQQ HENVCOMS [(VARS *temp-vars* HMENUITEMS HMIDDLEMENU HMenuItems)
	(FNS H H.BUTTONFN H.NullW H.PrintInfo H.delete H.editAxiom H.editSA H.erase H.load 
	     H.save HMenuFunction HReadProvePrint LoadHKB SaveHKB \DummyFoo \SEE.AT)
	(ADDVARS (BackgroundMenuCommands (H [QUOTE (ADD.PROCESS (QUOTE (H]
					    "Open window on logic programming environment")
					 ))
	(VARS (BackgroundMenu NIL))
	(ADVICE LOAD)
	(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS
		    (NLAMA)
		    (NLAML \SEE.AT)
		    (LAMA])

(RPAQQ *temp-vars* NIL)

(RPAQQ HMENUITEMS ((Dribble (QUOTE Dribble)
			      "Dribble on file")))

(RPAQQ HMIDDLEMENU NIL)

(RPAQQ HMenuItems (("Show Profile" (QUOTE SHOWPROFILE)
				     "Show the profile of environment")
		     ("Show(Axiom)" (QUOTE SHOWAXIOM)
				    "Pretty-print axioms"
				    (SUBITEMS ("Show SA" (QUOTE SHOWSA)
							 
						    "Pretty-print semantic attachment")
					      ("Show Axiom" (QUOTE SHOWAXIOM)
							    "Pretty-print axiom")))
		     ("Delete(Axiom)" (QUOTE DELETEAXIOM)
				      "Erases axiom from database"
				      (SUBITEMS ("Delete SA" (QUOTE DELETESA)
							     
					   "Erases semantic attachments from database")
						("DeleteAxiom" (QUOTE DELETEAXIOM)
							       
							  "Erases axiom from database")))
		     ("Edit(Axiom)" (QUOTE EDITAXIOM)
				    "Edit axioms"
				    (SUBITEMS ("Edit SA" (QUOTE EDITSA)
							 "Edit semantic attachment")
					      ("EditAxiom" (QUOTE EDITAXIOM)
							   "Edit axioms")))
		     (SetLimit (QUOTE SETLIMIT)
			       "Set limit of depth-search tree")
		     (Mode (QUOTE MODE)
			   "Set mode of demonstration"
			   (SUBITEMS (All (QUOTE ALL)
					  "Search for all goals")
				     (First (QUOTE FIRST)
					    "Stop at first goal reached")
				     (Interactive (QUOTE INTERACTIVE)
						  "Ask user to go on")))
		     [Shortform (QUOTE SHORTFORM)
				"Perform the control of occurrence"
				(SUBITEMS (Yes (QUOTE YES))
					  (No (QUOTE NO]
		     [Trace (QUOTE TRACE)
			    "Trace demonstration"
			    (SUBITEMS (Trace (QUOTE TRACE))
				      (NoTrace (QUOTE NOTRACE]
		     ["Trace PM" (QUOTE TRACEPM)
				 "Trace pattern matching"
				 (SUBITEMS (Trace (QUOTE TRACEPM))
					   (NoTrace (QUOTE NOTRACEPM]
		     (LoadHKB (QUOTE LOAD)
			      "Load H knowledge base")
		     (SaveHKB (QUOTE SAVE)
			      "Save H knowledge base")
		     ("EraseEnv" (QUOTE ERASE)
				 "Erase entire environment")
		     (Exit (QUOTE Exit)
			   "Exit from logic environment")))
(DEFINEQ

(H
  [LAMBDA NIL                                         (* edited: " 9-Feb-87 14:52")
    (LET* ((HWINDOW (CREATEW NIL (CONCAT "H " H.RELEASE.NUMBER 
					   " -- Horn Clauses Programming Environment ")
			       6 T))
	   (HMenu (MENUWINDOW (create MENU
					  MENUCOLUMNS ← 1
					  TITLE ← "H control window"
					  ITEMS ← HMenuItems
					  WHENSELECTEDFN ← (FUNCTION HMenuFunction)
					  CENTERFLG ← T)))
	   (HKBMenu (MENUWINDOW (create MENU
					    MENUCOLUMNS ← 1
					    TITLE ← "KB loaded:"
					    ITEMS ← NIL
					    CENTERFLG ← T)))
	   (LISPXUSERFN T)
	   (H.FROM.WINDOW T))
          (ATTACHWINDOW HMenu HWINDOW (QUOTE RIGHT)
			  (QUOTE TOP))
          (ATTACHWINDOW HKBMenu HWINDOW (QUOTE LEFT)
			  (QUOTE TOP))
          (PUTWINDOWPROP HWINDOW (QUOTE *functions*)
			   NIL)
          (PUTWINDOWPROP HWINDOW (QUOTE *int-mode*)
			   (QUOTE first))
          (PUTWINDOWPROP HWINDOW (QUOTE *l-trace*)
			   NIL)
          (PUTWINDOWPROP HWINDOW (QUOTE *limit*)
			   200)
          (PUTWINDOWPROP HWINDOW (QUOTE *match-trace*)
			   NIL)
          (PUTWINDOWPROP HWINDOW (QUOTE *predicates*)
			   NIL)
          (PUTWINDOWPROP HWINDOW (QUOTE *shortform*)
			   T)
          (PUTWINDOWPROP HWINDOW (QUOTE *variables*)
			   NIL)
          (OPENW HWINDOW)
          (TTYDISPLAYSTREAM HWINDOW)
          (USEREXEC (QUOTE ?--)
		      NIL
		      (FUNCTION HReadProvePrint))
          (CLOSEW HWINDOW])

(H.BUTTONFN
  [LAMBDA (W)                                         (* edited: "17-Mar-87 16:28")
    (COND
      ((LASTMOUSESTATE LEFT)
	T)
      ((LASTMOUSESTATE MIDDLE)
	(SELECTQ [SETQ COM (MENU (OR HMIDDLEMENU (SETQ HMIDDLEMENU
					       (create MENU
							 ITEMS ← HMENUITEMS]
		   [Dribble (LET ((PW (GETPROMPTWINDOW W))
				  (FILE NIL)
				  (FILENAME NIL))
			         (CLEARW PW)
			         (SETQ FILENAME (MKATOM (PROMPTFORWORD 
						  "Typescript to file (cr to close): "
									     NIL NIL PW)))
			         (FOO)
			         (CLEARW PW)
			         (COND
				   ((NULL FILENAME)
				     (CLOSEF (GETWINDOWPROP W (QUOTE TYPESCRIPTFILE))
					       )
				     (CLEARW PW)
				     (PRINTOUT PW (CONCAT (FULLNAME
							      (GETWINDOWPROP
								W
								(QUOTE TYPESCRIPTFILE)))
							    " closed"))
				     (PUTWINDOWPROP W (QUOTE TYPESCRIPTFILE)
						      NIL))
				   (T (SETQ FILE (OPENSTREAM FILENAME (QUOTE OUTPUT)
								 (QUOTE NEW)))
				      (if (NULL FILE)
					  then [PROGN NIL (CLEARW PW)
							  (PRINTOUT PW
								    (CONCAT
								      "Could not open"
								      (FULLNAME FILENAME]
					else (PROGN NIL (CLEARW PW)
							(PRINTOUT PW (CONCAT
								    (FULLNAME FILENAME)
								    " opened"))
							(PUTWINDOWPROP W (QUOTE 
									TYPESCRIPTFILE)
									 FILE]
		   T])

(H.NullW
  [LAMBDA (type)                                      (* edited: "17-Mar-87 16:33")
    (COND
      [(EQ type (QUOTE PM))
	(if (NULL *PMWindow*)
	    then (SETQ *PMWindow* (CREATEW NIL "Pattern matching window"))
		   (DSPSCROLL (QUOTE ON)
				*PMWindow*)
		   (PUTWINDOWPROP *PMWindow* (QUOTE BUTTONEVENTFN)
				    (FUNCTION H.BUTTONFN]
      [(EQ type (QUOTE TR))
	(if (NULL *TraceWindow*)
	    then (SETQ *TraceWindow* (CREATEW NIL "Tracing window"))
		   (DSPSCROLL (QUOTE ON)
				*TraceWindow*)
		   (PUTWINDOWPROP *TraceWindow* (QUOTE BUTTONEVENTFN)
				    (FUNCTION H.BUTTONFN]
      ((EQ type (QUOTE SH))
	(if (NULL *ShowWindow*)
	    then (PROGN NIL (SETQ *ShowWindow* (CREATEW NIL "Show window"))
			    (DSPSCROLL (QUOTE ON)
					 *ShowWindow*)
			    (PUTWINDOWPROP *ShowWindow* (QUOTE BUTTONEVENTFN)
					     (FUNCTION H.BUTTONFN])

(H.PrintInfo
  [LAMBDA (win-type args)                             (* edited: "17-Mar-87 16:32")
                                                      (* Names for windows are: *PMWindow*, for tracing pattern 
						      matching, *TraceWindow*, for tracing window, and 
						      *ShowWindow*, for showing window)
    (H.NullW win-type)
    (LET [(W (COND
	       ((EQ win-type (QUOTE PM))
		 *PMWindow*)
	       ((EQ win-type (QUOTE TR))
		 *TraceWindow*)
	       ((EQ win-type (QUOTE SH))
		 *ShowWindow*]
         (SHOWPRINT args W)
         (TERPRI W)
         (LET [(FILE (GETWINDOWPROP W (QUOTE TYPESCRIPTFILE]
	      (if FILE
		  then (SHOWPRINT args FILE])

(H.delete
  [LAMBDA (delendo ax-list)                           (* edited: "17-Oct-86 15:07")
    (COND
      ((NULL ax-list)
	NIL)
      ((EQUAL delendo (CAAR ax-list))
	(CDR ax-list))
      (T (CONS (CAR ax-list)
		 (H.delete delendo (CDR ax-list])

(H.editAxiom
  [LAMBDA (W)                                         (* edited: " 6-Feb-87 10:15")
    (CLEARW PROMPTWINDOW)
    (TTYDISPLAYSTREAM PROMPTWINDOW)
    (LET* [(preds (GETWINDOWPROP W (QUOTE *predicates*)))
	   (name (MENU (create MENU
				   MENUCOLUMNS ← (IPLUS 1 (IQUOTIENT (LENGTH preds)
									 10))
				   TITLE ← (QUOTE Predicates)
				   ITEMS ← (CONS (QUOTE --New--)
						   preds)
				   MENUBORDERSIZE ← 1
				   CENTERFLG ← T)))
	   (*dummy-axiom* (LIST (LIST (LIST (QUOTE predicate]
          [COND
	    ((NULL name)
	      NIL)
	    [(MEMBER name preds)
	      (SETQ *dummy-axiom* (GETPROP name (QUOTE axiom)))
	      (DV *dummy-axiom*)
	      (PUTPROP name (QUOTE axiom)
			 *dummy-axiom*)
	      (MkVars *dummy-axiom* W)
	      (SETQ *dummy-axiom* (LIST (LIST (LIST (QUOTE predicate]
	    (T (SETQ name (MKATOM (PROMPTFORWORD "Name of new axiom: ")))
	       (DV *dummy-axiom*)
	       (PUTPROP name (QUOTE axiom)
			  *dummy-axiom*)
	       (MkVars *dummy-axiom* W)
	       (PUTWINDOWPROP W (QUOTE *predicates*)
				(CONS name preds]
          (SETQ *dummy-axiom* (LIST (LIST (LIST (QUOTE predicate])

(H.editSA
  [LAMBDA (W)                                         (* edited: " 6-Feb-87 10:15")
    (CLEARW PROMPTWINDOW)
    (LET* [(SAs (GETWINDOWPROP W (QUOTE *functions*)))
	   (name (MENU (create MENU
				   MENUCOLUMNS ← (IPLUS 1 (IQUOTIENT (LENGTH SAs)
									 10))
				   TITLE ← (QUOTE Functions)
				   ITEMS ← (CONS (QUOTE --New--)
						   SAs)
				   MENUBORDERSIZE ← 1
				   CENTERFLG ← T)))
	   (*dummy-SA* (LIST (QUOTE LAMBDA)
			       (LIST (QUOTE ARGS)
				       (QUOTE ...))
			       (QUOTE BODY]
          (COND
	    ((NULL name)
	      NIL)
	    [(MEMBER name SAs)
	      (SETQ *dummy-SA* (GETPROP name (QUOTE funct)))
	      (DV *dummy-SA*)
	      (PUTPROP name (QUOTE funct)
			 *dummy-SA*)
	      (SETQ *dummy-SA* (LIST (QUOTE LAMBDA)
					 (LIST (QUOTE ARGS)
						 (QUOTE ...))
					 (QUOTE BODY]
	    (T (SETQ name (MKATOM (PROMPTFORWORD "Name of new SA: ")))
	       (DV *dummy-SA*)
	       (PUTPROP name (QUOTE funct)
			  *dummy-SA*)
	       (PUTWINDOWPROP W (QUOTE *functions*)
				(CONS name SAs))
	       (SETQ *dummy-SA* (LIST (QUOTE LAMBDA)
					  (LIST (QUOTE ARGS)
						  (QUOTE ...))
					  (QUOTE BODY])

(H.erase
  [LAMBDA NIL                                         (* edited: " 5-Feb-87 15:46")
    (PSETQ *functions1* NIL *functions* NIL *predicates1* NIL *predicates* NIL 
	   *variables1* NIL *variables* NIL])

(H.load
  [LAMBDA (kb)                                        (* edited: " 5-Feb-87 16:10")
    (LET ((numFoo NIL)
	  (numPred NIL))
         [LOAD (PACK (APPEND (UNPACK kb)
				   (QUOTE (%. H K B]
         (SETQ numPred (LENGTH *predicates1*))
         (SETQ numFoo (LENGTH *functions1*))
         (for I in *temp-foo* as Q in *functions1* as H from 1 to numFoo
	    do (PUTPROP Q (QUOTE funct)
			    I))
         (for I in *temp-pred* as Q in *predicates1* as H from 1 to numPred
	    do (PUTPROP Q (QUOTE axiom)
			    I))
         (for Q in *variables1* do (PUTPROP Q (QUOTE variable)
						    T))
         (SETQ *predicates* (APPEND *predicates* *predicates1*))
         (SETQ *functions* (APPEND *functions* *functions1*))
         (SETQ *variables* (APPEND *variables* *variables1*))
     T])

(H.save
  [LAMBDA (kb)                                        (* edited: " 5-Feb-87 15:43")
    (LET [[var (PACK (CONS (UNPACK kb)
			       (QUOTE (C O M S]
	  (file (PACK (APPEND (UNPACK kb)
				  (QUOTE (%. H K B]
         [SETQ *temp-foo* (for I in *functions* collect (GETPROP I (QUOTE
									     funct]
         [SETQ *temp-pred* (for I in *predicates* collect (GETPROP I
									     (QUOTE
									       axiom]
         (PSETQ *functions1* *functions* *predicates1* *predicates* *variables1* 
		*variables*)
         [SETQ var (LIST (LIST (QUOTE *functions1*)
				     (QUOTE *predicates1*)
				     (QUOTE *variables1*)
				     (QUOTE *temp-foo*)
				     (QUOTE *temp-pred*]
         (PUTDEF file (QUOTE FILES)
		   var)
         (MAKEFILE file])

(HMenuFunction
  [LAMBDA (item menu button)                          (* edited: "17-Mar-87 14:09")
    (LET* [(newitem (CADADR item))
	   (mainw (MAINWINDOW (WFROMMENU menu)))
	   (KBMenu (CADR (ATTACHEDWINDOWS mainw]
          (COND
	    ((EQ newitem (QUOTE Exit))
	      (PROG NIL
		      (GIVE.TTY.PROCESS mainw)
		      (BKSYSBUF (QUOTE (OK)))
		      (CLOSEW mainw)))
	    ((MEMBER newitem (QUOTE (ALL MODE)))
	      (PUTWINDOWPROP mainw (QUOTE *int-mode*)
			       (QUOTE all)))
	    ((EQ newitem (QUOTE FIRST))
	      (PUTWINDOWPROP mainw (QUOTE *int-mode*)
			       (QUOTE first)))
	    [(EQ newitem (QUOTE SHOWAXIOM))
	      (PROG (ans (mm (create MENU
					 MENUCOLUMNS ←
					 (IPLUS 1 (IQUOTIENT
						    (LENGTH (GETWINDOWPROP
								mainw
								(QUOTE *predicates*)))
						    10))
					 TITLE ← (QUOTE Predicates)
					 ITEMS ← (GETWINDOWPROP mainw (QUOTE 
									  *predicates*))
					 MENUBORDERSIZE ← 1
					 CENTERFLG ← T)))
		      (OR (GETWINDOWPROP mainw (QUOTE *predicates*))
			    (RETURN T))
		  flag(SETQ ans (MENU mm))
		      (if ans
			  then (PROG NIL
				         (H.PrintInfo (QUOTE SH)
							(GETPROP ans (QUOTE axiom)))
				         (GO flag]
	    [(EQ newitem (QUOTE SHOWSA))
	      (PROG (ans (mm (create MENU
					 MENUCOLUMNS ←
					 (IPLUS 1 (IQUOTIENT
						    (LENGTH (GETWINDOWPROP
								mainw
								(QUOTE *functions*)))
						    10))
					 TITLE ← (QUOTE Functions)
					 ITEMS ← (GETWINDOWPROP mainw (QUOTE 
									   *functions*))
					 MENUBORDERSIZE ← 1
					 CENTERFLG ← T)))
		      (OR (GETWINDOWPROP mainw (QUOTE *functions*))
			    (RETURN T))
		  flag(SETQ ans (MENU mm))
		      (if ans
			  then (PROG NIL
				         (H.PrintInfo (QUOTE SH)
							(GETPROP ans (QUOTE funct)))
				         (GO flag]
	    [(EQ newitem (QUOTE DELETEAXIOM))
	      (PROG (ans)
		  flag(SETQ ans (MENU (create
					    MENU
					    MENUCOLUMNS ←
					    (IPLUS 1 (IQUOTIENT
						       (LENGTH (GETWINDOWPROP
								   mainw
								   (QUOTE *predicates*)))
						       10))
					    TITLE ← (QUOTE Predicates)
					    ITEMS ← (GETWINDOWPROP mainw (QUOTE 
									  *predicates*))
					    MENUBORDERSIZE ← 1
					    CENTERFLG ← T)))
		      (if ans
			  then (PROG NIL
				         [PUTWINDOWPROP mainw (QUOTE *predicates*)
							  (DREMOVE ans
								     (GETWINDOWPROP
								       mainw
								       (QUOTE 
									  *predicates*]
				         (PUTPROP ans (QUOTE axiom)
						    NIL)
				         (GO flag]
	    [(EQ newitem (QUOTE DELETESA))
	      (PROG (ans)
		  flag(SETQ ans (MENU (create
					    MENU
					    MENUCOLUMNS ←
					    (IPLUS 1 (IQUOTIENT
						       (LENGTH (GETWINDOWPROP
								   mainw
								   (QUOTE *functions*)))
						       10))
					    TITLE ← (QUOTE Functions)
					    ITEMS ← (GETWINDOWPROP mainw (QUOTE 
									   *functions*))
					    MENUBORDERSIZE ← 1
					    CENTERFLG ← T)))
		      (if ans
			  then (PROG NIL
				         [PUTWINDOWPROP mainw (QUOTE *functions*)
							  (DREMOVE ans
								     (GETWINDOWPROP
								       mainw
								       (QUOTE 
									   *functions*]
				         (PUTPROP ans (QUOTE funct)
						    NIL)
				         (GO flag]
	    ((EQ newitem (QUOTE INTERACTIVE))
	      (PUTWINDOWPROP mainw (QUOTE *int-mode*)
			       T))
	    ((EQ newitem (QUOTE EDITAXIOM))
	      (H.editAxiom mainw))
	    ((EQ newitem (QUOTE EDITSA))
	      (H.editSA mainw))
	    ((MEMBER newitem (QUOTE (SHORTFORM YES)))
	      (PUTWINDOWPROP mainw (QUOTE *shortform*)
			       T))
	    ((EQ newitem (QUOTE NO))
	      (PUTWINDOWPROP mainw (QUOTE *shortform*)
			       NIL))
	    ((EQ newitem (QUOTE TRACE))
	      (PUTWINDOWPROP mainw (QUOTE *l-trace*)
			       T))
	    ((EQ newitem (QUOTE NOTRACE))
	      (PUTWINDOWPROP mainw (QUOTE *l-trace*)
			       NIL))
	    ((EQ newitem (QUOTE SETLIMIT))
	      (PUTWINDOWPROP mainw (QUOTE *limit*)
			       (RNUMBER "Set new limit:")))
	    ((EQ newitem (QUOTE ERASE))
	      (for I in (GETWINDOWPROP mainw (QUOTE *predicates*))
		 do (PUTPROP I (QUOTE axiom)
				 NIL))
	      (for I in (GETWINDOWPROP mainw (QUOTE *functions*))
		 do (PUTPROP I (QUOTE funct)
				 NIL))
	      (PUTWINDOWPROP mainw (QUOTE *functions*)
			       NIL)
	      (PUTWINDOWPROP mainw (QUOTE *predicates*)
			       NIL)
	      (PUTWINDOWPROP mainw (QUOTE *variables*)
			       NIL)
	      (PSETQ *temp-foo* NIL *temp-pred* NIL)
	      (PSETQ *functions1* NIL *predicates1* NIL *variables1* NIL *PMTraceWindow* 
		     NIL *ShowWindow* NIL *TraceWindow* NIL)
	      (DETACHWINDOW KBMenu)
	      (CLOSEW KBMenu)
	      (ATTACHMENU (create MENU
				      MENUCOLUMNS ← 1
				      TITLE ← "KB loaded:"
				      ITEMS ← NIL
				      CENTERFLG ← T)
			    mainw
			    (QUOTE LEFT)
			    (QUOTE TOP)))
	    ((EQ newitem (QUOTE TRACEPM))
	      (PUTWINDOWPROP mainw (QUOTE *match-trace*)
			       T))
	    ((EQ newitem (QUOTE NOTRACEPM))
	      (PUTWINDOWPROP mainw (QUOTE *match-trace*)
			       NIL))
	    ((EQ newitem (QUOTE LOAD))
	      (LoadHKB mainw))
	    ((EQ newitem (QUOTE SAVE))
	      (SaveHKB mainw))
	    ((EQ newitem (QUOTE SHOWPROFILE))
	      (CLEARW PROMPTWINDOW)
	      (PRINTOUT PROMPTWINDOW (QUOTE Mode:)
			.SP 1 (GETWINDOWPROP mainw (QUOTE *int-mode*))
			.SP 3 (QUOTE Limit:)
			(GETWINDOWPROP mainw (QUOTE *limit*))
			T
			(QUOTE Tracing:)
			.SP 1 (GETWINDOWPROP mainw (QUOTE *l-trace*))
			.SP 3 (QUOTE PMTracing:)
			.SP 1 (GETWINDOWPROP mainw (QUOTE *match-trace*))
			T])

(HReadProvePrint
  [LAMBDA (x line)                                    (* edited: "20-Oct-86 14:11")
    (PROG ((SYSPRETTYFLG T))
	    (H.?! (LIST x))
	    (RETURN T])

(LoadHKB
  [LAMBDA (W)                                         (* edited: " 4-Feb-87 10:14")
    (CLEARW PROMPTWINDOW)
    (TTYDISPLAYSTREAM PROMPTWINDOW)
    (LET [(ans (MKATOM (PROMPTFORWORD "Name of KB:")))
	  (numFoo NIL)
	  (numPred NIL)
	  (att-w (CADR (ATTACHEDWINDOWS W]
         [LOAD (PACK (APPEND (UNPACK ans)
				   (QUOTE (%. H K B]
         (DETACHWINDOW att-w)
         (CLOSEW att-w)
         (ATTACHMENU (create MENU
				 MENUCOLUMNS ← 1
				 TITLE ← "KB loaded:"
				 ITEMS ← (replace ITEMS
					    of (CAR (GETWINDOWPROP att-w
									 (QUOTE MENU)))
					    with
					     (APPEND [fetch ITEMS
							  of (CAR (GETWINDOWPROP
									att-w
									(QUOTE MENU]
						       (LIST ans)))
				 CENTERFLG ← T)
		       W
		       (QUOTE LEFT)
		       (QUOTE TOP))
         (SETQ numPred (LENGTH *predicates1*))
         (SETQ numFoo (LENGTH *functions1*))
         (for I in *temp-foo* as Q in *functions1* as H from 1 to numFoo
	    do (PUTPROP Q (QUOTE funct)
			    I))
         (for I in *temp-pred* as Q in *predicates1* as H from 1 to numPred
	    do (PUTPROP Q (QUOTE axiom)
			    I))
         (for Q in *variables1* do (PUTPROP Q (QUOTE variable)
						    T))
         (if (GETWINDOWPROP W (QUOTE *predicates*))
	     then (PUTWINDOWPROP W (QUOTE *predicates*)
				     (APPEND (GETWINDOWPROP W (QUOTE *predicates*))
					       *predicates1*))
	   else (PUTWINDOWPROP W (QUOTE *predicates*)
				   *predicates1*))
         (if (GETWINDOWPROP W (QUOTE *functions*))
	     then (PUTWINDOWPROP W (QUOTE *functions*)
				     (APPEND (GETWINDOWPROP W (QUOTE *functions*))
					       *functions1*))
	   else (PUTWINDOWPROP W (QUOTE *functions*)
				   *functions1*))
         (if (GETWINDOWPROP W (QUOTE *variables*))
	     then (PUTWINDOWPROP W (QUOTE *variables*)
				     (APPEND (GETWINDOWPROP W (QUOTE *variables*))
					       *variables1*))
	   else (PUTWINDOWPROP W (QUOTE *variables*)
				   *variables1*])

(SaveHKB
  [LAMBDA (W)                                         (* edited: " 3-Feb-87 18:15")
    (CLEARW PROMPTWINDOW)
    (TTYDISPLAYSTREAM PROMPTWINDOW)
    (LET* [(ans (MKATOM (PROMPTFORWORD "Name of KB:")))
	   [var (PACK (CONS (UNPACK ans)
				(QUOTE (C O M S]
	   (file (PACK (APPEND (UNPACK ans)
				   (QUOTE (%. H K B]
          [SETQ *temp-foo* (for I in (GETWINDOWPROP W (QUOTE *functions*))
				collect (GETPROP I (QUOTE funct]
          [SETQ *temp-pred* (for I in (GETWINDOWPROP W (QUOTE *predicates*))
				 collect (GETPROP I (QUOTE axiom]
          (PSETQ *functions1* (GETWINDOWPROP W (QUOTE *functions*))
		 *predicates1*
		 (GETWINDOWPROP W (QUOTE *predicates*))
		 *variables1*
		 (GETWINDOWPROP W (QUOTE *variables*)))
          [SETQ var (LIST (LIST (QUOTE *functions1*)
				      (QUOTE *predicates1*)
				      (QUOTE *variables1*)
				      (QUOTE *temp-foo*)
				      (QUOTE *temp-pred*]
          (PUTDEF file (QUOTE FILES)
		    var)
          (MAKEFILE file])

(\DummyFoo
  [LAMBDA NIL                                         (* edited: "25-Feb-87 11:30")
    (PROG NIL
	LOOP(BLOCK 600000)
	    (GO LOOP])

(\SEE.AT
  [NLAMBDA (ARG)                                    (* edited: " 3-Feb-87 17:42")
    (if H.FROM.WINDOW
	then (GETWINDOWPROP HWINDOW ARG)
      else (EVAL ARG])
)

(ADDTOVAR BackgroundMenuCommands (H [QUOTE (ADD.PROCESS (QUOTE (H]
				      "Open window on logic programming environment"))

(RPAQQ BackgroundMenu NIL)

(PUTPROPS LOAD READVICE [NIL (AROUND NIL (PROG1 (PROG ((UpdateClassBrowsers? NIL))
							(RETURN *))
						  (UpdateClassBrowsers])
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA )

(ADDTOVAR NLAML \SEE.AT)

(ADDTOVAR LAMA )
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2832 23212 (H 2842 . 4416) (H.BUTTONFN 4418 . 5945) (H.NullW 5947 . 6963) (
H.PrintInfo 6965 . 7717) (H.delete 7719 . 8013) (H.editAxiom 8015 . 9337) (H.editSA 9339 . 
10690) (H.erase 10692 . 10911) (H.load 10913 . 11887) (H.save 11889 . 12788) (HMenuFunction
 12790 . 19126) (HReadProvePrint 19128 . 19319) (LoadHKB 19321 . 21658) (SaveHKB 21660 . 
22841) (\DummyFoo 22843 . 23007) (\SEE.AT 23009 . 23210)))))
STOP