version 1.12, 2006/12/19 17:44:16
|
version 1.15, 2007/05/29 20:56:39
|
Line 60 sub maximareply {
|
Line 60 sub maximareply {
|
|
|
sub blacklisted { |
sub blacklisted { |
my ($cmd)=@_; |
my ($cmd)=@_; |
foreach my $forbidden ('save','load','plot','lisp','includ','compil','file','batch','stringout','translat','stout','stin','block','system') { |
foreach my $forbidden ('save','load','plot','lisp','includ','compil', |
|
'file','batch','stringout','translat','stout', |
|
'stin','block','system','concat') { |
if ($cmd=~/$forbidden/s) { return 1; } |
if ($cmd=~/$forbidden/s) { return 1; } |
} |
} |
return 0; |
return 0; |
Line 75 sub runscript {
|
Line 77 sub runscript {
|
if ($line=~/\w/) { $reply=&maximareply($socket,$line.";\n"); } |
if ($line=~/\w/) { $reply=&maximareply($socket,$line.";\n"); } |
if ($reply=~/^Error\:/) { return $reply; } |
if ($reply=~/^Error\:/) { return $reply; } |
} |
} |
$reply=~s/\W//gs; |
$reply=~s/^\s*//gs; |
|
$reply=~s/\s*$//gs; |
|
&Apache::lonxml::debug("maxima $fullscript \n reply $reply"); |
return $reply; |
return $reply; |
} |
} |
|
|
Line 101 sub maxima_run {
|
Line 105 sub maxima_run {
|
} |
} |
my $reply=&runscript($socket,$script); |
my $reply=&runscript($socket,$script); |
&disconnect($socket); |
&disconnect($socket); |
if ($reply=~/^\s*true\s*$/) { return 'EXACT_ANS'; } |
if ($reply=~/^\s*true\s*$/i) { return 'EXACT_ANS'; } |
if ($reply=~/^\s*false\s*/) { return 'INCORRECT'; } |
if ($reply=~/^\s*false\s*$/i) { return 'INCORRECT'; } |
return 'BAD_FORMULA'; |
return 'BAD_FORMULA'; |
} |
} |
|
|