 (defun bootstrap-specware4 (in-current-dir?)
   (interactive "P")
   (let ((root-dir (if in-current-dir? default-directory
-		    (concat (getenv "SPECWARE4") "/"))))
+		    (concat (getenv "SPECWARE4")))))
     (run-specware4 root-dir)
     (sleep-for 2)
     (sw:eval-in-lisp (format "(top-level::do-command :cd %S)" root-dir))

		    fi:common-lisp-host
		    fi:common-lisp-image-file
		    )
    (sleep-for 2)
;;;  (while (not (inferior-lisp-running-p))
;;;    (sleep-for 1))
;;;  (delete-windows-on "*Warnings*" t)
    ))

;;;(defun run-specware (&optional openSpecWindow)
;;;  (interactive "P")
;;;  (setq fi:common-lisp-host "localhost")
;;;;;
;;;;; fi:common-lisp-directory is the directory in which the lisp subprocess will
;;;;; be executed. It is defined in eli/fi-subproc.el with a default value nil
;;;;; This seems to work fine under Unix/Linux but under Windows there is 
;;;;; a "stringp, nil" error message. So we set it to "c:." to avoid the problem.
;;;;;
;;;  (setq fi:common-lisp-directory (getenv "LISP_DIRECTORY"))
;;;;;
;;;;; Specware can be started in two ways. The familiar way is to start the
;;;;; Lisp environment augmented with a Specware image. The term "image" comes
;;;;; from the Franz manual. At Kestrel, an image is called a "world". The other
;;;;; way is to create a new executable application using the ACL primitive
;;;;; generate-application. By executable we mean a .exe in the Windows world.
;;;;; The latter requires the Enterprise Edition of ACL. It has the advantage that
;;;;; we can ship Specware to users who do not already have ACL installed.
;;;;;
;;;;; Below we set a parameter fi:common-lisp-image-name. Just to confuse things
;;;;; further, this is the name used by eli/fi-subproc.el for the Lisp
;;;;; executable (and not an image in the ACL sense). The image file
;;;;; (in the ACL sense) or world, is bound to common-lisp-image-file
;;;;; If the executable is produced by generate-application, then typically,
;;;;; there will not be an ACL image file.
;;;;;
;;;  (setq fi:common-lisp-image-name (getenv "LISP_EXECUTABLE"))
;;;;;
;;;;; A "HEAP_IMAGE" is what Franz calls an image and what Kestrel calls a world.
;;;;; The suffix on such files is .dxl.
;;;;;
;;;  (setq fi:common-lisp-image-file (getenv "LISP_HEAP_IMAGE"))
;;;
;;;  (fi:common-lisp fi:common-lisp-buffer-name
;;;		  fi:common-lisp-directory
;;;		  fi:common-lisp-image-name
;;;		  fi:common-lisp-image-arguments
;;;		  fi:common-lisp-host
;;;		  fi:common-lisp-image-file
;;;		  ) 
;;; 
;;;;; Works only in an image where specware2000 resides.
;;;  (when openSpecWindow
;;;    (sw:eval-in-lisp "(progn (SpecwareUI::openSpecWindow) \"Done\")")))

;; The following is almost the same as the above. The difference is that
;; in the following we execute a Specware application (rather than run Lisp
;; with a Specware world);

(defun run-lisp-application ()
  (interactive)
  (when (inferior-lisp-running-p)
    (fi:exit-lisp)

		       (if (stringp in-current-dir?)
			   in-current-dir?
			 default-directory)
		     (concat (getenv "SPECWARE4"))))
	 (dir (concat root-dir "/Applications/Specware/Handwritten/Lisp"))
	 (bin-dir (concat root-dir
			     "/Applications/Specware/bin/"
			     (if (memq system-type '(ms-dos windows-nt windows-95
						     ms-windows))
				 "windows"
			       (symbol-name system-type))))
	 (world-name (concat bin-dir "/Specware4.dxl")))
    (run-plain-lisp)
    (sw:eval-in-lisp (format "(setf (sys:getenv \"SWPATH:/\") %S)" root-dir))
    (sw:eval-in-lisp (format "(setf (sys:getenv \"SPECWARE4\") %S)" root-dir))
    (sw:eval-in-lisp (format "(top-level::do-command :cd %S)" dir))
    (sw:eval-in-lisp "(load \"Specware4.lisp\")")

    (run-plain-lisp)
    (unless (inferior-lisp-running-p)
      (sleep-for 1))
    (sw:eval-in-lisp (format "(setf (sys:getenv \"SWPATH:/\") %S)" root-dir))
