From: James A. <amu...@us...> - 2004-07-24 17:17:10
|
Update of /cvsroot/maxima/maxima/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26779/src Modified Files: nregex.lisp maxima.system maxima-package.lisp macdes.lisp cl-info.lisp Log Message: Let GCL use the maxima info routines instead of its built-in info routines. This allows us to treat the prompt prefix and suffix properly with GCL. Index: nregex.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/nregex.lisp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- nregex.lisp 24 Jul 2003 18:42:33 -0000 1.3 +++ nregex.lisp 24 Jul 2004 17:17:01 -0000 1.4 @@ -23,7 +23,8 @@ ;;; ;;; First we create a copy of macros to help debug the beast -(eval-when (:compile-toplevel :load-toplevel :execute) +(eval-when #-gcl(:compile-toplevel :load-toplevel :execute) + #+gcl(load compile eval) (defpackage "NREGEX" (:use "COMMON-LISP") (:export Index: maxima.system =================================================================== RCS file: /cvsroot/maxima/maxima/src/maxima.system,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- maxima.system 16 Apr 2004 01:40:11 -0000 1.26 +++ maxima.system 24 Jul 2004 17:17:01 -0000 1.27 @@ -32,8 +32,8 @@ :components ((:file "maxima-package") (:file "autoconf-variables"))) (:module info :source-pathname "" - :components (#-gcl(:file "nregex") - #-gcl(:file "cl-info"))) + :components ((:file "nregex") + (:file "cl-info"))) (:module sloop :source-pathname "" :components ((:file "sloop"))) (:module declarations :source-pathname "" Index: maxima-package.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/maxima-package.lisp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- maxima-package.lisp 30 Apr 2004 02:54:28 -0000 1.18 +++ maxima-package.lisp 24 Jul 2004 17:17:01 -0000 1.19 @@ -11,17 +11,10 @@ ;; Create the package CL-INFO that holds the info regex routines. For ;; GCL, we import the necessary symbols we need from SYSTEM, since GCL ;; comes with an info reader. -#-gcl (defpackage "CL-INFO" (:use :common-lisp) (:export "INFO" "*INFO-PATHS*")) -#+gcl -(defpackage "CL-INFO" - (:use "LISP" "SYSTEM") - (:import-from "SYSTEM" "INFO" "*INFO-PATHS*") - (:export "INFO" "*INFO-PATHS")) - #+(and gcl (not ansi-cl)) ;; Traditional GCL may have empty CL package. Delete it. (if (find-package :common-lisp) @@ -142,6 +135,10 @@ #-gcl (import '( cl-info::*info-paths* ) "MAXIMA" ) +#+gcl +(shadowing-import '( cl-info::*info-paths* ) "MAXIMA" ) + + ;; MAXIMA uses LISP package which is legacy CLtL1 for GCL. ;; Thus with ANSI GCL we have to import some symbols from COMMON-LISP ;; package explicitly. Index: macdes.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/macdes.lisp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- macdes.lisp 20 Apr 2004 23:11:31 -0000 1.13 +++ macdes.lisp 24 Jul 2004 17:17:01 -0000 1.14 @@ -114,18 +114,14 @@ (T (merror "BAD ARG"))))))) ;; The documentation is now in INFO format and can be printed using -;; tex, or viewed using info or gnu emacs or using a web browser: -;; http://www.ma.utexas.edu/maxima/ Some versions of maxima built -;; have a builtin info retrieval mechanism. +;; tex, or viewed using info or gnu emacs or using a web browser. All +;; versions of maxima have a builtin info retrieval mechanism. (defmspec $describe (x) (setq x ($sconcat (cadr x))) - #-gcl (let ((cl-info::*prompt-prefix* *prompt-prefix*) (cl-info::*prompt-suffix* *prompt-suffix*)) - (cl-info:info x '("maxima.info") *info-paths*)) - #+gcl - (cl-info:info x '("maxima.info"))) + (cl-info:info x '("maxima.info") *info-paths*))) (defun $apropos ( s ) (cons '(mlist) (apropos-list s "MAXIMA"))) Index: cl-info.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/cl-info.lisp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- cl-info.lisp 20 Apr 2004 22:54:34 -0000 1.15 +++ cl-info.lisp 24 Jul 2004 17:17:01 -0000 1.16 @@ -32,18 +32,61 @@ (defun get-match (s n) (subseq s (match-start n) (match-end n))) -;; Compile the regex pattern in PAT for use by the string matcher. -(defun compile-regex (pat &key (case-sensitive t)) - (let ((*compile-print* nil) - (*compile-verbose* nil) - #+cmu - (*compile-progress* nil) - #+sbcl - (sb-ext:*compile-progress* nil) - ) - (compile nil - (nregex:regex-compile pat :case-sensitive case-sensitive)))) +;; Compile the regex pattern in PAT for use by the string matcher. We +;; precompile three regex's that are used for all queries. If there +;; were any more, I would have put them in a hash table +;; -- jfa 07/24/04 +(let* ((string1 (format nil "Node: ([^~a]*index[^~a]*)~a" + (code-char 127) (code-char 127) (code-char 127))) + (string2 (format nil "Node: Function and Variable Index~a([0-9]+)" + (code-char 127))) + (string3 (format nil "~a[~a~a][^~a]*Node:[~a~a]+Function and Variable Index[,~a~a][^~a]*~a" + (code-char 31) (code-char 10) (code-char 12) + (code-char 10) (code-char 32) (code-char 9) + (code-char 9) (code-char 10) (code-char 10) + (code-char 10))) + (precomp-nil-string1 + (compile nil + (nregex:regex-compile + string1 + :case-sensitive nil))) + (precomp-t-string2 + (compile nil + (nregex:regex-compile + string2 + :case-sensitive t))) + (precomp-t-string3 + (compile nil + (nregex:regex-compile + string3 + :case-sensitive t)))) + (defun compile-regex (pat &key (case-sensitive t)) + (cond + ((and (equal case-sensitive nil) + (string= pat string1)) + precomp-nil-string1) + ((and (equal case-sensitive t) + (string= pat string2)) + precomp-t-string2) + ((and (equal case-sensitive t) + (string= pat string3)) + precomp-t-string3) + (t + (let ((*compile-print* nil) + (*compile-verbose* nil) + #+cmu + (*compile-progress* nil) + #+sbcl + (sb-ext:*compile-progress* nil) + #+gcl + (compiler:*compile-verbose* nil) + ) + (compile nil + (nregex:regex-compile + pat + :case-sensitive case-sensitive)))))) + ) ;; Search the string STRING for the pattern PAT. Only the part of the ;; string bounded by START and END are searched. PAT may either be a ;; string or a compiled regex (which is a function). @@ -62,7 +105,8 @@ (match-start 0)) -1)) -(eval-when (compile eval) +(eval-when (compile load eval) + #-allegro (defmacro while (test &body body) `(loop while ,test do ,@ body)) #+nil @@ -107,12 +151,19 @@ (let ((len (file-length st))) (unless (<= 0 start len) (error "illegal file start ~a" start)) + #-gcl (let ((tem (make-array (- len start) :element-type 'base-char))) (when (> start 0) (file-position st start)) (read-sequence tem st :start 0 :end (length tem)) - tem)))) + tem) + #+gcl + (let ((tem (make-array (- len start) + :element-type 'string-char))) + (if (> start 0) (file-position st start)) + (si::fread tem 0 (length tem) st) tem) + ))) (defun atoi (string start) (parse-integer string :start start :junk-allowed t)) |