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

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

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

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

Legend:
Removed from v.5550  
changed lines
  Added in v.5551

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9