(* ;;-*-LISP-*- KEEP EMACS HAPPY ********************************
*
*     LOADSPEECH
*
****************************************************************)

(DEFVAR SPEECH.FILES 
	'(AUDIO COEWAVE FFT PARCOE PLOT SCOPE USER HANDSY
		SCALEDWINDOW SYNTH BUFFER PHONTOPV))

(DEFEXPR (LOADSPEECH (OPTIONAL FILES SPEECH.FILES) 
		     (OPTIONAL KIND 'LATEST))
  (PROG ()
    (LOAD? '{ERIS}<LISP>LIBRARY>SAMEDIR.DCOM)
    (LOAD? '{ERIS}<LISP>LIBRARY>COMPILEBANG.DCOM)
    (MOVD 'COMPILE%! 'COMPILE)
    (LOAD? '{ERIS}<LISPUSERS>BQUOTE.DCOM)
    (COND ((NULL (GETD 'SETF.HELPER))
	   (LOAD '{ERIS}<LISPUSERS>SETF.DCOM)))
    (COND ((NULL (GETD 'DEFHELPER))
	   (COND ((EQ USERNAME 'HALVORSEN)
		  (MOVD 'NILL 'EMACS)))
	   (LOAD '{ERIS}<LISPUSERS>EMACSUSER.DCOM)))
    (LOAD? '{ERIS}<ROACH>LISP>UTI3)
    (FOR FILE IN FILES 
     DO (SMARTLOAD FILE KIND))
))

(DEFEXPR (SMARTLOAD FILE (OPTIONAL KIND 'LATEST))
  (PROG (DCOMFILE FPKGFILE SOURCEFILE)
    (SETQ DCOMFILE (PACK* FILE '.DCOM))
    (SETQ FPKGFILE (PACK* FILE '.FPKG))
    (COND ((NULL (FULLNAME FPKGFILE))
	   (SETQ SOURCEFILE FILE))
	  ((NULL (FULLNAME FILE))
	   (SETQ SOURCEFILE FPKGFILE))
	  ((< (GETFILEINFO FILE 'ICREATIONDATE)
	      (GETFILEINFO FPKGFILE 'ICREATIONDATE))
	   (SETQ SOURCEFILE FPKGFILE))
	  (T (SETQ SOURCEFILE FILE)))
    (SELECTQ KIND
      (SOURCE (LOAD SOURCEFILE))
      (DCOM (COND ((FULLNAME DCOMFILE)
		   (* DCOM file exists *)
		   (LOAD DCOMFILE))
		  (T (LOAD SOURCEFILE))))
      (LATEST
       (COND ((AND (FULLNAME DCOMFILE)
		   (< (GETFILEINFO SOURCEFILE 'ICREATIONDATE)
		      (GETFILEINFO DCOMFILE 'ICREATIONDATE)))
	      (LOAD DCOMFILE))
	     (T (LOAD SOURCEFILE))))
      (SHOULDNT))
))

STOP