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

View of /trunk/pg/macros/contextTF.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, 8 months ago) by gage
File size: 1774 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 contextTF.pl - Imlements contexts for true/false problems.
   20 
   21 =head1 DESCRIPTION
   22 
   23 Implements contexts for string-valued answers especially
   24 for matching problems (where you match against T and F).
   25 
   26   Context("TF");
   27 
   28 You can add new strings to the context as needed (or remove old ones)
   29 via the Context()->strings->add() and Context()-strings->remove()
   30 methods.
   31 
   32 Use:
   33 
   34   ANS(string_cmp("T","F"));
   35 
   36 when there are two answers, the first being "T" and the second being "F".
   37 
   38 =cut
   39 
   40 loadMacros("MathObjects.pl","contextString.pl");
   41 
   42 sub _contextTF_init {
   43 
   44   my $context = $main::context{TF} = Parser::Context->getCopy("String");
   45   $context->{name} = "TF";
   46   $context->strings->are(
   47     "T" => {value => 1},
   48     "F" => {value => 0},
   49     "True" => {alias => "T"},
   50     "False" => {alias => "F"},
   51   );
   52 
   53   main::Context("TF");  ### FIXME:  probably should require author to set this explicitly
   54 }
   55 
   56 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9