* Fix inconsistency of libpath switch.
tswd
8 years ago
423 | 423 | (pathname (concatenate 'string topdir "/lib/"))) |
424 | 424 | (setq *system-ex-dir* |
425 | 425 | (pathname (concatenate 'string topdir "/exs/"))) |
426 | (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*))) | |
426 | ;; (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*)) | |
427 | (setq *chaos-libpath* (list *system-lib-dir*))) | |
427 | 428 | |
428 | 429 | #-(or (and CCL (not :openmcl)) ALLEGRO (and SBCL WIN32)) |
429 | 430 | (defun set-cafeobj-standard-library-path (&optional topdir) |
453 | 454 | (setq *system-prelude-dir* (translate-logical-pathname (merge-pathnames "prelude/"))) |
454 | 455 | (setq *system-lib-dir* (translate-logical-pathname (merge-pathnames "lib/"))) |
455 | 456 | (setq *system-ex-dir* (translate-logical-pathname (merge-pathnames "exs/"))) |
456 | (setq *chaos-libpath* | |
457 | (list *system-lib-dir* *system-ex-dir*))))) | |
457 | ;;; (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*)) | |
458 | (setq *chaos-libpath* (list *system-lib-dir*))))) | |
458 | 459 | |
459 | 460 | #+(and :SBCL :win32) |
460 | 461 | (defun set-cafeobj-standard-library-path (&optional topdir) |
467 | 468 | (setq *system-prelude-dir* (translate-logical-pathname (merge-pathnames "prelude/"))) |
468 | 469 | (setq *system-lib-dir* (translate-logical-pathname (merge-pathnames "lib/"))) |
469 | 470 | (setq *system-ex-dir* (translate-logical-pathname (merge-pathnames "exs/"))) |
470 | (setq *chaos-libpath* | |
471 | (list *system-lib-dir* *system-ex-dir*))))) | |
471 | ;;; (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*)) | |
472 | (setq *chaos-libpath* (list *system-lib-dir*))))) | |
472 | 473 | |
473 | 474 | ;;; patch by t-seino@jaist.ac.jp |
474 | 475 | #+(and CCL (not :openmcl)) |
482 | 483 | (full-pathname (make-pathname :host "ccl" :directory "lib/"))) |
483 | 484 | (setq *system-ex-dir* |
484 | 485 | (full-pathname (make-pathname :host "ccl" :directory "exs/"))) |
485 | (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*))) | |
486 | ;; (setq *chaos-libpath* (list *system-lib-dir* *system-ex-dir*)) | |
487 | (setq *chaos-libpath* (list *system-lib-dir*))) | |
486 | 488 | |
487 | 489 | ;;; MAIN ROUTINE |
488 | 490 | ;;; PROCESSING INPUT FILE STREAM |
342 | 342 | retries the evaluation. |
343 | 343 | ") |
344 | 344 | |
345 | (define ("no autoload") | |
345 | (define ("no-autoload") | |
346 | 346 | :category :library |
347 | :parse parse-no-autoload-command | |
347 | :parser parse-no-autoload-command | |
348 | 348 | :evaluator eval-ast |
349 | 349 | :title "`no autoload <module-name>`" |
350 | 350 | :related ("autoload") |
463 | 463 | (version) |
464 | 464 | ;; AUTO LOAD |
465 | 465 | (autoload :symbol :symbol) |
466 | (no autoload :symbol) | |
466 | (no-autoload :symbol) | |
467 | 467 | ;; (stop at :term |.|) |
468 | 468 | ;; ((:+ rwt) limit :symbol) |
469 | 469 | (test (:+ reduction red execution exec) (:if-present in :modexp |:|) |
158 | 158 | (let ((mod-name (second inp)) |
159 | 159 | (file (third inp))) |
160 | 160 | (%autoload* mod-name file))) |
161 | ||
161 | ||
162 | ;;; | |
163 | ;;; NO AUTOLOAD | |
164 | ;;; | |
165 | (defun parse-no-autoload-command (inp &rest ignore) | |
166 | (declare (ignore ignore)) | |
167 | (let ((mod-name (second inp))) | |
168 | (%no-autoload* mod-name))) | |
169 | ||
162 | 170 | ;;; ****** |
163 | 171 | ;;; CBREAD |
164 | 172 | ;;; ****** |
110 | 110 | (term-hash-equal (term-builtin-value term)))) |
111 | 111 | ((term-is-variable? term) (term-hash-eq term)))) |
112 | 112 | |
113 | (defun dump-term-hash (term-hash &optional (size term-hash-size)) | |
114 | (dotimes (x size) | |
115 | (let ((ent (svref term-hash x))) | |
116 | (when ent | |
117 | (format t "~%[~3d]: ~d entrie(s)" x (length ent)) | |
118 | (dotimes (y (length ent)) | |
119 | (let ((e (nth y ent))) | |
120 | (format t "~%(~d)" y) | |
121 | (let ((*print-indent* (+ 2 *print-indent*))) | |
122 | (term-print (car e)) | |
123 | (print-next) | |
124 | (princ "==>") | |
125 | (print-next) | |
126 | (term-print (cdr e))))))))) | |
113 | (defun dump-term-hash (term-hash &optional (size term-hash-size) (module *current-module*)) | |
114 | (with-in-module (module) | |
115 | (dotimes (x size) | |
116 | (let ((ent (svref term-hash x))) | |
117 | (when ent | |
118 | (format t "~%[~3d]: ~d entrie(s)" x (length ent)) | |
119 | (dotimes (y (length ent)) | |
120 | (let ((e (nth y ent))) | |
121 | (format t "~%(~d)" y) | |
122 | (let ((*print-indent* (+ 2 *print-indent*))) | |
123 | (term-print (car e)) | |
124 | (print-next) | |
125 | (princ "==>") | |
126 | (print-next) | |
127 | (term-print (cdr e)))))))))) | |
127 | 128 | |
128 | 129 | #-GCL |
129 | 130 | (declaim (inline get-hashed-term)) |
240 | 241 | |
241 | 242 | ;;; ---------------------------------------- |
242 | 243 | ;;; BASIC PROCS for REWRITE RULE APPLICATION |
243 | ||
244 | (defvar *memo-debug* nil) | |
245 | ||
246 | #| NOT USED | |
244 | 247 | (defmacro term-replace-with-memo (old new) |
245 | 248 | (once-only (old new) |
246 | 249 | ` (if (and (not (term-is-builtin-constant? ,old)) |
247 | 250 | (or *always-memo* |
248 | 251 | (method-has-memo (term-head ,old)))) |
249 | (progn | |
250 | (set-hashed-term (simple-copy-term ,old) *term-memo-table* ,new) | |
252 | (let ((term-memo (simple-copy-term ,old))) | |
253 | (when *memo-debug* | |
254 | (when (term-equational-equal term-memo ,new) | |
255 | (with-output-chaos-warning () | |
256 | (format t "E-E term is about to hashed!") | |
257 | (terpri) | |
258 | (term-print-with-sort ,new))) | |
259 | (format t "~%[memo]: ") | |
260 | (term-print-with-sort term-memo) | |
261 | (format t "~% ==> ") | |
262 | (term-print-with-sort ,new)) | |
263 | (set-hashed-term term-memo *term-memo-table* ,new) | |
251 | 264 | (term-replace ,old ,new)) |
252 | 265 | (term-replace ,old ,new)))) |
266 | |# | |
253 | 267 | |
254 | 268 | (declaim (inline term-replace-dd-simple)) |
255 | 269 | #-gcl |
779 | 793 | ;; return t iff the rule is applied. |
780 | 794 | is-applied)) |
781 | 795 | |
782 | #| -- moved to reducer.lisp | |
796 | #|| -- moved to reducer.lisp | |
783 | 797 | (defun simplify-on-top (term) |
784 | 798 | (declare (type term term) |
785 | 799 | (values t)) |
788 | 802 | (method-rules-with-different-top |
789 | 803 | (term-method term))) |
790 | 804 | term)) |
791 | |# | |
805 | ||# | |
792 | 806 | |
793 | 807 | ;;; |
794 | 808 | ;;; REWRITE ENGINE |
954 | 968 | (let ((term-nu nil) |
955 | 969 | (normal-form (get-hashed-term term *term-memo-table*))) |
956 | 970 | (unless normal-form |
957 | (setq term-nu (simple-copy-term term)) | |
958 | ;; compute the normal form of "term" | |
959 | (reduce-term term strategy) | |
960 | (setq normal-form term) | |
961 | ;; store the normal form | |
962 | (set-hashed-term term-nu *term-memo-table* normal-form)) | |
971 | (let ((rule-count (number-rewritings))) | |
972 | (setq term-nu (simple-copy-term term)) | |
973 | ;; compute the normal form of "term" | |
974 | (reduce-term term strategy) | |
975 | (setq normal-form term) | |
976 | (unless (= rule-count (number-rewritings)) | |
977 | (when *memo-debug* | |
978 | (when (term-equational-equal term-nu normal-form) | |
979 | (with-output-chaos-warning () | |
980 | (format t "E-E term is about to be hashed!") | |
981 | (format t "~%(~d) old = " rule-count (number-rewritings)) | |
982 | (term-print-with-sort term-nu) | |
983 | (format t "~%(~d) new = " (number-rewritings)) | |
984 | (term-print-with-sort normal-form)))) | |
985 | ;; store the normal form | |
986 | (set-hashed-term term-nu *term-memo-table* normal-form)))) | |
963 | 987 | normal-form)) |
964 | 988 | |
965 | 989 | (defmacro check-closed-world-assumption (?term) |
1382 | 1382 | (setf (cdr entry) file) |
1383 | 1383 | (push (cons modname file) *autoload-alist*))))) |
1384 | 1384 | |
1385 | ;;; ************ | |
1386 | ;;; NO AUTOLOAD | |
1387 | ;;; ************ | |
1388 | (defun eval-no-autoload (ast) | |
1389 | (let ((modname (%no-autoload-mod-name ast))) | |
1390 | (unless (assoc modname *autoload-alist* :test #'equal) | |
1391 | (with-output-chaos-warning () | |
1392 | (format t "Module ~s is not specified as 'autoload'." modname))) | |
1393 | (setq *autoload-alist* | |
1394 | (remove-if #'(lambda (x) (equal modname x)) *autoload-alist* | |
1395 | :key #'car)))) | |
1396 | ||
1385 | 1397 | ;;; ********************* |
1386 | 1398 | ;;; MISC SUPOORT ROUTINES |
1387 | 1399 | ;;; ********************* |
376 | 376 | file) |
377 | 377 | :eval eval-autoload) |
378 | 378 | |
379 | ;;; *********** | |
380 | ;;; NO AUTOLOAD | |
381 | ;;; *********** | |
382 | (defterm no-autoload (%script) | |
383 | :visible (mod-name) | |
384 | :eval eval-no-autoload) | |
385 | ||
379 | 386 | ;;; ****************************** |
380 | 387 | ;;; CIRCULAR COINDUCTIVE REWRITING |
381 | 388 | ;;; ****************************** |
191 | 191 | ;; debug flags : invisible from user, internal use only |
192 | 192 | ("sys" ("universal-sort") parity *allow-universal-sort* "" nil nil t) |
193 | 193 | ("debug" ("rewrite") parity *rewrite-debug* "" nil nil t) |
194 | ("debug" ("memo") parity *memo-debug* "" nil nil t) | |
194 | 195 | ("debug" ("hash") parity *on-term-hash-debug* "" nil nil t) |
195 | 196 | ("debug" ("axiom") parity *on-axiom-debug* "" nil nil t) |
196 | 197 | ("debug" ("beh") parity *beh-debug* "" nil nil t) |
302 | 303 | (type (chaos-switch-type switch))) |
303 | 304 | (cond ((eq name :comment) |
304 | 305 | (format t "~%~a" (second switch))) |
306 | ((equal name "libpath") | |
307 | (format t "~%libpath~24T= ~{~a~^:~}" value)) | |
305 | 308 | (t (when (atom name) (setq name (list name))) |
306 | 309 | (if (eq type 'parity) |
307 | 310 | (format t "~&~{~a~^|~a~} ~{~^ ~a~} ~24T~:[off~;on~]" name option value) |
343 | 346 | ;;; some switch setters |
344 | 347 | ;;; |
345 | 348 | (defun chaos-set-search-path (path) |
346 | (let* ((add (if (equal "+" (car path)) | |
347 | t | |
348 | nil)) | |
349 | (paths (if add (cadr path) (car path)))) | |
349 | (let* ((add (equal "+" (car path))) | |
350 | (minus (equal "-" (car path))) | |
351 | (paths (if (or add minus) (cadr path) (car path)))) | |
350 | 352 | (if add |
351 | 353 | (set-search-path-plus paths) |
352 | (set-search-path paths)))) | |
354 | (if minus | |
355 | (set-search-path-minus paths) | |
356 | (set-search-path paths))))) | |
353 | 357 | |
354 | 358 | (defun chaos-set-tram-path (path) |
355 | 359 | (let ((path (car path))) |
494 | 494 | (setq *chaos-libpath* |
495 | 495 | (append (nreverse path) *chaos-libpath*)))) |
496 | 496 | |
497 | (defun set-search-path-minus (paths) | |
498 | (when (consp paths) (setq paths (car paths))) | |
499 | (let ((path nil)) | |
500 | (dolist (p (parse-with-delimiter paths #\:)) | |
501 | (push p path)) | |
502 | (dolist (p path) | |
503 | (if (not (member p *chaos-libpath* :test #'equal)) | |
504 | (with-output-chaos-warning () | |
505 | (format t "The path ~s does not in 'libpath'." p)) | |
506 | (setq *chaos-libpath* (remove p *chaos-libpath* :test #'equal)))) | |
507 | *chaos-libpath*)) | |
508 | ||
497 | 509 | ;;; |
498 | 510 | ;;; INITIALIZATION |
499 | 511 | ;;; |