371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
} catch(e) {
throw "ERROR in OUTER evalTclStatements:!"+e+"!"+this.interp.current_statement+"!";
}
return result;
},
/* ==================== call ===================================== */
call: function(args) {
//print("CALL1");
//this.call_logs.push(args.toString());
if (this.call_debug) {
//print("IPCALL!"+args.toString()+"!");
}
//print("interp.call arg0!"+args[0]+"!length!"+args.length+"!arg1!"+args[1]+"!lv!"+this.level+"!call_lv!"+this.call_level+"!");
this.call_level++;
//print("CALL2a!"+args[0].toString()+"!");
if(_step && !confirm("this.call "+args)) {
throw "user abort";
}
//print("IPNS1!"+this.interp.current_namespace.full_name+"!");
var my_cmd = args[0].toString();
var func = this.interp.getCommand(my_cmd);
//print("CA!"+args[0]+"!"+func+"!");
if (this.call_debug) {
print("interp call func!"+func+"!type!"+func.type+"!name!"+func.name+"!NS!"+this.interp.command_namespace.name+"!");
}
//print("FUNC!"+(func instanceof Tcl.EnsembleCommand)+"!");
var pushed = 0;
if ((this.interp.current_namespace != this.interp.command_namespace) && (this.interp.command_namespace.name != "::")) {
this.interp.pushNamespace(this.interp.command_namespace.name, this.interp.command_namespace);
pushed = 1;
}
//print("IPNS!"+this.interp.current_namespace.full_name+"!");
var my_obj = new TclObject(this.interp, "", "TEXT");
var function_args = my_obj.getString(args);
if (!this.no_trace && (this.enterstep_traces.length > 0)) {
for (var i = 0; i < this.enterstep_traces.length; i++) {
var trace_obj = this.enterstep_traces[i];
var ops = trace_obj.getOps();
for (var j = 0; j < ops.length; j++) {
if (ops[j] == Tcl.TRACE_OP_ENTERSTEP) {
var code = trace_obj.getCommand()+" {"+function_args+"} enter";
try {
this.no_trace = true;
this.eval(code);
this.no_trace = false;
} catch(e) {
throw "error in executing enterstep trace: "+code+"!";
}
}
}
}
}
if (this.call_debug) {
print("CALL!"+args+"!");
}
var r = func.call(this.interp, args);
if (this.call_debug) {
print("CALL after!"+r+"!");
}
if (pushed) {
this.interp.popNamespace();
}
if (!this.no_trace && (this.leavestep_traces.length > 0)) {
for (var i = 0; i < this.leavestep_traces.length; i++) {
var trace_obj = this.leavestep_traces[i];
var ops = trace_obj.getOps();
for (var j = 0; j < ops.length; j++) {
if (ops[j] == Tcl.TRACE_OP_LEAVESTEP) {
var my_obj = new TclObject(this.interp, "", "TEXT");
var result = r;
if (result == null) {
result = "";
}
var code = trace_obj.getCommand()+" {"+function_args+"} "+this.code+" {"+result+"} leavestep";
try {
this.no_trace = true;
this.eval(code);
this.no_trace = false;
} catch(e) {
throw "error in executing leavestep trace: "+code+"!";
}
}
}
}
}
this.call_level--;
switch (this.code) {
case Tcl.OK:
case Tcl.ERROR:
case Tcl.RETURN:
return r;
case Tcl.BREAK:
if (!this.inLoop) {
throw "Invoked break outside of a loop";
}
break;
case Tcl.CONTINUE:
if (!this.inLoop) {
throw "Invoked continue outside of a loop";
}
break;
default:
throw "Unknown return code " + this.code;
}
|
|
>
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
} catch(e) {
throw "ERROR in OUTER evalTclStatements:!"+e+"!"+this.interp.current_statement+"!";
}
return result;
},
/* ==================== call ===================================== */
call: function(cmd_obj, args) {
this.call_debug = 1;
//print("CALL1");
//this.call_logs.push(args.toString());
if (this.call_debug) {
//print("IPCALL!"+args.toString()+"!");
}
//print("interp.call arg0!"+args[0]+"!length!"+args.length+"!arg1!"+args[1]+"!lv!"+this.level+"!call_lv!"+this.call_level+"!");
this.call_level++;
//print("CALL2a!"+args[0].toString()+"!");
//print("IPNS1!"+this.interp.current_namespace.full_name+"!");
//print("CA!"+args[0]+"!"+func+"!");
if (this.call_debug) {
print("interp call func!"+cmd_obj+"!type!"+cmd_obj.type+"!name!"+cmd_obj.name+"!NS!"+this.interp.command_namespace.name+"!");
}
//print("CMD_OBJ!"+(cmd_obj instanceof this.EnsembleCommand)+"!");
var pushed = 0;
if ((this.interp.current_namespace != this.interp.command_namespace) && (this.interp.command_namespace.name != "::")) {
this.interp.pushNamespace(this.interp.command_namespace.name, this.interp.command_namespace);
pushed = 1;
}
//print("IPNS!"+this.interp.current_namespace.full_name+"!");
var my_obj = new R.RaplObject(this.interp, "", "TEXT");
var function_args = my_obj.getString(args);
if (!this.no_trace && (this.enterstep_traces.length > 0)) {
for (var i = 0; i < this.enterstep_traces.length; i++) {
var trace_obj = this.enterstep_traces[i];
var ops = trace_obj.getOps();
for (var j = 0; j < ops.length; j++) {
if (ops[j] == this.TRACE_OP_ENTERSTEP) {
var code = trace_obj.getCommand()+" {"+function_args+"} enter";
try {
this.no_trace = true;
this.eval(code);
this.no_trace = false;
} catch(e) {
throw "error in executing enterstep trace: "+code+"!";
}
}
}
}
}
if (this.call_debug) {
print("CALL!"+args+"!"+cmd_obj+"!");
}
var r = cmd_obj.call(this.interp, args);
if (this.call_debug) {
print("CALL after!"+r+"!");
}
if (pushed) {
this.interp.popNamespace();
}
if (!this.no_trace && (this.leavestep_traces.length > 0)) {
for (var i = 0; i < this.leavestep_traces.length; i++) {
var trace_obj = this.leavestep_traces[i];
var ops = trace_obj.getOps();
for (var j = 0; j < ops.length; j++) {
if (ops[j] == this.TRACE_OP_LEAVESTEP) {
var my_obj = new R.RaplObject(this.interp, "", "TEXT");
var result = r;
if (result == null) {
result = "";
}
var code = trace_obj.getCommand()+" {"+function_args+"} "+this.code+" {"+result+"} leavestep";
try {
this.no_trace = true;
this.eval(code);
this.no_trace = false;
} catch(e) {
throw "error in executing leavestep trace: "+code+"!";
}
}
}
}
}
this.call_level--;
switch (this.code) {
case this.OK:
case this.ERROR:
case this.RETURN:
return r;
case this.BREAK:
if (!this.inLoop) {
throw "Invoked break outside of a loop";
}
break;
case this.CONTINUE:
if (!this.inLoop) {
throw "Invoked continue outside of a loop";
}
break;
default:
throw "Unknown return code " + this.code;
}
|
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
|
print("evalExprSubTree bottom!N!"+node.name+"!"+lv+"!");
}
return this.interp.statement_parser.objectify(node.getNodeValue());
}
if (child_left != null) {
type_left = child_left.getNodeType();
name_left = child_left.name;
if (type_left >= Tcl.TOKEN_MINUS) {
left_val = this.statement_parser.tree2Expr(child_left, node, "", lv);
} else {
val_left = child_left.getNodeValue();
}
}
if (child_right != null) {
type_right = child_right.getNodeType();
name_right = child_right.name;
if (type_right >= Tcl.TOKEN_MINUS) {
val_right = this.statement_parser.tree2Expr(child_right, node, "", lv);
} else {
val_right = child_right.getNodeValue();
}
}
if (this.eval_expr_debug) {
print("evalExprSubTree!N!"+node.name+"!L!"+name_left+"!T!"+type_left+"!V!"+val_left+"!R!"+name_right+"!T!"+type_right+"!V!"+val_right+"!"+lv+"!");
|
|
|
|
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
|
print("evalExprSubTree bottom!N!"+node.name+"!"+lv+"!");
}
return this.interp.statement_parser.objectify(node.getNodeValue());
}
if (child_left != null) {
type_left = child_left.getNodeType();
name_left = child_left.name;
if (type_left >= this.TOKEN_MINUS) {
left_val = this.statement_parser.tree2Expr(child_left, node, "", lv);
} else {
val_left = child_left.getNodeValue();
}
}
if (child_right != null) {
type_right = child_right.getNodeType();
name_right = child_right.name;
if (type_right >= this.TOKEN_MINUS) {
val_right = this.statement_parser.tree2Expr(child_right, node, "", lv);
} else {
val_right = child_right.getNodeValue();
}
}
if (this.eval_expr_debug) {
print("evalExprSubTree!N!"+node.name+"!L!"+name_left+"!T!"+type_left+"!V!"+val_left+"!R!"+name_right+"!T!"+type_right+"!V!"+val_right+"!"+lv+"!");
|