Function returning the version number



Oh, sorry -- I forgot to include the patch. Here it is.

best

Robert Dodier

PS.
Index: src/macsys.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/macsys.lisp,v
retrieving revision 1.83
diff -u -r1.83 macsys.lisp
--- src/macsys.lisp	6 Sep 2010 22:18:16 -0000	1.83
+++ src/macsys.lisp	20 Mar 2011 20:10:05 -0000
@@ -359,23 +359,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)