Changeset 70 for trunk


Ignore:
Timestamp:
Oct 11, 2015, 6:50:33 PM (9 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r68 r70  
    1212  OnDestroy = FormDestroy
    1313  OnShow = FormShow
    14   LCLVersion = '1.3'
     14  LCLVersion = '1.5'
    1515  WindowState = wsMaximized
    1616  object StatusBarMain: TStatusBar
  • trunk/Forms/UFormMain.pas

    r67 r70  
    167167uses
    168168  UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput,
    169   UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog;
     169  UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog,
     170  UBFTarget;
    170171
    171172resourcestring
     
    454455begin
    455456  OptionsForm.Load;
    456   //OptionsForm.LoadFromInterpretter(CurrentTarget);
    457457  if OptionsForm.ShowModal = mrOK then begin
    458     //OptionsForm.SaveToInterpretter(CurrentTarget);
    459458    OptionsForm.Save;
    460     if Assigned(Core.CurrentTarget) then
     459    if Assigned(Core.CurrentTarget) then begin
    461460      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;
    462466  end;
    463467end;
  • trunk/Forms/UFormOptions.lfm

    r67 r70  
    88  ClientWidth = 468
    99  OnShow = FormShow
    10   LCLVersion = '1.3'
     10  LCLVersion = '1.5'
    1111  object ButtonOk: TButton
    1212    Left = 389
  • trunk/Forms/UFormOptions.pas

    r64 r70  
    3939    procedure Load;
    4040    procedure Save;
    41     procedure LoadFromInterpretter(Interpretter: TTargetInterpretter);
    42     procedure SaveToInterpretter(Interpretter: TTargetInterpretter);
    4341  end;
    4442
     
    8179  CheckBoxDPIAuto.Checked := Core.ScaleDPI.AutoDetect;
    8280  ComboBoxOptimizatipn.ItemIndex := Integer(Core.OptimizationLevel);
     81  SpinEditCellSize.Value := Core.CellSize;
     82  SpinEditMemorySize.Value := Core.MemorySize;
    8383  UpdateInterface;
    8484end;
     
    9090  Core.ScaleDPI.AutoDetect := CheckBoxDPIAuto.Checked;
    9191  Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimizatipn.ItemIndex);
     92  Core.CellSize := SpinEditCellSize.Value;
     93  Core.MemorySize := SpinEditMemorySize.Value;
    9294end;
    9395
     
    104106end;
    105107
    106 procedure TOptionsForm.LoadFromInterpretter(Interpretter: TTargetInterpretter
    107   );
    108 begin
    109   SpinEditCellSize.Value := Interpretter.CellSize;
    110   SpinEditMemorySize.Value := Interpretter.MemorySize;
    111 end;
    112 
    113 procedure TOptionsForm.SaveToInterpretter(Interpretter: TTargetInterpretter);
    114 begin
    115   Interpretter.CellSize := SpinEditCellSize.Value;
    116   Interpretter.MemorySize := SpinEditMemorySize.Value;
    117 end;
    118 
    119108end.
    120109
  • trunk/Target/UTargetInterpretter.pas

    r68 r70  
    3030  TTargetInterpretter = class(TBFTarget)
    3131  private
    32     FCellSize: Integer;
    3332    FThreadState: Boolean;
    3433    FThread: TTargetInterpretterThread;
    3534    FStepCount: Integer;
    3635    FCommandTable: array[TMachineCommand] of TCommandHandler;
    37     function GetMemorySize: Integer;
    38     procedure SetMemorySize(AValue: Integer);
    3936    procedure SetThread(State: Boolean);
    4037    procedure PrepareJumpTable;
     
    7471    constructor Create; override;
    7572    destructor Destroy; override;
    76     procedure LoadFromRegistry(Root: HKEY; Key: string); override;
    77     procedure SaveToRegistry(Root: HKEY; Key: string); override;
    7873    property StepCount: Integer read FStepCount;
    79     property MemorySize: Integer read GetMemorySize write SetMemorySize;
    80     property CellSize: Integer read FCellSize write FCellSize;
    8174  end;
    8275
     
    146139end;
    147140
    148 function TTargetInterpretter.GetMemorySize: Integer;
    149 begin
    150   Result := Length(Memory);
    151 end;
    152 
    153 procedure TTargetInterpretter.SetMemorySize(AValue: Integer);
    154 begin
    155   SetLength(Memory, AValue);
    156 end;
    157 
    158141procedure TTargetInterpretter.SetThread(State: Boolean);
    159142begin
     
    175158  I: Integer;
    176159begin
     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
    177167  SetLength(Loop, 0);
    178168  for I := 0 to Length(FProgram) - 1 do begin
     
    259249begin
    260250  inherited;
     251  SetLength(Memory, MemorySize);
    261252  PrepareJumpTable;
    262253  FProgramIndex := 0;
     
    412403  Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto,
    413404    tcStepOver, tcRunToCursor];
    414   MemorySize := 30000;
    415   CellSize := 256;
    416405  // Base commands
    417406  FCommandTable[cmInc] := CommandInc;
     
    434423end;
    435424
    436 procedure TTargetInterpretter.LoadFromRegistry(Root: HKEY; Key: string);
    437 begin
    438   inherited LoadFromRegistry(Root, Key);
    439   with TRegistryEx.Create do
    440   try
    441     RootKey := Root;
    442     OpenKey(Key, True);
    443     CellSize := ReadIntegerWithDefault('CellSize', 256);
    444     MemorySize := ReadIntegerWithDefault('MemorySize', 30000);
    445   finally
    446     Free;
    447   end;
    448 end;
    449 
    450 procedure TTargetInterpretter.SaveToRegistry(Root: HKEY; Key: string);
    451 begin
    452   inherited SaveToRegistry(Root, Key);
    453   with TRegistryEx.Create do
    454   try
    455     RootKey := Root;
    456     OpenKey(Key, True);
    457     WriteInteger('CellSize', CellSize);
    458     WriteInteger('MemorySize', MemorySize);
    459   finally
    460     Free;
    461   end;
    462 end;
    463 
    464425end.
    465426
  • trunk/UBFTarget.pas

    r66 r70  
    3333    procedure LoadProgram; override;
    3434  public
     35    MemorySize: Integer;
     36    CellSize: Integer;
     37    constructor Create; override;
    3538    procedure OptimizeSource; override;
    3639    property ProgramIndex: Integer read FProgramIndex;
     
    314317end;
    315318
     319constructor TBFTarget.Create;
     320begin
     321  inherited Create;
     322  MemorySize := 30000;
     323  CellSize := 256;
     324end;
     325
    316326procedure TBFTarget.OptimizeSource;
    317327var
  • trunk/UCore.pas

    r67 r70  
    2828    OpenProjectOnStart: Boolean;
    2929    OptimizationLevel: TCompilerOptimization;
     30    CellSize: Integer;
     31    MemorySize: Integer;
    3032    procedure LoadFromRegistry(Root: HKEY; Key: string);
    3133    procedure SaveToRegistry(Root: HKEY; Key: string);
     
    4345uses
    4446  UFormMain, UTargetJava, UTargetDelphi, UTargetPHP, UTargetC,
    45   UTargetInterpretter, UTargetFPC;
     47  UTargetInterpretter, UTargetFPC, UBFTarget;
    4648
    4749
     
    8688    ScaleDPI.AutoDetect := ReadBoolWithDefault('DPIAuto', True);
    8789    OptimizationLevel := TCompilerOptimization(ReadIntegerWithDefault('OptimizationLevel', Integer(coNormal)));
     90    MemorySize := ReadIntegerWithDefault('MemorySize', 30000);
     91    CellSize := ReadIntegerWithDefault('CellSize', 256);
    8892  finally
    8993    Free;
     
    106110    WriteInteger('DPIY', ScaleDPI.DPI.Y);
    107111    WriteInteger('OptimizationLevel', Integer(OptimizationLevel));
     112    WriteInteger('MemorySize', MemorySize);
     113    WriteInteger('CellSize', CellSize);
    108114    if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
    109115      WriteString('LanguageCode', CoolTranslator1.Language.Code)
     
    127133    FCurrentTarget.OptimizationLevel := OptimizationLevel;
    128134    FCurrentTarget.Messages.OnChange := FormMain.MessagesChanged;
     135    if FCurrentTarget is TBFTarget then begin
     136      TBFTarget(FCurrentTarget).MemorySize := MemorySize;
     137      TBFTarget(FCurrentTarget).CellSize := CellSize;
     138    end;
    129139  end;
    130140  FormMain.UpdateTargetList;
  • trunk/UTarget.pas

    r66 r70  
    131131  end;
    132132
    133   TBFTarget = class
    134 
    135   end;
    136 
    137133  { TTargetList }
    138134
Note: See TracChangeset for help on using the changeset viewer.