Changeset 136
- Timestamp:
- Mar 5, 2022, 4:14:27 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r133 r136 547 547 end 548 548 object TimerRefresh: TTimer 549 Interval = 200 549 550 OnTimer = TimerRefreshTimer 550 551 Left = 70 -
trunk/Forms/UFormMain.pas
r134 r136 189 189 SFileNotFound = 'File %s not found.'; 190 190 191 const 192 ExamplesDir = 'Examples'; 193 191 194 { TFormMain } 192 195 … … 259 262 raise Exception.Create(SCloseProjectFirst); 260 263 FormSourceCode.SynEditSource.Lines.LoadFromFile(FileName); 261 Core. LastOpenedList.AddItem(FileName);264 Core.AddItemToLastOpenedList(FileName); 262 265 Core.Project.FileName := FileName; 263 266 Core.Project.Openned := True; … … 663 666 AProjectClose.Execute; 664 667 if Core.Project.Openned then Exit; 665 Core.Project.FileName := CombinePaths(Core.DataDir, 'Examples'+ DirectorySeparator + SNewProject + '.b');668 Core.Project.FileName := CombinePaths(Core.DataDir, ExamplesDir + DirectorySeparator + SNewProject + '.b'); 666 669 FormSourceCode.SynEditSource.Clear; 667 670 Core.Project.Openned := True; … … 683 686 684 687 procedure TFormMain.AProjectOpenExecute(Sender: TObject); 688 var 689 FileName: string; 685 690 begin 686 691 if Core.LastOpenedList.Items.Count > 0 then 687 OpenDialog1.FileName := Core.LastOpenedList.Items[0] 688 else OpenDialog1.FileName := CombinePaths(Core.DataDir, 'Examples'); 689 OpenDialog1.InitialDir := ExtractFileDir(OpenDialog1.FileName); 692 FileName := Core.LastOpenedList.Items[0] 693 else FileName := CombinePaths(Core.DataDir, ExamplesDir); 694 OpenDialog1.InitialDir := ExtractFileDir(FileName); 695 OpenDialog1.FileName := ExtractFileName(FileName); 690 696 if OpenDialog1.Execute then begin 691 697 AProjectClose.Execute; … … 697 703 procedure TFormMain.AProjectSaveAsExecute(Sender: TObject); 698 704 begin 699 SaveDialog1.FileName := Core.Project.FileName; 705 SaveDialog1.InitialDir := ExtractFileDir(Core.Project.FileName); 706 SaveDialog1.FileName := ExtractFileName(Core.Project.FileName); 700 707 if SaveDialog1.Execute then begin 701 708 FormSourceCode.SynEditSource.Lines.SaveToFile(SaveDialog1.FileName); 702 709 Core.Project.FileName := SaveDialog1.FileName; 703 Core. LastOpenedList.AddItem(SaveDialog1.FileName);710 Core.AddItemToLastOpenedList(SaveDialog1.FileName); 704 711 Core.Project.Modified := False; 705 712 UpdateInterface; … … 711 718 if Core.Project.Modified and FileExists(Core.Project.FileName) then begin 712 719 FormSourceCode.SynEditSource.Lines.SaveToFile(Core.Project.FileName); 720 Core.AddItemToLastOpenedList(Core.Project.FileName); 713 721 Core.Project.Modified := False; 714 722 UpdateInterface; -
trunk/Languages/LazFuck.cs.po
r135 r136 619 619 msgstr "Zastaveno" 620 620 621 #: utargetinterpretter.sbreakpointindexerror 622 #, object-pascal-format 623 msgid "Break point index error: %d" 624 msgstr "Chyba indexu bodu pÅeruÅ¡enÃ: %d" 625 621 626 #: utargetinterpretter.sjumptablecollision 622 627 msgid "Jump table collision" … … 628 633 msgstr "Nekonzistentnà skoková tabulka" 629 634 630 #: utargetinterpretter.sprogramlower limit631 msgid "Program run over lower limit"632 msgstr "Program pÅekroÄil dolnà omezenÃ"635 #: utargetinterpretter.sprogramlowermemorylimit 636 msgid "Program run over lower memory limit" 637 msgstr "Program pÅekroÄil dolnà rozsah pamÄti" 633 638 634 639 #: utargetinterpretter.sprogramnotrunning … … 636 641 msgstr "Program nebÄÅŸÃ" 637 642 638 #: utargetinterpretter.sprogramupper limit639 msgid "Program run over upper limit"640 msgstr "Program pÅekroÄil hornà omezenÃ"643 #: utargetinterpretter.sprogramuppermemorylimit 644 msgid "Program run over upper memory limit" 645 msgstr "Program pÅekroÄil hornà rozsah pamÄti" 641 646 642 647 #: utargetinterpretter.sunsupportedcommand -
trunk/Languages/LazFuck.pot
r135 r136 609 609 msgstr "" 610 610 611 #: utargetinterpretter.sbreakpointindexerror 612 #, object-pascal-format 613 msgid "Break point index error: %d" 614 msgstr "" 615 611 616 #: utargetinterpretter.sjumptablecollision 612 617 msgid "Jump table collision" … … 618 623 msgstr "" 619 624 620 #: utargetinterpretter.sprogramlower limit621 msgid "Program run over lower limit"625 #: utargetinterpretter.sprogramlowermemorylimit 626 msgid "Program run over lower memory limit" 622 627 msgstr "" 623 628 … … 626 631 msgstr "" 627 632 628 #: utargetinterpretter.sprogramupper limit629 msgid "Program run over upper limit"633 #: utargetinterpretter.sprogramuppermemorylimit 634 msgid "Program run over upper memory limit" 630 635 msgstr "" 631 636 -
trunk/Target/UTargetInterpretter.pas
r133 r136 16 16 private 17 17 FNewState: TRunState; 18 FMessage: string; 19 procedure DoMessage; 18 20 procedure DoSetState; 19 21 procedure SetStateSafe(State: TRunState); … … 81 83 82 84 resourcestring 83 SProgramLower Limit = 'Program run over lowerlimit';84 SProgramUpper Limit = 'Program run over upperlimit';85 SProgramLowerMemoryLimit = 'Program run over lower memory limit'; 86 SProgramUpperMemoryLimit = 'Program run over upper memory limit'; 85 87 SJumpTableInconsistent = 'Jump table is inconsistent'; 86 88 SJumpTableCollision = 'Jump table collision'; 87 89 SProgramNotRunning = 'Program not running'; 88 90 SUnsupportedCommand = 'Unsupported command'; 91 SBreakPointIndexError = 'Break point index error: %d'; 89 92 90 93 { TTargetInterpretterThread } … … 93 96 var 94 97 BreakPoint: TBreakPoint; 95 begin 98 Index: Integer; 99 begin 100 try 96 101 with Parent do 97 102 repeat … … 100 105 if FProgramBreakpoints[FProgramIndex] then begin 101 106 BreakPoint := BreakPoints.SearchByTargetPos(FProgramIndex); 102 if BreakPoint.System then BreakPoints.Delete(BreakPoints.IndexOf(BreakPoint)); 107 if BreakPoint.System then begin 108 Index := BreakPoints.IndexOf(BreakPoint); 109 if Index <> -1 then BreakPoints.Delete(Index) 110 else raise Exception.Create(Format(SBreakPointIndexError, [Index])); 111 end; 103 112 SetStateSafe(rsPaused); 104 113 end else begin … … 114 123 if State <> rsStopped then SetStateSafe(rsStopped); 115 124 until Terminated or (State = rsStopped); 125 126 except 127 on E: Exception do begin 128 FMessage := E.Message; 129 Synchronize(DoMessage); 130 end; 131 end; 132 end; 133 134 procedure TTargetInterpretterThread.DoMessage; 135 begin 136 Parent.SendMessage(FMessage); 116 137 end; 117 138 … … 123 144 procedure TTargetInterpretterThread.SetStateSafe(State: TRunState); 124 145 begin 146 if Parent.State = State then Exit; 125 147 FNewState := State; 126 148 Synchronize(DoSetState); … … 212 234 begin 213 235 if Memory[MemoryPosition + FProgram[FProgramIndex].RelIndex] = 0 then 214 FProgramIndex := FProgram[FProgramIndex].Parameter ;236 FProgramIndex := FProgram[FProgramIndex].Parameter - 1; 215 237 end; 216 238 … … 245 267 if MemoryPosition < MemorySize then 246 268 Inc(MemoryPosition, FProgram[FProgramIndex].Parameter) 247 else raise Exception.Create(SProgramUpper Limit);269 else raise Exception.Create(SProgramUpperMemoryLimit); 248 270 end; 249 271 … … 252 274 if MemoryPosition > 0 then 253 275 Dec(MemoryPosition, FProgram[FProgramIndex].Parameter) 254 else raise Exception.Create(SProgramLower Limit);276 else raise Exception.Create(SProgramLowerMemoryLimit); 255 277 end; 256 278 … … 319 341 procedure TTargetInterpretter.CheckMemoryBounds(Address: Integer); 320 342 begin 321 if Address < 0 then raise Exception.Create(SProgramLower Limit);322 if Address >= MemorySize then raise Exception.Create(SProgramUpper Limit);343 if Address < 0 then raise Exception.Create(SProgramLowerMemoryLimit); 344 if Address >= MemorySize then raise Exception.Create(SProgramUpperMemoryLimit); 323 345 end; 324 346 … … 428 450 Nesting := 1; 429 451 while (StepIndex < DebugSteps.Count) and (Nesting > 0) do begin 430 if TDebugStep(DebugSteps[StepIndex]).Operation = soStepIn then Inc(Nesting);431 if TDebugStep(DebugSteps[StepIndex]).Operation = soStepOut then Dec(Nesting);452 if DebugSteps[StepIndex].Operation = soStepIn then Inc(Nesting); 453 if DebugSteps[StepIndex].Operation = soStepOut then Dec(Nesting); 432 454 Inc(StepIndex); 433 455 end; 434 456 if StepIndex < DebugSteps.Count then begin 435 Breakpoints.SetSystem( TDebugStep(DebugSteps[StepIndex]).ProgramPosition);457 Breakpoints.SetSystem(DebugSteps[StepIndex].ProgramPosition); 436 458 end; 437 459 Run; -
trunk/UBFTarget.pas
r128 r136 589 589 ']': FProgram.Write(TMachineOperation.Create(cmLoopEnd, 0)); 590 590 end; 591 if DebugEnabled and (FProgram.Index <> LastIndex) then 592 DebugSteps.AddStep(I - 1, FProgram.Index - 1, soNormal); 591 if DebugEnabled and (FProgram.Index <> LastIndex) then begin 592 case FSourceCode[I] of 593 '[': DebugSteps.AddStep(I - 1, FProgram.Index - 1, soStepIn); 594 ']': DebugSteps.AddStep(I - 1, FProgram.Index - 1, soStepOut); 595 else DebugSteps.AddStep(I - 1, FProgram.Index - 1, soNormal); 596 end; 597 end; 593 598 LastIndex := FProgram.Index; 594 599 end; -
trunk/UCore.lfm
r135 r136 21 21 AppName = 'LazFuck' 22 22 Description = 'A simple BrainFuck IDE written in Lazarus/FPC.' 23 ReleaseDate = 44 57523 ReleaseDate = 44625 24 24 RegistryKey = '\Software\Chronosoft\LazFuck' 25 25 RegistryRoot = rrKeyCurrentUser -
trunk/UCore.pas
r135 r136 29 29 FCurrentTarget: TTarget; 30 30 StoredDimension: TControlDimension; 31 RecentFileRegistryContext: TRegistryContext; 31 32 procedure InitTargets; 32 33 procedure SetCurrentTarget(AValue: TTarget); … … 46 47 Optimizations: TOptimizations; 47 48 procedure Init; 49 procedure AddItemToLastOpenedList(FileName: string); 48 50 procedure LoadFromRegistry(Context: TRegistryContext); 49 51 procedure SaveToRegistry(Context: TRegistryContext); … … 69 71 70 72 { TCore } 73 74 procedure TCore.AddItemToLastOpenedList(FileName: string); 75 begin 76 with LastOpenedList do begin 77 LoadFromRegistry(RecentFileRegistryContext); 78 AddItem(FileName); 79 SaveToRegistry(RecentFileRegistryContext); 80 end; 81 end; 71 82 72 83 procedure TCore.DataModuleCreate(Sender: TObject); … … 91 102 StoredDimension := TControlDimension.Create; 92 103 InitTargets; 104 RecentFileRegistryContext := TRegistryContext.Create(ApplicationInfo.RegistryRoot, 105 ApplicationInfo.RegistryKey + '\' + RecentFilesRegKey); 93 106 LoadFromRegistry(Core.ApplicationInfo.GetRegistryContext); 94 107 end; … … 149 162 Free; 150 163 end; 151 LastOpenedList.LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + RecentFilesRegKey));152 164 Targets.LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\Compiler')); 165 LastOpenedList.LoadFromRegistry(RecentFileRegistryContext); 153 166 PersistentForm1.RegistryContext := Context; 154 167 end; … … 157 170 begin 158 171 Targets.SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\Compiler')); 159 LastOpenedList.SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + RecentFilesRegKey));160 172 with TRegistryEx.Create do 161 173 try -
trunk/UTarget.pas
r135 r136 113 113 DebugEnabled: Boolean; 114 114 Selected: Boolean; 115 procedure SendMessage(Text: string); 115 116 constructor Create; virtual; 116 117 destructor Destroy; override; … … 427 428 end; 428 429 430 procedure TTarget.SendMessage(Text: string); 431 begin 432 if Assigned(FOnMessage) then 433 FOnMessage(Text); 434 end; 435 429 436 procedure TTarget.SetSourceCode(AValue: string); 430 437 begin
Note:
See TracChangeset
for help on using the changeset viewer.