Changeset 70
- Timestamp:
- Oct 11, 2015, 6:50:33 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r68 r70 12 12 OnDestroy = FormDestroy 13 13 OnShow = FormShow 14 LCLVersion = '1. 3'14 LCLVersion = '1.5' 15 15 WindowState = wsMaximized 16 16 object StatusBarMain: TStatusBar -
trunk/Forms/UFormMain.pas
r67 r70 167 167 uses 168 168 UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput, 169 UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog; 169 UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog, 170 UBFTarget; 170 171 171 172 resourcestring … … 454 455 begin 455 456 OptionsForm.Load; 456 //OptionsForm.LoadFromInterpretter(CurrentTarget);457 457 if OptionsForm.ShowModal = mrOK then begin 458 //OptionsForm.SaveToInterpretter(CurrentTarget);459 458 OptionsForm.Save; 460 if Assigned(Core.CurrentTarget) then 459 if Assigned(Core.CurrentTarget) then begin 461 460 Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel; 461 if Core.CurrentTarget is TBFTarget then begin 462 TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize; 463 TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize; 464 end; 465 end; 462 466 end; 463 467 end; -
trunk/Forms/UFormOptions.lfm
r67 r70 8 8 ClientWidth = 468 9 9 OnShow = FormShow 10 LCLVersion = '1. 3'10 LCLVersion = '1.5' 11 11 object ButtonOk: TButton 12 12 Left = 389 -
trunk/Forms/UFormOptions.pas
r64 r70 39 39 procedure Load; 40 40 procedure Save; 41 procedure LoadFromInterpretter(Interpretter: TTargetInterpretter);42 procedure SaveToInterpretter(Interpretter: TTargetInterpretter);43 41 end; 44 42 … … 81 79 CheckBoxDPIAuto.Checked := Core.ScaleDPI.AutoDetect; 82 80 ComboBoxOptimizatipn.ItemIndex := Integer(Core.OptimizationLevel); 81 SpinEditCellSize.Value := Core.CellSize; 82 SpinEditMemorySize.Value := Core.MemorySize; 83 83 UpdateInterface; 84 84 end; … … 90 90 Core.ScaleDPI.AutoDetect := CheckBoxDPIAuto.Checked; 91 91 Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimizatipn.ItemIndex); 92 Core.CellSize := SpinEditCellSize.Value; 93 Core.MemorySize := SpinEditMemorySize.Value; 92 94 end; 93 95 … … 104 106 end; 105 107 106 procedure TOptionsForm.LoadFromInterpretter(Interpretter: TTargetInterpretter107 );108 begin109 SpinEditCellSize.Value := Interpretter.CellSize;110 SpinEditMemorySize.Value := Interpretter.MemorySize;111 end;112 113 procedure TOptionsForm.SaveToInterpretter(Interpretter: TTargetInterpretter);114 begin115 Interpretter.CellSize := SpinEditCellSize.Value;116 Interpretter.MemorySize := SpinEditMemorySize.Value;117 end;118 119 108 end. 120 109 -
trunk/Target/UTargetInterpretter.pas
r68 r70 30 30 TTargetInterpretter = class(TBFTarget) 31 31 private 32 FCellSize: Integer;33 32 FThreadState: Boolean; 34 33 FThread: TTargetInterpretterThread; 35 34 FStepCount: Integer; 36 35 FCommandTable: array[TMachineCommand] of TCommandHandler; 37 function GetMemorySize: Integer;38 procedure SetMemorySize(AValue: Integer);39 36 procedure SetThread(State: Boolean); 40 37 procedure PrepareJumpTable; … … 74 71 constructor Create; override; 75 72 destructor Destroy; override; 76 procedure LoadFromRegistry(Root: HKEY; Key: string); override;77 procedure SaveToRegistry(Root: HKEY; Key: string); override;78 73 property StepCount: Integer read FStepCount; 79 property MemorySize: Integer read GetMemorySize write SetMemorySize;80 property CellSize: Integer read FCellSize write FCellSize;81 74 end; 82 75 … … 146 139 end; 147 140 148 function TTargetInterpretter.GetMemorySize: Integer;149 begin150 Result := Length(Memory);151 end;152 153 procedure TTargetInterpretter.SetMemorySize(AValue: Integer);154 begin155 SetLength(Memory, AValue);156 end;157 158 141 procedure TTargetInterpretter.SetThread(State: Boolean); 159 142 begin … … 175 158 I: Integer; 176 159 begin 160 for I := 0 to Length(FProgram) - 1 do begin 161 case FProgram[I].Command of 162 cmLoopStart: FProgram[I].Parameter := 0; 163 cmLoopEnd: FProgram[I].Parameter := 0; 164 end; 165 end; 166 177 167 SetLength(Loop, 0); 178 168 for I := 0 to Length(FProgram) - 1 do begin … … 259 249 begin 260 250 inherited; 251 SetLength(Memory, MemorySize); 261 252 PrepareJumpTable; 262 253 FProgramIndex := 0; … … 412 403 Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto, 413 404 tcStepOver, tcRunToCursor]; 414 MemorySize := 30000;415 CellSize := 256;416 405 // Base commands 417 406 FCommandTable[cmInc] := CommandInc; … … 434 423 end; 435 424 436 procedure TTargetInterpretter.LoadFromRegistry(Root: HKEY; Key: string);437 begin438 inherited LoadFromRegistry(Root, Key);439 with TRegistryEx.Create do440 try441 RootKey := Root;442 OpenKey(Key, True);443 CellSize := ReadIntegerWithDefault('CellSize', 256);444 MemorySize := ReadIntegerWithDefault('MemorySize', 30000);445 finally446 Free;447 end;448 end;449 450 procedure TTargetInterpretter.SaveToRegistry(Root: HKEY; Key: string);451 begin452 inherited SaveToRegistry(Root, Key);453 with TRegistryEx.Create do454 try455 RootKey := Root;456 OpenKey(Key, True);457 WriteInteger('CellSize', CellSize);458 WriteInteger('MemorySize', MemorySize);459 finally460 Free;461 end;462 end;463 464 425 end. 465 426 -
trunk/UBFTarget.pas
r66 r70 33 33 procedure LoadProgram; override; 34 34 public 35 MemorySize: Integer; 36 CellSize: Integer; 37 constructor Create; override; 35 38 procedure OptimizeSource; override; 36 39 property ProgramIndex: Integer read FProgramIndex; … … 314 317 end; 315 318 319 constructor TBFTarget.Create; 320 begin 321 inherited Create; 322 MemorySize := 30000; 323 CellSize := 256; 324 end; 325 316 326 procedure TBFTarget.OptimizeSource; 317 327 var -
trunk/UCore.pas
r67 r70 28 28 OpenProjectOnStart: Boolean; 29 29 OptimizationLevel: TCompilerOptimization; 30 CellSize: Integer; 31 MemorySize: Integer; 30 32 procedure LoadFromRegistry(Root: HKEY; Key: string); 31 33 procedure SaveToRegistry(Root: HKEY; Key: string); … … 43 45 uses 44 46 UFormMain, UTargetJava, UTargetDelphi, UTargetPHP, UTargetC, 45 UTargetInterpretter, UTargetFPC ;47 UTargetInterpretter, UTargetFPC, UBFTarget; 46 48 47 49 … … 86 88 ScaleDPI.AutoDetect := ReadBoolWithDefault('DPIAuto', True); 87 89 OptimizationLevel := TCompilerOptimization(ReadIntegerWithDefault('OptimizationLevel', Integer(coNormal))); 90 MemorySize := ReadIntegerWithDefault('MemorySize', 30000); 91 CellSize := ReadIntegerWithDefault('CellSize', 256); 88 92 finally 89 93 Free; … … 106 110 WriteInteger('DPIY', ScaleDPI.DPI.Y); 107 111 WriteInteger('OptimizationLevel', Integer(OptimizationLevel)); 112 WriteInteger('MemorySize', MemorySize); 113 WriteInteger('CellSize', CellSize); 108 114 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then 109 115 WriteString('LanguageCode', CoolTranslator1.Language.Code) … … 127 133 FCurrentTarget.OptimizationLevel := OptimizationLevel; 128 134 FCurrentTarget.Messages.OnChange := FormMain.MessagesChanged; 135 if FCurrentTarget is TBFTarget then begin 136 TBFTarget(FCurrentTarget).MemorySize := MemorySize; 137 TBFTarget(FCurrentTarget).CellSize := CellSize; 138 end; 129 139 end; 130 140 FormMain.UpdateTargetList; -
trunk/UTarget.pas
r66 r70 131 131 end; 132 132 133 TBFTarget = class134 135 end;136 137 133 { TTargetList } 138 134
Note:
See TracChangeset
for help on using the changeset viewer.