[LON-CAPA-cvs] cvs: loncom / lonmaxima

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Thu, 02 Aug 2007 13:04:55 -0000


bisitz		Thu Aug  2 09:04:55 2007 EDT

  Modified files:              
    /loncom	lonmaxima 
  Log:
  Critical bug removed:
  For multiline Maxima "%o"-output, only the first line has been used. Now, all lines will be processed.
  
  Example:
  diff((sin(x)^2-cos(x^2))/sin(x),x,1);
  
  lonmaxima.session.log:
  (%o2) (2*x*sin(x^2)+2*cos(x)*sin(x))/sin(x)
         -cos(x)*(sin(x)^2-cos(x^2))/sin(x)^2
  
  LON-CAPA:
  (2*x*sin(x^2)+2*cos(x)*sin(x))/sin(x)
  Only the first line has been passed over to LON-CAPA.
  
  
Index: loncom/lonmaxima
diff -u loncom/lonmaxima:1.30 loncom/lonmaxima:1.31
--- loncom/lonmaxima:1.30	Tue Jun 12 19:48:45 2007
+++ loncom/lonmaxima	Thu Aug  2 09:04:55 2007
@@ -3,7 +3,7 @@
 # The LearningOnline Network with CAPA
 # Connect to MAXIMA CAS
 #
-# $Id: lonmaxima,v 1.30 2007/06/12 23:48:45 albertel Exp $
+# $Id: lonmaxima,v 1.31 2007/08/02 13:04:55 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -346,9 +346,10 @@
        if ($line=~/\;/) { $foundoutput=1; next; }
        if (!$foundoutput) { next; }
        if ($line=~/^Incorrect syntax:/) { $syntaxerr = 1; next; }
-       (my $label, $line) = ($line=~ /^(\(\%o\d+\))(.+)$/);
-       if ($label) {
-           $label=~s/\S/ /g;
+       if ( $line=~ /^(\(\%o\d+\))(.+)$/){
+           my $label = $1;
+           $line = $2;
+           $label =~s/\S/ /g;
            $line=$label.$line;
        }
        $realoutput.=$line."\n";