(FILECREATED "30-Jan-85 22:35:29" {ERIS}<LISPCORE>SOURCES>VANILLADISK.;2 4364   

      changes to:  (FNS \VANILLADISKINIT \VANILLAHOSTNAMEP \VANILLAEVENTFN \GETPSEUDODSK)
		   (VARS VANILLADISKCOMS)

      previous date: "15-Jan-85 12:29:28" {ERIS}<LISPCORE>SOURCES>VANILLADISK.;1)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT VANILLADISKCOMS)

(RPAQQ VANILLADISKCOMS ((FNS \VANILLADISKINIT \VANILLAHOSTNAMEP \VANILLAEVENTFN)
			(INITVARS (\PSEUDODSK))
			(GLOBALVARS \PSEUDODSK \DISKNAMECASEARRAY)
			(DECLARE: DONTEVAL@LOAD (P (\VANILLADISKINIT)))
			(LOCALVARS . T)))
(DEFINEQ

(\VANILLADISKINIT
  [LAMBDA NIL                                                (* bvm: "30-Jan-85 21:43")
    (PROG ((ARR (COPYARRAY UPPERCASEARRAY)))

          (* * Set up array that maps illegal filename chars to 0 and synonymous characters to a canonical char)


          (for I from 0 to (SUB1 (CHARCODE 0)) do (SETCASEARRAY ARR I 0))
                                                             (* Non-printing characters verboten)
          (for I from (ADD1 (CHARCODE 9)) to (SUB1 (CHARCODE A)) do (SETCASEARRAY ARR I 0))
          (for I from (ADD1 (CHARCODE Z)) to (SUB1 (CHARCODE a)) do (SETCASEARRAY ARR I 0))
          (for I from (ADD1 (CHARCODE z)) to \MAXCHAR do (SETCASEARRAY ARR I 0))
          (SETCASEARRAY ARR (CHARCODE ;)
			(CHARCODE ;))
          (SETCASEARRAY ARR (CHARCODE !)
			(CHARCODE ;))
          (SETCASEARRAY ARR (CHARCODE *)
			(CHARCODE *))
          (SETCASEARRAY ARR (CHARCODE ESCAPE)
			(CHARCODE *))
          (SETCASEARRAY ARR (CHARCODE ?)
			(CHARCODE #))
          (SETCASEARRAY ARR (CHARCODE %.)
			(CHARCODE %.))
          (SETCASEARRAY ARR (CHARCODE -)
			(CHARCODE -))
          (SETCASEARRAY ARR (CHARCODE +)
			(CHARCODE +))
          (SETCASEARRAY ARR (CHARCODE $)
			(CHARCODE $))
          (SETQ \DISKNAMECASEARRAY ARR))

          (* * Define a device whose sole purpose is to select the appropriate DSK device depending on which machine you're 
	  on)


    (\DEFINEDEVICE NIL (create FDEV
			       DEVICENAME ← "VANILLADISK"
			       EVENTFN ←(FUNCTION NILL)
			       HOSTNAMEP ←(FUNCTION \VANILLAHOSTNAMEP])

(\VANILLAHOSTNAMEP
  [LAMBDA (NAME)                                             (* bvm: "30-Jan-85 21:57")

          (* * Fires up the appropriate file system for the machine you're running on)


    (SELECTQ (MACHINETYPE)
	     ((DANDELION DOVE)

          (* * If there is a valid Lisp directory on the disk, use that; otherwise use the pseudo-disk coredevice)


	       (COND
		 ((NEQ NAME (QUOTE DSK))                     (* Not interested in any other names)
		   NIL)
		 ((AND (GETD (QUOTE \LFOpenDevice))
		       (\LFOpenDevice)))
		 (T 

          (* * Define the PSEUDO-DSK device, if it hasn't been defined yet, and make DSK synonymous with it.
	  On LOGOUT, the name DSK is disassociated with this device, but the device remains)


		    [COND
		      ((NOT \PSEUDODSK)
			(COREDEVICE (QUOTE PSEUDO-DSK))
			(SETQ \PSEUDODSK (\GETDEVICEFROMNAME (QUOTE PSEUDO-DSK)))
			(replace (FDEV EVENTFN) of \PSEUDODSK with (FUNCTION \VANILLAEVENTFN]
		    (\DEFINEDEVICE (QUOTE DSK)
				   \PSEUDODSK)
		    \PSEUDODSK)))
	     ((DOLPHIN DORADO)
	       (\M44HOSTNAMEP NAME))
	     NIL])

(\VANILLAEVENTFN
  [LAMBDA (FDEV EVENT)                                       (* bvm: "30-Jan-85 21:54")

          (* * Disassociates the name DSK from the pseudo disk, in case there's a real disk on the machine now)


    (SELECTQ EVENT
	     ((AFTERLOGOUT AFTERSYSOUT AFTERMAKESYS AFTERSAVEVM)
	       (\REMOVEDEVICE.NAMES FDEV (QUOTE DSK)))
	     NIL])
)

(RPAQ? \PSEUDODSK )
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS \PSEUDODSK \DISKNAMECASEARRAY)
)
(DECLARE: DONTEVAL@LOAD 
(\VANILLADISKINIT)
)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(LOCALVARS)
)
(PUTPROPS VANILLADISK COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (622 4082 (\VANILLADISKINIT 632 . 2487) (\VANILLAHOSTNAMEP 2489 . 3698) (\VANILLAEVENTFN
 3700 . 4080)))))
STOP