Skip to content

Commit d22fd2b

Browse files
committed
Reverted comment changes
1 parent 0934cd0 commit d22fd2b

34 files changed

Lines changed: 1266 additions & 470 deletions

macros/contexts/contextAlternateDecimal.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,14 @@ =head2 SETTING THE ALTERNATE FORM AS THE DEFAULT
145145
146146
=cut
147147

148+
###########################################################
149+
148150
loadMacros("MathObjects.pl");
149151

150152
sub _contextAlternateDecimal_init { context::AlternateDecimal->Init }
151153

154+
###########################################################
155+
152156
package context::AlternateDecimal;
153157

154158
#

macros/contexts/contextAlternateIntervals.pl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,14 @@ =head2 Setting the alternate form as the default
118118
119119
=cut
120120

121+
##########################################################################
122+
121123
loadMacros("MathObjects.pl");
122124

123125
sub _contextAlternateIntervals_init { context::AlternateIntervals->Init }
124126

127+
##########################################################################
128+
125129
package context::AlternateIntervals;
126130

127131
# Create the AlternateIntervals contexts
@@ -168,22 +172,23 @@ sub Enable {
168172
$context->lists->set("Interval" => { class => "context::AlternateIntervals::Parser::Interval" });
169173
}
170174

175+
#
171176
# Sets the default Interval context to use alternate decimals. The
172177
# two arguments determine the values for the enterIntervals and
173178
# displayIntervals flags. If enterIntervals is "alternate", then
174179
# student answers must use the alternate format for entering
175180
# intervals (though professors can use either).
176-
181+
#
177182
sub Default {
178183
my $self = shift;
179184
my $enter = shift || "either";
180185
my $display = shift || "either";
181186
my $cmp = ($enter eq "alternate");
182187
$enter = "either" if $cmp;
183-
188+
#
184189
# This adds the names from InequalitySetBuilder, but we need a better way to
185190
# link into contexts as they are created and copied.
186-
191+
#
187192
my @InequalitySetBuilder = (
188193
"SetBuilder::", "InequalitySetBuilder::",
189194
"InequalitySetBuilderInterval::", "InequalitySetBuilderUnion::",
@@ -202,6 +207,8 @@ sub Default {
202207
main::Context(main::Context()->{name});
203208
}
204209

210+
##########################################################################
211+
205212
package context::AlternateIntervals::Formula;
206213
our @ISA = ('Value::Formula');
207214

@@ -234,12 +241,13 @@ sub Open {
234241
$self->push($item);
235242
}
236243

244+
#
237245
# We need to modify the test for formInterval to NOT check the number
238246
# of entries so that better error messages are produced, and to handle
239247
# multiple close delimiters. These are both in teh "operand" branch,
240248
# so do the original for all the choices, and copy that branch here,
241249
# with our modifications.
242-
250+
#
243251
sub Close {
244252
my ($self, $type, $ref) = @_;
245253
$self->{ref} = $ref;
@@ -294,6 +302,8 @@ sub Close {
294302

295303
sub class {'Formula'}
296304

305+
##########################################################################
306+
297307
package context::AlternateIntervals::Interval;
298308
our @ISA = ('Value::Interval');
299309

macros/contexts/contextArbitraryString.pl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ sub _contextArbitraryString_init {
8181
$context->update;
8282
}
8383

84+
#
8485
# Handle creating String() constants
85-
86+
#
8687
package context::ArbitraryString;
8788
sub new { shift; main::Compute(@_) }
8889

90+
#
8991
# Replacement for Parser::String that uses the original string verbatim
9092
# (but replaces \r and \r\n by \n to handle different browser multiline input)
91-
93+
#
9294
package context::ArbitraryString::Parser::String;
9395
our @ISA = ('Parser::String');
9496

@@ -100,14 +102,16 @@ sub new {
100102
$self->SUPER::new($equation, $value, $ref);
101103
}
102104

105+
#
103106
# Replacement for Value::String that creates preview strings
104107
# that work for multiline input
105-
108+
#
106109
package context::ArbitraryString::Value::String;
107110
our @ISA = ("Value::String");
108111

112+
#
109113
# Mark a multi-line string to be displayed verbatim in TeX
110-
114+
#
111115
sub quoteTeX {
112116
my $self = shift;
113117
my $s = shift;
@@ -117,8 +121,9 @@ sub quoteTeX {
117121
"\\begin{array}{l}" . join("\\\\ ", @tex) . "\\end{array}";
118122
}
119123

124+
#
120125
# Quote HTML special characters
121-
126+
#
122127
sub quoteHTML {
123128
my $self = shift;
124129
my $s = $self->SUPER::quoteHTML(shift);
@@ -127,8 +132,9 @@ sub quoteHTML {
127132
return $s;
128133
}
129134

135+
#
130136
# Adjust preview and strings so they display multiline answers properly.
131-
137+
#
132138
sub cmp_preprocess {
133139
my $self = shift;
134140
my $ans = shift;

macros/contexts/contextBaseN.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,9 @@ sub eval {
302302
package context::BaseN::BOP::modulo;
303303
our @ISA = ('Parser::BOP::divide');
304304

305+
#
305306
# Do the division.
306-
307+
#
307308
sub _eval { $_[1] % $_[2] }
308309

309310
# A replacement for Value::Real that handles non-decimal integers

macros/contexts/contextComplexExtras.pl

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,27 @@ sub _contextComplexExtras_init {
9797
);
9898
}
9999

100+
####################################################
101+
#
100102
# Base UOP class that checks for matrix arguments
101-
103+
#
102104
package context::ComplexExtras::UOP;
103105
our @ISA = ("Parser::UOP");
104106

107+
#
105108
# Check that the operand is a Matrix
106-
109+
#
107110
sub _check {
108111
my $self = shift;
109112
$self->Error("'%s' is only defined for Matrices", $self->{def}{string})
110113
unless $self->{op}->type eq "Matrix";
111114
}
112115

116+
####################################################
117+
#
113118
# Implements the ~ operation on matrices and complex numbers
114119
# (as a left-associative unary operator)
115-
120+
#
116121
package context::ComplexExtras::UOP::conjugate;
117122
our @ISA = ("context::ComplexExtras::UOP");
118123

@@ -124,9 +129,11 @@ sub _check {
124129

125130
sub _eval { shift; $_[0]->conj }
126131

132+
####################################################
133+
#
127134
# Implements the ^T operation on matrices and complex numbers
128135
# (as a right-associative unary operator)
129-
136+
#
130137
package context::ComplexExtras::UOP::transpose;
131138
our @ISA = ("context::ComplexExtras::UOP");
132139

@@ -137,9 +144,11 @@ sub perl {
137144
return '(' . $self->{op}->perl . '->transpose)';
138145
}
139146

147+
####################################################
148+
#
140149
# Implements the ^* operation on matrices and complex numbers
141150
# (as a right-associative unary operator)
142-
151+
#
143152
package context::ComplexExtras::UOP::conjtrans;
144153
our @ISA = ("context::ComplexExtras::UOP");
145154

@@ -150,27 +159,32 @@ sub perl {
150159
return '(' . $self->{op}->perl . '->transpose->conj)';
151160
}
152161

162+
####################################################
163+
#
153164
# Implement functions with one matrix input and complex output
154-
165+
#
155166
package context::ComplexExtras::Function::matrix;
156167
our @ISA = ("Parser::Function");
157168

169+
#
158170
# Check for a single Matrix-valued input
159-
171+
#
160172
sub _check { (shift)->checkMatrix("complex") }
161173

174+
#
162175
# Evaluate by promoting to a Matrix
163176
# and then calling the routine from the Value package
164-
177+
#
165178
sub _eval {
166179
my $self = shift;
167180
my $name = $self->{def}{method} || $self->{name};
168181
$self->Package("Matrix")->promote($self->context, $_[0])->$name;
169182
}
170183

184+
#
171185
# Check for a single Matrix-valued argument. Then promote it to a Matrix (does error checking)
172186
# and call the routine from Value package (after converting "tr" to "trace")
173-
187+
#
174188
sub _call {
175189
my $self = shift;
176190
my $name = shift;

macros/contexts/contextComplexJ.pl

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,22 @@ =head2 SETTING THE ALTERNATE FORM AS THE DEFAULT
103103
104104
=cut
105105

106+
##########################################################################
107+
106108
loadMacros("MathObjects.pl");
107109

108110
sub _contextComplexJ_init {
109111
my $context = $main::context{Complex} = Parser::Context->getCopy("Complex");
110112
context::ComplexJ->Enable($context);
111113
}
112114

115+
###############################################################
116+
113117
package context::ComplexJ;
114118

119+
#
115120
# Enables complex j notation in the given context
116-
121+
#
117122
sub Enable {
118123
my $self = shift;
119124
my $context = shift || main::Context();
@@ -136,12 +141,13 @@ sub Enable {
136141
$context->update;
137142
}
138143

144+
#
139145
# Sets all the complex-based default contexts to use ComplexJ
140146
# notation. The two arguments determine the values for the
141147
# enterComplex and displayComplex flags. If enterComplex is "j",
142148
# then student answers must use the j notation (though
143149
# professors can use either).
144-
150+
#
145151
sub Default {
146152
my $self = shift;
147153
my $enter = shift || "either";
@@ -162,7 +168,11 @@ sub Default {
162168
main::Context(main::Context()->{name});
163169
}
164170

165-
# Handle Complex numbers so that they are displayed with the proper i or j value.
171+
###############################################################
172+
#
173+
# Handle Complex numbers so that they are displayed
174+
# with the proper i or j value.
175+
#
166176

167177
package context::ComplexJ::Value::Complex;
168178
our @ISA = ('Value::Complex');
@@ -183,7 +193,11 @@ sub TeX {
183193
return $z;
184194
}
185195

186-
# Make Parser Value object maintain the indicator for which notation was used for a complex number.
196+
###############################################################
197+
#
198+
# Make Parser Value object maintain the indicator for
199+
# which notation was used for a complex number.
200+
#
187201

188202
package context::ComplexJ::Parser::Value;
189203
our @ISA = ('Parser::Value');
@@ -201,7 +215,11 @@ sub new {
201215

202216
sub class {'Value'}
203217

204-
# Make sure complex numbers maintain their flag for which format was used to create them.
218+
###############################################################
219+
#
220+
# Make sure complex numbers maintain their flag for
221+
# which format was used to create them.
222+
#
205223

206224
package context::ComplexJ::Parser::Complex;
207225
our @ISA = ('Parser::Complex');
@@ -215,9 +233,14 @@ sub eval {
215233

216234
sub class {'Complex'}
217235

218-
# Produce error messages when the wrong notation is used for complex numbers.
219-
220-
# Swap i and j when required by the displayComplex flag in the output of constants.
236+
###############################################################
237+
#
238+
# Produce error messages when the wrong notation
239+
# is used for complex numbers.
240+
#
241+
# Swap i and j when required by the displayComplex flag
242+
# in the output of constants.
243+
#
221244

222245
package context::ComplexJ::Parser::Constant;
223246
our @ISA = ('Parser::Constant');
@@ -259,4 +282,6 @@ sub TeX {
259282

260283
sub class {'Constant'}
261284

285+
###############################################################
286+
262287
1;

0 commit comments

Comments
 (0)