version 1.2, 2009/04/17 00:34:46
|
version 1.4, 2009/04/18 16:03:14
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# |
# |
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# Connect to MAXIMA CAS |
# Connect to R CAS |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 316 sub make_new_child {
|
Line 316 sub make_new_child {
|
sub sync { |
sub sync { |
my ($command)=@_; |
my ($command)=@_; |
$counter++; |
$counter++; |
my $expect=$counter.time; |
my $expect=$counter; |
print $command "$expect;\n"; |
print $command "$expect;\n"; |
while (1) { |
while (1) { |
my $output=&getroutput($command); |
my $output=&getroutput($command); |
Line 352 sub getroutput {
|
Line 352 sub getroutput {
|
foreach my $line (split(/\n/,$output)) { |
foreach my $line (split(/\n/,$output)) { |
$line=~s/\s$//gs; |
$line=~s/\s$//gs; |
if ($line=~/^Error\:/) { $syntaxerr=1; next; } |
if ($line=~/^Error\:/) { $syntaxerr=1; next; } |
if (my ($result)=($line=~/^\[\d+\,*\]\s*(.*)/)) { $realoutput.=$result."\n"; } |
if (my ($result)=($line=~/^\[?\d+\,*\]?\s*(.*)/)) { $realoutput.=$result."\n"; } |
} |
} |
if (wantarray) { |
if (wantarray) { |
return ($realoutput,$syntaxerr); |
return ($realoutput,$syntaxerr); |