[1] | 1 | #|
|
---|
| 2 | $Id: make-cgb.lisp,v 1.3 2009/01/19 07:05:15 marek Exp $
|
---|
| 3 | *--------------------------------------------------------------------------*
|
---|
| 4 | | Copyright (C) 1994, Marek Rychlik (e-mail: rychlik@math.arizona.edu) |
|
---|
| 5 | | Department of Mathematics, University of Arizona, Tucson, AZ 85721 |
|
---|
| 6 | | |
|
---|
| 7 | | Everyone is permitted to copy, distribute and modify the code in this |
|
---|
| 8 | | directory, as long as this copyright note is preserved verbatim. |
|
---|
| 9 | *--------------------------------------------------------------------------*
|
---|
| 10 | |#
|
---|
| 11 | ;;(eval-when (eval load compile)
|
---|
| 12 | ;; (require :user-manual "../contrib/user_man/user-manual"))
|
---|
| 13 |
|
---|
| 14 | (defpackage "MAKE-CGB"
|
---|
| 15 | (:use "COMMON-LISP"))
|
---|
| 16 |
|
---|
| 17 | (in-package "MAKE-CGB")
|
---|
| 18 |
|
---|
| 19 | (defvar *save-path* "cgblisp")
|
---|
| 20 |
|
---|
| 21 | (defvar *cgb-version-string* "CGB Package: @(#)defsystem.lisp, version 1.9 of 2/13/96(17:56:13)"
|
---|
| 22 | "Refer to this version string when reporting bugs.")
|
---|
| 23 |
|
---|
| 24 | (defvar *lisp-suffix* ".lisp" "File extension used by the lisp system.")
|
---|
| 25 | (defvar *cgb-packages*
|
---|
| 26 | '("MAKELIST" "ORDER" "MONOM" "XGCD" "MODULAR" "COEFFICIENT-RING"
|
---|
| 27 | "TERM" "POLY" "MODULAR-POLY" "DIVISION" "PARSE" "PRINTER" "POLY-WITH-SUGAR"
|
---|
| 28 | "GROBNER" "COLORED-POLY" "POLY-GCD" "RAT" "RATPOLY"
|
---|
| 29 | "STRING-GROBNER" "DYNAMICS" "PROVER"
|
---|
| 30 | "INFIX" "CGB-LISP"))
|
---|
| 31 |
|
---|
| 32 | ;;----------------------------------------------------------------
|
---|
| 33 | ;; Various features which affect the functioning of the package
|
---|
| 34 | ;;----------------------------------------------------------------
|
---|
| 35 |
|
---|
| 36 | ;;Use pseudodivision to keep the size of integer coefficients
|
---|
| 37 | ;;as small as possible
|
---|
| 38 | (pushnew :pseudodivide *features*)
|
---|
| 39 |
|
---|
| 40 | ;;Use the grobner package within colored-poly package
|
---|
| 41 | (pushnew :colored-poly-use-grobner *features*)
|
---|
| 42 |
|
---|
| 43 | ;;colored-poly package
|
---|
| 44 | ;;Compute saturation of green lists with respect to
|
---|
| 45 | ;;red lists in order to eliminate cases early
|
---|
| 46 | (pushnew :use-saturation *features*)
|
---|
| 47 |
|
---|
| 48 | ;;Print tracing and debugging output
|
---|
| 49 | (pushnew :debug *features*)
|
---|
| 50 |
|
---|
| 51 | ;;Use gcd of integers to keep the size of integer coefficients
|
---|
| 52 | ;; of S-polynomials and normal forms down
|
---|
| 53 | (pushnew :use-gcd *features*)
|
---|
| 54 |
|
---|
| 55 | ;;grobner package
|
---|
| 56 | ;;Use the algorithm of Gebauer and Moeller (1988) to
|
---|
| 57 | ;;calculate Grobner bases
|
---|
| 58 | ;;(pushnew :use-gebauer-moeller *features*)
|
---|
| 59 |
|
---|
| 60 | #|
|
---|
| 61 | ;;Needed by Allegro Common Lisp in order to maintain
|
---|
| 62 | ;;compatibility with the book of Steele (1st edition)
|
---|
| 63 | ;;in regard to in-package and related operations
|
---|
| 64 | (pushnew :cgb-cltl1-compatibility *features*)
|
---|
| 65 | |#
|
---|
| 66 |
|
---|
| 67 | ;;Use pair reordering according to some heuristic in the
|
---|
| 68 | ;;Grobner algorithm
|
---|
| 69 | (pushnew :reorder-pairs *features*)
|
---|
| 70 |
|
---|
| 71 | ;;Perform Buchberger criterion every time a Grobner
|
---|
| 72 | ;;basis is returned or assumed as an argument;
|
---|
| 73 | ;;This feature is mostly for debugging by the
|
---|
| 74 | ;;package developer, but if you detect failure
|
---|
| 75 | ;;of the package in this way, please send the
|
---|
| 76 | ;;output to rychlik@math.arizona.edu
|
---|
| 77 | ;;DO NOT TURN THIS FEATURE ON IF EFFICIENCY
|
---|
| 78 | ;;IS REQUIRED!!!
|
---|
| 79 | ;;(pushnew :grobner-check *features*)
|
---|
| 80 |
|
---|
| 81 | #|
|
---|
| 82 | #+cgb-cltl1-compatibility
|
---|
| 83 | (progn
|
---|
| 84 | #+allegro
|
---|
| 85 | (progn
|
---|
| 86 | (setf *cltl1-in-package-compatibility-p* t)
|
---|
| 87 | (setf comp:*cltl1-compile-file-toplevel-compatibility-p* t)
|
---|
| 88 | (use-package *cltl1-package*))
|
---|
| 89 | )
|
---|
| 90 | |#
|
---|
| 91 |
|
---|
| 92 | (defun package-file (package-name)
|
---|
| 93 | (string-downcase package-name))
|
---|
| 94 |
|
---|
| 95 | (defun cgb-compile ()
|
---|
| 96 | #+kcl(system "rm *.o")
|
---|
| 97 | (dolist (package *cgb-packages*)
|
---|
| 98 | (print '----------------)
|
---|
| 99 | (compile-file (package-file package))
|
---|
| 100 | (load (package-file package))))
|
---|
| 101 |
|
---|
| 102 | (defun cgb-load (&key (print nil))
|
---|
| 103 | (declare (ignore print))
|
---|
| 104 | (dolist (package *cgb-packages*)
|
---|
| 105 | (load (package-file package)))
|
---|
| 106 | ;;A fix around a bug in GCL which causes
|
---|
| 107 | ;;an undefined symbol __setjmp with
|
---|
| 108 | ;;compiled code
|
---|
| 109 | #+gcl (load (concatenate 'string "parse" *lisp-suffix*))
|
---|
| 110 | )
|
---|
| 111 |
|
---|
| 112 | (defun cgb-load-lisp (&key (print nil))
|
---|
| 113 | (declare (ignore print))
|
---|
| 114 | (dolist (package *cgb-packages*)
|
---|
| 115 | (let ((lisp-file (concatenate 'string (package-file package) *lisp-suffix*)))
|
---|
| 116 | (load lisp-file)
|
---|
| 117 | ;;(use-package package)
|
---|
| 118 | )))
|
---|
| 119 |
|
---|
| 120 | (defun cgb-compile-and-load ()
|
---|
| 121 | (cgb-compile)
|
---|
| 122 | (cgb-load))
|
---|
| 123 |
|
---|
| 124 | (defun cgb-go ()
|
---|
| 125 | (in-package :cgb-lisp))
|
---|
| 126 |
|
---|
| 127 | #+allegro
|
---|
| 128 | (defun start-cgb-lisp ()
|
---|
| 129 | (tpl:start-interactive-top-level
|
---|
| 130 | *terminal-io*
|
---|
| 131 | #'cgb-lisp-top-level-read-eval-print-loop
|
---|
| 132 | nil
|
---|
| 133 | :initial-bindings nil))
|
---|
| 134 |
|
---|
| 135 | #+allegro
|
---|
| 136 | (defun cgb-lisp-top-level-read-eval-print-loop (&rest args)
|
---|
| 137 | (in-package :cgb-lisp)
|
---|
| 138 | (apply #'tpl:top-level-read-eval-print-loop args))
|
---|
| 139 |
|
---|
| 140 | #+allegro
|
---|
| 141 | (defun cgb-lisp-banner ()
|
---|
| 142 | (format
|
---|
| 143 | t
|
---|
| 144 | "~&Comprehensive Grobner Basis package by Marek Rychlik preloaded.~%~a~%"
|
---|
| 145 | *cgb-version-string*))
|
---|
| 146 |
|
---|
| 147 | #+kcl
|
---|
| 148 | (defun cgb-save ()
|
---|
| 149 | (defvar system::*akcl-top-level* (symbol-function 'system::top-level))
|
---|
| 150 | (compile
|
---|
| 151 | 'system::top-level
|
---|
| 152 | '(lambda ()
|
---|
| 153 | (format
|
---|
| 154 | t
|
---|
| 155 | "~&Comprehensive Grobner Basis package by Marek Rychlik preloaded.~%~a~%"
|
---|
| 156 | *cgb-version-string*)
|
---|
| 157 | (funcall system::*akcl-top-level*)))
|
---|
| 158 | (save *save-path*))
|
---|
| 159 |
|
---|
| 160 | #+allegro
|
---|
| 161 | (defun cgb-save ()
|
---|
| 162 | (setf excl:*restart-init-function* 'cgb-lisp-banner)
|
---|
| 163 | ;;(setf excl:*restart-app-function* 'start-cgb-lisp)
|
---|
| 164 | (excl:dumplisp
|
---|
| 165 | :name *save-path*
|
---|
| 166 | :home-env-var "CGBLISP_HOME"))
|
---|
| 167 |
|
---|
| 168 | ;;(load-system)
|
---|
| 169 |
|
---|
| 170 | ;;----------------------------------------------------------------
|
---|
| 171 | ;; Generate documentation
|
---|
| 172 | ;;----------------------------------------------------------------
|
---|
| 173 | ;;(defun create-cgb-manuals (prefix format)
|
---|
| 174 | ;; (create-manuals (mapcar #'intern *cgb-packages*)
|
---|
| 175 | ;; :prefix prefix
|
---|
| 176 | ;; :extension '.lisp
|
---|
| 177 | ;; :output-format format))
|
---|
| 178 |
|
---|
| 179 | ;;(defun cgb-doc ()
|
---|
| 180 | ;; (create-cgb-manuals '../doc/ 'text)
|
---|
| 181 | ;; (create-cgb-manuals '../latex-doc/ 'latex))
|
---|