How to find out runtime version of Maxima? (confused by new format of eigenvectors() in 5.19.2)
Subject: How to find out runtime version of Maxima? (confused by new format of eigenvectors() in 5.19.2)
From: Robert Dodier
Date: Wed, 16 Sep 2009 11:12:15 -0600
On 9/16/09, Chris Sangwin <sangwinc at for.mat.bham.ac.uk> wrote:
> MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*,
> 'digitcharp));
> MAXIMA_VERSION_NUM:float(MAXIMA_VERSION[2]+MAXIMA_VERSION[3]/10),
Well, orderlessp compares lists directly -- no need to smash
it into a number. Also, it's not guaranteed that versions are
composed solely of numbers -- could be letters too.
> ... in any case I'd love to have some way of knowing the runtime version
> of Maxima which is stable over future versions inside the Maxima core!
Well, here's an idea I had a while ago. Maybe it's time for this.
What does anyone think of this? Idea is for build_info to return
an expression instead of just print stuff to the console.
The return value is a structure. You can extract bits of it via "@".
(Sorry, undocumented features here ....)
With the following patch applied, I get this:
(%i2) foo : build_info () $
(%i3) foo;
(%o3)
Maxima version: 5.19post
Maxima build date: 2009-09-12 19:43:57
Host type: i686-pc-linux-gnu
Lisp implementation type: CLISP
Lisp implementation version: 2.46 (2008-07-02) (built 3427839018)
(memory 3461795063)
(%i4) foo at version;
(%o4) 5.19post
(%i5) foo at timestamp;
(%o5) 2009-09-12 19:43:57
(%i6) grind (foo);
?%build_info("5.19post","2009-09-12 19:43:57",
"i686-pc-linux-gnu","CLISP",
"2.46 (2008-07-02) (built 3427839018) (memory 3461795063)")$
What does anything think of that? Yes / no / maybe ??
HTH
Robert Dodier
PS.
Index: src/macsys.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/macsys.lisp,v
retrieving revision 1.75
diff -u -r1.75 macsys.lisp
--- src/macsys.lisp 10 Sep 2009 03:12:05 -0000 1.75
+++ src/macsys.lisp 16 Sep 2009 16:25:30 -0000
@@ -343,23 +343,57 @@
(format t (intl:gettext "Submit bug reports by following the 'Add
new' link on that page.~%"))
(format t (intl:gettext "Please include the following information
with your bug report:~%"))
(format t "-------------------------------------------------------------~%")
- ($build_info)
+ (displa ($build_info))
(format t "-------------------------------------------------------------~%")
(format t (intl:gettext "The above information is also reported by
the function 'build_info'.~%~%"))
"")
+(defstruct1 '((%build_info) $version $timestamp $host $lisp_name
$lisp_version))
+
+(defvar *maxima-build-info* nil)
+
(defmfun $build_info ()
- (format t (intl:gettext "~%Maxima version: ~a~%") *autoconf-version*)
- (format t (intl:gettext "Maxima build date: ~a:~a ~a/~a/~a~%")
- (third cl-user:*maxima-build-time*)
- (second cl-user:*maxima-build-time*)
- (fifth cl-user:*maxima-build-time*)
- (fourth cl-user:*maxima-build-time*)
- (sixth cl-user:*maxima-build-time*))
- (format t (intl:gettext "Host type: ~a~%") *autoconf-host*)
- (format t (intl:gettext "Lisp implementation type: ~a~%")
(lisp-implementation-type))
- (format t (intl:gettext "Lisp implementation version: ~a~%~%")
(lisp-implementation-version))
- "")
+ (or
+ *maxima-build-info*
+ (setq
+ *maxima-build-info*
+ (let
+ ((year (sixth cl-user:*maxima-build-time*))
+ (month (fifth cl-user:*maxima-build-time*))
+ (day (fourth cl-user:*maxima-build-time*))
+ (hour (third cl-user:*maxima-build-time*))
+ (minute (second cl-user:*maxima-build-time*))
+ (seconds (first cl-user:*maxima-build-time*)))
+ (mfuncall
+ '$new
+ `((%build_info)
+ ,*autoconf-version*
+ ,(format nil "~4,'0d-~2,'0d-~2,'0d ~2,'0d:~2,'0d:~2,'0d"
year month day hour minute seconds)
+ ,*autoconf-host*
+ ,(lisp-implementation-type)
+ ,(lisp-implementation-version)))))))
+
+(defun dimension-build-info (form result)
+ (declare (special bkptht bkptdp lines break))
+ (let
+ ((version-string (format nil (intl:gettext "Maxima version: ~a")
(mfuncall '$@ form '$version)))
+ (timestamp-string (format nil (intl:gettext "Maxima build date:
~a") (mfuncall '$@ form '$timestamp)))
+ (host-string (format nil (intl:gettext "Host type: ~a")
(mfuncall '$@ form '$host)))
+ (lisp-name-string (format nil (intl:gettext "Lisp implementation
type: ~a") (mfuncall '$@ form '$lisp_name)))
+ (lisp-version-string (format nil (intl:gettext "Lisp
implementation version: ~a") (mfuncall '$@ form '$lisp_version)))
+ (bkptht 1)
+ (bkptdp 1)
+ (lines 0)
+ (break 0))
+ (forcebreak result 0)
+ (forcebreak (reverse (coerce version-string 'list)) 0)
+ (forcebreak (reverse (coerce timestamp-string 'list)) 0)
+ (forcebreak (reverse (coerce host-string 'list)) 0)
+ (forcebreak (reverse (coerce lisp-name-string 'list)) 0)
+ (forcebreak (reverse (coerce lisp-version-string 'list)) 0))
+ nil)
+
+(setf (get '%build_info 'dimension) 'dimension-build-info)
(defvar *maxima-started* nil)