980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
|
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
|
-
+
|
case_list = vector[0];
}
/* command is here already decref'd */
if (rc < 0) {
// return -rc;
continue;
}
if (rc) {
if (rc > 0) {
script = case_list[i + 1];
}
}
} else {
script = case_list[i + 1];
}
}
|
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
|
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
|
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
|
interp.registerCommand("::unset", function (interp, args) {
this.requireExactArgc(args, 2, "unset", "");
interp.setVar(args[1], null);
});
/* ==================== command while ===================================== */
interp.registerCommand("::while", function (interp, args) {
args.shift();
this.requireExactArgc(args, 2, "while", "");
var cond = args.shift();
var body = args.shift();
var out = false;
if (args.length != 3) {
interp.wrongNumArgs(1, args, "condition body");
var res = "";
interp.inLoop = true;
interp.code = this.OK;
while (true) {
var my_cond = interp.statement_parser.parse2ExprTree(cond.toString());
test = interp.statement_parser.objectify(interp.eval_statement.evalExprSubTree(my_cond, null, 0));
interp.eval_statement.eval("::set _ "+test.toString());
if (!test.toBoolean()){
return interp.ERROR;
}
/* The general purpose implementation of while starts here */
while (1) {
var bool = new Array();
var ret_code;
if ((ret_code = interp.eval_expression.getBoolFromExpr(args[1], bool)) != interp.OK) {
return ret_code;
}
bool = bool[0];
if (!bool) {
break;
}
res = interp.eval_statement.eval(body);
if(interp.code == this.CONTINUE) {
continue;
}
if(interp.code != this.OK) {
if ((ret_code = interp.eval_statement.evalObj(args[2])) != interp.OK) {
switch (ret_code) {
case interp.BREAK:
out = true;
break;
case interp.CONTINUE:
continue;
break;
default:
return ret_code;
}
}
if (out) {
break;
}
}
interp.inLoop = false;
interp.setEmptyResult();
if(interp.code == this.BREAK || interp.code == this.CONTINUE) {
interp.code = this.OK;
}
return interp.statement_parser.objectify(res);
return interp.OK;
});
/* ==================== command variable ===================================== */
interp.registerCommand("::variable", function (interp, args) {
var var_name;
var tail;
var i;
|