RAPL

Diff
Login

Diff

Differences From Artifact [b5c49527e9]:

To Artifact [308e860d4d]:


318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
     * Think for example to this:
     *
     * set x {llength $x; ... some more code ...}; eval $x
     *
     * In order to preserve the internal rep, we increment the
     * inUse field of the script internal rep structure. 
     */
    script.in_use++;
    token = script.script_object.tokens;
    /* Execute every command sequentially until the end of the script
     * or an error occurs.
     */
    for (i = 0; i < script.len && retcode == stmt.OK; ) {
      var argc;
      var argv = new Array();







|







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
     * Think for example to this:
     *
     * set x {llength $x; ... some more code ...}; eval $x
     *
     * In order to preserve the internal rep, we increment the
     * inUse field of the script internal rep structure. 
     */
    script.ref_count++;
    token = script.script_object.tokens;
    /* Execute every command sequentially until the end of the script
     * or an error occurs.
     */
    for (i = 0; i < script.len && retcode == stmt.OK; ) {
      var argc;
      var argv = new Array();
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
//print("word_tokens 1!");
//script.dumpToken(i);
          switch (token[i].token) {
          case stmt.TOKEN_COMMENT:
	    had_comment = true;
            break;
          case stmt.TOKEN_QUOTE_ESC:
//            stmt.in_quotes = true;
	    /* fall through */
          case stmt.TOKEN_ESC:
          case stmt.TOKEN_STR:
            word_obj_ptr = token[i].obj_ptr;
            break;
          case stmt.TOKEN_VAR_ARRAY_NAME:
            word_obj_ptr = stmt.interp.array_obj_type.expandArray(token[i].obj_ptr);







<







368
369
370
371
372
373
374

375
376
377
378
379
380
381
//print("word_tokens 1!");
//script.dumpToken(i);
          switch (token[i].token) {
          case stmt.TOKEN_COMMENT:
	    had_comment = true;
            break;
          case stmt.TOKEN_QUOTE_ESC:

	    /* fall through */
          case stmt.TOKEN_ESC:
          case stmt.TOKEN_STR:
            word_obj_ptr = token[i].obj_ptr;
            break;
          case stmt.TOKEN_VAR_ARRAY_NAME:
            word_obj_ptr = stmt.interp.array_obj_type.expandArray(token[i].obj_ptr);
462
463
464
465
466
467
468
469

470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
        }
      }
      if (had_comment) {
        continue
      }
      if (retcode == stmt.OK && argc) {
        /* Lookup the command to call */
        cmd = stmt.interp.command_obj_type.getCommand(argv[0], stmt.FUNCTION_FLAGS_LEAVE_ERR_MSG);

        if (cmd != null) {
          /* Call it -- Make sure result is an empty object. */
          cmd.incrCmdRefCount();
          stmt.interp.setEmptyResult();
//print("argv!"+argv+"!");
//print("CMDT!"+argv[0]+"!"+cmd.getCommandTypeString(cmd.command_type)+"!");
//print("argv!"+argc+"!"+argv+"!"+argv.length+"!");
          if (cmd.is_proc) {
            retcode = stmt.interp.command_obj_type.callProcedure(cmd, script.script_object.file_name_obj, line_no, argc, argv);
          } else {
            stmt.interp.cmd_priv_data = cmd.u.native_fcn.privdata;
            retcode = cmd.u.native_fcn.cmd_proc(stmt.interp, argv, cmd);
          }
          cmd.decrCmdRefCount();
        } else {
//print("RETC!"+retcode+"!"+argc+"!"+argv+"!");
          /* Call [unknown] */
          retcode = stmt.interp.unknown(argc, argv, script.script_object.file_name_obj, line_no);
        }
      }

//      /* Finished with the command, so decrement ref counts of each argument */
      j = argv.length - 1;
      for (; j > 0; j--) {
        argv[j].decrRefCount();
      }
      argv = new Array();
    }

    /* Possibly add to the error stack trace */
    stmt.addErrorToStack(retcode, script.script_object.file_name_obj, line_no);

    /* Note that we don't have to decrement in_use, because the
     * following code transfers our use of the reference again to
     * the script object. */
    script_obj_ptr.freeIntRep();
    script_obj_ptr.obj_type = stmt.interp.script_obj_type;
    script_obj_ptr.setIntRepPtr(script);
    script_obj_ptr.decrRefCount();
//print("EVALOBJ end level!"+stmt.eval_level+"!"+retcode+"!");







|
>




<















<











|







461
462
463
464
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
481
482
483
484
485
486
487
488

489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
        }
      }
      if (had_comment) {
        continue
      }
      if (retcode == stmt.OK && argc) {
        /* Lookup the command to call */
//        cmd = stmt.interp.command_obj_type.getCommand(argv[0], stmt.FUNCTION_FLAGS_LEAVE_ERR_MSG);
        cmd = stmt.interp.getCommand(argv[0]);
        if (cmd != null) {
          /* Call it -- Make sure result is an empty object. */
          cmd.incrCmdRefCount();
          stmt.interp.setEmptyResult();

//print("CMDT!"+argv[0]+"!"+cmd.getCommandTypeString(cmd.command_type)+"!");
//print("argv!"+argc+"!"+argv+"!"+argv.length+"!");
          if (cmd.is_proc) {
            retcode = stmt.interp.command_obj_type.callProcedure(cmd, script.script_object.file_name_obj, line_no, argc, argv);
          } else {
            stmt.interp.cmd_priv_data = cmd.u.native_fcn.privdata;
            retcode = cmd.u.native_fcn.cmd_proc(stmt.interp, argv, cmd);
          }
          cmd.decrCmdRefCount();
        } else {
//print("RETC!"+retcode+"!"+argc+"!"+argv+"!");
          /* Call [unknown] */
          retcode = stmt.interp.unknown(argc, argv, script.script_object.file_name_obj, line_no);
        }
      }

//      /* Finished with the command, so decrement ref counts of each argument */
      j = argv.length - 1;
      for (; j > 0; j--) {
        argv[j].decrRefCount();
      }
      argv = new Array();
    }

    /* Possibly add to the error stack trace */
    stmt.addErrorToStack(retcode, script.script_object.file_name_obj, line_no);

    /* Note that we don't have to decrement ref_count, because the
     * following code transfers our use of the reference again to
     * the script object. */
    script_obj_ptr.freeIntRep();
    script_obj_ptr.obj_type = stmt.interp.script_obj_type;
    script_obj_ptr.setIntRepPtr(script);
    script_obj_ptr.decrRefCount();
//print("EVALOBJ end level!"+stmt.eval_level+"!"+retcode+"!");