Changeset 31 for trunk


Ignore:
Timestamp:
Feb 18, 2012, 8:02:50 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Renamed classes from Compiler to Target. Interpretter registred as possible and default target.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UCompilersForm.pas

    r25 r31  
    3131
    3232uses
    33   UMainForm, UCompiler;
     33  UMainForm, UTarget;
    3434
    3535resourcestring
     
    4646procedure TFormCompilers.ListView1Data(Sender: TObject; Item: TListItem);
    4747begin
    48   if (Item.Index >= 0) and (Item.Index < MainForm.Compilers.Count) then
    49   with TBrainFuckCompiler(MainForm.Compilers[Item.Index]) do begin
     48  if (Item.Index >= 0) and (Item.Index < MainForm.Targets.Count) then
     49  with TTarget(MainForm.Targets[Item.Index]) do begin
    5050    Item.Caption := Name;
    51     Item.Data := MainForm.Compilers[Item.Index];
     51    Item.Data := MainForm.Targets[Item.Index];
    5252    Item.SubItems.Add(CompilerPath);
    5353  end;
     
    5656procedure TFormCompilers.ListView1DblClick(Sender: TObject);
    5757begin
    58   with TBrainFuckCompiler(ListView1.Selected.Data) do
     58  with TTarget(ListView1.Selected.Data) do
    5959    CompilerPath := InputBox(SCompilerOptions, SCompilerPath,
    6060      CompilerPath);
     
    6464procedure TFormCompilers.ReloadList;
    6565begin
    66   ListView1.Items.Count := MainForm.Compilers.Count;
     66  ListView1.Items.Count := MainForm.Targets.Count;
    6767  ListView1.Refresh;
    6868end;
  • trunk/Forms/UMainForm.pas

    r30 r31  
    77uses
    88  Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs,
    9   Menus, ActnList, StdCtrls, ComCtrls, UBrainFuck, UCoolTranslator, StrUtils,
    10   SpecializedList, UCompiler, Registry, URegistry, ULastOpenedList, Process;
     9  Menus, ActnList, StdCtrls, ComCtrls, UTargetInterpretter, UCoolTranslator, StrUtils,
     10  SpecializedList, UTarget, Registry, URegistry, ULastOpenedList, Process;
    1111
    1212const
     
    146146    CompilerIndex: Integer;
    147147    ProjectFileName: string;
    148     BrainFuckCompiler: TBrainFuckCompiler;
    149     BrainFuckInterpreter: TBrainFuckInterpretter;
     148    BrainFuckCompiler: TTarget;
     149    BrainFuckInterpreter: TTargetInterpretter;
    150150    BreakPoints: TListInteger;
    151     Compilers: TCompilerList;
     151    Targets: TTargetList;
    152152    LastOpenedList: TLastOpenedList;
    153153    OpenProjectOnStart: Boolean;
     
    168168uses
    169169  UInterpretterForm, UApplicationInfo, UCompiledForm, UOptionsForm,
    170   UCompilerDelphi, UCompilerPHP, UCompilerC, UCompilersForm;
     170  UTargetDelphi, UTargetPHP, UTargetC, UCompilersForm;
    171171
    172172resourcestring
     
    255255  end;
    256256  LastOpenedList.LoadFromRegistry(Root, Key);
    257   Compilers.LoadFromRegistry(Root, Key);
     257  Targets.LoadFromRegistry(Root, Key);
    258258end;
    259259
    260260procedure TMainForm.SaveToRegistry(Root: HKEY; Key: string);
    261261begin
    262   Compilers.SaveToRegistry(Root, Key);
     262  Targets.SaveToRegistry(Root, Key);
    263263  LastOpenedList.SaveToRegistry(Root, Key);
    264264  with TRegistryEx.Create do
     
    308308begin
    309309  MenuItemTarget.Clear;
    310   for I := 0 to Compilers.Count - 1 do begin
     310  for I := 0 to Targets.Count - 1 do begin
    311311    NewMenuItem := TMenuItem.Create(MenuItemTarget);
    312     NewMenuItem.Caption := TBrainFuckCompiler(Compilers[I]).Name;
     312    NewMenuItem.Caption := TTarget(Targets[I]).Name;
    313313    NewMenuItem.OnClick := MenuItemTargetClick;
    314314    if I = CompilerIndex then NewMenuItem.Checked := True;
     
    320320begin
    321321  BreakPoints := TListInteger.Create;
    322   BrainFuckInterpreter := TBrainFuckInterpretter.Create;
     322  BrainFuckInterpreter := TTargetInterpretter.Create;
    323323  BrainFuckInterpreter.OnChangeState := BrainFuckInterpreterChangeState;
    324   BrainFuckCompiler := TBrainFuckCompiler.Create;
    325   Compilers := TCompilerList.Create;
    326   Compilers.Add(TBrainFuckCompilerDelphi.Create);
    327   Compilers.Add(TBrainFuckCompilerPHP.Create);
    328   Compilers.Add(TBrainFuckCompilerC.Create);
     324  BrainFuckCompiler := TTarget.Create;
     325  Targets := TTargetList.Create;
     326  Targets.Add(TTargetInterpretter.Create);
     327  Targets.Add(TTargetDelphi.Create);
     328  Targets.Add(TTargetPHP.Create);
     329  Targets.Add(TTargetC.Create);
    329330  UpdateTargetList;
    330331  LastOpenedList := TLastOpenedList.Create;
     
    338339  SaveToRegistry(RegistryRoot, ApplicationInfo.RegistryKey);
    339340  LastOpenedList.Free;
    340   Compilers.Free;
     341  Targets.Free;
    341342  BrainFuckCompiler.Free;
    342343  BrainFuckInterpreter.Free;
     
    449450procedure TMainForm.ACompileExecute(Sender: TObject);
    450451begin
    451   with TBrainFuckCompiler(Compilers[CompilerIndex]) do begin
     452  with TTarget(Targets[CompilerIndex]) do begin
    452453    Optimization := coNormal;
    453454    Source := MemoSource.Text;
     
    466467procedure TMainForm.ACompileAndRunExecute(Sender: TObject);
    467468begin
    468   with TBrainFuckCompiler(Compilers[CompilerIndex]) do begin
     469  with TTarget(Targets[CompilerIndex]) do begin
    469470    Optimization := coNormal;
    470471    Source := MemoSource.Text;
  • trunk/Forms/UOptionsForm.pas

    r25 r31  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Spin, ComCtrls, UBrainFuck;
     9  Spin, ComCtrls, UTargetInterpretter;
    1010
    1111type
     
    2828    { private declarations }
    2929  public
    30     procedure LoadFromInterpretter(Interpretter: TBrainFuckInterpretter);
    31     procedure SaveToInterpretter(Interpretter: TBrainFuckInterpretter);
     30    procedure LoadFromInterpretter(Interpretter: TTargetInterpretter);
     31    procedure SaveToInterpretter(Interpretter: TTargetInterpretter);
    3232  end;
    3333
     
    5959end;
    6060
    61 procedure TOptionsForm.LoadFromInterpretter(Interpretter: TBrainFuckInterpretter
     61procedure TOptionsForm.LoadFromInterpretter(Interpretter: TTargetInterpretter
    6262  );
    6363begin
     
    6666end;
    6767
    68 procedure TOptionsForm.SaveToInterpretter(Interpretter: TBrainFuckInterpretter);
     68procedure TOptionsForm.SaveToInterpretter(Interpretter: TTargetInterpretter);
    6969begin
    7070  Interpretter.CellSize := SpinEditCellSize.Value;
  • trunk/Target/UTarget.pas

    r30 r31  
    1111type
    1212  TCompilerOptimization = (coNone, coNormal);
     13
     14  TTargetCapability = (tcRun, tcPause, tcStop, tcStepOut, tsStepOver, tsStepInto,
     15    tsRunToCursor, tcCompile, tcBreakpoint);
     16  TTargetCapabilities = set of TTargetCapability;
    1317
    1418  { TTarget }
     
    2933    CompiledExtension: string;
    3034    ProjectFileName: string;
     35    Capabilities: TTargetCapabilities;
    3136    constructor Create; virtual;
    3237    procedure OptimizeSource;
     
    3439    procedure CompileToFile; virtual;
    3540    procedure Run; virtual;
     41    procedure Pause; virtual;
     42    procedure Stop; virtual;
     43    procedure StepOver; virtual;
     44    procedure StepInto; virtual;
     45    procedure StepOut; virtual;
     46    procedure RunToCursor; virtual;
    3647  end;
    3748
     
    168179end;
    169180
    170 
     181procedure TTarget.Pause;
     182begin
     183
     184end;
     185
     186procedure TTarget.Stop;
     187begin
     188
     189end;
     190
     191procedure TTarget.StepOver;
     192begin
     193
     194end;
     195
     196procedure TTarget.StepInto;
     197begin
     198
     199end;
     200
     201procedure TTarget.StepOut;
     202begin
     203
     204end;
     205
     206procedure TTarget.RunToCursor;
     207begin
     208
     209end;
    171210
    172211end.
  • trunk/Target/UTargetC.pas

    r30 r31  
    1919  end;
    2020
     21
    2122implementation
    2223
     
    2930  SourceExtension := '.c';
    3031  CompiledExtension := '.exe';
     32  Capabilities := [tcCompile, tcRun];
    3133  {$IFDEF Windows}
    3234  CompilerPath := 'c:\Program Files\MinGW\bin\gcc.exe -o %1:s';
  • trunk/Target/UTargetDelphi.pas

    r30 r31  
    2727  SourceExtension := '.pas';
    2828  CompiledExtension := '.exe';
     29  Capabilities := [tcCompile, tcRun];
    2930  {$IFDEF Windows}
    3031  CompilerPath := 'c:\Program Files\Embarcadero\RAD Studio\9.0\bin\DCC32.EXE';
  • trunk/Target/UTargetInterpretter.pas

    r30 r31  
    66
    77uses
    8   Classes, SysUtils, Dialogs, Forms, StrUtils;
     8  Classes, SysUtils, Dialogs, Forms, StrUtils, UTarget;
    99
    1010type
     
    2828  { TTargetInterpretter }
    2929
    30   TTargetInterpretter = class
     30  TTargetInterpretter = class(TTarget)
    3131  private
    3232    FCellSize: Integer;
     
    6464    procedure Reset;
    6565    procedure SingleStep;
    66     procedure Run;
    67     procedure Pause;
    68     procedure Stop;
     66    procedure Run; override;
     67    procedure Pause; override;
     68    procedure Stop; override;
    6969    constructor Create;
    7070    destructor Destroy; override;
     
    284284constructor TTargetInterpretter.Create;
    285285begin
     286  Name := 'Interpretter';
     287  Capabilities := [tcRun, tcPause, tcStop];
    286288  MemorySize := 30000;
    287289  CellSize := 256;
  • trunk/Target/UTargetPHP.pas

    r30 r31  
    2828  Name := 'PHP';
    2929  SourceExtension := '.php';
     30  Capabilities := [tcCompile, tcRun];
    3031  {$IFDEF Windows}
    3132  CompilerPath := 'c:\Program Files\PHP\php.exe';
  • trunk/UApplicationInfo.pas

    r23 r31  
    5353  Name := 'LazFuck';
    5454  Identification := 1;
    55   ReleaseDate := EncodeDate(2012, 2, 12);
     55  ReleaseDate := EncodeDate(2012, 2, 18);
    5656  MajorVersion := 0;
    5757  MinorVersion := 1;
Note: See TracChangeset for help on using the changeset viewer.