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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4666 - (view) (download) (as text)

1 : dpvc 2731 loadMacros('Parser.pl');
2 :    
3 :     sub _parserNumberWithUnits_init {}; # don't reload this file
4 :    
5 :     ######################################################################
6 :     #
7 :     # This is a Parser class that implements a number with units.
8 :     # It is a temporary version until the Parser can handle it
9 :     # directly.
10 :     #
11 :     # Use NumberWithUnits("num units") or NumberWithUnits(formula,"units")
12 :     # to generate a NumberWithUnits object, and then call its cmp method
13 :     # to get an answer checker for your number with units.
14 :     #
15 :     # Usage examples:
16 :     #
17 :     # ANS(NumberWithUnits("3 ft")->cmp);
18 :     # ANS(NumberWithUnits("$a*$b ft")->cmp);
19 :     # ANS(NumberWithUnits($a*$b,"ft")->cmp);
20 :     #
21 :    
22 :     #
23 : dpvc 4666 # We now call on the Legacy version, which is used by
24 :     # num_cmp to handle numbers with units.
25 : dpvc 2731 #
26 : dpvc 4666 sub NumberWithUnits {Parser::Legacy::NumberWithUnits->new(@_)}
27 : dpvc 2731
28 :     1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9