Changeset 128 for trunk/UTarget.pas
- Timestamp:
- Jan 17, 2022, 4:53:31 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTarget.pas
r126 r128 35 35 function SearchIndexByProgramPos(Pos: Integer): Integer; 36 36 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); 38 39 end; 39 40 … … 108 109 BreakPoints: TBreakPointList; 109 110 DebugSteps: TDebugStepList; 111 DebugEnabled: Boolean; 110 112 Messages: TMessageList; 111 113 constructor Create; virtual; … … 280 282 end; 281 283 282 procedure TDebugStepList.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgram, NewTarget: Integer); 284 procedure TDebugStepList.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom, 285 NewProgramTo: Integer; NewTarget: Integer = 0); 283 286 var 284 287 I: Integer; … … 288 291 First := SearchIndexByProgramPos(OldProgramFrom); 289 292 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; 296 307 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'); 300 310 end; 301 311 end;
Note:
See TracChangeset
for help on using the changeset viewer.