RAPL

Check-in [2daa2c733a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix for source command to return correct return value and fix for time command
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2daa2c733a3bb5ecc5d26e2fd2dd3c00ff1bddb2
User & Date: arnulf 2012-02-22 20:47:13
Context
2012-02-22
20:50
fixes check-in: 81e5d79a04 user: arnulf tags: trunk
20:47
fix for source command to return correct return value and fix for time command check-in: 2daa2c733a user: arnulf tags: trunk
20:42
added missing return statement check-in: c87f4a4e0b user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to rapl_pkg_corecmd.js.

979
980
981
982
983
984
985

986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
....
1348
1349
1350
1351
1352
1353
1354
1355

1356
1357
1358
1359
1360
1361
1362
....
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
....
1529
1530
1531
1532
1533
1534
1535
1536

1537
1538
1539
1540
1541
1542
1543
    return interp.OK;
  });

  /* ==================== command source ===================================== */
  interp.registerCommand("::source", function (interp, args) {
    var script_obj_ptr;
    var prev_script_obj;


    if (args.length != 2) {
      interp.wrongNumArgs(1, args, 1, "filename");
      return interp.ERROR;
    }
    script_obj_ptr = args[1];
    script_obj_ptr.incrRefCount();
    prev_script_obj = interp.current_script_obj;

    interp.current_script_obj = script_obj_ptr;
    interp.setResultString(interp.source(interp, script_obj_ptr));
    interp.current_script_obj = prev_script_obj;
    script_obj_ptr.decrRefCount();
    return interp.OK;
  });

  /* ==================== command split ===================================== */
  interp.registerCommand("::split", function (interp, args) {
//print("split!"+args+"!");
    var script_obj_ptr;
    var str;
................................................................................
    }
    if (script && script.getString() == "-") {
        interp.setResultFormatted("no body specified for pattern \"%#s\"", case_list[i - 2]);
        return interp.ERROR;
    }
    interp.setEmptyResult();
    if (script) {
      return interp.eval_statement.evalObj(script);

    }
    return interp.OK;
  });

  /* ==================== sec_msec ===================================== */
  function sec_msec () {
    var t = new Date();
................................................................................
    } else {
      var n = 1;
    }
    var t0 = sec_msec();
//var xx = interp.string_obj_type.newStringObj("10", -1);
//var yy = interp.string_obj_type.newStringObj("a", -1);
    for(var i = 0; i < n; i++) {
      interp.eval_statement.evalObj(code);
//        interp.setVar("a", xx);
//        interp.variable_obj_type.setVariable(yy, xx);
    }
//print("TT!"+((sec_msec()-t0)*1000/n + " microseconds per iteration")+"!");
    interp.setResult(interp.string_obj_type.newStringObj((sec_msec()-t0)*1000/n + " microseconds per iteration", -1));
    return interp.OK;
  });
................................................................................
      if ((ret_code = interp.eval_expression.getBoolFromExpr(args[1], bool)) != interp.OK) {
        return ret_code;
      }
      bool = bool[0];
      if (!bool) {
        break;
      }
      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;







>










|


|







 







|
>







 







|







 







|
>







979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
....
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
....
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
....
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
    return interp.OK;
  });

  /* ==================== command source ===================================== */
  interp.registerCommand("::source", function (interp, args) {
    var script_obj_ptr;
    var prev_script_obj;
    var ret_code;

    if (args.length != 2) {
      interp.wrongNumArgs(1, args, 1, "filename");
      return interp.ERROR;
    }
    script_obj_ptr = args[1];
    script_obj_ptr.incrRefCount();
    prev_script_obj = interp.current_script_obj;

    interp.current_script_obj = script_obj_ptr;
    ret_code = interp.source(interp, script_obj_ptr);
    interp.current_script_obj = prev_script_obj;
    script_obj_ptr.decrRefCount();
    return ret_code;
  });

  /* ==================== command split ===================================== */
  interp.registerCommand("::split", function (interp, args) {
//print("split!"+args+"!");
    var script_obj_ptr;
    var str;
................................................................................
    }
    if (script && script.getString() == "-") {
        interp.setResultFormatted("no body specified for pattern \"%#s\"", case_list[i - 2]);
        return interp.ERROR;
    }
    interp.setEmptyResult();
    if (script) {
      var retval = interp.eval_statement.evalObj(script);
      return retval;
    }
    return interp.OK;
  });

  /* ==================== sec_msec ===================================== */
  function sec_msec () {
    var t = new Date();
................................................................................
    } else {
      var n = 1;
    }
    var t0 = sec_msec();
//var xx = interp.string_obj_type.newStringObj("10", -1);
//var yy = interp.string_obj_type.newStringObj("a", -1);
    for(var i = 0; i < n; i++) {
      var retval = interp.eval_statement.evalObj(code);
//        interp.setVar("a", xx);
//        interp.variable_obj_type.setVariable(yy, xx);
    }
//print("TT!"+((sec_msec()-t0)*1000/n + " microseconds per iteration")+"!");
    interp.setResult(interp.string_obj_type.newStringObj((sec_msec()-t0)*1000/n + " microseconds per iteration", -1));
    return interp.OK;
  });
................................................................................
      if ((ret_code = interp.eval_expression.getBoolFromExpr(args[1], bool)) != interp.OK) {
        return ret_code;
      }
      bool = bool[0];
      if (!bool) {
        break;
      }
      ret_code = interp.eval_statement.evalObj(args[2]);
      if (ret_code != interp.OK) {
        switch (ret_code) {
        case interp.BREAK:
          out = true;
          break;
        case interp.CONTINUE:
          continue;
          break;