Changeset 9 for trunk/UMainForm.pas


Ignore:
Timestamp:
Feb 9, 2012, 4:10:10 PM (13 years ago)
Author:
chronos
Message:
  • Added: Easy compiler to Delphi.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMainForm.pas

    r7 r9  
    1616    ACompile: TAction;
    1717    AAbout: TAction;
     18    AViewCompiled: TAction;
     19    AViewInterpretter: TAction;
    1820    AProgramPause: TAction;
    1921    AProgramStop: TAction;
     
    3941    MenuItem16: TMenuItem;
    4042    MenuItem17: TMenuItem;
     43    MenuItem18: TMenuItem;
     44    MenuItem19: TMenuItem;
    4145    MenuItem2: TMenuItem;
     46    MenuItem20: TMenuItem;
     47    MenuItem40: TMenuItem;
     48    MenuItem21: TMenuItem;
    4249    MenuItem3: TMenuItem;
    4350    MenuItem4: TMenuItem;
     
    5966    ToolButton6: TToolButton;
    6067    ToolButton7: TToolButton;
     68    procedure ACompileExecute(Sender: TObject);
    6169    procedure AExitExecute(Sender: TObject);
    6270    procedure AProgramPauseExecute(Sender: TObject);
     
    6876    procedure AProjectSaveExecute(Sender: TObject);
    6977    procedure AProgramRunExecute(Sender: TObject);
     78    procedure AViewCompiledExecute(Sender: TObject);
     79    procedure AViewInterpretterExecute(Sender: TObject);
    7080    procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
    7181    procedure FormCreate(Sender: TObject);
     
    7888    Modified: Boolean;
    7989    ProjectFileName: string;
     90    BrainFuckCompiler: TBrainFuckCompiler;
    8091    BrainFuckInterpreter: TBrainFuckInterpretter;
    8192    procedure UpdateInterface;
     
    90101
    91102uses
    92   UInterpreterForm, UApplicationInfo;
     103  UInterpreterForm, UApplicationInfo, UCompiledForm;
    93104
    94105{ TMainForm }
     
    131142  BrainFuckInterpreter := TBrainFuckInterpretter.Create;
    132143  BrainFuckInterpreter.OnChangeState := BrainFuckInterpreterChangeState;
     144  BrainFuckCompiler := TBrainFuckCompiler.Create;
    133145end;
    134146
    135147procedure TMainForm.FormDestroy(Sender: TObject);
    136148begin
     149  BrainFuckCompiler.Free;
    137150  BrainFuckInterpreter.Free;
    138151end;
     
    146159end;
    147160
     161procedure TMainForm.AViewCompiledExecute(Sender: TObject);
     162begin
     163  CompiledForm.Show;
     164end;
     165
     166procedure TMainForm.AViewInterpretterExecute(Sender: TObject);
     167begin
     168  InterpreterForm.Show;
     169end;
     170
    148171procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    149172begin
     173  if Modified then AProjectSaveAs.Execute;
    150174end;
    151175
     
    153177begin
    154178  Close;
     179end;
     180
     181procedure TMainForm.ACompileExecute(Sender: TObject);
     182begin
     183  BrainFuckCompiler.Source := MemoSource.Text;
     184  BrainFuckCompiler.Compile;
     185  CompiledForm.MemoCompiled.Text := BrainFuckCompiler.Output;
     186  CompiledForm.Show;
    155187end;
    156188
Note: See TracChangeset for help on using the changeset viewer.