Changeset 128 for trunk/UTarget.pas


Ignore:
Timestamp:
Jan 17, 2022, 4:53:31 PM (2 years ago)
Author:
chronos
Message:
  • Added: Two more code examples.
  • Added: Allow to disable debugging support.
  • Added: Remember last opened tab in options form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTarget.pas

    r126 r128  
    3535    function SearchIndexByProgramPos(Pos: Integer): Integer;
    3636    procedure AddStep(SourcePos, TargetPos: Integer; Operation: TStepOperation);
    37     procedure UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgram, NewTarget: Integer);
     37    procedure UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom,
     38        NewProgramTo: Integer; NewTarget: Integer = 0);
    3839  end;
    3940
     
    108109    BreakPoints: TBreakPointList;
    109110    DebugSteps: TDebugStepList;
     111    DebugEnabled: Boolean;
    110112    Messages: TMessageList;
    111113    constructor Create; virtual;
     
    280282end;
    281283
    282 procedure TDebugStepList.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgram, NewTarget: Integer);
     284procedure TDebugStepList.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom,
     285    NewProgramTo: Integer; NewTarget: Integer = 0);
    283286var
    284287  I: Integer;
     
    288291  First := SearchIndexByProgramPos(OldProgramFrom);
    289292  Last := SearchIndexByProgramPos(OldProgramTo);
    290   for I := Last downto First + 1 do Delete(I);
    291   if NewProgram = -1 then begin
    292     Delete(First);
    293   end else begin
    294     if (First >= 0) and (First < Count) then begin
    295       Items[First].ProgramPosition := NewProgram;
     293  if (First <> -1) and (Last <> -1) then begin
     294    if First > Last then
     295      raise Exception.Create('First index higher than last index');
     296    if (First < 0) or (First >= Count) then
     297      raise Exception.Create('First index out of range');
     298    if (Last < 0) or (Last >= Count) then
     299      raise Exception.Create('Last index out of range');
     300    for I := Last downto First + 1 do Delete(I);
     301
     302    if NewProgramTo - NewProgramFrom = 0 then begin
     303      Delete(First);
     304    end else
     305    if NewProgramTo > NewProgramFrom then begin
     306      Items[First].ProgramPosition := NewProgramFrom;
    296307      Items[First].TargetPosition := NewTarget;
    297     end else begin
    298       // Index not found, possible new command?
    299     end;
     308    end else
     309      raise Exception.Create('Old program index higher than new');
    300310  end;
    301311end;
Note: See TracChangeset for help on using the changeset viewer.