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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : dpvc 5371 loadMacros("MathObjects.pl","contextString.pl");
2 : dpvc 2824
3 : gage 4997 =head3 Context("TF")
4 :    
5 : dpvc 5373 ##########################################################
6 :     #
7 :     # Implements contexts for string-valued answers especially
8 :     # for matching problems (where you match against T and F).
9 :     #
10 :     # Context("TF");
11 :     #
12 :     # You can add new strings to the context as needed (or remove old ones)
13 :     # via the Context()->strings->add() and Context()-strings->remove()
14 :     # methods.
15 :     #
16 :     # Use:
17 :     #
18 :     # ANS(string_cmp("T","F"));
19 :     #
20 :     # when there are two answers, the first being "T" and the second being "F".
21 :     #
22 : dpvc 2824
23 : gage 4997 =cut
24 :    
25 : dpvc 5392 sub _contextTF_init {
26 : dpvc 2824
27 : dpvc 5392 my $context = $main::context{TF} = Parser::Context->getCopy("String");
28 : dpvc 5441 $context->{name} = "TF";
29 : dpvc 5392 $context->strings->are(
30 :     "T" => {value => 1},
31 :     "F" => {value => 0},
32 :     "True" => {alias => "T"},
33 :     "False" => {alias => "F"},
34 :     );
35 : dpvc 2824
36 : dpvc 5392 main::Context("TF"); ### FIXME: probably should require author to set this explicitly
37 :     }
38 :    
39 : dpvc 5373 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9