version 1.23, 2007/02/03 04:09:30
|
version 1.25, 2007/02/08 10:08:02
|
Line 259 sub make_new_child {
|
Line 259 sub make_new_child {
|
while (my $cmd=<$client>) { |
while (my $cmd=<$client>) { |
&status('Processing command'); |
&status('Processing command'); |
print $command &unescape($cmd); |
print $command &unescape($cmd); |
my ($reply,$finished,$syntaxerr) = &getmaximaoutput($command); |
my ($reply,$finished,$syntaxerr) = &getmaximaoutput($command,1); |
if ((!$finished) && (!$syntaxerr) && ($reply !~ /^Error\:/)) { |
|
($reply,$finished,$syntaxerr) = &getmaximaoutput($command); |
|
} |
|
print $client &escape($reply)."\n"; |
print $client &escape($reply)."\n"; |
if ($reply=~/^Error\:/) { |
if ($reply=~/^Error\:/) { |
&logthis('Died through '.$reply); |
&logthis('Died through '.$reply); |
Line 294 sub make_new_child {
|
Line 291 sub make_new_child {
|
my $expect=$counter.time; |
my $expect=$counter.time; |
print $command "$expect;\n"; |
print $command "$expect;\n"; |
while (1) { |
while (1) { |
my $output=&getmaximaoutput($command); |
my $output=&getmaximaoutput($command,1); |
if (($output=~/\Q$expect\E/) || ($output=~/^Error\:/)) { |
if (($output=~/\Q$expect\E/) || ($output=~/^Error\:/)) { |
return; |
return; |
} |
} |
Line 303 sub make_new_child {
|
Line 300 sub make_new_child {
|
} |
} |
|
|
sub getmaximaoutput { |
sub getmaximaoutput { |
my ($command)=@_; |
my ($command,$numcheck)=@_; |
my (undef,$error,undef,$output)=$command->expect(20, -re => '\(\%i\d+\)'); |
my $regexp = '\(\%i\d+\)'; |
|
if ($numcheck) { |
|
if ($command->match() =~ /\(\%i(\d+)\)/) { |
|
my $nextmatch = $1+1; |
|
$regexp = '\(\%i'.$nextmatch.'\)'; |
|
} |
|
} |
|
my (undef,$error,undef,$output)=$command->expect(20, -re => $regexp); |
if ($error) { |
if ($error) { |
return 'Error: '.$error; |
return 'Error: '.$error; |
} |
} |