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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5371 - (download) (as text) (annotate)
Sun Aug 19 00:56:25 2007 UTC (12 years, 6 months ago) by dpvc
File size: 2119 byte(s)
Changed Parser.pl to MathObjects.pl

    1 
    2 ####################################################################
    3 # Copyright @ 1995-2007 University of Rochester
    4 # All Rights Reserved
    5 ####################################################################
    6 
    7 =head1 NAME
    8 
    9   PGinfo.pl
   10 
   11 =cut
   12 
   13 Provides macros for determining the values of the current context in which the problem
   14 is being written.
   15 
   16 loadMacros("MathObjects.pl");
   17 
   18 =head3  listVariables
   19 
   20 Usage:  listVariables();
   21 
   22 Prints all variables submitted in the problem form and all variables in the
   23 the Problem environment and all of the flag variables in Context().
   24 This is used for debugging and to determine the current
   25 context for the problem.
   26 
   27 =cut
   28 
   29 
   30 sub listVariables {
   31   TEXT($HR,"Form variables",$BR );
   32   listFormVariables();
   33   TEXT($HR,"Environment variables",$BR );
   34   listEnvironmentVariables();
   35   TEXT($HR,"Context flags",$BR );
   36   listContextFlags();
   37 }
   38 
   39 =head4 listFormVariables()
   40 
   41   Called by listVariables to print out the input form variables.
   42 
   43 =cut
   44 
   45 sub listFormVariables {
   46     # Lists all of the variables filled out on the input form
   47   # Useful for debugging
   48     TEXT(pretty_print($inputs_ref));
   49 
   50 }
   51 
   52 =head4 listEnvironmentVariables()
   53 
   54   Called by listVariables to print out the environment variables (in %envir).
   55 
   56 =cut
   57 
   58 
   59 sub listEnvironmentVariables {
   60     # list the environment variables
   61     TEXT(pretty_print(\%envir));
   62 }
   63 
   64 =head4 listContextFlags()
   65 
   66   Called by listVariables to print out context flags for Math Objects.
   67 
   68 =cut
   69 
   70 sub listContextFlags {
   71   my $context = $$Value::context->{flags};
   72   TEXT(pretty_print($context));
   73 }
   74 
   75 =head3 listContext()
   76 
   77   Usage:  listContext(Context())
   78 
   79   Prints out the contents of the current context hash -- includes flags and much more
   80 
   81 =cut
   82 
   83 sub listContext {  # include
   84   my $context = shift;
   85   return TEXT("$PAR Error in listContext:  usage:  listContext(Context()); # must specify a context to list $BR") unless defined $context;
   86   foreach $key (keys %$context) {
   87     next if $key =~/^_/; # skip if it begins with
   88     TEXT($HR, $key, $BR);
   89     TEXT( pretty_print($context->{$key}) );
   90   }
   91 }
   92 sub pp {
   93     my $hash = shift;
   94     "printing |". ref($hash)."|$BR". pretty_print($hash);
   95 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9