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

;;; File: kpml-defsys.lisp
;;; KPML 2.0; February--March 1998
;;;      2.1; April 1999
;;;      3.0-4.0; various extra subsystems added...
;;; John Bateman.

;;; ----------------------------------------------------------------------
;;; Functions for compiling and loading Komet-Penman Multilingual 1.1
;;; Definition of directory structure for KPML.
;;;
;;; Delta wrt betas: separate maintenance of binary directories
;;;                  added,
;;;                  system for emacs interaction incorporated.
;;; KPML 1.1: separation of Penman, ML-Penman, KPML removed: there is
;;;           now only support for a single KPML system.
;;;   May97:
;;;   first support for PC under Windows using CLIM2.1 added, note
;;;   that there is *no* support for the old style window interface
;;;   here. ACL3.0.2 also does not support multiprocessing and so
;;;   so there are certain restrictions as a consequence. Options
;;;   are conditionalized where necessary on aclpc and acl3.0.
;;;
;;; KPML 2.0:
;;;   Feb98:
;;;   support for PC under Windows using Harlequin Lispworks.
;;; KPML 2.1:
;;;   some of the old interprocess communication stuff needs to
;;;   be redone for ACL5.0, not done as yet: just conditionalized out
;;;   so don't try to start a server!
;;; KPML 4.0
;;;   Some new files for XML handling...
;;; ----------------------------------------------------------------------

(make:defsystem KPML
  :source-pathname *root-of-kpml*
  :source-extension "lisp" 
  :binary-pathname *kpml-binaries-root*
  :components ((:module CORE
			:source-pathname "Processes"
			:components 
  (
   (:module PACKAGES
	    :source-pathname "packages"
	    :components (
			 (:file "kpml-package-def")
			 (:file "kpml-kb-package-def")
			 ))
   (:module INITIALIZATION
	    :source-pathname "initialization"
	    :components (
			 (:file variables)
			 (:file structures)
			 (:file macro-utilities)
			 (:file utilities)
			 (:file multilinguality)
			 (:file features-record)
			 (:file font-profiles)
			 (:file language-range-defs)
			 (:file morphology-declarations)
			 (:file description-declarations)     ;; 3.2
                         #+lispworks (:file code-page-setter)
			 (:file xml-loaders)                  ;; 4.0
			 ))
   (:module CROSS-FILE-SYSTEM-COMPATIBILITY
	    :source-pathname "x-platform"
	    :components 
	    ((:file "cross-file-system-functions")))
   (:module OBJECTS
	    :source-pathname "objects"
	    :components (
			 (:file ml-merging)
			 (:file features)
			 (:file systems)
			 (:file choosers)
			 (:file spls)
			 (:file inquiries)
			 (:file lexemes)
			 (:file generation-results)          ;; 4.0 moved here because
			 (:file examples)                    ;;     examples uses printable-cs
			 (:file default-orderings)
			 (:file dependencies)
			 (:file networks)
			 (:file punctuation)
			 (:file spl-macros)
			 (:file spl-defaults)
			 (:file standard-default-declarations)
			 ))
   (:module KR-INTERFACE
	    :source-pathname "kr-interfaces"
	    :components (
			 (:file concept-lexicon-annotations)))
   (:module DISPLAY
	    :source-pathname "display"
	    :components (
			 (:file basic-ttyio)
			 (:file pretty-printing)
			 (:file generic-systemic-display)
			 (:file ml-who-can-what)
			 (:file prettifying)
                         (:file extra-reports)
			 #+(or acl3.0 lispworks4.0)(:file nonansi-pretty)
			 (:file xml-printing.lisp)
			 ))
   (:module GENERATION
	    :source-pathname "generation"
	    :components (
			 (:file selectors)
			 (:file generation-actions)
			 (:file generate)
			 (:file traversal)
			 (:file example-running)
			 (:file basic-realizations)
			 (:file morphology)
			 (:file templates)
			 (:file inquiry-interaction)
			 (:file lexicon-interaction)
			 (:file term-resolution)
			 (:file morph-realizations)
			 (:file agreement-domains)
			 (:file modification-specification)
			 (:file history-cumulation)
			 (:file structure)
			 #-kpmltest(:file orderings)
			 ;; clean-orderings does not use CLISP: tested?
			 #+kpmltest(:file clean-orderings)
			 (:file string-cleanups)
			 (:file tracing)
			 ))
   
   (:module MANAGEMENT
	    :source-pathname "management"
	    :components (
			 (:file conversions)
			 (:file copyrights)
			 (:file config)
			 (:file image-makers)
			 (:file loader)
			 (:file kpml-resource-maintenance)
			 (:file lexicons)
			 (:file messages)
			 (:file performance-profiler)
			 (:file regions)
			 (:file resources)
			 (:file speedup)
			 (:file surveys)
			 (:file tests)
			 ))
   

   #+(and allegro (not acl3.0))
   (:module UI-EMACS
	    :source-pathname "ui-emacs"
	    :components (
			 (:file lisp-side-interaction)
			 #-mswindows
			 (:file mule-readtables)
			 ))
   ))))
   
;;; ----------------------------------------------------------------------
;;; 3.0 server-client support for Allegro made a separate system...
;;; ----------------------------------------------------------------------

(make:defsystem KPML-ACL-IPC
  :source-pathname *root-of-kpml*
  :source-extension "lisp" 
  :binary-pathname *kpml-binaries-root*
  :components ((:module CORE
			:source-pathname "Processes"
			:components 
			(
			 (:module KPML-IPC
				  :source-pathname "management"
				  :components (
					       (:file server-client)))))))


;;; ----------------------------------------------------------------------
;;; CLIM interface related systems

(make:defsystem CROSS-PLATFORM-COMPATIBILITY
  :source-pathname *root-of-kpml*
  :source-extension "lisp" 
  :binary-pathname *kpml-binaries-root*
  :components 
  ((:module window-interface
	    :source-pathname "Processes/x-platform"
	    :components 
	    ((:file "cross-platform-compatibility")))))

(make:defsystem KPML-CLIM
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components 
  ((:module 
    CORE
    :source-pathname "Processes"
    :components 
    (
     #+(and aclpc acl3.0)
     (:module ACL-CLIM
	      :source-pathname "ui-clim/acl-clim"
	      :components
	      ((:file "winacl-actions")
	       (:file "nothread-frame-starter")
	       (:file "constructed-clim-subseq")))
     #+(and lispworks mswindows)
     (:module PCLW-CLIM
	      :source-pathname "ui-clim/pclw-clim"
	      :components
	      ((:file "editor-actions")
	       (:file "window-renaming")))
     (:module UI-CLIM
	      :source-pathname "ui-clim"
	      :components ((:file "variables")
			   (:file "threader")
                           (:file "frame-starter")                  ;; 3.0
                           (:file "general-facilities")             ;; 4.1 has macros
                           (:file "kpml-menu-choose")
			   (:file "type-faces-and-colors")
			   (:file "flexible-fonts")
			   (:file "presentation-methods")
			   (:file "application-starter")
			   (:file "extra-command-tables")
			   (:file "flag-bars")
			   (:file "options-selection")
			   (:file "inspection")
			   (:file "interface-root")
			   (:file "development")
                           (:file "generation-modes-menu-bar")       ;; 2.1
			   (:file "extra-development-commands")
			   (:file "resource-grapher-interface")
			   (:file "resource-display-tool")
			   (:file "resource-grapher-option")
                           (:file "selection-expression-tool")       ;; 2.1
			   (:file "structure-grapher-interface")
			   (:file "example-grapher-interface")
			   (:file "misc-extra-frames")
                           (:file "user-response-frame")             ;; 3.0
			   (:file "presentation-actions")
			   
	   ;;; following batch handles different external editors...
	   ;;; have to be careful about the Lisp versions...
			   (:file "editor-actions")
			   #+(and :allegro (not acl3.0))
			       (:file "emacs-actions")
			   #-(or (and :unix :allegro)
				 (and :allegro :mswindows)
				 (and aclpc acl3.0)
                                 lispworks)
			       (:file "editor-action-stubbs")
			       
			   (:file "chooser-display")
			   (:file "directory-menus")
			   (:file "genre-grapher")
			   (:file "cumulative-history-display")
			   (:file "traversal-graph")
			   (:file "lof")
			   (:file "system-popups-interface")
			   (:file "cautious-rs-dialog-box")
			   (:file "chooser-editor")
			   (:file "inquiry-editor")
			   (:file "lexeme-editor")              ;; 3.2.39 (beta)
			   (:file "example-operations")
                           (:file "regression")                 ;; 4.1 
			   (:file "exrun-progress-interface")
			   (:file "example-mismatches")
			   (:file "examples-as-docu")           ;; 3.2.44 (experimental)
			   (:file "formatting-with-markup")     ;; 3.2
			   (:file "regions-overview-interface")
			   (:file "pickups")
			   (:file "kpml-demo-setup")
                           #-(and aclpc acl3.0)
                             (:file "sorted-menu")
                           (:file "startups")     ;; 3.1 ACL5.0 PC compatible
			   ))
     (:module CLIM-UI-SUBSTRATE
	      :source-pathname "ui-clim/substrate"
	      :components 
	      ((:file "utilities")
	       (:file "kpml-i-fns")
	       #-(and acl3.0 aclpc)(:file "kpml-system-flags")
	       (:file "ml-window-ops")
	       (:file "system-to-interface")
		     (:file "object-descriptions")
		     (:file "resource-grapher")
		     (:file "structure-grapher")
                     (:file "ui-tests")                       ;; 3.1
		     (:file "leftover-pretty-printing")
		     (:file "history-cumulation")
		     (:file "penman-feature-record-update")
		     (:file "system-popups")
		     (:file "regions-overview")
		     ))
     #+(and acl3.0 aclpc)
     (:module WINACL-UI-SUBSTRATE
	      :source-pathname "ui-aclwin"
	      :source-extension "LSP"
	      :components 
	      ((:file "acl-editor-window")
	       (:file "system-flags-acl")
	       (:file "generation-modes")
	       (:file "file-dialog")
	       (:file "winemacs-eval-server"))
	      )
     ))))

   
(make:defsystem KPML-INTERFACE-STUBB
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module interface-stubb
	    :source-pathname "Processes/ui-clim-stubb"
	    :components
	    ((:file "stubb-kpml-i-package-def")
	     (:file "stubb-startup-def")))))

 ;; ------------------------
 ;; 4.0 null KR option
 ;; ------------------------

(make:defsystem KPML-NULL-KR
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module kr-stubb
	    :source-pathname "Processes/kr-interfaces"
	    :components
	    ((:file "kpml-kr-interface")))))


 ;; -------------------------
 ;; 4.0 only loaded if XMLS present for XML parsing...
 ;; -------------------------

(make:defsystem KPML-XML
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module XML-INPUT
	    :source-pathname "Processes/management"
	    :components (
			 (:file xmls-2-spl)))))


;;; ----------------------------------------------------------------------

(make:defsystem STRATIFICATION
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module stratification-code
	    :source-pathname "Processes/stratification"
	    :components
	    ((:module syntagmatics
		      :source-pathname ""
		      :components
		      ((:file "generalized-units")
		       (:file "gsp-realizations")
		       (:file "register-realizations")))
	     (:module paradigmatics
		      :source-pathname ""
		      :components
		      ((:file "stratified-traversal")
		       (:file "flags")
		       (:file "external-resources")
		       (:file "planner")
		       (:file "discourse-semantics")
		       (:file "shared-discourse-semantics")
		       (:file "grammaticising")))))))

(make:defsystem UI-STRATIFICATION
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components 
  ((:module ui-additions
	    :source-pathname "Processes/ui-clim"
	    :components
	    ((:file "ui-strat-additions")))))

;;; ----------------------------------------------------------------------

(make:defsystem KPML-SERVER
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module server-client
	    :source-pathname "Processes/server"
	    :components
	    (#+allegro (:file "server")
	     ))))

(make:defsystem KPML-LOOM-SPEEDUP
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components
  ((:module faster-generation
	    :source-pathname "Processes/kr-interfaces/loom"
	    :components
	    (#+(and :allegro (not :ALLEGRO-V5.0))(:file "speedy")))))

;;; ----------------------------------------------------------------------

(make:defsystem KPML-PATCHES
  :source-pathname *root-of-kpml*
  :source-extension "lisp"
  :binary-pathname *kpml-binaries-root*
  :components 
  ((:module window-patches
	    ;; 2.0 Note: the directory used to be Patches, but this seems
	    ;;           to be frequently changed in copying between Unix
	    ;;           and Windows to patches due to the warped PC
	    ;;           ideas of an operating system. So the name is changed
	    ;;           here so that the unwary don't get tripped over.
	    :source-pathname "patches"
	    :components 
	    ((:file "kpml-body-patches")
	     (:file "kpml-interface-patches")))))








