Changeset 93 for branches/dcomp/CmdLine/Compiler
- Timestamp:
- Nov 4, 2016, 9:17:57 PM (8 years ago)
- Location:
- branches/dcomp/CmdLine/Compiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dcomp/CmdLine/Compiler/UAnalyzerPascal.pas
r92 r93 1 1 unit UAnalyzerPascal; 2 3 {$mode delphi}4 2 5 3 interface -
branches/dcomp/CmdLine/Compiler/UCompiler.pas
r92 r93 4 4 5 5 uses 6 SysUtils, UAnalyzer, UTarget;6 SysUtils, Generics.Collections, UAnalyzer, UTarget; 7 7 8 8 type … … 11 11 12 12 TCompiler = class 13 Analyzers: array of TAnalyzer;14 Targets: array of TTarget;13 SupportedAnalyzers: TObjectList<TAnalyzer>; 14 SupportedTargets: TObjectList<TTarget>; 15 15 Analyzer: TAnalyzer; 16 16 Target: TTarget; 17 MainSourceFile: string; 17 18 procedure Compile; 18 19 procedure RegisterTarget(TargetClass: TTargetClass); 19 20 procedure RegisterAnalyzer(AnalyzerClass: TAnalyzerClass); 21 constructor Create; 22 destructor Destroy; override; 20 23 end; 21 24 … … 33 36 procedure TCompiler.RegisterTarget(TargetClass: TTargetClass); 34 37 begin 35 SetLength(Targets, Length(Targets) + 1); 36 Targets[Length(Targets) - 1] := TargetClass.Create; 38 SupportedTargets.Add(TargetClass.Create); 37 39 if not Assigned(Target) then 38 Target := Targets[Length(Targets) - 1]; 40 Target := SupportedTargets.Last; 41 end; 42 43 constructor TCompiler.Create; 44 begin 45 SupportedTargets := TObjectList<TTarget>.Create; 46 SupportedAnalyzers := TObjectList<TAnalyzer>.Create; 47 end; 48 49 destructor TCompiler.Destroy; 50 begin 51 SupportedTargets.Free; 52 SupportedAnalyzers.Free; 53 inherited; 39 54 end; 40 55 41 56 procedure TCompiler.RegisterAnalyzer(AnalyzerClass: TAnalyzerClass); 42 57 begin 43 SetLength(Analyzers, Length(Analyzers) + 1); 44 Analyzers[Length(Analyzers) - 1] := AnalyzerClass.Create; 58 SupportedAnalyzers.Add(AnalyzerClass.Create); 45 59 if not Assigned(Analyzer) then 46 Analyzer := Analyzers[Length(Analyzers) - 1];60 Analyzer := SupportedAnalyzers.Last; 47 61 end; 48 62
Note:
See TracChangeset
for help on using the changeset viewer.