(DEFINE-FILE-INFO READTABLE "INTERLISP" PACKAGE "INTERLISP")
(FILECREATED " 3-Aug-88 16:18:54" {ERINYES}<LISPUSERS>LYRIC>SEARCHMENU.;3 31614  

      changes to%:  (VARS SEARCHMENUCOMS)
                    (FNS SearchMenu.MatchWords)

      previous date%: "28-Mar-88 11:35:35" {ERINYES}<LISPUSERS>LYRIC>SEARCHMENU.;2)


(* "
Copyright (c) 1987, 1988 by Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT SEARCHMENUCOMS)

(RPAQQ SEARCHMENUCOMS
       ((COMS * SEARCHMENUDEPENDENCIES)
        (FILES DICTTOOL ANALYZER FREEMENU (FROM {QV}<DICTSERVER>LISP>)
               DICTCLIENT)
        (INITVARS SearchMenu SearchMenu.Stream (SearchMenu.Cutoff 39))
        (FNS SearchMenu.Create SearchMenu.GetData SearchMenu.PrintData SearchMenu.PrintDef 
             SearchMenu.PrintSearch SearchMenu.ToggleKey SearchMenu.ToggleSample SearchMenu.PrintUses
             SearchMenu.Clear SearchMenu.MatchWords SearchMenu.MatchKeys SearchMenu.SearchFn 
             SearchMenu.SetDatabase SearchMenu.DeleteKey SearchMenu.DeleteKeys)
        (FNS TEdit.MatchWords DictTool.MatchWords)
        (VARS SearchKey SearchDelete SearchMatch SearchPrint SearchDatabase SearchClear SearchUses 
              SearchDef SearchSample SearchExamples SearchMatchKeys)
        (P (SearchMenu.Create))))

(RPAQQ SEARCHMENUDEPENDENCIES
       [(* * code to make sure that the right versions of everything are loaded. The P must be 
           executed before any FILES commands.)
        [E (PUTPROP 'SEARCHMENU 'DEPENDENCIES (for FILE in (FILECOMSLST 'SEARCHMENU 'FILES)
                                                   collect
                                                   (CONS FILE (CAAR (GETPROP FILE 'FILEDATES]
        (PROP DEPENDENCIES SEARCHMENU)
        (P (for FILE FILEDATE in (GETPROP 'SEARCHMENU 'DEPENDENCIES)
                do
                [SETQ FILEDATE (CAAR (GETPROP (CAR FILE)
                                            'FILEDATES]
                (COND ([AND FILEDATE (CDR FILE)
                            (ILESSP (IDATE FILEDATE)
                                   (IDATE (CDR FILE]
                       (* clear FILEDATES to force FILESLOAD to reload the file.)
                       (PUTPROP (CAR FILE)
                              'FILEDATES NIL])
(* * code to make sure that the right versions of everything are loaded. The P must be executed before
 any FILES commands.)


(PUTPROPS SEARCHMENU DEPENDENCIES ((DICTTOOL . " 3-Aug-88 16:06:44")
                                   (ANALYZER . " 3-Jun-88 17:03:38")
                                   (FREEMENU . "19-Jan-87 18:02:27")
                                   (DICTCLIENT . " 8-Oct-87 15:15:08")))

[for FILE FILEDATE in (GETPROP 'SEARCHMENU 'DEPENDENCIES)
   do [SETQ FILEDATE (CAAR (GETPROP (CAR FILE)
                                  'FILEDATES]
      (COND
         ([AND FILEDATE (CDR FILE)
               (ILESSP (IDATE FILEDATE)
                      (IDATE (CDR FILE]                      (* clear FILEDATES to force FILESLOAD 
                                                             to reload the file.)
          (PUTPROP (CAR FILE)
                 'FILEDATES NIL]

(FILESLOAD DICTTOOL ANALYZER FREEMENU (FROM {QV}<DICTSERVER>LISP>)
       DICTCLIENT)

(RPAQ? SearchMenu NIL)

(RPAQ? SearchMenu.Stream NIL)

(RPAQ? SearchMenu.Cutoff 39)
(DEFINEQ

(SearchMenu.Create
  [LAMBDA (MATCHES KEYWEIGHTS KEYMENU CLEAR)                 (* ; "Edited 28-Mar-88 11:21 by jtm:")
                                                             (* "w.a.l.johnson" "30-Nov-87 10:02")
                                                             (* "w.a.l.johnson" "11-Nov-87 17:16")
                                                             (* jtm%: "30-Oct-87 15:39")
    (LET (REGION EXAMPLES SEARCHMENUDATA POSWORDS NEGWORDS NEGKEYS MISSINGWORDS MENUTYPE)
         (COND
            (SearchMenu (SETQ REGION (WINDOWPROP SearchMenu 'REGION))
                   (SETQ SEARCHMENUDATA (AND (NOT CLEAR)
                                             (SearchMenu.GetData SearchMenu)))
                   [OR KEYWEIGHTS (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA 'KEYWEIGHTS]
                   [OR MATCHES (SETQ MATCHES (LISTGET SEARCHMENUDATA 'MATCHES]
                   (SETQ POSWORDS (LISTGET SEARCHMENUDATA 'POSWORDS))
                   (SETQ NEGWORDS (LISTGET SEARCHMENUDATA 'NEGWORDS))
                   (SETQ NEGKEYS (LISTGET SEARCHMENUDATA 'NEGKEYS))
                   (SETQ EXAMPLES (LISTGET SEARCHMENUDATA 'EXAMPLES))
                   (FM.ENDEDIT SearchMenu)
                   (CLOSEW SearchMenu)))
         [SETQ MENUTYPE (COND
                           (KEYMENU 'KEYMENU)
                           (T 'SAMPLEMENU]
         (COND
            ((NULL SEARCHMENUDATA)
             (SETQ SEARCHMENUDATA (LIST 'MENUTYPE MENUTYPE)))
            (T (LISTPUT SEARCHMENUDATA 'MENUTYPE MENUTYPE)))
         (LISTPUT SEARCHMENUDATA 'KEYWEIGHTS KEYWEIGHTS)
         (LISTPUT SEARCHMENUDATA 'MATCHES MATCHES)
         (MOVEW (SETQ SearchMenu
                 (FREEMENU [APPEND `[(PROPS FORMAT ROW LEFT %, (OR 0 (AND REGION (CAR REGION)))
                                            BOTTOM %, (OR 0 (AND REGION (CADR REGION]
                                  [COND
                                     [KEYMENU `(((LABEL ,SearchSample SELECTEDFN 
                                                        SearchMenu.ToggleSample)
                                                 (LABEL ,SearchMatchKeys SELECTEDFN 
                                                        SearchMenu.MatchKeys)
                                                 (LABEL ,SearchPrint SELECTEDFN 
                                                        SearchMenu.PrintSearch)
                                                 (LABEL ,SearchDatabase SELECTEDFN 
                                                        SearchMenu.SetDatabase)
                                                 (LABEL ,SearchClear SELECTEDFN SearchMenu.Clear]
                                     (T `(((LABEL ,SearchKey SELECTEDFN SearchMenu.ToggleKey)
                                           (LABEL ,SearchMatch SELECTEDFN SearchMenu.MatchWords)
                                           (LABEL ,SearchPrint SELECTEDFN SearchMenu.PrintSearch)
                                           (LABEL ,SearchDelete SELECTEDFN SearchMenu.DeleteKeys)
                                           (LABEL ,SearchDatabase SELECTEDFN SearchMenu.SetDatabase)
                                           (LABEL ,SearchClear SELECTEDFN SearchMenu.Clear))
                                          ((TYPE EDITSTART LABEL ,SearchExamples LINKS (EDIT EXAMPLES
                                                                                             ))
                                           (TYPE EDIT ID EXAMPLES LABEL %, (OR EXAMPLES ""]
                                  (COND
                                     [KEYMENU                (* (TYPE 3STATE LABEL %,
                                                             (CONCAT (CAR KEY) ":") STATE %,
                                                             (COND ((MEMBER (CAR KEY) NEGKEYS) NIL)
                                                             (T (QUOTE NEUTRAL)))))
                                            (for KEY ID in KEYWEIGHTS
                                               collect `((LABEL ,SearchUses ID %, (COPYALL
                                                                                   (CAR KEY))
                                                                SELECTEDFN SearchMenu.PrintUses)
                                                         (TYPE EDITSTART LABEL %, (CONCAT
                                                                                   (CAR KEY)
                                                                                   ":")
                                                               LINKS %, (LIST 'EDIT (CAR KEY)))
                                                         (TYPE EDIT ID %, (CAR KEY)
                                                               LABEL %, (CADR KEY]
                                     (T (for MATCH ID inside MATCHES
                                           collect (SETQ ID (COND
                                                               ((LISTP MATCH)
                                                                (CAR MATCH))
                                                               (T MATCH)))
                                                 [COND
                                                    ((AND (LISTP MATCH)
                                                          (NTH (CADDR MATCH)
                                                               5))
                                                     (RPLACD (NTH (CADDR MATCH)
                                                                  5)
                                                            (LIST "..."]
                                                 `((LABEL ,SearchDef ID %, (COPYALL ID)
                                                          SELECTEDFN SearchMenu.PrintDef)
                                                   (TYPE 3STATE ID %, ID LABEL %, (MKSTRING MATCH)
                                                         INITSTATE %, (COND
                                                                         ((MEMBER ID POSWORDS)
                                                                          T)
                                                                         ((MEMBER ID NEGWORDS)
                                                                          OFF]
                        "Search Menu"))
                (OR (AND REGION (CAR REGION))
                    0)
                (OR (AND REGION (CADR REGION))
                    0))
         (OPENW SearchMenu)
         (COND
            ((SETQ MISSINGWORDS (AND MATCHES (for KEY in POSWORDS
                                                when [NOT (COND
                                                             ((LISTP (CAR MATCHES))
                                                              (SASSOC KEY MATCHES))
                                                             (T (MEMBER KEY MATCHES] collect KEY)))
             (PROMPTPRINT "Lost keys: " MISSINGWORDS)
             (FLASHWINDOW PROMPTWINDOW)
             (SETQ POSWORDS (LDIFFERENCE POSWORDS MISSINGWORDS))
             (LISTPUT SEARCHMENUDATA 'POSWORDS POSWORDS)))
         (WINDOWPROP SearchMenu 'SEARCHMENUDATA SEARCHMENUDATA])

(SearchMenu.GetData
  [LAMBDA (WINDOW)                                           (* ; "Edited 25-Mar-88 15:18 by jtm:")

    (LET (STATE SEARCHMENUDATA KEYWEIGHTS EXAMPLES MATCHES POSWORDS NEGWORDS)
         (SETQ STATE (FM.GETSTATE WINDOW))
         (SETQ SEARCHMENUDATA (WINDOWPROP WINDOW 'SEARCHMENUDATA))
         (COND
            ((EQ 'KEYMENU (LISTGET SEARCHMENUDATA 'MENUTYPE))
             (SETQ KEYWEIGHTS (for TAIL WEIGHT on STATE by (CDDR TAIL)
                                 when (AND TAIL (STRINGP (CAR TAIL))
                                           [NUMBERP (SETQ WEIGHT (MKATOM (CADR TAIL]
                                           (NOT (ZEROP WEIGHT))) collect (LIST (CAR TAIL)
                                                                               WEIGHT)))
             (LISTPUT SEARCHMENUDATA 'KEYWEIGHTS KEYWEIGHTS))
            (T (SETQ EXAMPLES (LISTGET STATE 'EXAMPLES))
               (LISTPUT SEARCHMENUDATA 'EXAMPLES EXAMPLES)
               (SETQ POSWORDS (LISTGET SEARCHMENUDATA 'POSWORDS))
               (for WORD in (PARSEBYCOLONS EXAMPLES) do (push POSWORDS WORD))
               (SETQ MATCHES (LISTGET SEARCHMENUDATA 'MATCHES))
               (for MATCH KEY in MATCHES do (SETQ KEY (COND
                                                         ((LISTP MATCH)
                                                          (CAR MATCH))
                                                         (T MATCH)))
                                            (SELECTQ (LISTGET STATE KEY)
                                                (T (AND (NOT (MEMBER KEY POSWORDS))
                                                        (push POSWORDS KEY))
                                                   [COND
                                                      ((MEMBER KEY NEGWORDS)
                                                       (SETQ NEGWORDS (REMOVE KEY NEGWORDS])
                                                (OFF (push NEGWORDS KEY)
                                                     [COND
                                                        ((MEMBER KEY POSWORDS)
                                                         (SETQ POSWORDS (REMOVE KEY POSWORDS])
                                                NIL))
               (LISTPUT SEARCHMENUDATA 'POSWORDS (INTERSECTION POSWORDS POSWORDS))
               (LISTPUT SEARCHMENUDATA 'NEGWORDS NEGWORDS)))
         SEARCHMENUDATA])

(SearchMenu.PrintData
  [LAMBDA (STREAM POSWORDS NEGWORDS KEYS MATCHES)            (* jtm%: "28-Oct-87 15:17")
    (OR STREAM (SETQ STREAM (OPENTEXTSTREAM)))
    (COND
       ((AND (BOUNDP 'SquareSampleFreq)
             (BOUNDP 'InvertedDict.MinimumMatches))
        (printout STREAM "(" InvertedDict.MinimumMatches " min, " (COND
                                                                     (SquareSampleFreq "")
                                                                     (T "not"))
               " squared)")))
    (printout STREAM "***" "SEARCH MENU PRINTED ON " (DATE)
           "***" T T)
    (COND
       (POSWORDS (printout STREAM "SELECTED WORDS: ")
              [for TAIL on POSWORDS do (printout STREAM (CAR TAIL)
                                              (COND
                                                 ((CDR TAIL)
                                                  "; ")
                                                 (T ""]
              (printout STREAM T)))
    (COND
       (NEGWORDS (printout STREAM "IGNOREDKEYS: ")
              [for TAIL on NEGWORDS do (printout STREAM (CAR TAIL)
                                              (COND
                                                 ((CDR TAIL)
                                                  "; ")
                                                 (T ""]
              (printout STREAM T)))
    (printout STREAM T "KEY WEIGHTS:" T)
    (for KEY in KEYS do (printout STREAM .FR 6 (CADR KEY)
                               %,
                               (CAR KEY)
                               T))
    (printout STREAM T "MATCHES:" T)
    (for MATCH in MATCHES do [COND
                                ((NTH (CADDR MATCH)
                                      5)
                                 (RPLACD (NTH (CADDR MATCH)
                                              5)
                                        (LIST "..."]
                             (printout STREAM .FR 6 (CADR MATCH)
                                    %,
                                    (CAR MATCH)
                                    %,
                                    (CADDR MATCH)
                                    T))
    (printout STREAM T)
    STREAM])

(SearchMenu.PrintDef
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* jtm%: "13-Oct-87 14:13")
    (LET (WORD NERD DICT)
         (SETQ WORD (FM.ITEMPROP ITEM 'ID))
         [AND (SETQ NERD (NerdForStream SearchMenu.Stream))
              (SETQ DICT (InvertedDict.Prop NERD 'DICTIONARY]
         (TEdit.PrintDefinition NIL DICT WORD])

(SearchMenu.PrintSearch
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* jtm%: "28-Oct-87 14:43")
    (LET (SEARCHMENUDATA POSWORDS NEGWORDS KEYWEIGHTS MATCHES SCRATCH)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ POSWORDS (LISTGET SEARCHMENUDATA 'POSWORDS))
         (SETQ NEGWORDS (LISTGET SEARCHMENUDATA 'NEGWORDS))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA 'KEYWEIGHTS))
         (SETQ MATCHES (LISTGET SEARCHMENUDATA 'MATCHES))
         (SETQ SCRATCH (SearchMenu.PrintData NIL POSWORDS NEGWORDS KEYWEIGHTS MATCHES))
         (TEDIT.INCLUDESTREAM (Dict.OutputStream)
                SCRATCH)
         (CLOSEF SCRATCH])

(SearchMenu.ToggleKey
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 15:57")
                                                             (* jtm%: " 9-Oct-87 10:46")
    (SearchMenu.GetData WINDOW)
    (SearchMenu.Create NIL NIL T])

(SearchMenu.ToggleSample
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 16:00")
                                                             (* jtm%: " 9-Oct-87 10:46")
    (SearchMenu.GetData WINDOW)
    (SearchMenu.Create NIL NIL NIL NIL])

(SearchMenu.PrintUses
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* jtm%: "13-Oct-87 10:11")
    (LET (WORD)
         (SETQ WORD (FM.ITEMPROP ITEM 'ID))
         (TEdit.PrintSearch NIL (NerdForStream SearchMenu.Stream)
                WORD])

(SearchMenu.Clear
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* "w.a.l.johnson" "11-Nov-87 15:58")
                                                             (* jtm%: "28-Oct-87 14:17")
    (SearchMenu.Create NIL NIL NIL T])

(SearchMenu.MatchWords
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 15:58")
                                                             (* jtm%: " 2-Aug-88 13:36")
    (LET (SEARCHMENUDATA POSWORDS NEGKEYS MATCHES NERD MATCHWORDSFN (STARTTIME (CLOCK 0)))
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ POSWORDS (LISTGET SEARCHMENUDATA 'POSWORDS))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA 'NEGKEYS))
         (SETQ NERD (SearchMenu.SetDatabase NIL WINDOW))
         (PROMPTPRINT "Searching in " (InvertedDict.Name NERD)
                " for words like: " POSWORDS (COND
                                                (NEGKEYS (CONCAT ", ignoring the keys: " NEGKEYS))
                                                (T "")))
         [SETQ MATCHES (COND
                          ((SETQ MATCHWORDSFN (InvertedDict.Prop NERD 'RELEVANCESEARCHFN))
                           (APPLY* MATCHWORDSFN NERD POSWORDS NEGKEYS 0 SearchMenu.Cutoff))
                          (T (DICTCLIENT.MATCHWORDS POSWORDS NEGKEYS 0 SearchMenu.Cutoff
                                    (InvertedDict.Prop NERD 'RemoteDict]
         (PROMPTPRINT "Search time: " (QUOTIENT (IDIFFERENCE (CLOCK 0)
                                                       STARTTIME)
                                             1000.0)
                " seconds.")
         (SearchMenu.Create (CADR MATCHES)
                (CAR MATCHES])

(SearchMenu.MatchKeys
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 16:08")
                                                             (* jtm%: "28-Oct-87 14:22")
    (LET (SEARCHMENUDATA MATCHES KEYWEIGHTS NERD WEIGHTSEARCHFN (STARTTIME (CLOCK 0)))
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA 'KEYWEIGHTS))
         (SETQ NERD (SearchMenu.SetDatabase NIL WINDOW))
         (PROMPTPRINT "Searching on keys: " KEYWEIGHTS)
         [SETQ MATCHES (COND
                          ((SETQ WEIGHTSEARCHFN (InvertedDict.Prop NERD 'WEIGHTSEARCHFN))
                           (APPLY* WEIGHTSEARCHFN NERD KEYWEIGHTS 0 SearchMenu.Cutoff))
                          (T (DICTCLIENT.WEIGHTEDSEARCH KEYWEIGHTS 0 SearchMenu.Cutoff
                                    (InvertedDict.Prop NERD 'RemoteDict]
         (PROMPTPRINT "Search time: " (QUOTIENT (IDIFFERENCE (CLOCK 0)
                                                       STARTTIME)
                                             1000.0)
                " seconds.")
         (SearchMenu.Create (CADR MATCHES)
                (CAR MATCHES])

(SearchMenu.SearchFn
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* ; "Edited 25-Mar-88 15:31 by jtm:")

    (LET (KEYS SEARCHRESULT)
         (SETQ KEYS (LISTGET (FM.GETSTATE WINDOW)
                           'SearchKeys))
         (SETQ SEARCHRESULT (InvertedDict.WeightedSearch WordNerd KEYS))
         (RPLACD (NTH SEARCHRESULT SearchMenu.Cutoff))
         (SearchMenu.Create SEARCHRESULT])

(SearchMenu.SetDatabase
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* jtm%: "30-Nov-87 11:32")
    [COND
       ((NULL SearchMenu.Stream)
        (SETQ SearchMenu.Stream (OPENTEXTSTREAM]
    (COND
       [(NULL MENUITEM)                                      (* called by SearchMenu.MatchWords and 
                                                             SearchMenu.MatchKeys)
        (COND
           ((STREAMPROP SearchMenu.Stream 'nerd))
           (T (TEdit.SetNerd SearchMenu.Stream]
       (T (TEdit.SetNerd SearchMenu.Stream])

(SearchMenu.DeleteKey
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "30-Nov-87 10:27")
                                                             (* jtm%: "30-Oct-87 16:04")
    (LET (SEARCHMENUDATA POSWORDS KEYWEIGHTS NEGKEYS NEGKEY)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA 'NEGKEYS))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA 'KEYWEIGHTS))
         (PROG NIL
           LP  (COND
                  ((SETQ NEGKEY (MENU (create MENU
                                             TITLE ← "key to delete:"
                                             ITEMS ← (for KEYWEIGHT in KEYWEIGHTS
                                                        unless (MEMBER (CAR KEYWEIGHT)
                                                                      NEGKEYS)
                                                        collect (LIST (CONCAT (CAR KEYWEIGHT)
                                                                             ": " "(" (CADR KEYWEIGHT
                                                                                            )
                                                                             ")")
                                                                      (CAR KEYWEIGHT)))
                                             CENTERFLG ← T)))
                   (pushnew NEGKEYS NEGKEY)
                   (LISTPUT SEARCHMENUDATA 'NEGKEYS NEGKEYS)
                   (GO LP])

(SearchMenu.DeleteKeys
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "30-Nov-87 10:27")
                                                             (* "w.a.l.johnson" "30-Nov-87 10:10")
                                                             (* jtm%: "30-Oct-87 16:04")
    (LET (SEARCHMENUDATA POSWORDS KEYWEIGHTS NEGKEYS NEGKEY)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA 'NEGKEYS))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA 'KEYWEIGHTS))
         (PROG NIL
           LP  (COND
                  ((SETQ NEGKEY (MENU (create MENU
                                             TITLE ← "key to delete:"
                                             ITEMS ← (for KEYWEIGHT in KEYWEIGHTS
                                                        unless (MEMBER (CAR KEYWEIGHT)
                                                                      NEGKEYS)
                                                        collect (LIST (CONCAT (CAR KEYWEIGHT)
                                                                             ": " "(" (CADR KEYWEIGHT
                                                                                            )
                                                                             ")")
                                                                      (CAR KEYWEIGHT)))
                                             CENTERFLG ← T)))
                   (pushnew NEGKEYS NEGKEY)
                   (LISTPUT SEARCHMENUDATA 'NEGKEYS NEGKEYS)
                   (GO LP])
)
(DEFINEQ

(TEdit.MatchWords
  [LAMBDA (stream dict words)                                (* jtm%: "28-Sep-87 15:17")
          
          (* * prints out the definitions that have a particular phrase in them.)

    (OR stream (SETQ stream (Dict.OutputStream)))
    (DictTool.TEditWrapper (NerdForStream stream)
           (FUNCTION DictTool.MatchWords)
           stream words "Type sample words:" "Searching for words like" 'SAMPLEWORDS])

(DictTool.MatchWords
  [LAMBDA (dict selection stream)                            (* jtm%: " 9-Oct-87 13:43")
    (LET (looks words fn pos)
         [SETQ words (CADR (COND
                              ((SETQ fn (InvertedDict.Prop dict 'MATCHWORDSFN))
                               (APPLY* fn dict selection))
                              ((InvertedDict.Prop dict 'RemoteDict)
                               (DICTCLIENT.MATCHWORDS (PARSEBYCOLONS selection)
                                      NIL NIL NIL (InvertedDict.Prop dict 'RemoteDict]
         (SETQ pos (TEDIT.GETPOINT stream))
         (TEDIT.INSERT stream (CONCAT selection ": "))
         (SETQ looks (CONS pos (IDIFFERENCE (TEDIT.GETPOINT stream)
                                      pos)))
         [for tail on words do (TEDIT.INSERT stream (CONCAT (CAR (CAR tail))
                                                           (COND
                                                              ((CDR tail)
                                                               "; ")
                                                              (T ""]
         (TEDIT.INSERT stream (CHARACTER (CHARCODE CR)))
         (TEDIT.INSERT stream (CHARACTER (CHARCODE CR)))
          
          (* do the looks last to avoid messing up the text placement.)

         (TEDIT.LOOKS stream '(FAMILY TIMESROMAN SIZE 10 FACE STANDARD) 1 (TEDIT.GETPOINT stream))
         (TEDIT.LOOKS stream '(FAMILY HELVETICA SIZE 10 FACE BOLD) (CAR looks)
                (CDR looks))
         words])
)

(RPAQQ SearchKey #*(64 23)COOOOOOOOOOOOOO@GOOOOOOOOOOOOOOHN@@@@@@@@@@@@@CLL@@@@@@@@@@@@@ANL@@@@@@@@@@@@@AKL@@@@@@@@@@@@@AMLLINLDCAINFBFBAKLMIHLLCAIHGBFBAMLMAHFHCKIHGJFBAKLOANGHCKINEJFBAMLMIHC@BNMHENFBAKLMIHC@BNMHDNGBA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KDDLGBLLAKC@FBLGD@MICLDLALLLAIKLFCHFL@L@@@@@@@@@@@@@@@@GD@L@@@@@@@@@@@@@@@@FL@L@@@@@@@@@@@@@@@@GD@L@@@@@@@@@@@@@@@@FL@N@@@@@@@@@@@@@@@@OD@OOOOOOOOOOOOOOOOONL@GOOOOOOOOOOOOOOOOOD@CBJJJJJJJJJJJJJJJKL@AMEEEEEEEEEEEEEEEEH@@OOOOOOOOOOOOOOOOO@@
)

(SearchMenu.Create)
(PUTPROPS SEARCHMENU COPYRIGHT ("Xerox Corporation" 1987 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (3399 24724 (SearchMenu.Create 3409 . 10763) (SearchMenu.GetData 10765 . 13271) (
SearchMenu.PrintData 13273 . 15582) (SearchMenu.PrintDef 15584 . 15945) (SearchMenu.PrintSearch 15947
 . 16641) (SearchMenu.ToggleKey 16643 . 16939) (SearchMenu.ToggleSample 16941 . 17246) (
SearchMenu.PrintUses 17248 . 17519) (SearchMenu.Clear 17521 . 17781) (SearchMenu.MatchWords 17783 . 
19279) (SearchMenu.MatchKeys 19281 . 20497) (SearchMenu.SearchFn 20499 . 20927) (
SearchMenu.SetDatabase 20929 . 21504) (SearchMenu.DeleteKey 21506 . 23061) (SearchMenu.DeleteKeys 
23063 . 24722)) (24725 26746 (TEdit.MatchWords 24735 . 25180) (DictTool.MatchWords 25182 . 26744)))))
STOP