src/scripttools/debugging/scripts/commands/advance.qs
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 name = "advance";
       
     2 
       
     3 group = "running";
       
     4 
       
     5 shortDescription = "Continue the program up to the given location";
       
     6 
       
     7 longDescription = "This command has the same syntax as the \"break\" command.";
       
     8 
       
     9 seeAlso = [ "break", "tbreak" ];
       
    10 
       
    11 argumentTypes = [ "script-filename" ];
       
    12 
       
    13 function execute() {
       
    14     if (arguments.length == 0) {
       
    15         message("Missing argument(s).");
       
    16         return;
       
    17     }
       
    18     var arg = arguments[0];
       
    19     var colonIndex = arg.lastIndexOf(':');
       
    20     if (colonIndex == -1) {
       
    21         lineNumber = parseInt(arg);
       
    22         if (isNaN(lineNumber)) {
       
    23             message("Location must be of the form <file>:<line> or <line>.");
       
    24             return;
       
    25         }
       
    26         var sid = getCurrentScriptId();
       
    27         if (sid == -1) {
       
    28             message("No script.");
       
    29             return;
       
    30         }
       
    31         scheduleRunToLocation(sid, lineNumber);
       
    32     } else {
       
    33         fileName = arg.slice(0, colonIndex);
       
    34         lineNumber = parseInt(arg.slice(colonIndex+1));
       
    35         // ### resolve the script to see if it's loaded or not? (e.g. so we can issue a warning)
       
    36         scheduleRunToLocation(fileName, lineNumber);
       
    37     }
       
    38 }
       
    39 
       
    40 function handleResponse(resp) {
       
    41 }