Changeset 35
- Timestamp:
- Feb 19, 2012, 12:03:21 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.lfm
r34 r35 590 590 Action = AProgramRunToCursor 591 591 end 592 object MenuItem31: TMenuItem 593 Action = AProgramShowExecutionPoint 594 end 592 595 end 593 596 object MenuItem24: TMenuItem … … 821 824 Caption = 'Step into' 822 825 ImageIndex = 15 826 OnExecute = AProgramStepIntoExecute 823 827 ShortCut = 118 824 828 end … … 827 831 Caption = 'Step over' 828 832 ImageIndex = 17 833 OnExecute = AProgramStepOverExecute 829 834 ShortCut = 119 830 835 end … … 833 838 Caption = 'Run to cursor' 834 839 ImageIndex = 14 840 OnExecute = AProgramRunToCursorExecute 835 841 ShortCut = 115 836 842 end … … 839 845 Caption = 'Step out' 840 846 ImageIndex = 16 847 OnExecute = AProgramStepOutExecute 841 848 ShortCut = 8311 842 849 end … … 876 883 Caption = 'Show position in target' 877 884 OnExecute = AShowTargetPositionExecute 885 ShortCut = 16393 878 886 end 879 887 object AShowSourcePosition: TAction 880 888 Caption = 'Show position in source' 881 889 OnExecute = AShowSourcePositionExecute 890 ShortCut = 16393 891 end 892 object AProgramShowExecutionPoint: TAction 893 Category = 'Program' 894 Caption = 'Show execution point' 895 OnExecute = AProgramShowExecutionPointExecute 882 896 end 883 897 end -
trunk/Forms/UMainForm.lrt
r34 r35 36 36 TMAINFORM.ASHOWTARGETPOSITION.CAPTION=Show position in target 37 37 TMAINFORM.ASHOWSOURCEPOSITION.CAPTION=Show position in source 38 TMAINFORM.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point -
trunk/Forms/UMainForm.pas
r34 r35 18 18 19 19 TMainForm = class(TForm) 20 AProgramShowExecutionPoint: TAction; 20 21 AShowSourcePosition: TAction; 21 22 AShowTargetPosition: TAction; … … 72 73 MenuItem29: TMenuItem; 73 74 MenuItem30: TMenuItem; 75 MenuItem31: TMenuItem; 74 76 MenuItem32: TMenuItem; 75 77 MenuItem33: TMenuItem; … … 111 113 ToolButton9: TToolButton; 112 114 procedure ABreakpointToggleExecute(Sender: TObject); 113 procedure AProgramCompileExecute(Sender: TObject);114 115 procedure AExitExecute(Sender: TObject); 115 116 procedure AFormatSourceExecute(Sender: TObject); 116 117 procedure AGenerateNumberExecute(Sender: TObject); 117 118 procedure AOptionsExecute(Sender: TObject); 119 procedure AProgramCompileExecute(Sender: TObject); 118 120 procedure AProgramPauseExecute(Sender: TObject); 121 procedure AProgramRunToCursorExecute(Sender: TObject); 122 procedure AProgramShowExecutionPointExecute(Sender: TObject); 123 procedure AProgramStepIntoExecute(Sender: TObject); 124 procedure AProgramStepOutExecute(Sender: TObject); 125 procedure AProgramStepOverExecute(Sender: TObject); 119 126 procedure AProgramStopExecute(Sender: TObject); 120 127 procedure AProjectCloseExecute(Sender: TObject); … … 144 151 FCurrentTarget: TTarget; 145 152 procedure AProjectOpenRecentExecute(Sender: TObject); 146 procedure BrainFuckInterpreterChangeState(Sender: TObject);153 procedure TargetStateChanged(Sender: TObject); 147 154 procedure MenuItemTargetClick(Sender: TObject); 148 155 procedure ProjectOpen(FileName: string); … … 218 225 end; 219 226 220 procedure TMainForm.BrainFuckInterpreterChangeState(Sender: TObject); 221 begin 227 procedure TMainForm.TargetStateChanged(Sender: TObject); 228 var 229 DebugStep: TDebugStep; 230 begin 231 if CurrentTarget.State = rsPaused then 232 AProgramShowExecutionPoint.Execute; 222 233 UpdateInterface; 223 234 end; … … 253 264 for I := 0 to Targets.Count - 1 do 254 265 TTarget(Targets[I]).OnChangeState := nil; 255 FCurrentTarget.OnChangeState := BrainFuckInterpreterChangeState;266 FCurrentTarget.OnChangeState := TargetStateChanged; 256 267 UpdateInterface; 257 268 end; … … 309 320 AProjectClose.Enabled := ProjectFileName <> ''; 310 321 AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and 311 (ProjectFileName <> '') and (CurrentTarget.State = rsStopped) ;322 (ProjectFileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused); 312 323 AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and 313 324 (ProjectFileName <> '') and (CurrentTarget.State = rsRunning); 314 325 AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and 315 326 (ProjectFileName <> '') and (CurrentTarget.State <> rsStopped); 316 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and (ProjectFileName <> ''); 317 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and (ProjectFileName <> ''); 318 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and (ProjectFileName <> ''); 319 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and (ProjectFileName <> ''); 320 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and (ProjectFileName <> ''); 327 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities); 328 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and 329 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 330 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and 331 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 332 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and 333 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 334 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and 335 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 336 AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and 337 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 338 AShowSourcePosition.Enabled := CurrentTarget.Compiled; 339 AShowTargetPosition.Enabled := CurrentTarget.Compiled; 321 340 UpdateStatusBar; 322 341 UpdateTargetList; … … 373 392 TTargetInterpretter(CurrentTarget).Input := InterpreterForm.MemoInput.Lines.Text; 374 393 CurrentTarget.SourceCode := MemoSource.Text; 375 if not CurrentTarget.Compiled then CurrentTarget.Compile;394 if not CurrentTarget.Compiled then AProgramCompile.Execute; 376 395 CurrentTarget.Run; 377 396 end; … … 381 400 DebugStep: TDebugStep; 382 401 begin 383 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(MemoSource.SelStart); 384 MemoTarget.SelStart := DebugStep.SourcePosition; 385 PageControl1.TabIndex := 0; 402 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(MemoTarget.SelStart); 403 if Assigned(DebugStep) then begin 404 MemoSource.SelStart := DebugStep.SourcePosition; 405 PageControl1.TabIndex := 0; 406 end; 386 407 end; 387 408 … … 391 412 begin 392 413 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart); 393 MemoTarget.SelStart := DebugStep.TargetPosition; 394 PageControl1.TabIndex := 1; 414 if Assigned(DebugStep) then begin 415 MemoTarget.SelStart := DebugStep.TargetPosition; 416 PageControl1.TabIndex := 1; 417 end; 395 418 end; 396 419 … … 487 510 begin 488 511 with CurrentTarget do begin 512 Stop; 489 513 Optimization := coNormal; 490 514 SourceCode := MemoSource.Text; … … 492 516 Compile; 493 517 MemoTarget.Text := TargetCode; 518 UpdateInterface; 494 519 end; 495 520 end; … … 503 528 begin 504 529 CurrentTarget.Pause 530 end; 531 532 procedure TMainForm.AProgramRunToCursorExecute(Sender: TObject); 533 var 534 DebugStep: TDebugStep; 535 begin 536 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart); 537 CurrentTarget.RunToCursor(DebugStep.TargetPosition); 538 end; 539 540 procedure TMainForm.AProgramShowExecutionPointExecute(Sender: TObject); 541 var 542 DebugStep: TDebugStep; 543 begin 544 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(CurrentTarget.ExecutionPosition); 545 MemoSource.SelStart := DebugStep.SourcePosition; 546 MemoTarget.SelStart := DebugStep.TargetPosition; 547 end; 548 549 procedure TMainForm.AProgramStepIntoExecute(Sender: TObject); 550 begin 551 CurrentTarget.StepInto; 552 end; 553 554 procedure TMainForm.AProgramStepOutExecute(Sender: TObject); 555 begin 556 CurrentTarget.StepOut; 557 end; 558 559 procedure TMainForm.AProgramStepOverExecute(Sender: TObject); 560 begin 561 CurrentTarget.StepOver; 505 562 end; 506 563 -
trunk/Languages/LazFuckIDE.cs.po
r34 r35 137 137 msgstr "Spustit po ukazatel" 138 138 139 #: tmainform.aprogramshowexecutionpoint.caption 140 msgid "Show execution point" 141 msgstr "" 142 139 143 #: tmainform.aprogramstepinto.caption 140 144 msgctxt "tmainform.aprogramstepinto.caption" -
trunk/Languages/LazFuckIDE.po
r34 r35 128 128 msgstr "" 129 129 130 #: tmainform.aprogramshowexecutionpoint.caption 131 msgid "Show execution point" 132 msgstr "" 133 130 134 #: tmainform.aprogramstepinto.caption 131 135 msgctxt "TMAINFORM.APROGRAMSTEPINTO.CAPTION" -
trunk/Target/UTarget.pas
r34 r35 49 49 procedure AddLine(Text: string); 50 50 function LongFileName(FileName: string): string; 51 function GetExecutionPosition: Integer; virtual; 51 52 public 52 53 Name: string; … … 58 59 ProjectFileName: string; 59 60 Capabilities: TTargetCapabilities; 60 BreakPoint ers: TListInteger;61 BreakPoints: TListInteger; 61 62 DebugSteps: TDebugStepList; 62 63 constructor Create; virtual; … … 71 72 procedure StepInto; virtual; 72 73 procedure StepOut; virtual; 73 procedure RunToCursor ; virtual;74 procedure RunToCursor(Pos: Integer); virtual; 74 75 procedure LoadFromRegistry(Root: HKEY; Key: string); virtual; 75 76 procedure SaveToRegistry(Root: HKEY; Key: string); virtual; … … 79 80 property TargetCode: string read GetTargetCode; 80 81 property Compiled: Boolean read FCompiled write FCompiled; 82 property ExecutionPosition: Integer read GetExecutionPosition; 81 83 end; 82 84 … … 184 186 begin 185 187 Result := FTargetCode; 188 end; 189 190 function TTarget.GetExecutionPosition: Integer; 191 begin 192 186 193 end; 187 194 … … 211 218 inherited; 212 219 Optimization := coNormal; 213 BreakPoint ers := TListInteger.Create;220 BreakPoints := TListInteger.Create; 214 221 DebugSteps := TDebugStepList.Create; 215 222 end; … … 218 225 begin 219 226 DebugSteps.Free;; 220 BreakPoint ers.Free;227 BreakPoints.Free; 221 228 inherited Destroy; 222 229 end; … … 303 310 end; 304 311 305 procedure TTarget.RunToCursor ;312 procedure TTarget.RunToCursor(Pos: Integer); 306 313 begin 307 314 -
trunk/Target/UTargetC.pas
r34 r35 57 57 58 58 begin 59 inherited; 59 60 Indent := 0; 60 61 FTargetCode := ''; -
trunk/Target/UTargetDelphi.pas
r34 r35 52 52 53 53 begin 54 inherited; 54 55 Indent := 0; 55 56 FTargetCode := ''; -
trunk/Target/UTargetInterpretter.pas
r33 r35 45 45 procedure CommandLoopStart; 46 46 procedure CommandLoopEnd; 47 procedure SingleStep;48 47 procedure Reset; 48 procedure PrepareBreakPoints; 49 49 protected 50 50 function GetTargetCode: string; override; 51 function GetExecutionPosition: Integer; override; 51 52 public 52 53 FProgram: array of TBrainFuckCommand; 54 FProgramBreakpoints: array of Boolean; 53 55 SourceJump: array of Integer; 54 56 SourcePosition: Integer; … … 64 66 procedure Pause; override; 65 67 procedure Stop; override; 68 procedure StepInto; override; 69 procedure StepOver; override; 70 procedure StepOut; override; 71 procedure RunToCursor(Pos: Integer); override; 66 72 constructor Create; override; 67 73 destructor Destroy; override; … … 92 98 procedure TTargetInterpretterThread.Execute; 93 99 begin 100 with Parent do 94 101 repeat 95 while (Parent.SourcePosition < Length(Parent.FProgram)) and (Parent.State <> rsStopped) do begin 96 Parent.SingleStep; 97 while Parent.State = rsPaused do begin 98 Sleep(1); 99 end; 102 while (SourcePosition < Length(FProgram)) and (State <> rsStopped) do begin 103 if State = rsRunning then begin 104 if FProgramBreakpoints[SourcePosition] then begin 105 FProgramBreakpoints[SourcePosition] := False; 106 SetState(rsPaused); 107 end else begin 108 FCommandTable[FProgram[SourcePosition]]; 109 Inc(SourcePosition); 110 Inc(FStepCount); 111 end; 112 end else 113 if State = rsPaused then Sleep(1); 100 114 end; 101 Parent.SetState(rsStopped);102 until Terminated or ( Parent.State = rsStopped);115 SetState(rsStopped); 116 until Terminated or (State = rsStopped); 103 117 end; 104 118 … … 127 141 Pos: Integer; 128 142 begin 143 inherited; 129 144 DebugSteps.Clear; 130 145 SetLength(FProgram, Length(FSourceCode)); … … 282 297 end; 283 298 299 procedure TTargetInterpretter.PrepareBreakPoints; 300 var 301 I: Integer; 302 begin 303 SetLength(FProgramBreakpoints, Length(FProgram)); 304 for I := 0 to High(FProgramBreakpoints) do 305 FProgramBreakpoints[I] := False; 306 for I := 0 to BreakPoints.Count - 1 do 307 FProgramBreakpoints[BreakPoints[I]] := True; 308 end; 309 284 310 function TTargetInterpretter.GetTargetCode: string; 285 311 var … … 291 317 end; 292 318 293 procedure TTargetInterpretter.SingleStep; 294 begin 295 FCommandTable[FProgram[SourcePosition]]; 296 Inc(SourcePosition); 297 Inc(FStepCount); 319 function TTargetInterpretter.GetExecutionPosition: Integer; 320 begin 321 Result := SourcePosition; 298 322 end; 299 323 … … 302 326 SetState(rsRunning); 303 327 Reset; 328 PrepareBreakPoints; 304 329 SetThread(False); 305 330 SetThread(True); … … 314 339 begin 315 340 SetState(rsStopped); 341 end; 342 343 procedure TTargetInterpretter.StepInto; 344 var 345 Step: TDebugStep; 346 begin 347 Step := DebugSteps.SearchByTargetPos(SourcePosition); 348 FProgramBreakpoints[Step.TargetPosition + 1] := True; 349 end; 350 351 procedure TTargetInterpretter.StepOver; 352 var 353 Step: TDebugStep; 354 begin 355 end; 356 357 procedure TTargetInterpretter.StepOut; 358 begin 359 inherited StepOut; 360 end; 361 362 procedure TTargetInterpretter.RunToCursor(Pos: Integer); 363 begin 364 FProgramBreakpoints[Pos] := True; 316 365 end; 317 366 -
trunk/Target/UTargetPHP.pas
r34 r35 55 55 56 56 begin 57 inherited; 57 58 Indent := 0; 58 59 FTargetCode := '';
Note:
See TracChangeset
for help on using the changeset viewer.