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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9