[system] / trunk / pg / lib / Value.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2579 Revision 2592
97# 97#
98sub showClass { 98sub showClass {
99 my $value = shift; 99 my $value = shift;
100 return "'".$value."'" unless ref($value); 100 return "'".$value."'" unless ref($value);
101 my $class = class($value); 101 my $class = class($value);
102 $class .= ' Number' if $class =~ m/^(Real|Complex)$/;
103 $class .= ' of Intervals' if $class eq 'Union';
102 return showType($value->{tree}) if $class eq 'Formula'; 104 return showType($value->{tree}) if $class eq 'Formula';
103 return 'an '.$class if substr($class,0,1) =~ m/[aeio]/i; 105 return 'an '.$class if substr($class,0,1) =~ m/[aeio]/i;
104 return 'a '.$class; 106 return 'a '.$class;
105} 107}
106 108
281 my $sprec = $$context->{precedence}{class($self)}; 283 my $sprec = $$context->{precedence}{class($self)};
282 my $oprec = $$context->{precedence}{class($other)}; 284 my $oprec = $$context->{precedence}{class($other)};
283 return defined($oprec) && $sprec < $oprec; 285 return defined($oprec) && $sprec < $oprec;
284} 286}
285 287
288sub promote {shift}
289
286# 290#
287# Default stub to call when no function is defined for an operation 291# Default stub to call when no function is defined for an operation
288# 292#
289sub nomethod { 293sub nomethod {
290 my ($l,$r,$flag,$op) = @_; 294 my ($l,$r,$flag,$op) = @_;
378 382
379sub ijk { 383sub ijk {
380 Value::Error("Can't use method 'ijk' with objects of type '".(shift)->class."'"); 384 Value::Error("Can't use method 'ijk' with objects of type '".(shift)->class."'");
381} 385}
382 386
383use carp;
384# 387#
385# Report an error 388# Report an error
386# 389#
387sub Error { 390sub Error {
388 my $message = shift; 391 my $message = shift;
389 $$context->setError($message,''); 392 $$context->setError($message,'');
393# die $message . traceback();
390 die $message . Value::getCaller(); 394 die $message . getCaller();
391} 395}
392 396
393# 397#
394# Try to locate the line and file where the error occurred 398# Try to locate the line and file where the error occurred
395# 399#
427use Value::List; 431use Value::List;
428use Value::Interval; 432use Value::Interval;
429use Value::Union; 433use Value::Union;
430# use Value::Formula; 434# use Value::Formula;
431 435
436use Value::AnswerChecker; # for WeBWorK
437
438###########################################################################
439
440use vars qw($installed);
441$Value::installed = 1;
442
443###########################################################################
432########################################################################### 444###########################################################################
433# 445#
434# To Do: 446# To Do:
435# 447#
436# Make a class for infinity? 448# Make a class for infinity?

Legend:
Removed from v.2579  
changed lines
  Added in v.2592

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9