Ignore:
Timestamp:
Nov 8, 2010, 10:06:37 AM (14 years ago)
Author:
george
Message:
  • Parser renamed to Analyzer.
  • Modified: Specialized parsers and analyzers separated from compiler for purpose of creating custom parsers and analyzers. Units UParsers and UAnalyzers determine which classes will be really used.
Location:
trunk/IDE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE

    • Property svn:ignore set to
      lib
  • trunk/IDE/Forms/UMainForm.pas

    r10 r12  
    3030    Button1: TButton;
    3131    CheckBoxLogParsing: TCheckBox;
    32     ComboBoxAnalyzerType: TComboBox;
    33     ComboBoxTargetSelection: TComboBox;
     32    ComboBoxAnalyzer: TComboBox;
     33    ComboBoxProducer: TComboBox;
    3434    CoolDockClient1: TCoolDockClient;
    3535    CoolDockMaster1: TCoolDockMaster;
     
    5555    procedure AProjectSaveAsExecute(Sender: TObject);
    5656    procedure ComboBox1Change(Sender: TObject);
    57     procedure ComboBoxTargetSelectionChange(Sender: TObject);
     57    procedure ComboBoxProducerChange(Sender: TObject);
    5858    procedure FormShow(Sender: TObject);
    5959    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     
    9191begin
    9292  // Compile project file
    93   if CheckBoxLogParsing.Checked then
    94      Compiler.Parser.OnDebugLog := CompilerDebugLog
    95      else Compiler.Parser.OnDebugLog := nil;
    96   Compiler.ProducerType := TProducerType(ComboBoxTargetSelection.ItemIndex);
    97   Compiler.Init;
    98   Compiler.Parser.OnGetSource := GetSource;
    99 
    100   if Project.Items.Count > 0 then
    101   with TProjectFile(Project.Items[0]) do begin
    102     Compiler.TargetFolder := Project.RootDir;
    103     Compiler.Compile(Parent.GetDir + ExtractFileNameOnly(Name), Source);
    104   end;
    105 
    106   ProjectManager.TreeViewProjectChange(Self, ProjectManager.TreeViewProject.Selected);
    107   MessagesForm.Reload;
     93  if (ComboBoxAnalyzer.Items.Count > 0) and (ComboBoxAnalyzer.ItemIndex <> -1) and
     94    (ComboBoxProducer.Items.Count > 0) and (ComboBoxProducer.ItemIndex <> -1) then begin
     95    Compiler.Producer := Compiler.Producers[ComboBoxProducer.ItemIndex];
     96    Compiler.Analyzer := Compiler.Analyzers[ComboBoxAnalyzer.ItemIndex];
     97    Compiler.Analyzer.OnGetSource := GetSource;
     98    Compiler.Init;
     99
     100    if CheckBoxLogParsing.Checked then
     101      Compiler.Analyzer.OnDebugLog := CompilerDebugLog
     102      else Compiler.Analyzer.OnDebugLog := nil;
     103
     104    if Project.Items.Count > 0 then
     105    with TProjectFile(Project.Items[0]) do begin
     106      Compiler.TargetFolder := Project.RootDir;
     107      Compiler.Compile(Parent.GetDir + ExtractFileNameOnly(Name), Source);
     108    end;
     109    ProjectManager.TreeViewProjectChange(Self, ProjectManager.TreeViewProject.Selected);
     110    MessagesForm.Reload;
     111  end;
    108112end;
    109113
     
    163167      OpenKey(RegistryKey, True);
    164168      ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);
    165       ComboBoxTargetSelection.ItemIndex :=
     169      ComboBoxProducer.ItemIndex :=
    166170        ReadIntegerWithDefault('ProducerType', 0);
    167       ComboBoxAnalyzerType.ItemIndex :=
     171      ComboBoxAnalyzer.ItemIndex :=
    168172        ReadIntegerWithDefault('AnalyzerType', 0);
    169173      CheckBoxLogParsing.Checked := ReadBoolWithDefault('LogParsing', False);
     
    181185      OpenKey(RegistryKey, True);
    182186      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
    183       WriteInteger('ProducerType', ComboBoxTargetSelection.ItemIndex);
    184       WriteInteger('AnalyzerType', ComboBoxAnalyzerType.ItemIndex);
     187      WriteInteger('ProducerType', ComboBoxProducer.ItemIndex);
     188      WriteInteger('AnalyzerType', ComboBoxAnalyzer.ItemIndex);
    185189      WriteBool('LogParsing', CheckBoxLogParsing.Checked);
    186190    finally
     
    208212procedure TMainForm.FormCreate(Sender: TObject);
    209213var
    210   ProducerType: TProducerType;
    211   AnalyzerType: TAnalyzerType;
     214  I: Integer;
    212215begin
    213216  DebugLog.FileName := 'DebugLog.txt';
     
    219222  LastOpenedFiles.ClickAction := OpenRecentClick;
    220223
    221   ComboBoxTargetSelection.Clear;
    222   for ProducerType := Low(ProducerType) to High(ProducerType) do
    223     ComboBoxTargetSelection.AddItem(ProducerTypeName[ProducerType], nil);
    224   ComboBoxAnalyzerType.Clear;
    225   for AnalyzerType := Low(AnalyzerType) to High(AnalyzerType) do
    226     ComboBoxAnalyzerType.AddItem(AnalyzerTypeName[AnalyzerType], nil);
     224  ComboBoxProducer.Clear;
     225  for I := 0 to Compiler.Producers.Count - 1 do
     226    ComboBoxProducer.AddItem(Compiler.Producers[I].Name, nil);
     227  ComboBoxAnalyzer.Clear;
     228  for I := 0 to Compiler.Analyzers.Count - 1 do
     229    ComboBoxAnalyzer.AddItem(Compiler.Analyzers[I].Name, nil);
    227230end;
    228231
     
    283286end;
    284287
    285 procedure TMainForm.ComboBoxTargetSelectionChange(Sender: TObject);
     288procedure TMainForm.ComboBoxProducerChange(Sender: TObject);
    286289begin
    287290  ABuildExecute(Self);
Note: See TracChangeset for help on using the changeset viewer.