74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
-
+
-
-
-
-
-
|
@expressions = ();
@prefixes = ();
substitute_subexpressions();
display_subexpressions () if ($debug);
for ($i = 0; $i <= $#expressions; $i++) {
my $result = process_expression ();
process_expression ();
if ($result) {
$prefixes[$i] = "";
$expressions[$i] = "$result";
}
}
display_subexpressions () if ($debug);
reassemble_expression ();
print STDOUT "$expression";
}
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
-
+
-
+
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
}
}
if ($cr eq '') {
return;
}
# call cr(arg1,arg2,...)
# call cr(arg1,arg2,...) User-defined CR in the model directory
if (-e "$cr.pm") {
no strict 'refs'; # allow symbolic references
my $expr = $expressions[$i];
eval "require $cr";
$cr->import (@_[1 .. $#_]);
no strict 'refs'; # allow symbolic references
&$cr ($expr);
my $substitution = &$cr ($expr);
use strict 'refs';
if ($substitution) {
$prefixes[$i] = "";
$expressions[$i] = "$substitution";
}
}
}
# call cr(arg1,arg2,...) Standard CR in the mtt namespace
if (-e "mtt/$cr.pm") {
my $expr = $expressions[$i];
my $mttcr = "mtt::$cr";
eval "require 'mtt/$cr.pm'";
$mttcr->import (@_[1 .. $#_]);
no strict 'refs'; # allow symbolic references
my $substitution = &$cr ($expr);
use strict 'refs';
if ($substitution) {
$prefixes[$i] = "";
$expressions[$i] = "$substitution";
}
}
}
#-------------------------------------------------------------------------------
sub display_subexpressions() {
for ($i = 0; $i <= $#expressions; $i++) {
my $prefix = " ";
$prefix = $prefixes[$i] if ($prefixes[$i]);
|