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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 08 Feb 2007 06:28:30 -0000


raeburn		Thu Feb  8 01:28:30 2007 EDT

  Modified files:              
    /loncom	lonmaxima 
  Log:
  One solution to slow processing of computations -make this a while() loop.   
  
  
Index: loncom/lonmaxima
diff -u loncom/lonmaxima:1.23 loncom/lonmaxima:1.24
--- loncom/lonmaxima:1.23	Fri Feb  2 23:09:30 2007
+++ loncom/lonmaxima	Thu Feb  8 01:28:30 2007
@@ -3,7 +3,7 @@
 # The LearningOnline Network with CAPA
 # Connect to MAXIMA CAS
 #
-# $Id: lonmaxima,v 1.23 2007/02/03 04:09:30 raeburn Exp $
+# $Id: lonmaxima,v 1.24 2007/02/08 06:28:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -259,8 +259,8 @@
            while (my $cmd=<$client>) {
               &status('Processing command');
               print $command &unescape($cmd);
-              my ($reply,$finished,$syntaxerr) = &getmaximaoutput($command);
-              if ((!$finished) && (!$syntaxerr) && ($reply !~ /^Error\:/)) {
+              my ($reply,$finished,$syntaxerr);
+              while ((!$finished) && (!$syntaxerr) && ($reply !~ /^Error\:/)) {
                   ($reply,$finished,$syntaxerr) = &getmaximaoutput($command);
               }
               print $client &escape($reply)."\n";
@@ -304,7 +304,7 @@
 
 sub getmaximaoutput {
     my ($command)=@_;
-    my (undef,$error,undef,$output)=$command->expect(20, -re => '\(\%i\d+\)');
+    my (undef,$error,undef,$output)=$command->expect(20, -re => '^\(\%i\d+\)');
     if ($error) {
        return 'Error: '.$error;
     }