public function get_maxima_available()
 {
     if ('unix' != stack_connection_helper::get_platform()) {
         return stack_string('healthunabletolistavail');
     }
     $this->command = 'maxima --list-avail';
     $rawresult = $this->call_maxima('');
     return $rawresult;
 }
 public function compute($command)
 {
     $context = "Platform: " . stack_connection_helper::get_platform() . "\n";
     $context .= "Maxima shell command: " . $this->command . "\n";
     $context .= "Maxima initial command: " . $this->initcommand . "\n";
     $context .= "Maxima timeout: " . $this->timeout;
     $this->debug->log('Context used', $context);
     $this->debug->log('Maxima command', $command);
     $rawresult = $this->call_maxima($command);
     $this->debug->log('CAS result', $rawresult);
     $unpackedresult = $this->unpack_raw_result($rawresult);
     $this->debug->log('Unpacked result as', print_r($unpackedresult, true));
     if (!stack_connection_helper::check_stackmaxima_version($unpackedresult)) {
         stack_connection_helper::warn_about_version_mismatch($this->debug);
     }
     return $unpackedresult;
 }
 protected function guess_maxima_command($path)
 {
     global $CFG;
     if (stack_connection_helper::get_platform() == 'unix-optimised') {
         // We are trying to use a Lisp snapshot of Maxima with all the
         // STACK libraries loaded.
         $lispimage = $CFG->dataroot . '/stack/maxima-optimised';
         if (is_readable($lispimage)) {
             return $lispimage;
         }
     }
     if (is_readable('/Applications/Maxima.app/Contents/Resources/maxima.sh')) {
         // This is the path on Macs, if Maxima has been installed following
         // the instructions on Sourceforge.
         return '/Applications/Maxima.app/Contents/Resources/maxima.sh';
     }
     // Default guess on Linux.
     return 'maxima';
 }