(make-package "COMPILER" :use '("LISP"))
(import '(si::proclaimed-function si::proclaimed-closure si::proclaimed-return-type si::proclaimed-arg-types) :compiler)
(make-package "SLOOP" :use '("LISP"))
(make-package "ANSI-LOOP" :use '("LISP"))
(make-package "DEFPACKAGE" :use '("LISP"))
(make-package "TK" :use '("LISP" "SLOOP"))
(make-package "FPE" :use '("LISP"))

(in-package "SYSTEM")
(use-package :fpe)

(defvar *command-args* nil)
 ;; if ANY header or license information is printed by the
 ;; program, then the following License and Enhancement notice
 ;; must be printed (see License).

(progn 

  (system:init-system) 
  (gbc t)

  (in-package "USER")

 (or lisp::*link-array*
     (setq lisp::*link-array*
	   (make-array (ash 1 11)  :element-type 'string-char :fill-pointer 0)))
 (si::use-fast-links t)

 (let* ((x (append (pathname-directory si::*system-directory*) (list :parent)))
	(lsp (append x (list "lsp")))
	(cmpnew (append x (list "cmpnew")))
	(h (append x (list "h")))
	(gtk (append x (list "gcl-tk"))))
   (dolist (d (list lsp cmpnew))
       (load (make-pathname :name "sys-proclaim" :type "lisp" :directory d)))
   (load (make-pathname :name "tk-package" :type "lsp" :directory gtk))
   (load (make-pathname :name "gcl_cmpmain" :type "lsp" :directory cmpnew))
   (load (make-pathname :name "gcl_lfun_list" :type "lsp" :directory cmpnew))
   (load (make-pathname :name "gcl_cmpopt" :type "lsp" :directory cmpnew))
   (load (make-pathname :name "gcl_auto_new" :type "lsp" :directory lsp))

   (gbc t)

   (setq compiler::*cmpinclude* "\"cmpinclude.h\"") 
 
   (when compiler::*cmpinclude-string*
     (with-open-file (st (make-pathname :directory h :name "cmpinclude" :type "h"))
		     (let
			 ((tem (make-array (file-length st) :element-type 'standard-char
					   :static t)))
		       (if (si::fread tem 0 (length tem) st)
			   (setq compiler::*cmpinclude-string* tem))))))
 
 (setf (symbol-function 'si:clear-compiler-properties)
       (symbol-function 'compiler::compiler-clear-compiler-properties))
 
 (defvar si::*lib-directory* (namestring (make-pathname :directory (list :parent))))
 
 (terpri)
 (setq si:*inhibit-macro-special* t)
 (gbc t) (system:reset-gbc-count)
 
 (defun system:top-level nil (system::gcl-top-level))
 
 (setq compiler::*default-c-file* nil)
 (setq compiler::*default-h-file* nil)
 (setq compiler::*default-data-file* nil)
 (setq compiler::*default-system-p* nil)
 (setq compiler::*keep-gaz* nil)
 
 (unintern 'system)
 (unintern 'lisp)
 (unintern 'compiler)
 (unintern 'user)
 (fmakunbound 'si::init-cmp-anon)
 
 (if (fboundp 'si::user-init) (si::user-init))
 (si::set-up-top-level)
 
 (setq si::*gcl-extra-version* @LI-EXTVERS@
       si::*gcl-minor-version* @LI-MINVERS@
       si::*gcl-major-version* @LI-MAJVERS@)
 (setq compiler::*cc* @LI-CC@)
 (setq compiler::*ld* @LI-LD@)
 (setq compiler::*ld-libs* @LI-LD-LIBS@)
 (setq compiler::*opt-three* @LI-OPT-THREE@)
 (setq compiler::*opt-two* @LI-OPT-TWO@)
 (setq compiler::*init-lsp* @LI-INIT-LSP@)

 (defvar si::*system-banner* (si::default-system-banner))
 (setq si::*optimize-maximum-pages* t)
 
 (in-package 'user)
 (import 'si::info)

 t)
