[system] / trunk / pg / macros / parserNumberWithUnits.pl Repository:
ViewVC logotype

View of /trunk/pg/macros/parserNumberWithUnits.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6058 - (download) (as text) (annotate)
Thu Jun 25 23:28:44 2009 UTC (10 years, 6 months ago) by gage
File size: 1683 byte(s)
syncing pg HEAD with pg2.4.7 on 6/25/2009

    1 ################################################################################
    2 # WeBWorK Online Homework Delivery System
    3 # Copyright  2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
    4 # $CVSHeader$
    5 #
    6 # This program is free software; you can redistribute it and/or modify it under
    7 # the terms of either: (a) the GNU General Public License as published by the
    8 # Free Software Foundation; either version 2, or (at your option) any later
    9 # version, or (b) the "Artistic License" which comes with this package.
   10 #
   11 # This program is distributed in the hope that it will be useful, but WITHOUT
   12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13 # FOR A PARTICULAR PURPOSE.  See either the GNU General Public License or the
   14 # Artistic License for more details.
   15 ################################################################################
   16 
   17 =head1 NAME
   18 
   19 parserNumberWithUnits.pl - Implements a number with units.
   20 
   21 =head1 DESCRIPTION
   22 
   23 This is a Parser class that implements a number with units.
   24 It is a temporary version until the Parser can handle it
   25 directly.
   26 
   27 Use NumberWithUnits("num units") or NumberWithUnits(formula,"units")
   28 to generate a NumberWithUnits object, and then call its cmp method
   29 to get an answer checker for your number with units.
   30 
   31 Usage examples:
   32 
   33   ANS(NumberWithUnits("3 ft")->cmp);
   34   ANS(NumberWithUnits("$a*$b ft")->cmp);
   35   ANS(NumberWithUnits($a*$b,"ft")->cmp);
   36 
   37 We now call on the Legacy version, which is used by
   38 num_cmp to handle numbers with units.
   39 
   40 =cut
   41 
   42 loadMacros('MathObjects.pl');
   43 
   44 sub _parserNumberWithUnits_init {
   45   main::PG_restricted_eval('sub NumberWithUnits {Parser::Legacy::NumberWithUnits->new(@_)}');
   46 }
   47 
   48 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9