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