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

Diff of /trunk/pg/macros/PG.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1140 Revision 1253
105 105
106 106
107=cut 107=cut
108 108
109sub DOCUMENT { 109sub DOCUMENT {
110
110 $STRINGforOUTPUT =""; 111 $STRINGforOUTPUT ="";
111 $STRINGforHEADER_TEXT =""; 112 $STRINGforHEADER_TEXT ="";
112 @PG_ANSWERS=(); 113 @PG_ANSWERS=();
113 @main::PG_ANSWER_ENTRY_ORDER = (); 114
114 @PG_UNLABELED_ANSWERS = (); 115 @PG_UNLABELED_ANSWERS = ();
115 %PG_ANSWERS_HASH = (); 116 %PG_ANSWERS_HASH = ();
117 # FIXME: We are initializing these variables into both Safe::Root1 (the cached safe compartment)
118 # and Safe::Root2 (the current one)
119 # There is a good chance they won't be properly updated in one or the other of these compartments.
120
121 @main::PG_ANSWER_ENTRY_ORDER = ();
116 $main::ANSWER_PREFIX = 'AnSwEr'; 122 $main::ANSWER_PREFIX = 'AnSwEr';
117 %main::PG_FLAGS=(); #global flags 123 %main::PG_FLAGS=(); #global flags
118 $main::showPartialCorrectAnswers = 0 unless defined($main::showPartialCorrectAnswers ); 124 $main::showPartialCorrectAnswers = 0 unless defined($main::showPartialCorrectAnswers );
119 $main::showHint = 1 unless defined($main::showHint); 125 $main::showHint = 1 unless defined($main::showHint);
120 $main::solutionExists =0; 126 $main::solutionExists =0;
121 $main::hintExists =0; 127 $main::hintExists =0;
122 %main::gifs_created = (); 128 %main::gifs_created = ();
123 129 eval(q!
130 @main::PG_ANSWER_ENTRY_ORDER = ();
131 $main::ANSWER_PREFIX = 'AnSwEr';
132 %main::PG_FLAGS=(); #global flags
133 $main::showPartialCorrectAnswers = 0 unless defined($main::showPartialCorrectAnswers );
134 $main::showHint = 1 unless defined($main::showHint);
135 $main::solutionExists =0;
136 $main::hintExists =0;
137 %main::gifs_created = ();
138 !);
124 die "The environment variable envir has not been defined" unless defined(%main::envir); 139 die "The environment variable envir has not been defined" unless defined(%main::envir);
125 140
126 foreach my $var ( keys %main::envir ) { 141 foreach my $var ( keys %main::envir ) {
127 eval("\$main::$var =\$main::envir{'$var'}"); 142 eval("\$main::$var =\$main::envir{'$var'}");
128 warn "Problem defining ", q{\$main::$var}, " while inititializing the PG problem: $@" if $@; 143 warn "Problem defining ", q{\$main::$var}, " while inititializing the PG problem: $@" if $@;
129 } 144 }
130 145 eval(q!
131 @main::submittedAnswers = @{$main::refSubmittedAnswers} if defined($main::refSubmittedAnswers); 146 @main::submittedAnswers = @{$main::refSubmittedAnswers} if defined($main::refSubmittedAnswers);
132 $main::PG_original_problemSeed = $main::problemSeed; 147 $main::PG_original_problemSeed = $main::problemSeed;
133 $main::PG_random_generator = new PGrandom($main::problemSeed) || die "Can't create random number generator."; 148 $main::PG_random_generator = new PGrandom($main::problemSeed) || die "Can't create random number generator.";
134 $main::ans_rule_count = 0; # counts questions 149 $main::ans_rule_count = 0; # counts questions
135 150
136 # end unpacking of environment variables. 151 # end unpacking of environment variables.
137 $main::QUIZ_PREFIX = '' unless defined($main::QUIZ_PREFIX) 152 $main::QUIZ_PREFIX = '' unless defined($main::QUIZ_PREFIX)
153
154 !);
155 @main::submittedAnswers = @{$main::refSubmittedAnswers} if defined($main::refSubmittedAnswers);
156 $main::PG_original_problemSeed = $main::problemSeed;
157 $main::PG_random_generator = new PGrandom($main::problemSeed) || die "Can't create random number generator.";
158 $main::ans_rule_count = 0; # counts questions
159
160 # end unpacking of environment variables.
161 $main::QUIZ_PREFIX = '' unless defined($main::QUIZ_PREFIX)
162
138} 163}
139 164
140# HEADER_TEXT is for material which is destined to be placed in the header of the html problem -- such 165# HEADER_TEXT is for material which is destined to be placed in the header of the html problem -- such
141# as javaScript code. 166# as javaScript code.
142 167

Legend:
Removed from v.1140  
changed lines
  Added in v.1253

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9