Changeset 41 for trunk/Target


Ignore:
Timestamp:
Feb 19, 2012, 5:26:03 PM (13 years ago)
Author:
chronos
Message:
  • Added: New Java target.
Location:
trunk/Target
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTarget.pas

    r40 r41  
    7979    procedure SetSourceCode(AValue: string); virtual;
    8080    function GetTargetCode: string; virtual;
    81     procedure AddLine(Text: string);
     81    procedure AddLine(Text: string = '');
    8282    function LongFileName(FileName: string): string;
    8383    function GetExecutionPosition: Integer; virtual;
     
    8888    Optimization: TCompilerOptimization;
    8989    CompilerPath: string;
     90    ExecutorPath: string;
    9091    SourceExtension: string;
    9192    CompiledExtension: string;
     
    101102    procedure Compile; virtual;
    102103    procedure CompileToFile; virtual;
     104    procedure RunFromFile; virtual;
    103105    procedure Run; virtual;
    104106    procedure Pause; virtual;
     
    309311end;
    310312
    311 procedure TTarget.AddLine(Text: string);
     313procedure TTarget.AddLine(Text: string = '');
    312314begin
    313315  FTargetCode := FTargetCode + DupeString('  ', Indent) + Text + LineEnding;
     
    384386    Process.Free;
    385387  end else raise Exception.Create(Format(SCompilerNotFound, [CompilerPath]));
    386 
     388end;
     389
     390procedure TTarget.RunFromFile;
     391var
     392  Process: TProcess;
     393  CompiledFile: string;
     394begin
    387395  CompiledFile := ExtractFilePath(ProjectFileName) +
    388396    'compiled' + DirectorySeparator + Name + DirectorySeparator +
     
    391399  try
    392400    Process := TProcess.Create(nil);
    393     Process.CommandLine := LongFileName(CompiledFile);
     401    Process.CommandLine := LongFileName(ExecutorPath) + ' ' + LongFileName(CompiledFile);
    394402    Process.Options := [poWaitOnExit];
    395403    Process.Execute;
  • trunk/Target/UTargetC.pas

    r35 r41  
    107107  Dec(Indent);
    108108  AddLine('}');
     109
     110  CompileToFile;
    109111end;
    110112
     
    140142procedure TTargetC.Run;
    141143begin
    142   CompileToFile;
    143144  inherited;
     145  RunFromFile;
    144146end;
    145147
  • trunk/Target/UTargetDelphi.pas

    r35 r41  
    101101  Dec(Indent);
    102102  AddLine('end.');
     103
     104  CompileToFile;
    103105end;
    104106
    105107procedure TTargetDelphi.Run;
    106108begin
    107   CompileToFile;
    108109  inherited Run;
     110  RunFromFile;
    109111end;
    110112
  • trunk/Target/UTargetPHP.pas

    r35 r41  
    9595  AddLine('');
    9696  AddLine('?>');
     97
     98  CompileToFile;
    9799end;
    98100
    99101procedure TTargetPHP.Run;
    100102begin
    101   CompileToFile;
    102103  inherited Run;
     104  RunFromFile;
    103105end;
    104106
Note: See TracChangeset for help on using the changeset viewer.