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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5551 - (download) (as text) (annotate)
Tue Oct 2 20:48:05 2007 UTC (12 years, 2 months ago) by sh002i
File size: 882 byte(s)
improved formatting for docs -- these were in pod sections but were all
formatted as verbatim sections, and i moved them into normal paragraphs,
lists, etc. should make things more readable from the web.

    1 =head1 NAME
    2 
    3 parserFormulaWithUnits.pl - Implements a formula with units.
    4 
    5 =head1 DESCRIPTION
    6 
    7 This is a Parser class that implements a formula with units.
    8 It is a temporary version until the Parser can handle it
    9 directly.
   10 
   11 Use FormulaWithUnits("num units") or FormulaWithUnits(formula,"units")
   12 to generate a FormulaWithUnits object, and then call its cmp() method
   13 to get an answer checker for your formula with units.
   14 
   15 Usage examples:
   16 
   17     ANS(FormulaWithUnits("3x+1 ft")->cmp);
   18     ANS(FormulaWithUnits("$a*x+1 ft")->cmp);
   19 
   20     $x = Formula("x");
   21     ANS(FormulaWithUnits($a*$x+1,"ft")->cmp);
   22 
   23 =cut
   24 
   25 loadMacros('MathObjects.pl');
   26 
   27  #
   28  #  Now uses the version in Parser::Legacy::NumberWithUnits
   29  #  to avoid duplication of common code.
   30  #
   31 
   32 sub _parserFormulaWithUnits_init {
   33   main::PG_restricted_eval('sub FormulaWithUnits {Parser::Legacy::FormulaWithUnits->new(@_)}');
   34 }
   35 
   36 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9