Parent Directory
|
Revision Log
merged changes from rel-2-1-a1 -- stop using that branch.
1 ######################################################################### 2 # 3 # Implements functions that require complex inputs 4 # 5 package Parser::Function::complex; 6 use strict; use vars qw(@ISA); 7 @ISA = qw(Parser::Function); 8 9 # 10 # Check that the argument is complex, and 11 # mark the result as real or complex, as appropriate. 12 # 13 sub _check { 14 my $self = shift; 15 return $self->checkComplex(@_) if $self->{def}{complex}; 16 return $self->checkReal(@_); 17 } 18 19 # 20 # Evaluate by calling the appropriate routine from Value.pm. 21 # 22 sub _eval { 23 my $self = shift; my $name = $self->{name}; 24 my $c = Value::Complex::promote($_[0]); 25 $c->$name; 26 } 27 28 # 29 # Check for the right number of arguments. 30 # Convert argument to a complex (does error checking) 31 # and then call the appropriate routine from Value.pm. 32 # 33 sub _call { 34 my $self = shift; my $name = shift; 35 Value::Error("Function '$name' has too many inputs") if scalar(@_) > 1; 36 Value::Error("Function '$name' has too few inputs") if scalar(@_) == 0; 37 my $c = Value::Complex::promote($_[0]); 38 $c->$name; 39 } 40 41 ######################################################################### 42 43 1; 44
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |