(FILECREATED "22-JUN-81 14:31:50" <NEWLISP>HELPSYS.;1 45236  

     changes to:  HELPSYS HELPSYS1A HELPARG HELPCHOOZCAT HGETINDEX1B HELPASSISTANCE

     previous date: "25-JUN-80 00:44:30" <LISP>HELPSYS.;19)


(PRETTYCOMPRINT HELPSYSCOMS)

(RPAQQ HELPSYSCOMS ((FNS * HELPSYSFNS)
		    (VARS CATLST FNTAGLST EMTAGLST HELPSYSPUNCTUATIONMARKS (HARDCOPYFLG)
			  (HELPADRF)
			  (HELPIDXF)
			  (HELPSYSDIR)
			  (HELPSYSFL)
			  (HELPSYSCRCHAR (CHARACTER 31))
			  HELPSYSDIRLST)
		    [ADDVARS (AFTERSYSOUTFORMS (SETQ HELPIDXF (SETQ HELPADRF (SETQ HELPSYSDIR]
		    (DECLARE: DOEVAL@COMPILE DONTCOPY
			      (PROP MACRO HBIN HBOUT HCRPOS HCRPOSP OSFBSZ OSFPTR OMAPIN OMAPELT))
		    (BLOCKS * HELPSYSBLOCKS)))

(RPAQQ HELPSYSFNS (HELPSYS HELPSYS0 HELPSYS1A HELPSYS1B HGETSUBJECT HPRTCHOOZ HFIXSUBJ HFIXSUBJ1A 
			   HFIXSUBJ1B HMAKEASKUSERLST HELPARG HELPRINT HELPRINT1 HELPRINT2 
			   HELPRINTMORE HELPFOOTNOTEP HELPRINOTE HELPRINT2A HELPRINTFN HELPBOUT 
			   HELPMKITEMLDIFF HMKITEMLST1A HPHRASEFILEPOS HUNPACKPHRASE HELPCHOOZCAT 
			   HELPWORDS HELPMKATOM HCXR HNEXTDIGITP HGETINDEX1B HELPASSISTANCE 
			   HELPSYSSTOP))
(DEFINEQ

(HELPSYS
  [LAMBDA (WHAT?-SUBJECT WHAT?-CATEGORY IN?-TOPIC IN?-CATEGORY)
                                   (* lmm: "24-MAR-77 13:48:01")
    (RESETLST (PROG (IJFN TAG SUBJECT SELCATFLG (HELPTTYFLG (NULL WHAT?-SUBJECT))
			  INT)
		    (RESETSAVE NIL (QUOTE (HELPSYS0)))
		    (RESETSAVE (OUTPUT T))
		    [COND
		      ((NULL HELPADRF)
			(OR [AND (SETQ HELPADRF (HGETINDEX1B (QUOTE HELPADRF)))
				 (SETQ HELPIDXF (HGETINDEX1B (QUOTE HELPIDXF]
			    (RETURN)))
		      (T (INPUT (INFILE HELPADRF))
			 (INPUT (INFILE HELPIDXF]
		    [COND
		      ((EQ WHAT?-CATEGORY (QUOTE ARGS))
			(PROG NIL
			      (SETFILEPTR HELPADRF (OR (HELPBINSEARCH WHAT?-SUBJECT HELPIDXF)
						       (RETURN)))
			      (OR (EQ (READC HELPADRF)
				      (QUOTE %())
				  (RETURN))
			  LP  (RETURN (SELECTQ (RATOM HELPADRF)
					       (%) NIL)
					       (ARGS (LISTP (READ HELPADRF)))
					       (AND (NULL (SKREAD HELPADRF))
						    (GO LP]
		    (SETQ LASTCH# NIL)
		    (SETQ LASTSENTEND NIL)
		    (SETQ LASTHELPSYSFL NIL)
		    (AND (SETQ INT (GETINTERRUPT (QUOTE OUTPUTBUFFER)))
			 (RESETSAVE (INTCHAR INT (QUOTE (HELPSYSSTOP))
					     T)))
		    [COND
		      (WHAT?-SUBJECT (RETURN (HELPSYS1B WHAT?-SUBJECT WHAT?-CATEGORY IN?-TOPIC 
							IN?-CATEGORY]
		    (PRIN1 (QUOTE "Type ??? <CR> for assistance"))
		    (TERPRI)
		    (USEREXEC (QUOTE !)
			      (CONS (QUOTE (??? (HELPASSISTANCE)))
				    (CONS [QUOTE (STOP (RETFROM (QUOTE USEREXEC]
					  LISPXMACROS))
			      (FUNCTION HELPSYS1A))
		    (RETURN (QUOTE thank-you])

(HELPSYS0
  [LAMBDA NIL                           (* lmm: "18-MAR-77 11:21:08")
    (AND HELPIDXF (OPENP HELPIDXF)
	 (CLOSEF HELPIDXF))
    (AND HELPIDXF (OPENP HELPADRF)
	 (CLOSEF HELPADRF))
    (AND HELPSYSFL (OPENP HELPSYSFL)
	 (CLOSEF HELPSYSFL])

(HELPSYS1A
  [LAMBDA (X Y)                    (* lmm: "23-MAR-77 15:01:45")
    (PROG ((LST (CONS X Y))
	   A AWD TYPE TEM TEM1 B IS IN THE ARG ARGV ITEM ENTRY)
          (AND (LITATOM X)
	       (FGETD X)
	       (LISTP Y)
	       (OR [AND (NULL (CDR Y))
			(OR (NULL (CAR Y))
			    (LISTP (CAR Y]
		   (EQ (ARGTYPE X)
		       3))
	       (RETURN))
          [COND
	    ((EQ X (QUOTE MORE))   (* MORE, when typed by itself, means start printing text from the last position 
				   after the previous subject presented.)
	      (HELPSYS1B SUBJECT (QUOTE MORE))
	      (GO RETF))
	    ((SETQ IN (HELPWORDS (QUOTE (OF IN FOR TO))
				 LST))
	      (SETQ B AWD)
	      (COND
		((SETQ THE (HELPWORDS (QUOTE (THE AN A))
				      IN T))
		  (SETQ IN THE)))
	      (SETQ ENTRY (HELPMKATOM IN]
          [COND
	    ((SETQ IS (HELPWORDS (QUOTE (ABOUT IS ARE))
				 LST))
	      [COND
		((SETQ THE (HELPWORDS (QUOTE (THE AN A))
				      IS T))
		  (SETQ TEM1 (PROG (FLG Z (W (QUOTE ARG)))
			       LP1 (COND
				     ([NULL (SETQ Z (STRPOS W (SETQ TEM (PACK THE]
				       (AND FLG (RETURN))
				       [SETQ W (OR (FIXSPELL (CAR THE)
							     70
							     (QUOTE (ARGS ARGUMENTS))
							     NIL THE)
						   (FIXSPELL (CADR THE)
							     70
							     (QUOTE (ARG ARGUMENT))
							     NIL
							     (CDR THE]
				       (SETQ FLG T)
				       (GO LP1)))
			           (RETURN Z)))
		  (COND
		    [TEM1 (SETQ ARG (COND
			      ((EQ TEM1 1)
				(QUOTE THE))
			      (T (MKATOM (SUBSTRING TEM 1 (SUB1 TEM1]
		    (T (SETQ IS THE]
	      (OR IN (SETQ ENTRY (HELPMKATOM IS]
          [COND
	    ((AND (NULL IN)
		  (NULL IS))
	      (SETQ ENTRY (HELPMKATOM LST]
          [SETQ ITEM (COND
	      (ARG (SETQ ARGV ARG))
	      ((AND IN (SETQ TEM (TAILP B IS)))
		(HELPMKATOM (LDIFF IS TEM]
          (COND
	    (ARGV (HELPSYS1B ITEM (QUOTE ARGS)
			     ENTRY TYPE ARGV))
	    (ITEM (HELPSYS1B ITEM NIL ENTRY TYPE))
	    (T (HELPSYS1B ENTRY TYPE)))
      RETF(RETFROM (QUOTE LISPX)
		   NIL T])

(HELPSYS1B
  [LAMBDA (WHAT?-SUBJECT WHAT?-CATEGORY IN?-TOPIC IN?-CATEGORY ARGFLG)
                                        (* lmm: "24-MAR-77 13:27:26")

          (* HELPSYS1B is called from either: HELPSYS 
	  (if arguments were specified) or from HELPSYS1A 
	  (after parsing an inquiry). After determining what information
	  is to be presented, HELPRINT is called to print it.)


    (PROG (PTRLST ITEM)
          [COND
	    ((EQ WHAT?-CATEGORY (QUOTE MORE))

          (* When called from HELPSYS1A with WHAT?-CATEGORY=MORE start 
	  printing the text which followed the previous subject 
	  presented.)


	      (RETURN (HELPRINTMORE SUBJECT TAG LASTHELPSYSFL 
				    LASTSENTEND)))
	    [IN?-TOPIC                  (* The information to be 
					retrieved is contained within 
					this topic (subject.))
	      (COND
		[(EQ WHAT?-CATEGORY (QUOTE EM))

          (* If the subcategory of the subject (WHAT?-SUBJECT) is an 
	  Error Message, try to look-up the coresponding index entry or 
	  set up for a search of the window of material defined by the 
	  IN?-TOPIC/IN?-CATEGORY.)


		  (COND
		    ((SETQ PTRLST (HGETSUBJECT IN?-TOPIC (QUOTE EM)
					       T)))
		    ((SETQ PTRLST (HGETSUBJECT IN?-TOPIC IN?-CATEGORY))
		      (SETQ ITEM WHAT?-SUBJECT))
		    (T (GO RTN)))
		  (COND
		    ((NULL TAG)
		      (SETQ TAG WHAT?-CATEGORY]
		[(EQ WHAT?-CATEGORY (QUOTE ARGS))
                                        (* If ARGS has been specified, 
					argument related information is 
					to be presented.)
		  (SETQ PTRLST (HGETSUBJECT IN?-TOPIC IN?-CATEGORY))
		  (AND SUBJECT (SETQ IN?-TOPIC SUBJECT))
		  (COND
		    ((NUMBERP WHAT?-SUBJECT)

          (* If n>0 specified; user wants to see all information 
	  contained within IN?-TOPIC (fn) which pertains to the "name" 
	  of that particular argument.)


		      (OR (SETQ ITEM (CAR (NTH (HGETSUBJECT
						 IN?-TOPIC
						 (QUOTE ARGS))
					       WHAT?-SUBJECT)))
			  (RETURN)))
		    [ARGFLG 

          (* When called with ARGFLG, from HELPSYS1A, ARG=Number -
	  the number, in english. i.e: FIRST or 1ST.)


			    (SETQ ITEM (COND
				((EQ (SETQ ARGV (HELPARG PTRLST ARG))
				     (QUOTE BADARG!))
				  (RETURN))
				(T ARGV]
		    (T (SETQ ITEM WHAT?-SUBJECT]
		((AND WHAT?-CATEGORY (SETQ PTRLST (HGETSUBJECT 
							  IN?-TOPIC 
						      WHAT?-SUBJECT)))
                                        (* WHAT?-SUBJECT itself can be 
					indexed under IN?-TOPIC.)
		  )
		((SETQ PTRLST (HGETSUBJECT IN?-TOPIC IN?-CATEGORY))
                                        (* look-up IN?-TOPIC;
					WHAT?-SUBJECT will be used as a 
					"search" argument.)
		  (SETQ ITEM WHAT?-SUBJECT))
		(T (GO RTN)))

          (* Reset IN?-TOPIC to SUBJECT, localfreevar set in 
	  HGETSUBJECT, thus allowing for possible spelling-correction.)


	      (AND SUBJECT (SETQ IN?-TOPIC SUBJECT))
	      (COND
		((NULL TAG)
		  (SETQ TAG IN?-CATEGORY]
	    ((SETQ PTRLST (HGETSUBJECT WHAT?-SUBJECT WHAT?-CATEGORY))
                                        (* IN?-TOPIC was not specified, 
					look-up 
					WHAT?-SUBJECT/WHAT?-CATEGORY.)
	      (COND
		((EQ WHAT?-CATEGORY (QUOTE ARGS))
                                        (* ARGLIST of WHAT?-CATEGORY 
					(fn) is all that is wanted -
					{bye!}.)
		  (RETURN PTRLST)))

          (* Reset WHAT?-SUBJECT to SUBJECT, localfreevar set in 
	  HGETSUBJECT, thus allowing for possible spelling-correction.)


	      (AND SUBJECT (SETQ WHAT?-SUBJECT SUBJECT))
	      (COND
		((NULL TAG)
		  (SETQ TAG WHAT?-CATEGORY]
      RTN (RETURN (COND
		    ((NULL SUBJECT)     (* SUBJECT could not be found in
					the index, -
					{see ya later!}.)
		      (COND
			(HELPTTYFLG (LISPXPRIN1 (OR IN?-TOPIC 
						    WHAT?-SUBJECT)
						T)
				    (LISPXPRIN1 (QUOTE 
					   "--unavailable subject.")
						T)
				    (LISPXTERPRI T)))
		      (RETURN))
		    (T                  (* Well, we have a subject to 
					present--{so let's print it}.)
		       (HELPRINT SUBJECT ITEM PTRLST TAG SELCATFLG])

(HGETSUBJECT
  [LAMBDA (SUBJ TYPE NON-CORRECTFLG)    (* lmm: "24-MAR-77 13:04:55")
    (PROG (W L ADR LTH TEM TEM1 PTRL TEMBEGADR BEGIDXF SPLSTA)
                                        (* Lookup the index-offset ptr 
					into the sentence-PTR-List file 
					(HELPADRFile) for SUBJect.)
          (SETQ SUBJECT)
          (SETQ TAG)
          (SETQ SELCATFLG)
      TOP [COND
	    ((NULL SUBJ)
	      (RETURN))
	    ((SETQ ADR (HELPBINSEARCH (COND
					((STRINGP SUBJ)
					  (SETQ SUBJ (MKATOM SUBJ)))
					(T SUBJ))
				      HELPIDXF))
	      (SETQ SUBJECT SUBJ)
	      (AND (NEQ TYPE (QUOTE ARGS))
		   (SETQ TAG TYPE))
	      (SETFILEPTR HELPADRF ADR))
	    [(NULL HELPTTYFLG)
	      (RETURN (SETQ SUBJECT (SETQ TAG]
	    [(SETQ TEM (STRPOS (QUOTE )
			       SUBJ))
	      [SETQ SPLSTA (HFIXSUBJ1B (COND
					 ((IGREATERP TEM 1)
					   (SETQ BEGIDXF NIL)
					   SUBJ)
					 (T (HFIXSUBJ1A (QUOTE 27)
							HELPIDXF)
					    (SETQ BEGIDXF (GETFILEPTR
						HELPIDXF))
					    (QUOTE Z]
	      (AND BEGIDXF (SETFILEPTR HELPIDXF BEGIDXF))
	      (SETQ L (FIXSPELL SUBJ 70 SPLSTA NIL NIL NIL
				(QUOTE ALL)))
	      (COND
		((NULL L)
		  (RETURN))
		((CDR L)
		  (SETQ L (DREVERSE L))
		  (HPRTCHOOZ L)
		  (SETQ SUBJ (ASKUSER DWIMWAIT NIL (QUOTE ("Which one"))
				      (HMAKEASKUSERLST L)))
		  (GO TOP))
		(T (SETQ SUBJ (CAR L))
		   (COND
		     ((NULL HELPTTYFLG)
		       (PRIN1 (QUOTE "="))
		       (PRINT SUBJ)))
		   (GO TOP]
	    ([SETQ TEM (FIXSPELL SUBJ 70 (SETQ SPLSTA (HFIXSUBJ1B
				     SUBJ))
				 NIL NIL (AND (EQ TYPE (QUOTE ARGS))
					      (FUNCTION GETD]
	      (SETQ SUBJ TEM)
	      (GO TOP))
	    (T (RETURN (SETQ SUBJECT (SETQ TAG NIL]

          (* If the SUBJect's subcategory (TYPE) is not found, read the 
	  entire sentence-PTR-List. -
	  If the file ptr, in HELPADRF, does not point to a left-paren %(
 
	  an incorrect value was returned by HELPBINSEARCH or 
	  HELPADRFile has been "garbaged.")

                                        (* !TEMP! Save ptr to 
					beg-HELPADRFile.)
          (SETQ TEMBEGADR (GETFILEPTR HELPADRF))
          (COND
	    ((NULL TYPE)
	      (GO FOUND))
	    ((NEQ (READC HELPADRF)
		  (QUOTE %())
	      (PRIN1 "invalid index offset ptr in:")
	      (PRINT HELPADRF)
	      (GO RTN)))                (* Search for either 
					right-paren, end of 
					sentence-PTR-List;
					or subcategory (TYPE).)
      LP  (COND
	    ((EQ (SETQ TEM1 (RATOM HELPADRF))
		 (QUOTE %)))

          (* !TEMP! If TEM1 is not a "true" subcat of SUBJECT, allow for
	  error -
	  present material as if: TYPE=NIL. -
	  -
	  However, if NON-CORRECTFLG=T return NIL, as usual, in this 
	  case.)


	      (AND (OR NON-CORRECTFLG (EQ TYPE (QUOTE ARGS)))
		   (GO RTN))
	      (SETFILEPTR HELPADRF TEMBEGADR)
	      (SETQ TAG NIL)
	      (SETQ SELCATFLG T)
	      (GO FOUND))
	    ((EQ TEM1 TYPE)
	      (GO FOUND))
	    ((NULL (SKREAD HELPADRF))
	      (GO LP))
	    (T (GO RTN)))
      FOUND
          (SETQ PTRL (LISTP (READ HELPADRF)))
      RTN (RETURN PTRL])

(HPRTCHOOZ
  [LAMBDA (LST)                         (* lmm: "18-MAR-77 13:38:28")
    (PROG (L (LTH (FLENGTH LST))
	     (CHOOZ# 0))
      LP  (COND
	    ((NULL (SETQ L (CAR LST)))
	      (RETURN LTH)))
          (PRIN1 (SETQ CHOOZ# (ADD1 CHOOZ#)))
          (PRIN1 (QUOTE %.))
          (SPACES 1)
          (PRIN1 L)
          (TERPRI)
          (SETQ LST (CDR LST))
          (GO LP])

(HFIXSUBJ
  [LAMBDA (X)                           (* lmm: "23-MAR-77 15:01:06")

          (* Designed for use as a FIXSPELL generator fn.
	  Returns one token per call from the index file HELPIDXF;
	  NIL when upper limit is exhausted.)


    (COND
      ((NOT (ILESSP (GETFILEPTR HELPIDXF)
		    (ELT X 2)))
	NIL)
      (T (PROG1 (RATOM HELPIDXF)
		(SKREAD HELPIDXF])

(HFIXSUBJ1A
  [LAMBDA (CHARV FILE)                  (* lmm: "24-MAR-77 00:27:56")
    (PROG ((JFN (VAG (OPNJFN FILE)))
	   (MIN (IDIFFERENCE CHARV 64))
	   MAX PAGE)

          (* Returns the upper/lower limits of the window containing all
	  tokens which begin with CHARV; the numeric value of the first 
	  character of SUBJect.)


          (OSFBSZ JFN 7)
          (SETQ PAGE (OMAPIN JFN 0))
          [SETQ MIN (OMAPELT JFN PAGE
			     (SETQ MAX
			       (VAG (COND
				      ((ILESSP MIN 1)
					0)
				      ((IGREATERP MIN 26)
					(COND
					  ((AND (IGREATERP MIN 32)
						(ILESSP MIN 59))
					    (IPLUS MIN -32))
					  (T 27)))
				      (T MIN]
          [SETQ MAX (OMAPELT JFN PAGE (VAG (ADD1 (LOC MAX]
          (OSFPTR JFN (LOC (OMAPELT JFN PAGE MIN)))
          (RETURN (SUB1 (LOC (OMAPELT JFN PAGE MAX])

(HFIXSUBJ1B
  [LAMBDA (WD)

          (* Sets up array used by FIXSPELL generator fn 
	  HFIXSUBJ. Also, "zeros-in" on a particular window 
	  determined by the first character of WD.)


    (PROG (X)
          (SETQ X (ARRAY 3))
          (SETA X 1 (QUOTE HFIXSUBJ))
          (SETA X 2 (HFIXSUBJ1A (CHCON1 WD)
				HELPIDXF))
          (SETA X 3 0)
          (RETURN X])

(HMAKEASKUSERLST
  [LAMBDA (LST)
    (PROG ((N 0))
          (RETURN
	    (APPEND
	      LST
	      (MAPCAR LST
		      (FUNCTION (LAMBDA (X)
			  (SETQ N (ADD1 N))
			  (SUBPAIR (QUOTE (N X))
				   (LIST N X)
				   (QUOTE (N X EXPLAINSTRING N 
					     NOECHOFLG T CONFIRMFLG T 
					     RETURN
					     (PROGN (TERPRI T)
						    (QUOTE X])

(HELPARG
  [LAMBDA (PTRLST ARG)             (* lmm "22-JUN-81 14:28")
    (PROG (FNARGS FDARG ARGX SFX PFX A N NLST NSPLST FIXFLG TEM)
          (SETQQ NSPLST (FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGTH NINTH TENTH))
          (SETQQ NLST ((FOUR . 4)
		  (FIF . 5)
		  (SIX . 6)
		  (SEVEN . 7)
		  (EIG . 8)
		  (NIN . 9)
		  (TEN . 10)))
      LP  (SETQ SFX (MKATOM (SUBSTRING ARG -2)))
          (SETQ PFX (MKATOM (SUBSTRING ARG 1 -3)))
          (COND
	    ([NULL (SETQ FNARGS (LISTGET1 PTRLST (QUOTE ARGS]
	      (GO RTN))
	    ((EQ ARG (QUOTE THE))
	      (GO RTN))
	    ((MEMB ARG FNARGS)
	      (SETQ FDARG ARG)
	      (GO RTN)))
          [SETQ TEM (COND
	      ((EQ ARG (QUOTE LAST))
		(LENGTH FNARGS))
	      (T (SELECTQ SFX
			  (ST (AND (OR (EQ PFX 1)
				       (EQ PFX (QUOTE FIR)))
				   1))
			  (ND (AND (OR (EQ PFX 2)
				       (EQ PFX (QUOTE SECO)))
				   2))
			  (RD (AND (OR (EQ PFX 3)
				       (EQ PFX (QUOTE THI)))
				   3))
			  [TH (OR (NUMBERP PFX)
				  (CDR (ASSOC PFX NLST]
			  NIL]
          (COND
	    ((NULL TEM)
	      (COND
		(FIXFLG (SETQ ARG ARGX)
			(GO RTN)))
	      (SETQ FIXFLG T)
	      (SETQ ARGX ARG)
	      (SETQ ARG (FIXSPELL ARG 70 NSPLST))
	      (GO LP)))
          [SETQ FDARG (AND (NUMBERP TEM)
			   (CAR (NTH FNARGS TEM]
      RTN (RETURN (COND
		    (FDARG FDARG)
		    ((EQ ARG (QUOTE THE))
		      (COND
			(FNARGS (PRIN1 " Arguments for ")
				(PRIN1 SUBJECT)
				(MAPRINT FNARGS NIL " are:  [" "]
" ";"))
			(T (PRIN1 SUBJECT)
			   (PRIN1 " doesn't have any arguments!")
			   (TERPRI)))
		      (QUOTE BADARG!))
		    (T (COND
			 (HELPTTYFLG (TERPRI)
				     (PRIN1 (L-CASE ARG T))
				     (PRIN1 " argument is nonexsistent for: ")
				     (PRINT SUBJECT)))
		       (QUOTE BADARG!])

(HELPRINT
  [LAMBDA (SUBJ ITEM PTRLST SUBJCD SELECTFLG)
                                        (* lmm: "24-MAR-77 13:30:40")
    (PROG (X TEM PLTH SENTL FSNT FSNTFLG FORMFLG FNOTEL FNOTELST 
	     CHOOZFLG FNTCRFLG HELPFL ITMFLG INDENT# (LNLTH (LINELENGTH)
							    )
	     (INDENTFLG 0))
          (SETQ PLTH (COND
	      ((SETQ TEM (INTERSECTION (CONS (QUOTE ARGS)
					     EMTAGLST)
				       PTRLST))
		(IPLUS (ITIMES (FLENGTH TEM)
			       2)
		       2))
	      (T 2)))
          (COND
	    ([NULL (SETQ SENTL (COND
		       ((AND (NULL SUBJCD)
			     (IGREATERP (FLENGTH PTRLST)
					PLTH))
			 (SETQ CHOOZFLG T)
			 (HELPCHOOZCAT PTRLST))
		       ((AND SUBJCD (NULL SELECTFLG))
			 PTRLST)
		       (T (OR SUBJCD (SETQ SUBJCD (CAR PTRLST)))
			  (CADR PTRLST]
	      (COND
		(HELPTTYFLG (PRIN1 SUBJ)
			    (PRIN1 " - additional info unavailable.")
			    (TERPRI)))
	      (RETURN)))
          [MAPC
	    SENTL
	    (FUNCTION (LAMBDA (SENTLX)
		(PROG (CH# FL TEM TEM1 TEM2 ONEFNTFLG SENTX REFL)
		      (COND
			([NOT (AND (SETQ HELPSYSFL (HGETINDEX1B
				       (CAR SENTLX)))
				   (SETQ IJFN (OPNJFN HELPSYSFL]
			  (PRIN1 SUBJ)
			  (PRIN1 " - info unavailable at this time.")
			  (TERPRI)
			  (RETURN)))
		      (SETQ FL (NAMEFIELD HELPSYSFL))
		      (SETQ FSNT (CADR SENTLX))
		      [SETQ CH# (SUBSTRING FL 1
					   (SUB1 (STRPOS "L" FL]
		      (COND
			([SETQ SENTX
			    (COND
			      [ITEM
				(SETQ ITMFLG
				  (PROG (A L STRLST PHRASE BEGFN L1 
					   LST1 BEG END
					   (LST (CDR SENTLX))
					   (SENTL (CDR SENTLX)))
				        (SETQ END
					  (HCXR (CAR (FLAST SENTL))
						T))
				        [COND
					  ((SETQ PHRASE
					      (STRPOS " " ITEM)))
					  (T
					    (SETQ STRLST
					      (NCONC
						(LIST (L-CASE ITEM)
						      (L-CASE ITEM T)
						      ITEM
						      (U-CASE ITEM))
						(AND
						  (EQ (CHCON1 ITEM)
						      60)
						  (SUBSTRING ITEM 1 -2]
				    LP  (COND
					  ([NULL
					      (SETQ BEG
						(HCXR (SETQ A
							(CAR LST]
					    (GO RTN))
					  ((AND (IGREATERP
						  (LENGTH A)
						  1)
						(NUMBERP (CAR A)))
					    (SETQ LST (CDR LST))
					    (GO LP)))
				    LP1 (COND
					  ((AND
					      [OR
						(AND PHRASE
						     (SETQ BEGFN
						       (HPHRASEFILEPOS
							 ITEM HELPSYSFL 
							 BEG END T)))
						(SOME
						  STRLST
						  (FUNCTION (LAMBDA (X)
						      (SETQ BEGFN
							(FFILEPOS
							  X HELPSYSFL 
							  BEG END NIL T]
					      (FMEMB
						(HBIN IJFN)
						(QUOTE (31 32 33 34 39 
							   41 44 45 46 
							   47 58 59 61 
							   62 63 93 125)
						       ))
					      (NOT
						(INTERSECTION
						  [SETQ A
						    (HMKITEMLST1A
						      (SETQ LST1
							(HELPMKITEMLDIFF
							  BEGFN LST
							  (NULL
							    (CDR LST]
						  L)))
					    (SETQ L (NCONC L A))
					    (SETQ LST LST1)
					    (SETQ LST (CDR LST))
					    (GO LP))
					  (BEGFN (SETQ BEG BEGFN)
						 (GO LP1)))
				    RTN (SETQ FSNTFLG
					  (EQUAL (CAR L)
						 (CAR SENTL)))
				        (RETURN L]
			      (T (CDR SENTLX]
			  [MAPC SENTX
				(FUNCTION (LAMBDA (X)
				    (COND
				      ((AND (IGREATERP (LENGTH X)
						       1)
					    (NUMBERP (CAR X)))
					(SETQ FNOTELST
					  (NCONC1 FNOTELST
						  (CAR X]
			  (COND
			    ((AND HELPTTYFLG (NULL CHOOZFLG))
			      (TERPRI)
			      (TERPRI)
			      (SPACES 1)
			      (PRIN1 (QUOTE %())
			      (PRIN1 SUBJ)
			      (COND
				((SETQ TEM (CDR (FASSOC SUBJCD CATLST)))
				  (PRIN1 (QUOTE " as a "))
				  (PRIN1 TEM))
				((OR (GETD SUBJCD)
				     (STRPOS " " SUBJCD))
				  (PRIN1 (QUOTE ,))
				  (SPACES 1)
				  (PRIN1 SUBJCD)
				  (PRIN1 (QUOTE ,)))
				(T (PRIN1 "cross reference in ")
				   (PRIN1 SUBJCD)))
			      (PRIN1 (QUOTE " from section "))
			      (PRIN1 CH#)
			      (PRIN1 (QUOTE %)))
			      (TERPRI))
			    ((CDR SENTL)
			      (COND
				[(NULL HARDCOPYFLG)
				  (TERPRI)
				  (RPTQ 7 (PRIN1 (QUOTE "----------"]
				(T (TERPRI)
				   (TERPRI)))
			      (TERPRI)
			      (PRIN1 "... from section ")
			      (PRIN1 CH#)
			      (TERPRI)))
                                        (* Set flg if only one footnote 
					present.)
			  (SETQ ONEFNTFLG (NULL (CDR FNOTELST)))

          (* If the subject is a function, or similar, print the 
	  "subject and argument" text line. Usually, on the first line.)


			  [SETQ FORMFLG
			    (OR (EQ SUBJCD (QUOTE FD))
				(AND (MEMB SUBJCD FNTAGLST)
				     (NOT (MEMB SUBJCD EMTAGLST]
			  [COND
			    ((NULL (CDR REFL))
                                        (* Set variables to be used by 
					MORE command.)
			      (SETQ LASTCH# CH#)
			      (SETQ LASTHELPSYSFL HELPSYSFL)
			      (SETQ LASTSENTBEGIN (HCXR (CAAR SENTX)))
			      (SETQ LASTSENTEND
				(HCXR (CAR (FLAST SENTX))
				      T]
			  (COND
			    ((AND ITEM (NEQ FSNT (CAR SENTX))
				  FORMFLG)
			      (HELPRINTFN (LIST FSNT)
					  SUBJCD)))
			  (HELPRINT1 SENTX NIL FNOTELST)
			  (TERPRI)
			  (RETURN (SETQ HELPFL (NCONC1 HELPFL
						       (CLOSEF 
							  HELPSYSFL]
          (RETURN (COND
		    [(AND ITEM (NULL ITMFLG))
		      (COND
			(HELPTTYFLG (PRIN1 ITEM)
				    (PRIN1 " not found in ")
				    (PRINT ENTRY]
		    (T HELPFL])

(HELPRINT1
  [LAMBDA (REFLST BEGFLG FNTFLG)        (* lmm: "24-MAR-77 13:04:42")
    (PROG (A ALL MFLG TEM TEM1 TEM2 FNTEM FNTLST (MORDF (QUOTE y))
	     (FNTCTR 0)
	     (KTR 0)
	     (KTR1 0)
	     (NSENT (LENGTH REFLST))
	     [LSTEND (OR BEGFLG (SUB1 (HCXR (CAR REFLST]
	     BEG END)
          (AND (NULL BEGFLG)
	       (OR ITEM (NEQ SUBJCD (QUOTE FD)))
	       [SETQ TEM (HCXR (SETQ A (CAR REFLST]
	       [NOT (MEMB (CAR A)
			  (QUOTE (H h]
	       (SETQ TEM1 (FILEPOS HELPSYSCRCHAR HELPSYSFL TEM))
	       (SETQ TEM2 (IDIFFERENCE TEM1 TEM))
	       (SETQ TEM (IDIFFERENCE LNLTH TEM2))
	       (IGREATERP TEM 1)
	       (SPACES TEM))
          [MAP REFLST
	       (FUNCTION (LAMBDA (REFL)
		   (PROG (A CREND TEM (X (CAR REFL))
			    (Y (CADR REFL)))
		         (SETQ BEG (CAR X))
		         (SETQ END (CDR X))
		         (COND
			   ((LISTP (CDR (LISTP X)))
			     [COND
			       [(NUMBERP BEG)
				 (COND
				   [(IGREATERP FNTCTR 0)
				     (RETURN (SETQ FNTCTR (SUB1 FNTCTR]
				   (FNTLST (SETQ FNTLST
					     (NCONC1 FNTLST X))
					   (RETURN)))
				 (OR FNOTEL (SETQ FNOTEL (LIST BEG)))
				 (SETQ FNTCRFLG (POSITION))
				 (COND
				   ((AND (OR Y FNTFLG)
					 (OR (EQ (CAR REFLST)
						 X)
					     ONEFNTFLG
					     (HELPFOOTNOTEP FNOTEL)))
				     [SETQ TEM
				       (FNTH REFL (ADD1 (FLENGTH FNOTEL]
				     (SETQ FNTEM (LDIFF REFL TEM))
				     (SETQ REFL TEM)
				     (HELPRINOTE FNTEM)
				     (SETQ FNOTEL NIL)
				     (SETQ FNTCTR 0))
				   (T (SETQ FNTLST (LIST X]
			       [(LITATOM BEG)
				 (COND
				   ((NULL HARDCOPYFLG)
				     (COND
				       ((AND FNTCRFLG (IGREATERP 
							   FNTCRFLG 2))
					 (SPACES (SUB1 FNTCRFLG))
					 (SETQ FNTCRFLG NIL)))
				     (HELPRINT2A (CAR END)
						 (CDR END)
						 T))
				   ((EQ BEG (QUOTE /))
				     (HELPRINT2 (CAR END)
						(CDR END)))
				   (T (HELPRINT2A (CAR END)
						  (CDR END]
			       (T (SETQ LSTEND (HELPRINT1 X LSTEND))
				  (SETQ KTR (ADD1 KTR))
				  (SETQ KTR1 (ADD1 KTR1]
			     (RETURN)))
		         (COND
			   ((NULL HARDCOPYFLG)
			     (COND
			       ((AND FNTCRFLG (IGREATERP
				       (SETQ TEM (SUB1 FNTCRFLG))
				       1))
				 (SPACES TEM)
				 (SETQ FNTCRFLG NIL)))
			     (HELPRINT2A BEG END T)
			     (RETURN)))
		         (HELPRINT2 BEG END)
		         (SETQ LSTEND END)
		         (SETQ KTR (ADD1 KTR))
		         (SETQ KTR1 (ADD1 KTR1))
		         [COND
			   ((AND HARDCOPYFLG
				 (NOT (LITATOM (CAR Y)))
				 [NOT (AND (IGREATERP (LENGTH Y)
						      1)
					   (NUMBERP (CAR Y]
				 (IGREATERP KTR1 1)
				 (IGREATERP NSENT 3)
				 (NEQ (ADD1 KTR)
				      NSENT)
				 (NEQ KTR NSENT)
				 (NULL FNOTELST))
			     (SETQ KTR1 0)
			     (TERPRI)
			     [SETQ TEM (ASKUSER DWIMWAIT MORDF
						(LIST (QUOTE "More"]
			     (COND
			       ((OR (EQ TEM (QUOTE n))
				    (EQ TEM (QUOTE N)))
				 (GO RTN))
			       (MFLG (SETQ MORDF (QUOTE n)))
			       ((EQ TEM MORDF)
				 (SETQ MFLG T]
		         (RETURN]
      RTN (RETURN (COND
		    ((AND FNTLST (NULL FNTFLG)
			  (NULL BEGFLG))
		      (SETQ TEM FNTLST)
		      (HELPRINT1 TEM (SETQ FNTLST NIL)
				 T))
		    (T LSTEND])

(HELPRINT2
  [LAMBDA (BEG END)                     (* lmm: "23-MAR-77 14:50:41")
    (PROG (A CRFLG (SP (QUOTE (32)))
	     (W (CONS))
	     (N 0)
	     SENTLTH)
          [COND
	    ((OR (NULL BEG)
		 (NULL END))
	      (RETURN))
	    (T (SETQ SENTLTH (ADD1 (IDIFFERENCE END BEG]
          (SETFILEPTR HELPSYSFL BEG)
      TOP (SETQ A (HBIN IJFN))
      LP  (COND
	    ((IGREATERP (SETQ N (ADD1 N))
			SENTLTH)
	      (COND
		((EQ A 31)
		  (HELPBOUT (CAR W))
		  (HELPBOUT SP)))
	      (RETURN))
	    ([OR (EQ A 32)
		 (AND (EQ A 31)
		      (SETQ N (ADD1 N]
	      (AND (CAR W)
		   (HELPBOUT (CAR W)))
	      (HELPBOUT SP)
	      (FRPLACD (FRPLACA W NIL)
		       NIL)
	      (COND
		[(EQ (SETQ A (HBIN IJFN))
		     32)
		  (SETQ N (ADD1 N))
		  (HELPBOUT SP)
		  (SETQ A
		    (PROG (X Y Z TEM)
		      LP1 [COND
			    ((EQ (SETQ X (HBIN IJFN))
				 32)
			      (SETQ N (ADD1 N))
			      (GO LP1))
			    ((AND (NUMBERP (CAR FNOTELST))
				  (NUMBERP (FCHARACTER X)))
			      (SETQ Y (GETFILEPTR HELPSYSFL))
			      (COND
				((SETQ Z (HNEXTDIGITP X T))
				  [SETQ N
				    (IPLUS
				      N
				      (ADD1 (SETQ TEM
					      (IDIFFERENCE
						(GETFILEPTR HELPSYSFL)
						Y]
				  (COND
				    ((EQ (CAR FNOTELST)
					 Z)
				      (HELPBOUT (LIST 123 42
						      (CHCON Z)
						      42 125 32))
				      (SETQ FNOTEL (NCONC1
					  FNOTEL
					  (CAR FNOTELST)))
				      (SETQ FNOTELST (CDR FNOTELST))
				      (GO LP1))
				    (T (SETFILEPTR HELPSYSFL Y]
		          (RETURN X]
		((EQ A 31)
		  (TERPRI)))
	      (GO LP))
	    (T (SETQ W (TCONC W A))
	       (GO TOP])

(HELPRINTMORE
  [LAMBDA (SUBJ TAG LASTFL LASTEND)     (* lmm: "24-MAR-77 13:43:23")

          (* Called when user wants to display text following a subject.
	  The variables LASTFL, LASTEND, and LASTCH# represent the last 
	  filename, last file position, and last section# printed from.)


    (PROG (NXEND MFLG (END (ADD1 LASTEND))
		 TEM)                   (* Open the previous filename)
          (OR (AND (SETQ HELPSYSFL (HGETINDEX1B LASTHELPSYSFL))
		   (SETQ IJFN (OPNJFN HELPSYSFL)))
	      (RETURN))
      TOP                               (* Position the fileptr to after
					the last position printed.)
          (SETFILEPTR HELPSYSFL END)
          (COND
	    ((NULL (SETQ NXEND (FFILEPOS "" HELPSYSFL)))
                                        (* Find end of page.
					If not, end of file.)
	      (PRIN1 (QUOTE "end of file"))
	      (GO RTN))
	    (MFLG (GO LP)))             (* Start printing one page at a 
					time.)
          (TERPRI)
          (PRIN1 SUBJ)
          (SPACES 1)
          (PRIN1 (QUOTE "...continued from section"))
          (SPACES 1)
          (PRIN1 LASTCH#)
          (TERPRI)
      LP  (TERPRI)
          (HELPRINT2A END (SUB1 NXEND)
		      T)
          (COND
	    ((EQ [SETQ MFLG (ASKUSER DWIMWAIT (QUOTE n)
				     (QUOTE (More]
		 (QUOTE Y))
	      (SETQ END (ADD1 NXEND))
	      (GO TOP)))
      RTN (RETURN (CLOSEF HELPSYSFL])

(HELPFOOTNOTEP
  [LAMBDA (FL)                          (* lmm: "24-MAR-77 00:15:37")
    (TERPRI)
    (MAPRINT FL NIL "Footnote [" "] " ",")
    (EQ (ASKUSER DWIMWAIT (QUOTE Y)
		 (LIST (QUOTE "now")))
	(QUOTE Y])

(HELPRINOTE
  [LAMBDA (FNTLST NOTE#)                (* lmm: "24-MAR-77 13:03:29")
    (PROG ((ULN (QUOTE ----------)))
          [MAPC FNTLST
		(FUNCTION (LAMBDA (FNTL)
		    (PROG ((FNT# (CAR FNTL))
			   (BEG (CADR FNTL))
			   (END (CDDR FNTL)))
		          (COND
			    ((AND NOTE# (NEQ NOTE# FNT#))
			      (RETURN))
			    (ONEFNTFLG (TERPRI)))
		          (PRIN1 ULN)
		          (COND
			    ((NULL HARDCOPYFLG)
			      (HELPRINT2A BEG END T))
			    (T (TERPRI)
			       (SETFILEPTR HELPSYSFL BEG)
			       (HCRPOS)
			       (HELPBOUT (LIST 123 42 (CHCON (
HNEXTDIGITP))
					       42 125))
			       (HELPRINT2 (GETFILEPTR HELPSYSFL)
					  END)))
		          (TERPRI]
          (RETURN (COND
		    ([AND (CDR REFL)
			  (NOT (AND (IGREATERP (LENGTH (CAR REFL))
					       1)
				    (NUMBERP (CAAR REFL]
		      (PRIN1 ULN)
		      (TERPRI])

(HELPRINT2A
  [LAMBDA (BEG END SPFLG)               (* lmm: "24-MAR-77 14:00:26")
    (SETFILEPTR HELPSYSFL BEG)
    (PROG (A (L (IDIFFERENCE END BEG))
	     (SPN 0)
	     LSTN)
      TOP (COND
	    ((MINUSP (SETQ L (SUB1 L)))
	      (RETURN)))
          (SETQ A (HBIN IJFN))
      LP  (HBOUT A)
          (COND
	    ((EQ A 31)
	      (SETQ L (SUB1 L))
	      (AND SPFLG (GO TOP)))
	    (T (GO TOP)))
      LP1 (COND
	    ((MINUSP (SETQ L (SUB1 L)))
	      (RETURN)))
          (COND
	    ((EQ (SETQ A (HBIN IJFN))
		 32)
	      (SETQ SPN (ADD1 SPN))
	      (AND LSTN (IGREATERP SPN LSTN)
		   (HBOUT A))
	      (GO LP1)))
          (OR LSTN (SETQ LSTN SPN))
          (SETQ SPN 0)
          (GO LP])

(HELPRINTFN
  [LAMBDA (REFLST CD)                   (* lmm: "24-MAR-77 01:18:18")
    (PROG (BEG END (A (CAR REFLST)))
          (RETURN (COND
		    ((SETQ END (FFILEPOS (COND
					   ((EQ CD (QUOTE FD))
					     "]")
					   (T "  "))
					 HELPSYSFL
					 (SETQ BEG (HCXR A))
					 (HCXR A T)
					 NIL T))
		      (COPYBYTES HELPSYSFL (OUTPUT)
				 BEG END)
		      (TERPRI)
		      (SPACES 3)
		      (CONS (CONS (ADD1 END)
				  (CDR A))
			    (CDR REFLST)))
		    (T REFLST])

(HELPBOUT
  [LAMBDA (L)                           (* lmm: "23-MAR-77 14:16:29")
    (COND
      ((IGREATERP (IPLUS (FLENGTH L)
			 (POSITION))
		  LNLTH)
	(TERPRI)))
    (MAPC L (FUNCTION (LAMBDA (X)
	      (COND
		((NLISTP X)
		  (HBOUT X))
		(T (HELPBOUT X])

(HELPMKITEMLDIFF
  [LAMBDA (BEG SENTL LFLG SPLITFLG)             (* rlw: 10 SEP 75 1058)
    (PROG (A B L END (LST SENTL))
      LP  [COND
	    ((NULL (SETQ L (CAR LST)))
	      (RETURN))
	    ((IGREATERP (LENGTH L)
			1)
	      (COND
		[(AND (LISTP (CAR L))
		      (SETQ B (HELPMKITEMLDIFF BEG L NIL T)))
		  (RETURN (NCONC (AND B (LIST B))
				 (CDR LST]
		((OR (NUMBERP (SETQ A (CAR L)))
		     (EQ A (QUOTE /)))
		  (SETQ L (CDR L)))
		(T (GO NX]
          [COND
	    ((OR (EQP BEG (SETQ A (CAR L)))
		 (EQP BEG (SETQ END (CDR L)))
		 (AND (IGREATERP BEG A)
		      (ILESSP BEG END)))
	      (RETURN (COND
			(SPLITFLG SENTL)
			(T LST]
      NX  (SETQ LST (CDR LST))
          (GO LP])

(HMKITEMLST1A
  [LAMBDA (ITML)                                (* rlw: 10 SEP 75 1041)
                                                (* HMKITEMLST1A returns 
						(CAR itemlst) and any 
						footnote refernces which
						follow it.)
    (PROG ((A (CAR ITML))
	   (L (CADR ITML)))
          (RETURN (COND
		    [[AND (IGREATERP (LENGTH L)
				     1)
			  (OR (NUMBERP (CAR L))
			      (EQ (CAR L)
				  (QUOTE /]
		      (CONS A (HMKITEMLST1A (CDR ITML]
		    (T (LIST A])

(HPHRASEFILEPOS
  (LAMBDA (PHRASE FILE BEG END)         (* lmm "17-APR-78 13:13")

          (* Searches file for PHRASE -
	  an atom or string containing one or more separate words.)


    (PROG (ADR LST)
          (AND (SETQ ADR
		 (FFILEPOS (CAR (SETQ LST
				  (OR (LISTP PHRASE)
				      (AND PHRASE (OR (LITATOM PHRASE)
						      (STRINGP PHRASE))
					   (HUNPACKPHRASE PHRASE))
				      (RETURN))))
			   FILE BEG END NIL T))
	       (COND
		 ((CDR LST)
		   (HPHRASEFILEPOS (CDR LST)
				   FILE
				   (ADD1 ADR)
				   END))
		 (T ADR))))))

(HUNPACKPHRASE
  [LAMBDA (PHRASE)                      (* lmm: "18-MAR-77 16:15:00")

          (* Converts a PHRASE (atom or string) to a list of those 
	  elements contained within.)


    (PROG (A L)
      LP  [COND
	    ((NULL (SETQ A (STRPOS " " PHRASE)))
	      (RETURN (NCONC1 L PHRASE]
          [SETQ L (NCONC1 L (SUBSTRING PHRASE 1 (SUB1 A]
          (SETQ PHRASE (SUBSTRING PHRASE (ADD1 A)
				  NIL PHRASE))
          (GO LP])

(HELPCHOOZCAT
  [LAMBDA (PTRLST)                 (* lmm "22-JUN-81 14:30")
    (PROG (A L TEM TEM1 CHARL TAGL (PTRL PTRLST))
          (OR PTRL (RETURN))
      LP  [COND
	    [(NULL PTRL)
	      (PRIN1 (QUOTE "Subcategories available:"))
	      (TERPRI)
	      (HPRTCHOOZ L)
	      (SETQ TEM (ASKUSER DWIMWAIT (QUOTE (1 %
))
				 (QUOTE ("Which one"))
				 (HMAKEASKUSERLST CHARL)
				 T))
	      (RETURN (SETQ SUBJCD (COND
			  ([AND (NUMBERP TEM)
				(SETQ TEM1 (CAR (NTH PTRLST TEM]
			    TEM1)
			  ((SETQ TEM1 (LISTGET1 TAGL TEM))
			    (LISTGET1 PTRLST TEM1]
	    ((EQ (SETQ A (CAR PTRL))
		 (QUOTE ARGS))
	      (GO NX))
	    ((SETQ TEM (CDR (FASSOC A CATLST)))
	      [SETQ CHARL (NCONC1 CHARL (SETQ TEM1 (U-CASE TEM]
	      (SETQ TAGL (NCONC TAGL (LIST TEM1 A)))
	      (SETQ L (NCONC1 L TEM))
	      (GO NX))
	    ((STRPOS " " A)
	      [SETQ CHARL (NCONC1 CHARL (SETQ TEM1 (U-CASE A]
	      (SETQ TAGL (NCONC TAGL (LIST TEM1 A)))
	      (SETQ L (NCONC1 L A))
	      (GO NX))
	    (T (SETQ CHARL (NCONC1 CHARL (U-CASE A)))
	       (SETQ L (NCONC1 L (PACK (LIST A " {cross referenced subject}"]
      NX  (SETQ PTRL (CDDR PTRL))
          (GO LP])

(HELPWORDS
  [LAMBDA (WORDS INSENTENCE NEXTWORDFLG)
                                        (* lmm: "24-MAR-77 01:54:47")
    (PROG NIL
          [for W in WORDS do (COND
			       ([SETQ AWD
				   (COND
				     (NEXTWORDFLG
				       (COND
					 ((EQ (CAR INSENTENCE)
					      W)
					   INSENTENCE)))
				     (T (MEMB W INSENTENCE]
				 (GO RTN]
      RTN (RETURN
	    (CDR (OR AWD (COND
		       (NEXTWORDFLG
			 (SETQ AWD (AND (CDDR INSENTENCE)
					(FIXSPELL (CAR INSENTENCE)
						  70
						  (QUOTE (THE AN)))
					INSENTENCE)))
		       (T (for XWLST on INSENTENCE do (RETURN AWD)
			     when (AND (FIXSPELL (CAR XWLST)
						 70 WORDS NIL XWLST)
				       (SETQ AWD XWLST])

(HELPMKATOM
  [LAMBDA (L)
    (COND
      ((CDR L)
	(MKATOM (SUBSTRING L 2 -2)))
      (T (CAR L])

(HCXR
  [LAMBDA (L CDRFLG SETFVFLG)           (* lmm: "24-MAR-77 01:15:07")
    (COND
      ((LISTP (CDR (LISTP L)))
	(OR (AND (OR (NUMBERP (CAR L))
		     (LITATOM (CAR L)))
		 (OR (NULL SETFVFLG)
		     (SETQ FVFLG (CAR L)))
		 (HCXR (CDR L)
		       CDRFLG SETFVFLG))
	    (AND (NULL CDRFLG)
		 (HCXR (CAR L)
		       SETFVFLG))
	    (HCXR (CADR L)
		  T SETFVFLG)))
      (CDRFLG (CDR L))
      (T (CAR L])

(HNEXTDIGITP
  [LAMBDA (BKUPFLG)                             (* rlw: 8 SEP 75 57)

          (* If the next character to be read is a number, 
	  followed by a chariage-return, the number is 
	  returned, otherwise NIL. If there is the number 
	  followed by other numbers, separated by spaces, 
	  those numbers are returned as a list.
	  i.e. 45...46...47<cr> the list: 
	  (45 46 47) will be returned.
	  If BKUPFLG is true the fileptr is reset -1.0)


    (PROG (A X)
          [AND BKUPFLG (SETFILEPTR HELPSYSFL (SUB1 (GETFILEPTR 
							  HELPSYSFL]
      LP  (COND
	    ((NUMBERP (SETQ A (RATOM HELPSYSFL)))
	      [COND
		((HCRPOSP)
		  (RETURN (OR (AND X (NCONC1 X A))
			      A]
	      (SETQ X (NCONC1 X A))
	      (GO LP))
	    (T (RETURN])

(HGETINDEX1B
  [LAMBDA (FILE)                   (* lmm: "18-MAR-77 13:49:51")
    (AND FILE (PROG (FULLNAME (FILE1 (NAMEFIELD FILE T)))
		    (OR [SOME (COND
				(HELPSYSDIR (FRPLACA (QUOTE (HELPSYS))
						     HELPSYSDIR))
				(T HELPSYSDIRLST))
			      (FUNCTION (LAMBDA (X)
				  (SETQ FULLNAME (INFILEP (PACKFILENAME (QUOTE DIRECTORY)
									(SETQ HELPSYSDIR X)
									(QUOTE BODY)
									FILE1]
			(PROGN (COND
				 (HELPTTYFLG (TERPRI)
					     (PRIN1 FILE1)
					     (PRIN1 " not found.
")
					     (TERPRI)))
			       (RETURN)))
		    (RETURN (INPUT (INFILE FULLNAME])

(HELPASSISTANCE
  [LAMBDA (HELPFILE)               (* lmm: "24-MAR-77 13:43:07")
    (AND [SETQ HELPFILE (HGETINDEX1B (OR HELPFILE (QUOTE HELPHELP]
	 (PROGN (COPYBYTES HELPFILE (OUTPUT)
			   0
			   (GETEOFPTR HELPFILE))
		(CLOSEF HELPFILE)))
    NIL])

(HELPSYSSTOP
  [LAMBDA (FLG)                         (* lmm: "24-MAR-77 13:50:32")
    (JSYS 65 65)
    (TERPRI T)
    (RETFROM (OR [SETQ FLG (OR (STKPOS (QUOTE HELPSYS1A))
			       (STKPOS (QUOTE HELPSYS1B]
		 (STKPOS (QUOTE ERRORSET))
		 T)
	     FLG T])
)

(RPAQQ CATLST ((FD . "function description")
	       (SD . "subject description/reference")
	       (AS . "assemble statement")
	       (BC . "break command")
	       (BV . "break variable/parameter")
	       (CQ . "compiler question")
	       (CR . "response to compiler question")
	       (CV . "compiler variable/parameter")
	       (CEM . "compiler error message")
	       (CLV . "CLISP variable/parameter")
	       (DC . "DECLARE: option")
	       (DM . "dwim message")
	       (DV . "dwim variable/parameter")
	       (E . "edit command")
	       (EA . "edita command")
	       (EP . "edit pattern")
	       (EM . "error message")
	       (EV . "editor variable/parameter")
	       (FT . "function type")
	       (FV . "file package variable/parameter")
	       (FLG . "system flag")
	       (IE . "reference in editor")
	       (IS . "CLISP iterative statement operator")
	       (LS . "lap statement")
	       (n>0 . "n a number, edit command")
	       (OV . "Overlay variable/parameter")
	       (PA . "prog. asst. command")
	       (PC . "prettydef command")
	       (PE . "reference typed by editor")
	       (PV . "prettydef variable/parameter")
	       (PRV . "printstructure variable/parameter")
	       (PAV . "prog. asst. variable/parameter")
	       (PMC . "pattern match compiler reference")
	       (RT . "reference in readtables")
	       (SY . "system variable/parameter")
	       (PN . "property name")
	       (TC . "tenex command")
	       (TD . "reference typed by dwim")
	       (TY . "reference typed by system")
	       (TRC . "transor command")
	       (TRD . "topic description")
	       (XR . "cross referenced subject")
	       (TRS . "transorset command")))

(RPAQQ FNTAGLST (FD SD TRD ARGS AS BC DC E EA IE IS LS n>0 PA PC PN PV PMC TC TRC TRS))

(RPAQQ EMTAGLST (EM CEM))

(RPAQQ HELPSYSPUNCTUATIONMARKS (%
 %
 %
 %  , %. ; : ! ? %" ' %) %] } > / = -))

(RPAQ HARDCOPYFLG NIL)

(RPAQ HELPADRF NIL)

(RPAQ HELPIDXF NIL)

(RPAQ HELPSYSDIR NIL)

(RPAQ HELPSYSFL NIL)

(RPAQ HELPSYSCRCHAR (CHARACTER 31))

(RPAQQ HELPSYSDIRLST (HELPSYS LISP))

(ADDTOVAR AFTERSYSOUTFORMS (SETQ HELPIDXF (SETQ HELPADRF (SETQ HELPSYSDIR))))
(DECLARE: DOEVAL@COMPILE DONTCOPY 

(PUTPROPS HBIN MACRO [(JFN PTR)    (* lmm: "23-MAR-77 13:48:12")
		      (PROG1 [LOC (ASSEMBLE NIL
					    (CQ (VAG JFN))
					    (JSYS 50Q)
					    (CAIN 2 , 15Q)
					    (JSYS 50Q)
					    (CAIN 2 , 12Q)
					    (MOVEI 2 , 37Q)
					    (MOVEI 1 , 0 (2]
			     (AND PTR (SETN HBINPTR (ADD1 HBINPTR])

(PUTPROPS HBOUT MACRO ((BYTE)      (* lmm: "23-MAR-77 15:03:50")
		       (ASSEMBLE NIL
			         (CQ (VAG BYTE))
			         (MOVEI FX , 1)
			         (PUSHJ CP , FOUT))))

(PUTPROPS HCRPOS MACRO (NIL (FILEPOS HELPSYSCRCHAR HELPSYSFL NIL NIL NIL T)))

(PUTPROPS HCRPOSP MACRO (NIL (FILEPOS HELPSYSCRCHAR HELPSYSFL NIL (IPLUS (GETFILEPTR HELPSYSFL)
									 2)
				      NIL T)))

(PUTPROPS OSFBSZ MACRO ((JFN N)
			(ASSEMBLE NIL
			          (CQ JFN)
			          (CQ2 (VAG N))
			          (JSYS 46Q)
			          (JFCL))))

(PUTPROPS OSFPTR MACRO ((JFN POS)
			(ASSEMBLE NIL
			          (CQ JFN)
			          (CQ2 (VAG POS))
			          (JSYS 27Q)
			          (JFCL))))

(PUTPROPS OMAPIN MACRO ((JFN N)
			(ASSEMBLE NIL
			          (CQ (VAG N))
                                   (* JFN and PAGE must be varialbles.)
			          (VAR (HRL 1 , JFN))
			          (MOVE 2 , = -377777777001Q)
			          (HRLZI 3 , 100000Q)
			          (JSYS 56Q)
                                   (* PMAP)
			          (LSH 1 , 11Q))))

(PUTPROPS OMAPELT MACRO ((JFN PAGE N)
			 (ASSEMBLE NIL
			           (CQ N)
                                   (* JFN and PAGE must be variables.)
			           (LSHC 1 , -1)
			       LP  (VAR (XOR 1 , PAGE))
			           (TRNE 1 , 777000Q)
			           (JRST REMAP)
			           (TLNN 2 , 400000Q)
			           (JRST * 3)
			           (HRRZ 1 , 777000Q (1))
			           (SKIPA)
			           (HLRZ 1 , 777000Q (1))
			           (JRST DONE)
			       REMAP
			           (VAR (XOR 1 , PAGE))
			           (PUSHN 1)
			           (PUSHN 2)
			           (LSH 1 , -11Q)
			           [CQ (SETQ PAGE (OMAPIN JFN (LOC (AC]
			           (POPN 2)
			           (POPN 1)
			           (JRST LP)
			       DONE)))
)

(RPAQQ HELPSYSBLOCKS ((HELPSYSBLOCK HCXR HELPARG HELPASSISTANCE HELPBOUT HELPCHOOZCAT HELPFOOTNOTEP 
				    HELPMKATOM HELPMKITEMLDIFF HELPRINOTE HELPRINT HELPRINT1 
				    HELPRINT2 HELPRINT2A HELPRINTFN HELPRINTMORE HELPSYS HELPSYS1A 
				    HELPSYS1B HELPWORDS HFIXSUBJ1A HFIXSUBJ1B HGETINDEX1B HGETSUBJECT 
				    HMAKEASKUSERLST HMKITEMLST1A HNEXTDIGITP HPHRASEFILEPOS HPRTCHOOZ 
				    HUNPACKPHRASE (ENTRIES HELPSYS HELPSYS1A HGETINDEX1B 
							   HELPASSISTANCE)
				    (RETFNS HELPSYS1A HELPSYS1B)
				    (LOCALFREEVARS ARG ARGV AWD ENTRY FNOTEL FNOTELST FNTCRFLG 
						   FSNTFLG FVFLG HELPTTYFLG IJFN ITEM LNLTH ONEFNTFLG 
						   REFL SELCATFLG SUBJCD SUBJECT TAG)
				    (GLOBALVARS CATLST EMTAGLST FNTAGLST HARDCOPYFLG HELPADRF 
						HELPIDXF HELPSYSCRCHAR HELPSYSDIR HELPSYSDIRLST 
						HELPSYSFL LASTCH# LASTHELPSYSFL LASTSENTBEGIN 
						LASTSENTEND LISPXMACROS)
				    (SPECVARS LASTHELPSYSFL LASTSENTBEGIN LASTSENTEND LASTCH#))
	(NIL HELPSYS0 HFIXSUBJ HELPSYSSTOP (LOCALVARS . T)
	     (GLOBALVARS HELPIDXF HELPADRF HELPSYSFL))))
[DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY
(BLOCK: HELPSYSBLOCK HCXR HELPARG HELPASSISTANCE HELPBOUT HELPCHOOZCAT HELPFOOTNOTEP HELPMKATOM 
	HELPMKITEMLDIFF HELPRINOTE HELPRINT HELPRINT1 HELPRINT2 HELPRINT2A HELPRINTFN HELPRINTMORE 
	HELPSYS HELPSYS1A HELPSYS1B HELPWORDS HFIXSUBJ1A HFIXSUBJ1B HGETINDEX1B HGETSUBJECT 
	HMAKEASKUSERLST HMKITEMLST1A HNEXTDIGITP HPHRASEFILEPOS HPRTCHOOZ HUNPACKPHRASE
	(ENTRIES HELPSYS HELPSYS1A HGETINDEX1B HELPASSISTANCE)
	(RETFNS HELPSYS1A HELPSYS1B)
	(LOCALFREEVARS ARG ARGV AWD ENTRY FNOTEL FNOTELST FNTCRFLG FSNTFLG FVFLG HELPTTYFLG IJFN ITEM 
		       LNLTH ONEFNTFLG REFL SELCATFLG SUBJCD SUBJECT TAG)
	(GLOBALVARS CATLST EMTAGLST FNTAGLST HARDCOPYFLG HELPADRF HELPIDXF HELPSYSCRCHAR HELPSYSDIR 
		    HELPSYSDIRLST HELPSYSFL LASTCH# LASTHELPSYSFL LASTSENTBEGIN LASTSENTEND 
		    LISPXMACROS)
	(SPECVARS LASTHELPSYSFL LASTSENTBEGIN LASTSENTEND LASTCH#))
(BLOCK: NIL HELPSYS0 HFIXSUBJ HELPSYSSTOP (LOCALVARS . T)
	(GLOBALVARS HELPIDXF HELPADRF HELPSYSFL))
]
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1168 38585 (HELPSYS 1180 . 2788) (HELPSYS0 2792 . 3057) (HELPSYS1A 3061 . 5238) (
HELPSYS1B 5242 . 9583) (HGETSUBJECT 9587 . 12819) (HPRTCHOOZ 12823 . 13230) (HFIXSUBJ 13234 . 13636) (
HFIXSUBJ1A 13640 . 14513) (HFIXSUBJ1B 14517 . 14902) (HMAKEASKUSERLST 14906 . 15269) (HELPARG 15273 . 
17114) (HELPRINT 17118 . 22634) (HELPRINT1 22638 . 25944) (HELPRINT2 25948 . 27655) (HELPRINTMORE 
27659 . 29135) (HELPFOOTNOTEP 29139 . 29366) (HELPRINOTE 29370 . 30284) (HELPRINT2A 30288 . 31024) (
HELPRINTFN 31028 . 31546) (HELPBOUT 31550 . 31833) (HELPMKITEMLDIFF 31837 . 32554) (HMKITEMLST1A 32558
 . 33050) (HPHRASEFILEPOS 33054 . 33655) (HUNPACKPHRASE 33659 . 34127) (HELPCHOOZCAT 34131 . 35341) (
HELPWORDS 35345 . 36069) (HELPMKATOM 36073 . 36176) (HCXR 36180 . 36626) (HNEXTDIGITP 36630 . 37406) (
HGETINDEX1B 37410 . 38029) (HELPASSISTANCE 38033 . 38305) (HELPSYSSTOP 38309 . 38582)))))
STOP