(in-package "COMMON-LISP-USER")

;; ---------------------------------------------------------------------
;;; Delivery script for KPML 3.0 with LW4.1/5.0 plus wait and generate
;;; No interface present, just generates...
;;; John, Bremen, Feb 2000.
;;; Updated to KPML4, June 2002.
;;; Updated to LW5, December 2007.
;;;                             August 2009: make location independent...

#-lispworks5 (print "NOT LISPWORKS 5 or above: CAN ONLY FAIL NASTILY!!!")
#-lispworks5 (print "-------------------------------------------")
#-lispworks5 (print "  DO NOT PASS GO!! ")
#-lispworks5 (print "  DO NOT COLLECT 200 GBPs, USD, Euros!!")
#-lispworks5 (print "-------------------------------------------")

;; ---------------------------------------------------------------------
;;; Not yet made space efficient in any way, need to do
;;; something sensible about clos templates for this to
;;; stand a chance. 
;; ---------------------------------------------------------------------

(load-all-patches)

;; ----------------------------------------------------------------------
;; *** THE FOLLOWING MUST ONLY BE SET IF THE KPML BINARIES ARE BEING ***
;; *** KEPT IN A DIFFERENT PLACE TO THE SOURCE FILES. THIS IS NOT    ***
;; *** THE CASE UNLESS YOU HAVE EXPLICITLY ORGANIZED THIS TO BE DONE ***
;; *** LOCALLY.
;;
;(defparameter *KPML-BINARIES-ROOT* 
;          (pathname "C:\\john\\systems\\KPML\\BINARIES\\LWW5-NO-GUI\\"))
;; ----------------------------------------------------------------------

(push :dump-kpml *features*)

(eval-when
 (compile load eval)
 (setq kpml-root
       (make-pathname
	:device (pathname-device cl-user::*load-truename*)
	:host (pathname-host cl-user::*load-truename*)
	:directory (butlast (pathname-directory cl-user::*load-truename*)))))

;; get us access to the environment variables regardless of Lisp version...
(load (merge-pathnames "Processes/x-platform/getenv.lisp" kpml-root))

(setf kpml-res-root
  (kpml-getenv "KPMLRESOURCEBASE"
           (merge-pathnames "Resources/" (kpml-parent-directory kpml-root))
           ;; --- or just add some absolute path if you prefer... ---
           ;; "C:/john/systems/kpml/Resources/"
           ;; -------------------------------------------------------------------
           )) 

(load (merge-pathnames "KPML-INSTALLATION" kpml-root))
(load (merge-pathnames "processes/server/server-client-lw5/server-eg.lisp" kpml-root))
(load (merge-pathnames "KPML-IMAGE-SCRIPTS/wait-and-generate.lisp" kpml-root))

(kpml::load-kpml-configuration-file)

;;
;; flags for safe running regardless of input... 
;;
   (setf kpml::*standalone* T)
   (setf kpml::*demo-mode* T)
   (setf kpml::example-runner-flag T)

;; and timestamp it...
   (setf kpml::*kpml-creation-timestamp* (kpml::time-stamp))

(lispworks::deliver 
 'kpml::waiting-generate 
 (merge-pathnames  
  "kpml4-binaries/kpml-images/LW5-bbox/kpml4-bbox-new" (kpml-parent-directory kpml-root) )
 0
 :multiprocessing T
 :keep-clos T
 :keep-eval T)


#||

         :clos-info :classes-and-methods
         :diagnostics-file "C:\\kpml-clos-diags"
         :compact nil
         :in-memory-delivery T
         :keep-clos T
         :keep-debug-mode :keep-packages

||#

