(FILECREATED " 9-Jan-87 19:45:25" {ERIS}<LISPUSERS>KOTO>PHONE-DIRECTORY.;3 7991   

      changes to:  (FNS Cache-Phone-Directory-Files)

      previous date: "22-Aug-86 15:54:28" {ERIS}<LISPUSERS>KOTO>PHONE-DIRECTORY.;2)


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

(PRETTYCOMPRINT PHONE-DIRECTORYCOMS)

(RPAQQ PHONE-DIRECTORYCOMS ((FNS Cache-Phone-Directory-Files Let-your-fingers-do-the-walking 
Phone-Directory-Kill-Proc Phone-Window-ButtonEventFn Lookup-Person Phone-Window-WhenOpenedFn) (BITMAPS
 fingersIconMask fingersIconBM) (INITVARS (*Cached-Phone-Directory-Files* NIL) (*Phone-Directory-Pos* 
(create POSITION XCOORD ← 15 YCOORD ← (DIFFERENCE SCREENHEIGHT 75))) (*Phone-Directory-Region* (
CREATEREGION 15 (DIFFERENCE SCREENHEIGHT 258) 400 250))) (GLOBALVARS *Cached-Phone-Directory-Files* 
*Phone-Directory-Pos* *Phone-Directory-Region* fingersIconMask fingersIconBM) (FILES GREP) (P (
Let-your-fingers-do-the-walking))))
(DEFINEQ

(Cache-Phone-Directory-Files
(LAMBDA (msgStream) (* smL " 9-Jan-87 19:40") (* * Cache the phone directory files in core) (printout 
msgStream T "Caching phone directory files...") (LET ((oldFiles *Cached-Phone-Directory-Files*)) (SETQ
 *Cached-Phone-Directory-Files* (for file in (for f inside PHONELISTFILES collect (FINDFILE f)) bind 
localFile when (NOT (NULL file)) collect (printout msgStream T "Caching " file "...") (SETQ localFile 
(PACKFILENAME.STRING (QUOTE HOST) (QUOTE CORE) (QUOTE VERSION) NIL (QUOTE BODY) file)) (COPYFILE file 
localFile) localFile)) (for file in oldFiles do (DELFILE file))) (printout NIL "done" T T)))

(Let-your-fingers-do-the-walking
  [LAMBDA NIL                                                (* smL "21-Aug-86 14:08")

          (* * Create a directory lookup window)


    (LET ((w (CREATEW *Phone-Directory-Region* "Phone directory" NIL)))
         [WINDOWPROP w (QUOTE ICONFN)
		       (FUNCTION (LAMBDA (w icon)
			   (OR icon (ICONW fingersIconBM fingersIconMask *Phone-Directory-Pos* T]
         (WINDOWADDPROP w (QUOTE OPENFN)
			  (FUNCTION Phone-Window-WhenOpenedFn))
         (WINDOWADDPROP w (QUOTE EXPANDFN)
			  (FUNCTION Phone-Window-WhenOpenedFn))
         (WINDOWADDPROP w (QUOTE CLOSEFN)
			  (FUNCTION Phone-Directory-Kill-Proc))
         (WINDOWADDPROP w (QUOTE SHRINKFN)
			  (FUNCTION Phone-Directory-Kill-Proc))
         (WINDOWPROP w (QUOTE BUTTONEVENTFN)
		       (FUNCTION Phone-Window-ButtonEventFn))
         [WINDOWPROP w (QUOTE RIGHTBUTTONFN)
		       (FUNCTION (LAMBDA (w)
			   (if (EQ (THIS.PROCESS)
				       (WINDOWPROP w (QUOTE PROCESS)))
			       then [ADD.PROCESS (BQUOTE (DOWINDOWCOM (\, w]
			     else (DOWINDOWCOM w]
         (SHRINKW w)
     w])

(Phone-Directory-Kill-Proc
  [LAMBDA (window)                                           (* smL "21-Aug-86 13:05")

          (* * Kill the phone directory process associated with the window)


    (LET [(proc (WINDOWPROP window (QUOTE PROCESS]
         (if (PROCESSP proc)
	     then (if (TTY.PROCESSP proc)
			then (TTY.PROCESS T))
		    (DEL.PROCESS proc])

(Phone-Window-ButtonEventFn
  [LAMBDA (w)                                                (* smL " 1-Aug-86 09:37")

          (* * The button event fn for the phone directory lookup window -
	  if the user bugs in the title, lets them re-cache the phone list)


    (if [AND (NOT (MOUSESTATE UP))
		 (NOT (INSIDEP (DSPCLIPPINGREGION NIL w)
				   (LASTMOUSEX w)
				   (LASTMOUSEY w)))
		 (MENU (LOADTIMECONSTANT (create MENU
						       ITEMS ←(QUOTE ("Recache the directory files?"
									 ]
	then (Cache-Phone-Directory-Files PROMPTWINDOW])

(Lookup-Person
  [LAMBDA (w)                                                (* smL "21-Aug-86 13:46")

          (* * The main program for the Phone-Directory)


    (OPENW w)
    (TTYDISPLAYSTREAM w)
    (TTY.PROCESS (THIS.PROCESS))
    (OR *Cached-Phone-Directory-Files* (Cache-Phone-Directory-Files T))
    (bind name
       do (TERPRI)
	    (SETQ name (TTYIN "Name:  " NIL NIL (QUOTE (STRING NORAISE))
				  NIL NIL NIL NIL))
	    (if (NOT (NULL name))
		then (GREP name *Cached-Phone-Directory-Files*))
       until (NOT (OPENWP w])

(Phone-Window-WhenOpenedFn
  [LAMBDA (w)                                                (* smL "21-Aug-86 13:21")

          (* * The OPENFN for the Phone lookup window)


    (if (WINDOWPROP w (QUOTE PROCESS))
	then (TTY.PROCESS (WINDOWPROP w (QUOTE PROCESS)))
      else (OPENW w)
	     (ADD.PROCESS (BQUOTE (Lookup-Person (\, w)))
			    (QUOTE NAME)
			    (QUOTE Lookup-Person)
			    (QUOTE WINDOW)
			    w])
)

(RPAQ fingersIconMask (READBITMAP))
(57 62
"AOOOOOOOOOOOOL@@"
"GOOOOOOOOOOOOO@@"
"GOOOOOOOOOOOOO@@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OOOOOOOOOOOOOOH@"
"OO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OOOOH@@@@CH@"
"N@@AOOGOL@@@@CH@"
"N@@AONCOL@@@@CH@"
"N@@COHIOL@@@@CH@"
"N@@COIION@@@@CH@"
"N@@GOALON@@@@CH@"
"N@@GLCLOO@@@@CH@"
"N@@OHCNGO@@@@CH@"
"N@@@@GNGOH@@@CH@"
"N@@@@GOCOH@@@CH@"
"N@@@@ONAOH@@@CH@"
"N@@@AOLAOL@@@CH@"
"N@@@AOL@OL@@@CH@"
"N@@@COH@ON@@@CH@"
"N@@@COH@GN@@@CH@"
"N@@@GO@@GO@@@CH@"
"N@@@GN@@CO@@@CH@"
"N@@@OL@@AO@@@CH@"
"N@@@OL@@AOH@@CH@"
"N@@AOH@@@OH@@CH@"
"N@@AO@@@@OL@@CH@"
"N@@AO@@@@GL@@CH@"
"N@@AN@@@@CN@@CH@"
"N@@AL@@@@CN@@CH@"
"N@@@@@@@@AO@@CH@"
"N@@@@@@@@@O@@CH@"
"N@@@@@@@@@F@@CH@"
"O@@@GOHAON@@@GH@"
"O@@AOONCOOH@@GH@"
"OL@GOOOGOON@AOH@"
"OOOOL@OOHAOOOOH@"
"OOOO@@GO@@GOOOH@"
"NOOL@@GO@@AOOKH@"
"NAO@@@CN@@@GLCH@"
"N@@@@@CN@@@@@CH@"
"N@@@@@@@@@@@@CH@"
"N@@@@@@@@@@@@CH@"
"N@@@@@@@@@@@@CH@"
"G@@@@@@@@@@@@G@@"
"GOOOOOOOOOOOOO@@"
"COOOOOOOOOOOON@@"
"@OOOOOOOOOOOOH@@")

(RPAQ? *Cached-Phone-Directory-Files* NIL)

(RPAQ? *Phone-Directory-Pos* (create POSITION XCOORD ← 15 YCOORD ← (DIFFERENCE SCREENHEIGHT 75)))

(RPAQ? *Phone-Directory-Region* (CREATEREGION 15 (DIFFERENCE SCREENHEIGHT 258) 400 250))
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS *Cached-Phone-Directory-Files* *Phone-Directory-Pos* *Phone-Directory-Region* 
fingersIconMask fingersIconBM)
)
(FILESLOAD GREP)
(Let-your-fingers-do-the-walking)
(PUTPROPS PHONE-DIRECTORY COPYRIGHT ("Xerox Corporation" 1986 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (965 5013 (Cache-Phone-Directory-Files 975 . 1610) (Let-your-fingers-do-the-walking 1612
 . 2859) (Phone-Directory-Kill-Proc 2861 . 3271) (Phone-Window-ButtonEventFn 3273 . 3891) (
Lookup-Person 3893 . 4522) (Phone-Window-WhenOpenedFn 4524 . 5011)))))
STOP