122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
});
var sqrt = "";
sqrt = Math.sqrt; // "publish" other Math.* functions as needed
/* ==================== command expr ===================================== */
interp.registerCommand("::expr", function (interp, args) {
args.shift();
var result = null;
if (args.length == 1) {
/* seems to be a braced expression argument, parse again for variable substitution */
var cond = args.shift();
if (cond.hasWordValue()) {
cond = cond.getWordValue();
} else {
throw "cond without word not yet implemented";
}
var cond = cond.getBraceContents();
|
<
>
>
|
>
|
>
>
>
>
>
>
|
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
});
var sqrt = "";
sqrt = Math.sqrt; // "publish" other Math.* functions as needed
/* ==================== command expr ===================================== */
interp.registerCommand("::expr", function (interp, args) {
var result = null;
var retcode;
print("::expr!"+args+"!");
if (args.length == 2) {
result = new Array();
/* seems to be a braced expression argument */
print("::expr!"+args+"!");
retcode = interp.eval_expression.evalExpression(args[1], result);
print("::expr retcode!"+retcode+"!");
var cond = args.shift();
if (cond.hasWordValue()) {
cond = cond.getWordValue();
} else {
throw "cond without word not yet implemented";
}
var cond = cond.getBraceContents();
|