Changeset 59 for trunk/IDE


Ignore:
Timestamp:
Jul 17, 2012, 6:44:54 AM (12 years ago)
Author:
chronos
Message:
  • Modified: Compiler will accept source code not only from files but it can be feed by in-memory content.
Location:
trunk/IDE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UFormMain.pas

    r55 r59  
    168168begin
    169169  FormSourceCode.Save;
     170  AProjectSave.Execute;
    170171  with Core do begin
    171172    // Compile project file
     
    178179    if Project.Files.Count > 0 then
    179180    with TProjectFile(Project.Files[0]) do begin
    180       Compiler.SourceFiles.Clear;
    181       Project.Files.DumpFileList(Compiler.SourceFiles);
     181      Compiler.SourceFiles.Files.Clear;
     182      Project.Files.DumpFileList(Compiler.SourceFiles.Files);
    182183      Compiler.MainSource := Project.MainSource.AbsoluteFileName;
    183184      TargetProject.FileName := ExtractFileDir(Project.FileName) + DirectorySeparator +
     
    186187      Compiler.TargetFolder := ExtractFileDir(TargetProject.FileName);
    187188      Compiler.Compile;
    188       TargetProject.Files.LoadFromList(Compiler.TargetFiles);
     189      TargetProject.Files.LoadFromList(Compiler.TargetFiles.Files);
    189190      FormTargetProject.UpdateInterface;
    190191    end;
  • trunk/IDE/UCore.pas

    r57 r59  
    1313
    1414  TCustomCompiler = class(TCompiler)
     15    SourceFiles: TSourceFileManager;
     16    TargetFiles: TSourceFileManager;
    1517    procedure LoadFromRegistry(Root: HKEY; Key: string);
    1618    procedure SaveToRegistry(Root: HKEY; Key: string);
     19    constructor Create; override;
     20    destructor Destroy; override;
    1721  end;
    1822
     
    2933  private
    3034    procedure ProjectChange(Sender: TObject);
     35    function LoadSourceFile(FileName: string; var Content: string): Boolean;
     36    function SaveSourceFile(FileName: string; const Content: string): Boolean;
    3137  public
    3238    ReopenLastOpenedFile: Boolean;
     
    8187  DeleteFile(DebugLog1.FileName);
    8288  Compiler := TCustomCompiler.Create;
     89  //Compiler.OnLoadSource := LoadSourceFile;
     90  //Compiler.OnSaveTarget := SaveSourceFile;
    8391  Project := TProject.Create;
    8492  ProjectTemplates := TProjectTemplateList.Create;
     
    116124begin
    117125  FormMain.UpdateInterface;
     126end;
     127
     128function TCore.LoadSourceFile(FileName: string; var Content: string): Boolean;
     129begin
     130
     131end;
     132
     133function TCore.SaveSourceFile(FileName: string; const Content: string): Boolean;
     134begin
     135
    118136end;
    119137
     
    205223end;
    206224
     225constructor TCustomCompiler.Create;
     226begin
     227  inherited Create;
     228  SourceFiles := TSourceFileManager.Create;
     229  TargetFiles := TSourceFileManager.Create;
     230  OnLoadSource := SourceFiles.GetFileContent;
     231  OnSaveTarget := TargetFiles.SetFileContent;
     232end;
     233
     234destructor TCustomCompiler.Destroy;
     235begin
     236  TargetFiles.Free;
     237  SourceFiles.Free;
     238  inherited Destroy;
     239end;
     240
    207241
    208242end.
Note: See TracChangeset for help on using the changeset viewer.