[LON-CAPA-cvs] cvs: modules /gerd/maxima lonmaxima.pm

bisitz lon-capa-cvs@mail.lon-capa.org
Mon, 12 Jun 2006 14:22:04 -0000


bisitz		Mon Jun 12 10:22:04 2006 EDT

  Modified files:              
    /modules/gerd/maxima	lonmaxima.pm 
  Log:
  mathresponse successfully calls lonmaxima
  
  
Index: modules/gerd/maxima/lonmaxima.pm
diff -u modules/gerd/maxima/lonmaxima.pm:1.3 modules/gerd/maxima/lonmaxima.pm:1.4
--- modules/gerd/maxima/lonmaxima.pm:1.3	Mon Jun 12 09:51:13 2006
+++ modules/gerd/maxima/lonmaxima.pm	Mon Jun 12 10:22:01 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Interface routines to MAXIMA CAS
 #
-# $Id: lonmaxima.pm,v 1.3 2006/06/12 13:51:13 bisitz Exp $
+# $Id: lonmaxima.pm,v 1.4 2006/06/12 14:22:01 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,6 +31,7 @@
 use strict;
 use IO::Socket;
 use Apache::lonnet;
+use LONCAPA;
 
 sub connect {
    return IO::Socket::UNIX->new(Peer    => $Apache::lonnet::perlvar{'lonSockDir'}.'/maximasock',
@@ -46,11 +47,11 @@
 sub maximareply {
     my ($socket,$cmd)=@_;
     if ($socket) {
-	print $socket &Apache::lonnet::escape($cmd)."\n";
+	print $socket &escape($cmd)."\n";
         my $reply=<$socket>;
         chomp($reply);
         if ($reply=~/^Incorrect/) { $reply='Error: '.$reply; }
-        return &Apache::lonnet::unescape($reply);
+        return &unescape($reply);
     } else {
         return 'Error: no connection.';
     }
@@ -82,6 +83,10 @@
         $points,
         $randomseed,
         $reterror) = @_;
+    my $socket=&connect();
+    my $reply=&compareterms($socket,$response,$answer);
+    &disconnect($socket);
+    if ($reply eq 'true') { return 1; }
     return 7;
 }