Changeset 75 for trunk/Compiler
- Timestamp:
- Jun 4, 2024, 12:22:49 AM (5 months ago)
- Location:
- trunk/Compiler
- Files:
-
- 4 added
- 2 edited
- 25 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyzer.pas
r74 r75 1 unit UAnalyzer; 2 3 {$MODE Delphi} 4 {$MACRO ON} 1 unit Analyzer; 5 2 6 3 interface 7 4 8 5 uses 9 SysUtils, Variants, Classes, Contnrs,10 Dialogs, USourceCodePascal, FileUtil, SpecializedList;6 SysUtils, Variants, Classes, Dialogs, SourceCodePascal, FileUtil, 7 Generics.Collections; 11 8 12 9 type … … 54 51 CodePosition: TPoint; 55 52 SourceCode2: string; 56 Tokens: TObjectList ; // TObjectList<TToken>53 Tokens: TObjectList<TToken>; 57 54 TokenIndex: Integer; 58 55 constructor Create; … … 83 80 end; 84 81 85 { T ListAnalyzer}86 87 T ListAnalyzer = class(TListObject)82 { TAnalyzers } 83 84 TAnalyzers = class(TObjectList<TAnalyzer>) 88 85 function SearchBySysName(Name: string): TAnalyzer; 89 86 procedure LoadToStrings(Strings: TStrings); … … 93 90 SExpectedButFound = 'Expected "%s" but "%s" found.'; 94 91 92 95 93 implementation 96 94 97 { T ListAnalyzer}98 99 function T ListAnalyzer.SearchBySysName(Name: string): TAnalyzer;95 { TAnalyzers } 96 97 function TAnalyzers.SearchBySysName(Name: string): TAnalyzer; 100 98 var 101 99 I: Integer; … … 107 105 end; 108 106 109 procedure T ListAnalyzer.LoadToStrings(Strings: TStrings);107 procedure TAnalyzers.LoadToStrings(Strings: TStrings); 110 108 var 111 109 I: Integer; … … 154 152 constructor TAnalyzer.Create; 155 153 begin 156 Tokens := TObjectList .Create;154 Tokens := TObjectList<TToken>.Create; 157 155 {$IFDEF windows} 158 156 LineEndingChar := LineEnding[1]; … … 164 162 destructor TAnalyzer.Destroy; 165 163 begin 166 Tokens.Free;167 inherited Destroy;164 FreeAndNil(Tokens); 165 inherited; 168 166 end; 169 167 -
trunk/Compiler/Compiler.pas
r74 r75 1 unit UCompiler; 2 3 {$MODE Delphi} 1 unit Compiler; 4 2 5 3 interface 6 4 7 5 uses 8 SysUtils, Variants, Classes, Contnrs, FileUtil, UModularSystem, UCompilerAPI, 9 Dialogs, USourceCodePascal, UProducer, UAnalyzer, SpecializedList, UTarget, 10 fgl; 6 SysUtils, Variants, Classes, FileUtil, ModularSystem, CompilerAPI, 7 Dialogs, SourceCodePascal, Producer, Analyzer, Generics.Collections, Target; 11 8 12 9 type … … 20 17 21 18 TSourceFileManager = class 22 Files: T ListString;19 Files: TStringList; 23 20 function LoadStringFromFile(FileName: string): string; 24 21 procedure SaveStringToFile(FileName: string; Content: string); … … 45 42 public 46 43 AbstractCode: TProgram; 47 ErrorMessages: T FPGObjectList<TErrorMessage>;44 ErrorMessages: TObjectList<TErrorMessage>; 48 45 CompiledFolder: string; 49 46 50 Targets: T ListTarget;51 Analyzers: T ListAnalyzer;52 Convertors: T ListObject;53 Executors: T ListObject;47 Targets: TTargets; 48 Analyzers: TAnalyzers; 49 Convertors: TObjectList<TObject>; 50 Executors: TObjectList<TObject>; 54 51 API: TCompilerAPI; 55 52 TargetFolder: string; … … 73 70 74 71 uses 75 UAnalyzerPascal;72 AnalyzerPascal; 76 73 77 74 resourcestring … … 146 143 constructor TSourceFileManager.Create; 147 144 begin 148 Files := T ListString.Create;145 Files := TStringList.Create; 149 146 end; 150 147 151 148 destructor TSourceFileManager.Destroy; 152 149 begin 153 F iles.Free;154 inherited Destroy;150 FreeAndNil(Files); 151 inherited; 155 152 end; 156 153 … … 168 165 constructor TCompiler.Create; 169 166 begin 170 Targets := T ListTarget.Create;171 Analyzers := T ListAnalyzer.Create;172 Convertors := T ListObject.Create;173 Executors := T ListObject.Create;167 Targets := TTargets.Create; 168 Analyzers := TAnalyzers.Create; 169 Convertors := TObjectList<TObject>.Create; 170 Executors := TObjectList<TObject>.Create; 174 171 API := TCompilerAPI.Create; 175 172 API.Compiler := Self; 176 173 AbstractCode := TProgram.Create; 177 ErrorMessages := T FPGObjectList<TErrorMessage>.Create;174 ErrorMessages := TObjectList<TErrorMessage>.Create; 178 175 CompiledFolder := 'Compiled'; 179 176 ModuleManager := TModuleManager.Create(nil); -
trunk/Compiler/CompilerAPI.pas
r74 r75 1 unit UCompilerAPI; 2 3 {$mode delphi}{$H+} 1 unit CompilerAPI; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UModularSystem, UAnalyzer, UTarget, USourceConvertor,9 SpecializedList, UExecutor;6 Classes, SysUtils, ModularSystem, Analyzer, Target, SourceConvertor, 7 Generics.Collections, Executor; 10 8 11 9 type … … 25 23 end; 26 24 25 27 26 implementation 28 27 29 28 uses 30 UCompiler;29 Compiler; 31 30 32 31 … … 40 39 procedure TCompilerAPI.UnregisterTarget(AClass: TTargetClass); 41 40 begin 42 TCompiler(Compiler).Targets.Remove(TObject(AClass));41 //TCompiler(Compiler).Targets.Remove(TObject(AClass)); 43 42 end; 44 43 … … 69 68 destructor TCompilerAPI.Destroy; 70 69 begin 71 inherited Destroy;70 inherited; 72 71 end; 73 72 -
trunk/Compiler/Executor.pas
r74 r75 1 unit UExecutor; 2 3 {$mode Delphi}{$H+} 1 unit Executor; 4 2 5 3 interface … … 33 31 TExecutorClass = class of TExecutor; 34 32 33 35 34 implementation 36 35 … … 39 38 procedure TExecutor.SetRunState(AValue: TRunState); 40 39 begin 41 if FRunState =AValue then Exit;42 FRunState :=AValue;40 if FRunState = AValue then Exit; 41 FRunState := AValue; 43 42 end; 44 43 -
trunk/Compiler/Modules/ASM8051/ProducerASM8051.pas
r74 r75 1 unit UProducerASM8051; 2 3 {$MODE Delphi} 1 unit ProducerASM8051; 4 2 5 3 interface … … 7 5 uses 8 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, USourceCodePascal, UProducer, Contnrs;7 Dialogs, SourceCodePascal, Producer, Generics.Collections; 10 8 11 9 type … … 37 35 procedure GenerateModule(Module: TSourceModule); 38 36 public 39 AssemblyCode: TObjectList ; // TList<TAssemblerLine>37 AssemblyCode: TObjectList<TAssemblerLine>; 40 38 procedure AssignToStringList(Target: TStringList); override; 41 39 procedure Produce(Module: TSourceModule); override; … … 107 105 constructor TProducerAsm8051.Create; 108 106 begin 109 AssemblyCode := TObjectList .Create;107 AssemblyCode := TObjectList<TAssemblerLine>.Create; 110 108 {$IFDEF Windows} 111 109 CompilerPath := 'c:\ASM8051\ASM51.EXE'; -
trunk/Compiler/Modules/ASM8051/TargetASM8051.pas
r74 r75 1 unit UTargetASM8051; 2 3 {$mode Delphi}{$H+} 1 unit TargetASM8051; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget;6 Classes, SysUtils, Target; 9 7 10 8 type … … 16 14 end; 17 15 16 18 17 implementation 19 18 … … 22 21 constructor TTargetASM8051.Create; 23 22 begin 24 inherited Create;23 inherited; 25 24 SysName := 'ASM8051'; 26 25 Name := 'ASM8051'; -
trunk/Compiler/Modules/Brainfuck/ModuleBrainfuck.pas
r74 r75 1 unit UModuleBrainfuck; 2 3 {$mode delphi}{$H+} 1 unit ModuleBrainfuck; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UModularSystem, USourceConvertor;6 Classes, SysUtils, ModularSystem, SourceConvertor; 9 7 10 8 type … … 42 40 43 41 uses 44 UCompilerAPI, USourceCodePascal;42 CompilerAPI, SourceCodePascal; 45 43 46 44 resourcestring … … 56 54 constructor TConvertorBFToPascal.Create; 57 55 begin 58 inherited Create;56 inherited; 59 57 Name := 'BFToPascal'; 60 58 InputType := TSourceBrainfuck; … … 71 69 constructor TConvertorTextToBF.Create; 72 70 begin 73 inherited Create;71 inherited; 74 72 Name := 'TextToBF'; 75 73 InputType := TSourceFileLink; -
trunk/Compiler/Modules/Delphi/ModuleDelphi.pas
r74 r75 1 unit UModuleDelphi; 2 3 {$mode Delphi}{$H+} 1 unit ModuleDelphi; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget, UExecutor, UModularSystem;6 Classes, SysUtils, Target, Executor, ModularSystem; 9 7 10 8 type … … 28 26 29 27 uses 30 UProducerDelphi, UCompilerAPI;28 ProducerDelphi, CompilerAPI; 31 29 32 30 resourcestring … … 38 36 begin 39 37 inherited; 40 Name:= 'Delphi';38 Identification := 'Delphi'; 41 39 Title := SDelphi; 42 40 end; -
trunk/Compiler/Modules/Delphi/ProducerDelphi.pas
r74 r75 1 unit UProducerDelphi; 2 3 {$MODE Delphi} 1 unit ProducerDelphi; 4 2 5 3 interface … … 7 5 uses 8 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, USourceCodePascal, UProducer, StrUtils, USourceConvertor;7 Dialogs, SourceCodePascal, Producer, StrUtils, SourceConvertor; 10 8 11 9 type … … 16 14 private 17 15 Producer: TProducer; 18 procedure GenerateUses(UsedModules: TUsedModule List);16 procedure GenerateUses(UsedModules: TUsedModules); 19 17 procedure GenerateModule(Module: TSourceModule); 20 18 procedure GenerateUnit(Module: TSourceModule); … … 22 20 procedure GeneratePackage(Module: TSourceModule); 23 21 procedure GenerateType(AType: TType; AssignSymbol: Char = ':'); 24 procedure GenerateTypes(Types: TType List);22 procedure GenerateTypes(Types: TTypes); 25 23 procedure GenerateCommonBlockInterface(CommonBlock: TCommonBlock; 26 24 LabelPrefix: string); 27 25 procedure GenerateCommonBlockImplementation(CommonBlock: TCommonBlock; 28 26 LabelPrefix: string); 29 procedure GenerateFunctions(Functions: TFunction List);27 procedure GenerateFunctions(Functions: TFunctions); 30 28 procedure GenerateFunction(AFunction: TFunction); 31 29 procedure GenerateFunctionHead(AFunction: TFunction); 32 procedure GenerateConstants(Constants: TConstant List);30 procedure GenerateConstants(Constants: TConstants); 33 31 procedure GenerateConstant(Constant: TConstant); 34 32 procedure GenerateBeginEnd(BeginEnd: TBeginEnd); 35 procedure GenerateVariableList(Variables: TVariable List);33 procedure GenerateVariableList(Variables: TVariables); 36 34 procedure GenerateVariable(Variable: TVariable); 37 35 procedure GenerateCommand(Command: TCommand); … … 49 47 end; 50 48 49 51 50 implementation 52 51 … … 72 71 destructor TProducerPascal.Destroy; 73 72 begin 74 Producer.Free;73 FreeAndNil(Producer); 75 74 inherited; 76 75 end; 77 76 78 procedure TProducerPascal.GenerateUses(UsedModules: TUsedModule List);77 procedure TProducerPascal.GenerateUses(UsedModules: TUsedModules); 79 78 var 80 79 I: Integer; … … 142 141 procedure TProducerPascal.GenerateLibrary(Module: TSourceModule); 143 142 begin 144 145 143 end; 146 144 147 145 procedure TProducerPascal.GeneratePackage(Module: TSourceModule); 148 146 begin 149 150 147 end; 151 148 … … 192 189 end; 193 190 194 procedure TProducerPascal.GenerateTypes(Types: TType List);191 procedure TProducerPascal.GenerateTypes(Types: TTypes); 195 192 var 196 193 I: Integer; … … 231 228 end; 232 229 233 procedure TProducerPascal.GenerateFunctions(Functions: TFunction List);230 procedure TProducerPascal.GenerateFunctions(Functions: TFunctions); 234 231 var 235 232 I: Integer; … … 280 277 end; 281 278 282 procedure TProducerPascal.GenerateConstants(Constants: TConstant List);279 procedure TProducerPascal.GenerateConstants(Constants: TConstants); 283 280 var 284 281 I: Integer; … … 322 319 end; 323 320 324 procedure TProducerPascal.GenerateVariableList(Variables: TVariable List);321 procedure TProducerPascal.GenerateVariableList(Variables: TVariables); 325 322 var 326 323 I: Integer; -
trunk/Compiler/Modules/GCC/ModuleGCC.pas
r74 r75 1 unit UModuleGCC; 2 3 {$mode delphi}{$H+} 1 unit ModuleGCC; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UModularSystem, UProducerGCC, UTargetGCC, UCompilerAPI;6 Classes, SysUtils, ModularSystem, ProducerGCC, TargetGCC, CompilerAPI; 9 7 10 8 type … … 13 11 14 12 TModuleGCC = class(TModule) 13 public 15 14 Target: TTargetGCC; 16 15 constructor Create(AOwner: TComponent); override; … … 31 30 begin 32 31 inherited; 33 Name:= 'GCC';32 Identification := 'GCC'; 34 33 Title := SGCC; 35 34 end; -
trunk/Compiler/Modules/GCC/ProducerGCC.pas
r74 r75 1 unit UProducerGCC; 2 3 {$MODE Delphi} 1 unit ProducerGCC; 4 2 5 3 interface … … 7 5 uses 8 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, USourceCode, UProducer, StrUtils;7 Dialogs, StdCtrls, SourceCodePascal, Producer, StrUtils; 10 8 11 9 type … … 19 17 procedure Emit(AText: string); 20 18 procedure EmitLn(AText: string = ''); 21 procedure GenerateUses(UsedModules: TUsedModule List);19 procedure GenerateUses(UsedModules: TUsedModules); 22 20 procedure GenerateModule(Module: TSourceModule); 23 21 procedure GenerateCommonBlock(CommonBlock: TCommonBlock; 24 22 LabelPrefix: string); 25 23 procedure GenerateType(AType: TType); 26 procedure GenerateTypes(Types: TType List);24 procedure GenerateTypes(Types: TTypes); 27 25 procedure GenerateProgram(ProgramBlock: TProgram); 28 procedure GenerateFunctions(Functions: TFunction List;26 procedure GenerateFunctions(Functions: TFunctions; 29 27 Prefix: string = ''); 30 28 procedure GenerateBeginEnd(BeginEnd: TBeginEnd); 31 procedure GenerateVariableList(VariableList: TVariable List);29 procedure GenerateVariableList(VariableList: TVariables); 32 30 procedure GenerateVariable(Variable: TVariable); 33 31 procedure GenerateCommand(Command: TCommand); … … 113 111 end; 114 112 115 procedure TProducerGCCC.GenerateUses(UsedModules: TUsedModule List);113 procedure TProducerGCCC.GenerateUses(UsedModules: TUsedModules); 116 114 var 117 115 I: Integer; … … 155 153 end; 156 154 157 procedure TProducerGCCC.GenerateFunctions(Functions: TFunction List;158 Prefix: string = '');155 procedure TProducerGCCC.GenerateFunctions(Functions: TFunctions; Prefix: string 156 ); 159 157 var 160 158 I: Integer; … … 202 200 end; 203 201 204 procedure TProducerGCCC.GenerateVariableList(VariableList: TVariable List);202 procedure TProducerGCCC.GenerateVariableList(VariableList: TVariables); 205 203 var 206 204 I: Integer; … … 361 359 end; 362 360 363 procedure TProducerGCCC.GenerateTypes(Types: TType List);361 procedure TProducerGCCC.GenerateTypes(Types: TTypes); 364 362 var 365 363 I: Integer; -
trunk/Compiler/Modules/GCC/TargetGCC.pas
r74 r75 1 unit UTargetGCC; 2 3 {$mode Delphi}{$H+} 1 unit TargetGCC; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget;6 Classes, SysUtils, Target; 9 7 10 8 type … … 22 20 constructor TTargetGCC.Create; 23 21 begin 24 inherited Create;22 inherited; 25 23 SysName := 'GCC'; 26 24 Name := 'GCC'; -
trunk/Compiler/Modules/Interpretter/ModuleInterpretter.pas
r74 r75 1 unit UModuleInterpretter; 2 3 {$mode Delphi}{$H+} 1 unit ModuleInterpretter; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget, UExecutor, USourceCodePascal, Dialogs,9 SpecializedList, UModularSystem;6 Classes, SysUtils, Target, Executor, SourceCodePascal, Dialogs, 7 Generics.Collections, ModularSystem; 10 8 11 9 type … … 30 28 function Evaluate(Expression: TExpression): TValue; 31 29 public 32 Variables: T ListObject;30 Variables: TObjectList<TVariable>; 33 31 procedure Run; override; 34 32 constructor Create; … … 47 45 48 46 uses 49 UCompiler, UCompilerAPI;47 Compiler, CompilerAPI; 50 48 51 49 resourcestring … … 58 56 begin 59 57 inherited; 60 Name:= 'Interpretter';58 Identification := 'Interpretter'; 61 59 Title := 'Interpretter'; 62 60 Version := '0.1'; … … 187 185 constructor TExecutorInterpretter.Create; 188 186 begin 189 Variables := T ListObject.Create;187 Variables := TVariables.Create; 190 188 end; 191 189 192 190 destructor TExecutorInterpretter.Destroy; 193 191 begin 194 Variables.Free;195 inherited Destroy;192 FreeAndnil(Variables); 193 inherited; 196 194 end; 197 195 -
trunk/Compiler/Modules/Pascal/AnalyzerPascal.pas
r74 r75 1 unit UAnalyzerPascal; 2 3 {$mode delphi} 1 unit AnalyzerPascal; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UAnalyzer, USourceCodePascal, Dialogs, USourceConvertor;6 Classes, SysUtils, Analyzer, SourceCodePascal, Dialogs, SourceConvertor; 9 7 10 8 type … … 16 14 public 17 15 Parser: TAnalyzer; 18 function DebugExpressions(List: T ListExpression): string;16 function DebugExpressions(List: TExpressions): string; 19 17 function ParseFile(Name: string): Boolean; 20 18 function ParseWhileDo(var WhileDo: TWhileDo; SourceCode: TCommonBlock): Boolean; 21 19 function ParseExpression(SourceCode: TExpression): Boolean; 22 20 function ParseExpressionParenthases(SourceCode: TExpression; 23 Expressions: T ListExpression): Boolean;21 Expressions: TExpressions): Boolean; 24 22 function ParseExpressionOperator(SourceCode: TExpression; 25 Expressions: T ListExpression): Boolean;23 Expressions: TExpressions): Boolean; 26 24 function ParseExpressionRightValue(SourceCode: TExpression; 27 Expressions: T ListExpression): Boolean;25 Expressions: TExpressions): Boolean; 28 26 function ParseExpressionFunctionCall(SourceCode: TExpression; 29 Expressions: T ListExpression; var Func: TFunctionCall): Boolean;30 function ParseUses(SourceCode: TUsedModule List; AExported: Boolean): Boolean;31 function ParseUsesItem(SourceCode: TUsedModule List; AExported: Boolean): Boolean;27 Expressions: TExpressions; var Func: TFunctionCall): Boolean; 28 function ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean; 29 function ParseUsesItem(SourceCode: TUsedModules; AExported: Boolean): Boolean; 32 30 function ParseModule(ProgramCode: TProgram): TSourceModule; 33 31 function ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean; … … 40 38 function ParseCommand(SourceCode: TCommonBlock): TCommand; 41 39 function ParseBeginEnd(var BeginEnd: TBeginEnd; SourceCode: TCommonBlock): Boolean; 42 function ParseFunction(SourceCode: TFunction List; Exported: Boolean = False): Boolean;40 function ParseFunction(SourceCode: TFunctions; Exported: Boolean = False): Boolean; 43 41 procedure ParseFunctionParameters(SourceCode: TFunction; ValidateParams: Boolean = False); 44 42 function ParseIfThenElse(var IfThenElse: TIfThenElse; SourceCode: TCommonBlock): Boolean; … … 46 44 function ParseAssigment(var Assignment: TAssignment; SourceCode: TCommonBlock): Boolean; 47 45 function ParseFunctionCall(var Call: TFunctionCall; SourceCode: TCommonBlock): Boolean; 48 function ParseVariableList(SourceCode: TVariable List; Exported: Boolean = False): Boolean;49 procedure ParseVariable(SourceCode: TVariable List; Exported: Boolean = False);50 function ParseConstantList(SourceCode: TConstant List; Exported: Boolean = False): Boolean;51 function ParseConstant(SourceCode: TConstant List; Exported: Boolean = False): Boolean;52 function ParseType(TypeList: TType List; var NewType: TType; ExpectName: Boolean = True;46 function ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean; 47 procedure ParseVariable(SourceCode: TVariables; Exported: Boolean = False); 48 function ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean; 49 function ParseConstant(SourceCode: TConstants; Exported: Boolean = False): Boolean; 50 function ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True; 53 51 AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean; 54 52 function ParseTypeParameters(var NewType: TType): Boolean; … … 86 84 SNotRecordOrClass = '"%s" not record or class'; 87 85 86 88 87 implementation 89 88 90 89 { TAnalyzerPascal } 91 90 92 function TAnalyzerPascal.DebugExpressions(List: T ListExpression): string;91 function TAnalyzerPascal.DebugExpressions(List: TExpressions): string; 93 92 var 94 93 I: Integer; … … 152 151 function TAnalyzerPascal.ParseExpression(SourceCode: TExpression): Boolean; 153 152 var 154 Expressions: T ListExpression;153 Expressions: TExpressions; 155 154 I: Integer; 156 155 II: Integer; … … 158 157 (* with Parser do 159 158 try 160 Expressions := T ListExpression.Create;159 Expressions := TExpressions.Create; 161 160 Expressions.Add(TExpression.Create); 162 161 with SourceCode do begin … … 206 205 207 206 function TAnalyzerPascal.ParseExpressionParenthases(SourceCode: TExpression; 208 Expressions: T ListExpression): Boolean;207 Expressions: TExpressions): Boolean; 209 208 var 210 209 NewExpression: TExpression; … … 230 229 231 230 function TAnalyzerPascal.ParseExpressionOperator(SourceCode: TExpression; 232 Expressions: T ListExpression): Boolean;231 Expressions: TExpressions): Boolean; 233 232 begin 234 233 (*if IsOperator(NextToken) then begin … … 241 240 242 241 function TAnalyzerPascal.ParseExpressionRightValue(SourceCode: TExpression; 243 Expressions: T ListExpression): Boolean;242 Expressions: TExpressions): Boolean; 244 243 var 245 244 UseType: TType; … … 348 347 end; 349 348 if Assigned(NewExpression) then begin 350 TExpression(Expressions.Last).SubItems .Last:= NewExpression;349 TExpression(Expressions.Last).SubItems[TExpression(Expressions.Last).SubItems.Count - 1] := NewExpression; 351 350 with TExpression(Expressions.Items[Expressions.Add(TExpression.Create)]) do 352 351 begin 353 352 CommonBlock := SourceCode.CommonBlock; 354 SubItems .First:= NewExpression;353 SubItems[0] := NewExpression; 355 354 end; 356 355 Result := True; … … 364 363 365 364 function TAnalyzerPascal.ParseExpressionFunctionCall(SourceCode: TExpression; 366 Expressions: T ListExpression; var Func: TFunctionCall): Boolean;365 Expressions: TExpressions; var Func: TFunctionCall): Boolean; 367 366 var 368 367 UseFunction: TFunction; … … 666 665 { TParserParseFunctionList } 667 666 668 function TAnalyzerPascal.ParseFunction(SourceCode: TFunction List;667 function TAnalyzerPascal.ParseFunction(SourceCode: TFunctions; 669 668 Exported: Boolean = False): Boolean; 670 669 var … … 796 795 while (NextToken <> ')') and (NextTokenType <> ttEndOfFile) do begin 797 796 // while IsIdentificator(NextCode) do begin 798 with TParameter List(Parameters) do begin797 with TParameters(Parameters) do begin 799 798 VariableName := ReadToken; 800 799 if VariableName = 'var' then begin … … 948 947 { TParserVariableList } 949 948 950 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariable List; Exported: Boolean = False): Boolean;949 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean; 951 950 var 952 951 NewValueType: TType; … … 968 967 { TParserVariable } 969 968 970 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariable List; Exported: Boolean = False);969 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariables; Exported: Boolean = False); 971 970 var 972 971 VariableName: string; … … 1016 1015 { TParserConstantList } 1017 1016 1018 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstant List; Exported: Boolean = False): Boolean;1017 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean; 1019 1018 begin 1020 1019 with Parser do … … 1030 1029 end; 1031 1030 1032 function TAnalyzerPascal.ParseConstant(SourceCode: TConstant List;1031 function TAnalyzerPascal.ParseConstant(SourceCode: TConstants; 1033 1032 Exported: Boolean): Boolean; 1034 1033 var … … 1082 1081 { TParserType } 1083 1082 1084 function TAnalyzerPascal.ParseType(TypeList: TType List; var NewType: TType; ExpectName: Boolean = True;1083 function TAnalyzerPascal.ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True; 1085 1084 AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean; 1086 1085 begin … … 1471 1470 { TParserUsedModuleList } 1472 1471 1473 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModule List; AExported: Boolean): Boolean;1472 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean; 1474 1473 var 1475 1474 NewUsedModule: TUsedModule; … … 1488 1487 end; 1489 1488 1490 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModule List;1489 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModules; 1491 1490 AExported: Boolean): Boolean; 1492 1491 begin -
trunk/Compiler/Modules/Pascal/ModulePascal.pas
r74 r75 1 unit UModulePascal; 2 3 {$mode delphi}{$H+} 1 unit ModulePascal; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UModularSystem, UAnalyzerPascal;6 Classes, SysUtils, ModularSystem, AnalyzerPascal; 9 7 10 8 type … … 24 22 25 23 uses 26 UCompilerAPI;24 CompilerAPI; 27 25 28 26 { TModulePascal } … … 31 29 begin 32 30 inherited; 33 Name:= 'Pascal';31 Identification := 'Pascal'; 34 32 Title := 'Pascal'; 35 33 Version := '0.1'; … … 38 36 destructor TModulePascal.Destroy; 39 37 begin 40 inherited Destroy;38 inherited; 41 39 end; 42 40 -
trunk/Compiler/Modules/Pascal/SourceCodePascal.pas
r74 r75 1 unit USourceCodePascal; 2 3 {$MODE Delphi} 4 {$MACRO ON} 1 unit SourceCodePascal; 5 2 6 3 interface 7 4 8 5 uses 9 SysUtils, Variants, Classes, Dialogs, SpecializedList, USourceConvertor;6 SysUtils, Variants, Classes, Dialogs, Generics.Collections, SourceConvertor; 10 7 11 8 type … … 22 19 23 20 TCommonBlock = class; 24 TType List= class;25 TConstant List= class;26 TVariable List= class;27 TFunction List= class;28 T ListExpression= class;21 TTypes = class; 22 TConstants = class; 23 TVariables = class; 24 TFunctions = class; 25 TExpressions = class; 29 26 TExpression = class; 30 27 TFunction = class; … … 40 37 41 38 TContext = class 42 43 end; 44 45 TCommandList = class; 39 end; 40 41 TCommands = class; 46 42 47 43 TCommand = class … … 57 53 end; 58 54 59 // TListExpression = TGObjectList<Integer, TExpression> 60 TListExpression = class(TListObject); 55 { TExpressions } 56 57 TExpressions = class(TObjectList<TExpression>) 58 procedure Assign(Source: TExpressions); 59 end; 61 60 62 61 { TFunctionCall } … … 64 63 TFunctionCall = class(TCommand) 65 64 FunctionRef: TFunction; 66 ParameterExpression: T ListExpression;65 ParameterExpression: TExpressions; 67 66 constructor Create; 68 67 destructor Destroy; override; … … 70 69 71 70 TBeginEnd = class(TCommand) 72 Commands: TCommand List;71 Commands: TCommands; 73 72 CommonBlock: TCommonBlock; 74 73 procedure Clear; … … 90 89 91 90 TRepeatUntil = class(TCommand) 92 Block: TCommand List;91 Block: TCommands; 93 92 Condition: TExpression; 94 93 end; … … 120 119 end; 121 120 122 // TListCaseOfEndBranche = TGObjectList<Integer, TCaseOfEndBranche> 123 TListCaseOfEndBranche = class(TListObject); 121 TListCaseOfEndBranche = class(TObjectList<TCaseOfEndBranche>); 124 122 125 123 TCaseOfEnd = class(TCommand) … … 132 130 133 131 TTryFinally = class(TCommand) 134 Block: TCommand List;135 FinallyBlock: TCommand List;132 Block: TCommands; 133 FinallyBlock: TCommands; 136 134 end; 137 135 138 136 TTryExcept = class(TCommand) 139 Block: TCommandList; 140 ExceptBlock: TCommandList; 141 end; 142 143 // TCommandList = TGObjectList<Integer, TCommand> 144 TCommandList = class(TListObject); 137 Block: TCommands; 138 ExceptBlock: TCommands; 139 end; 140 141 TCommands = class(TObjectList<TCommand>); 145 142 146 143 TCommonBlockSection = (cbsVariable, cbsType, cbsConstant); … … 150 147 Parent: TCommonBlock; 151 148 ParentModule: TSourceModule; 152 Constants: TConstant List;153 Types: TType List;154 Variables: TVariable List;155 Functions: TFunction List;156 Order: T ListObject;149 Constants: TConstants; 150 Types: TTypes; 151 Variables: TVariables; 152 Functions: TFunctions; 153 Order: TObjectList<TObject>; 157 154 Code: TBeginEnd; 158 155 constructor Create; virtual; … … 166 163 ForwardDeclared: Boolean; 167 164 Internal: Boolean; 168 Parent: TType List;165 Parent: TTypes; 169 166 Name: string; 170 167 Size: Integer; … … 172 169 Exported: Boolean; 173 170 Visibility: TTypeVisibility; 174 Parameters: TType List;171 Parameters: TTypes; 175 172 procedure Assign(Source: TType); 176 173 constructor Create; … … 178 175 end; 179 176 180 // TListType = TGObjectList<Integer, TType> 181 TListType = class(TListObject); 182 183 TTypeList = class(TListType) 177 { TTypes } 178 179 TTypes = class(TObjectList<TType>) 184 180 Parent: TCommonBlock; 185 181 function Search(Name: string; Exported: Boolean = False): TType; 186 182 destructor Destroy; override; 183 function AddNew: TType; 187 184 end; 188 185 … … 214 211 end; 215 212 216 // TListEnumItem = TGObjectList<Integer, TEnumItem> 217 TListEnumItem = class(TListObject); 213 TEnumItems = class(TObjectList<TEnumItem>); 218 214 219 215 TTypeEnumeration = class(TType) 220 Items: T ListEnumItem;216 Items: TEnumItems; 221 217 constructor Create; 222 218 destructor Destroy; override; … … 239 235 end; 240 236 241 // TListConstant = TGObjectList<Integer, TConstant> 242 TListConstant = class(TListObject); 243 244 TConstantList = class(TListConstant) 237 TConstants = class(TObjectList<TConstant>) 245 238 Parent: TCommonBlock; 246 239 function Search(Name: string): TConstant; … … 256 249 end; 257 250 258 // TListVariable = TGObjectList<Integer, TVariable> 259 TListVariable = class(TListObject); 260 261 TVariableList = class(TListVariable) 251 TVariables = class(TObjectList<TVariable>) 262 252 Parent: TCommonBlock; 263 253 function Search(Name: string; Exported: Boolean = False): TVariable; … … 268 258 end; 269 259 270 // TListParameter = TGObjectList<Integer, TParameter> 271 TListParameter = class(TListObject); 272 273 TParameterList = class(TListParameter) 260 TParameters = class(TObjectList<TParameter>) 274 261 Parent: TFunction; 275 262 function Search(Name: string): TParameter; … … 288 275 Value: TValue; 289 276 OperatorName: string; 290 SubItems: T ListExpression;277 SubItems: TExpressions; 291 278 Associated: Boolean; 292 279 Braces: Boolean; … … 302 289 Internal: Boolean; 303 290 FunctionType: TFunctionType; 304 Parameters: TParameter List;291 Parameters: TParameters; 305 292 ResultType: TType; 306 293 Exported: Boolean; … … 310 297 end; 311 298 312 // TListFunction = TGObjectList<Integer, TFunction> 313 TListFunction = class(TListObject); 314 315 TFunctionList = class(TListFunction) 299 { TFunctions } 300 301 TFunctions = class(TObjectList<TFunction>) 316 302 Parent: TCommonBlock; 317 303 function Search(Name: string; Exported: Boolean = False): TFunction; 318 304 destructor Destroy; override; 305 function AddNew: TFunction; 319 306 end; 320 307 … … 326 313 end; 327 314 328 // TListUsedModule = TGObjectList<Integer, TUsedModule> 329 TListUsedModule = class(TListObject); 330 331 TUsedModuleList = class(TListUsedModule) 315 TUsedModules = class(TObjectList<TUsedModule>) 332 316 ParentModule: TSourceModule; 333 317 end; … … 340 324 Name: string; 341 325 TargetFile: string; 342 UsedModules: TUsedModule List;326 UsedModules: TUsedModules; 343 327 Body: TCommonBlock; 344 328 Internal: Boolean; … … 374 358 end; 375 359 376 // TListModule = TGObjectList<Integer, TModule> 377 TListModule = class(TListObject); 378 379 { TModuleList } 380 381 TModuleList = class(TListModule) 360 { TModules } 361 362 TModules = class(TObjectList<TSourceModule>) 382 363 function Search(Name: string): TSourceModule; 383 364 end; … … 387 368 TProgram = class(TSource) 388 369 Device: TDevice; 389 Modules: TModule List;370 Modules: TModules; 390 371 MainModule: TSourceModule; 391 372 procedure Clear; … … 408 389 SAssignmentError = 'Assignment error'; 409 390 391 410 392 implementation 411 393 … … 415 397 begin 416 398 inherited; 417 Parameters := TParameter List.Create;399 Parameters := TParameters.Create; 418 400 Parameters.Parent := Self; 419 401 //ResultType := TType.Create; … … 422 404 destructor TFunction.Destroy; 423 405 begin 424 Parameters.Free;425 // ResultType.Free;406 FreeAndNil(Parameters); 407 // FreeAndNil(ResultType); 426 408 inherited; 427 409 end; … … 438 420 begin 439 421 Device := TDevice.Create; 440 Modules := TModule List.Create;422 Modules := TModules.Create; 441 423 end; 442 424 443 425 destructor TProgram.Destroy; 444 426 begin 445 Modules.Free; 446 Device.Free; 447 end; 448 449 { TConstant } 450 451 452 { TConstantList } 453 454 destructor TConstantList.Destroy; 455 begin 456 inherited; 457 end; 458 459 function TConstantList.Search(Name: string): TConstant; 427 FreeAndNil(Modules); 428 FreeAndNil(Device); 429 end; 430 431 { TConstants } 432 433 destructor TConstants.Destroy; 434 begin 435 inherited; 436 end; 437 438 function TConstants.Search(Name: string): TConstant; 460 439 var 461 440 I: Integer; … … 476 455 begin 477 456 inherited; 478 UsedModules := TUsedModule List.Create;457 UsedModules := TUsedModules.Create; 479 458 UsedModules.ParentModule := Self; 480 459 Body := TCommonBlock.Create; … … 484 463 destructor TSourceModule.Destroy; 485 464 begin 486 Body.Free;487 UsedModules.Free;465 FreeAndNil(Body); 466 FreeAndNil(UsedModules); 488 467 inherited; 489 468 end; … … 504 483 constructor TCommonBlock.Create; 505 484 begin 506 Constants := TConstant List.Create;485 Constants := TConstants.Create; 507 486 Constants.Parent := Self; 508 Types := TType List.Create;487 Types := TTypes.Create; 509 488 Types.Parent := Self; 510 Variables := TVariable List.Create;489 Variables := TVariables.Create; 511 490 Variables.Parent := Self; 512 Functions := TFunction List.Create;491 Functions := TFunctions.Create; 513 492 Functions.Parent := Self; 514 493 Code := TBeginEnd.Create; 515 494 Code.Parent := Self; 516 495 Code.CommonBlock := Self; 517 Order := T ListObject.Create;496 Order := TObjectList<TObject>.Create; 518 497 Order.OwnsObjects := False; 519 498 end; … … 521 500 destructor TCommonBlock.Destroy; 522 501 begin 523 Constants.Free; 524 Types.Free; 525 Variables.Free; 526 Functions.Free; 527 Code.Free; 528 Order.Free; 529 inherited; 530 end; 531 532 { TTypeList } 533 534 destructor TTypeList.Destroy; 535 begin 536 inherited; 537 end; 538 539 function TTypeList.Search(Name: string; Exported: Boolean = False): TType; 502 FreeAndNil(Constants); 503 FreeAndNil(Types); 504 FreeAndNil(Variables); 505 FreeAndNil(Functions); 506 FreeAndNil(Code); 507 FreeAndNil(Order); 508 inherited; 509 end; 510 511 { TTypes } 512 513 destructor TTypes.Destroy; 514 begin 515 inherited; 516 end; 517 518 function TTypes.AddNew: TType; 519 begin 520 Result := TType.Create; 521 Add(Result); 522 end; 523 524 function TTypes.Search(Name: string; Exported: Boolean = False): TType; 540 525 var 541 526 I: Integer; … … 557 542 end; 558 543 559 { TVariable List}560 561 destructor TVariable List.Destroy;562 begin 563 inherited; 564 end; 565 566 function TVariable List.Search(Name: string; Exported: Boolean = False): TVariable;544 { TVariables } 545 546 destructor TVariables.Destroy; 547 begin 548 inherited; 549 end; 550 551 function TVariables.Search(Name: string; Exported: Boolean = False): TVariable; 567 552 var 568 553 I: Integer; … … 602 587 end; 603 588 604 { TFunctionList } 605 606 destructor TFunctionList.Destroy; 607 begin 608 inherited; 609 end; 610 611 function TFunctionList.Search(Name: string; Exported: Boolean): TFunction; 589 { TFunctions } 590 591 destructor TFunctions.Destroy; 592 begin 593 inherited; 594 end; 595 596 function TFunctions.AddNew: TFunction; 597 begin 598 Result := TFunction.Create; 599 Add(Result); 600 end; 601 602 function TFunctions.Search(Name: string; Exported: Boolean): TFunction; 612 603 var 613 604 I: Integer; … … 631 622 constructor TExpression.Create; 632 623 begin 633 SubItems := T ListExpression.Create;624 SubItems := TExpressions.Create; 634 625 SubItems.Count := 2; 635 626 SubItems.OwnsObjects := False; … … 638 629 destructor TExpression.Destroy; 639 630 begin 640 SubItems.Free;631 FreeAndNil(SubItems); 641 632 inherited; 642 633 end; … … 654 645 end; 655 646 656 { TParameter List}657 658 destructor TParameter List.Destroy;659 begin 660 inherited; 661 end; 662 663 function TParameter List.Search(Name: string): TParameter;647 { TParameters } 648 649 destructor TParameters.Destroy; 650 begin 651 inherited; 652 end; 653 654 function TParameters.Search(Name: string): TParameter; 664 655 var 665 656 I: Integer; … … 675 666 procedure TBeginEnd.Clear; 676 667 begin 677 678 668 end; 679 669 … … 681 671 begin 682 672 inherited; 683 Commands := TCommand List.Create;673 Commands := TCommands.Create; 684 674 end; 685 675 686 676 destructor TBeginEnd.Destroy; 687 677 begin 688 Commands.Free;678 FreeAndNil(Commands); 689 679 inherited; 690 680 end; … … 699 689 destructor TAssignment.Destroy; 700 690 begin 701 Source.Free; 702 inherited; 691 FreeAndNil(Source); 692 inherited; 693 end; 694 695 { TExpressions } 696 697 procedure TExpressions.Assign(Source: TExpressions); 698 var 699 I: Integer; 700 begin 701 while Count > Source.Count do Delete(Count - 1); 702 while Count < Source.Count do Add(TExpression.Create); 703 for I := 0 to Count - 1 do 704 Items[I].Assign(Source[I]); 703 705 end; 704 706 … … 713 715 destructor TWhileDo.Destroy; 714 716 begin 715 Condition.Free;716 Command.Free;717 FreeAndNil(Condition); 718 FreeAndNil(Command); 717 719 inherited; 718 720 end; … … 728 730 destructor TCaseOfEnd.Destroy; 729 731 begin 730 Branches.Free;732 FreeAndNil(Branches); 731 733 inherited; 732 734 end; … … 741 743 destructor TIfThenElse.Destroy; 742 744 begin 743 Condition.Free;744 inherited Destroy;745 FreeAndNil(Condition); 746 inherited; 745 747 end; 746 748 … … 750 752 begin 751 753 inherited; 752 ParameterExpression := T ListExpression.Create;754 ParameterExpression := TExpressions.Create; 753 755 end; 754 756 755 757 destructor TFunctionCall.Destroy; 756 758 begin 757 ParameterExpression.Free;758 inherited Destroy;759 FreeAndNil(ParameterExpression); 760 inherited; 759 761 end; 760 762 … … 770 772 destructor TForToDo.Destroy; 771 773 begin 772 Start.Free;773 Stop.Free;;774 inherited Destroy;774 FreeAndNil(Start); 775 FreeAndNil(Stop); 776 inherited; 775 777 end; 776 778 … … 785 787 destructor TTypeRecord.Destroy; 786 788 begin 787 CommonBlock.Free;788 inherited Destroy;789 end; 790 791 { TModule List}792 793 function TModule List.Search(Name: string): TSourceModule;789 FreeAndNil(CommonBlock); 790 inherited; 791 end; 792 793 { TModules } 794 795 function TModules.Search(Name: string): TSourceModule; 794 796 var 795 797 I: Integer; … … 820 822 function TSourceModule.SearchConstant(Name: string; Outside: Boolean): TConstant; 821 823 begin 822 823 824 end; 824 825 … … 864 865 destructor TModuleProgram.Destroy; 865 866 begin 866 inherited Destroy;867 inherited; 867 868 end; 868 869 … … 881 882 destructor TModuleUnit.Destroy; 882 883 begin 883 InititializeSection.Free;884 F inalalizeSection.Free;885 inherited Destroy;884 FreeAndNil(InititializeSection); 885 FreeAndNil(FinalalizeSection); 886 inherited; 886 887 end; 887 888 … … 891 892 begin 892 893 inherited; 893 Items := T ListEnumItem.Create;894 Items := TEnumItems.Create; 894 895 end; 895 896 896 897 destructor TTypeEnumeration.Destroy; 897 898 begin 898 Items.Free;899 inherited Destroy;899 FreeAndNil(Items); 900 inherited; 900 901 end; 901 902 … … 910 911 destructor TTypeClass.Destroy; 911 912 begin 912 CommonBlock.Free;913 inherited Destroy;913 FreeAndNil(CommonBlock); 914 inherited; 914 915 end; 915 916 … … 942 943 constructor TType.Create; 943 944 begin 944 Parameters := TType List.Create;945 Parameters := TTypes.Create; 945 946 //Parameters.Parent := Parent.Parent; 946 947 end; … … 948 949 destructor TType.Destroy; 949 950 begin 950 Parameters.Free;951 inherited Destroy;951 FreeAndNil(Parameters); 952 inherited; 952 953 end; 953 954 -
trunk/Compiler/Producer.pas
r74 r75 1 unit UProducer; 2 3 {$MODE Delphi} 1 unit Producer; 4 2 5 3 interface 6 4 7 5 uses 8 USourceCodePascal, Classes, SysUtils, StrUtils, SpecializedList, Process,6 SourceCodePascal, Classes, SysUtils, StrUtils, Generics.Collections, Process, 9 7 FileUtil, Forms; 10 8 -
trunk/Compiler/SourceConvertor.pas
r74 r75 1 unit USourceConvertor; 2 3 {$mode delphi}{$H+} 1 unit SourceConvertor; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, SpecializedList;6 Classes, SysUtils, Generics.Collections; 9 7 10 8 type … … 22 20 23 21 TSourceText = class(TSource) 24 Code: T ListString;22 Code: TStringList; 25 23 constructor Create; 26 24 destructor Destroy; override; … … 28 26 29 27 TSourceList = class 30 Items: T ListObject; // TListObject<TSource>28 Items: TObjectList<TSource>; 31 29 end; 32 30 … … 57 55 procedure TConvertor.Convert(Input, Output: TSourceList); 58 56 begin 59 60 57 end; 61 58 … … 74 71 constructor TSourceText.Create; 75 72 begin 76 Code := T ListString.Create;73 Code := TStringList.Create; 77 74 end; 78 75 79 76 destructor TSourceText.Destroy; 80 77 begin 81 Code.Free;82 inherited Destroy;78 FreeAndNil(Code); 79 inherited; 83 80 end; 84 81 -
trunk/Compiler/Target.pas
r74 r75 1 unit UTarget; 2 3 {$mode Delphi}{$H+} 1 unit Target; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UProducer, UExecutor, SpecializedList;6 Classes, SysUtils, Producer, Executor, Generics.Collections; 9 7 10 8 type … … 17 15 Producer: TProducer; 18 16 Executor: TExecutor; 19 Compiler: TObject; // TCompiler17 Compiler: TObject; // TCompiler 20 18 constructor Create; virtual; 21 19 destructor Destroy; override; … … 24 22 TTargetClass = class of TTarget; 25 23 26 { T ListTarget}24 { TTargets } 27 25 28 T ListTarget = class(TListObject)26 TTargets = class(TObjectList<TTarget>) 29 27 function SearchBySysName(Name: string): TTarget; 30 28 procedure LoadToStrings(Strings: TStrings); … … 43 41 destructor TTarget.Destroy; 44 42 begin 45 Producer.Free;46 Executor.Free;47 inherited Destroy;43 FreeAndNil(Producer); 44 FreeAndNil(Executor); 45 inherited; 48 46 end; 49 47 50 { T ListTarget}48 { TTargets } 51 49 52 function T ListTarget.SearchBySysName(Name: string): TTarget;50 function TTargets.SearchBySysName(Name: string): TTarget; 53 51 var 54 52 I: Integer; … … 60 58 end; 61 59 62 procedure T ListTarget.LoadToStrings(Strings: TStrings);60 procedure TTargets.LoadToStrings(Strings: TStrings); 63 61 var 64 62 I: Integer; -
trunk/Compiler/Target/Dynamic C/ProducerDynamicC.pas
r74 r75 1 unit UProducerDynamicc; 2 3 {$MODE Delphi} 1 unit ProducerDynamicC; 4 2 5 3 interface … … 7 5 uses 8 6 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, USourceCodePascal, UProducer, StrUtils;7 Dialogs, StdCtrls, SourceCodePascal, Producer, StrUtils; 10 8 11 9 type … … 17 15 function TranslateType(Name: string): string; 18 16 function TranslateOperator(Name: string): string; 19 procedure GenerateUses(UsedModules: TUsedModule List);17 procedure GenerateUses(UsedModules: TUsedModules); 20 18 procedure GenerateModule(Module: TSourceModule); 21 19 procedure GenerateCommonBlock(CommonBlock: TCommonBlock; 22 20 LabelPrefix: string); 23 21 procedure GenerateType(AType: TType); 24 procedure GenerateTypes(Types: TType List);22 procedure GenerateTypes(Types: TTypes); 25 23 procedure GenerateProgram(ProgramBlock: TProgram); 26 procedure GenerateFunctions(Functions: TFunction List;24 procedure GenerateFunctions(Functions: TFunctions; 27 25 Prefix: string = ''; HeaderOnly: Boolean = False); 28 26 procedure GenerateBeginEnd(BeginEnd: TBeginEnd); 29 procedure GenerateVariableList(VariableList: TVariable List);27 procedure GenerateVariableList(VariableList: TVariables); 30 28 procedure GenerateVariable(Variable: TVariable); 31 29 procedure GenerateCommand(Command: TCommand); … … 43 41 end; 44 42 43 45 44 implementation 46 45 … … 56 55 destructor TProducerDynamicC.Destroy; 57 56 begin 58 TextSource.Free;57 FreeAndNil(TextSource); 59 58 inherited; 60 59 end; … … 87 86 end; 88 87 89 procedure TProducerDynamicC.GenerateUses(UsedModules: TUsedModule List);88 procedure TProducerDynamicC.GenerateUses(UsedModules: TUsedModules); 90 89 var 91 90 I: Integer; … … 150 149 end; 151 150 152 procedure TProducerDynamicC.GenerateFunctions(Functions: TFunction List;151 procedure TProducerDynamicC.GenerateFunctions(Functions: TFunctions; 153 152 Prefix: string = ''; HeaderOnly: Boolean = False); 154 153 var … … 197 196 end; 198 197 199 procedure TProducerDynamicC.GenerateVariableList(VariableList: TVariable List);198 procedure TProducerDynamicC.GenerateVariableList(VariableList: TVariables); 200 199 var 201 200 I: Integer; … … 360 359 end; 361 360 362 procedure TProducerDynamicC.GenerateTypes(Types: TType List);361 procedure TProducerDynamicC.GenerateTypes(Types: TTypes); 363 362 var 364 363 I: Integer; -
trunk/Compiler/Target/GCC/ProducerGCC.pas
r74 r75 1 unit UProducerGCC; 2 3 {$MODE Delphi} 1 unit ProducerGCC; 4 2 5 3 interface 6 4 7 5 uses 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, USourceCodePascal, UProducer, StrUtils;6 SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, 7 SourceCodePascal, Producer, StrUtils; 10 8 11 9 type … … 19 17 procedure Emit(AText: string); 20 18 procedure EmitLn(AText: string = ''); 21 procedure GenerateUses(UsedModules: TUsedModule List);19 procedure GenerateUses(UsedModules: TUsedModules); 22 20 procedure GenerateModule(Module: TSourceModule); 23 21 procedure GenerateCommonBlock(CommonBlock: TCommonBlock; 24 22 LabelPrefix: string); 25 23 procedure GenerateType(AType: TType); 26 procedure GenerateTypes(Types: TType List);24 procedure GenerateTypes(Types: TTypes); 27 25 procedure GenerateProgram(ProgramBlock: TProgram); 28 procedure GenerateFunctions(Functions: TFunction List;26 procedure GenerateFunctions(Functions: TFunctions; 29 27 Prefix: string = ''); 30 28 procedure GenerateBeginEnd(BeginEnd: TBeginEnd); 31 procedure GenerateVariableList(VariableList: TVariable List);29 procedure GenerateVariableList(VariableList: TVariables); 32 30 procedure GenerateVariable(Variable: TVariable); 33 31 procedure GenerateCommand(Command: TCommand); … … 48 46 end; 49 47 48 50 49 implementation 51 50 … … 66 65 destructor TProducerGCCC.Destroy; 67 66 begin 68 TextSource.Free;67 FreeAndNil(TextSource); 69 68 inherited; 70 69 end; … … 113 112 end; 114 113 115 procedure TProducerGCCC.GenerateUses(UsedModules: TUsedModule List);114 procedure TProducerGCCC.GenerateUses(UsedModules: TUsedModules); 116 115 var 117 116 I: Integer; … … 155 154 end; 156 155 157 procedure TProducerGCCC.GenerateFunctions(Functions: TFunction List;156 procedure TProducerGCCC.GenerateFunctions(Functions: TFunctions; 158 157 Prefix: string = ''); 159 158 var … … 202 201 end; 203 202 204 procedure TProducerGCCC.GenerateVariableList(VariableList: TVariable List);203 procedure TProducerGCCC.GenerateVariableList(VariableList: TVariables); 205 204 var 206 205 I: Integer; … … 361 360 end; 362 361 363 procedure TProducerGCCC.GenerateTypes(Types: TType List);362 procedure TProducerGCCC.GenerateTypes(Types: TTypes); 364 363 var 365 364 I: Integer; -
trunk/Compiler/Target/Java/TargetJava.pas
r74 r75 1 unit UTargetJava; 2 3 {$mode Delphi}{$H+} 1 unit TargetJava; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget;6 Classes, SysUtils, Target; 9 7 10 8 type … … 22 20 constructor TTargetJava.Create; 23 21 begin 24 inherited Create;22 inherited; 25 23 SysName := 'Java'; 26 24 Name := 'Java'; -
trunk/Compiler/Target/NASM/TargetNASM.pas
r74 r75 1 unit UTargetNASM; 2 3 {$mode Delphi}{$H+} 1 unit TargetNASM; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget;6 Classes, SysUtils, Target; 9 7 10 8 type … … 23 21 constructor TTargetNASM.Create; 24 22 begin 25 inherited Create;23 inherited; 26 24 Name := 'NASM'; 27 25 SysName := 'NASM'; -
trunk/Compiler/Target/PHP/TargetPHP.pas
r74 r75 1 unit UTargetPHP; 2 3 {$mode Delphi}{$H+} 1 unit TargetPHP; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget;6 Classes, SysUtils, Target; 9 7 10 8 type … … 16 14 end; 17 15 16 18 17 implementation 19 18 … … 22 21 constructor TTargetPHP.Create; 23 22 begin 24 inherited Create;23 inherited; 25 24 SysName := 'PHP'; 26 25 Name := 'PHP'; -
trunk/Compiler/Target/XML/TargetXML.pas
r74 r75 1 unit UTargetXML; 2 3 {$mode Delphi}{$H+} 1 unit TargetXML; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UTarget, UProducer, USourceCodePascal;6 Classes, SysUtils, Target, Producer, SourceCodePascal; 9 7 10 8 type … … 91 89 constructor TTargetXML.Create; 92 90 begin 93 inherited Create;91 inherited; 94 92 SysName := 'XML'; 95 93 Name := 'XML'; -
trunk/Compiler/TranspascalCompiler.lpk
r74 r75 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <CONFIG> 3 <Package Version=" 4">3 <Package Version="5"> 4 4 <PathDelim Value="\"/> 5 5 <Name Value="TranspascalCompiler"/> … … 25 25 </CompilerOptions> 26 26 <Version Minor="1"/> 27 <Files Count="2 7">27 <Files Count="28"> 28 28 <Item1> 29 <Filename Value=" UCompiler.pas"/>30 <UnitName Value=" UCompiler"/>29 <Filename Value="Compiler.pas"/> 30 <UnitName Value="Compiler"/> 31 31 </Item1> 32 32 <Item2> 33 <Filename Value="Modules\Pascal\ USourceCodePascal.pas"/>34 <UnitName Value=" USourceCodePascal"/>33 <Filename Value="Modules\Pascal\SourceCodePascal.pas"/> 34 <UnitName Value="SourceCodePascal"/> 35 35 </Item2> 36 36 <Item3> 37 <Filename Value=" UProducer.pas"/>38 <UnitName Value=" UProducer"/>37 <Filename Value="Producer.pas"/> 38 <UnitName Value="Producer"/> 39 39 </Item3> 40 40 <Item4> 41 <Filename Value=" UAnalyzer.pas"/>42 <UnitName Value=" UAnalyzer"/>41 <Filename Value="Analyzer.pas"/> 42 <UnitName Value="Analyzer"/> 43 43 </Item4> 44 44 <Item5> 45 <Filename Value=" UTarget.pas"/>46 <UnitName Value=" UTarget"/>45 <Filename Value="Target.pas"/> 46 <UnitName Value="Target"/> 47 47 </Item5> 48 48 <Item6> 49 <Filename Value=" UExecutor.pas"/>50 <UnitName Value=" UExecutor"/>49 <Filename Value="Executor.pas"/> 50 <UnitName Value="Executor"/> 51 51 </Item6> 52 52 <Item7> 53 <Filename Value="Modules\Pascal\ UAnalyzerPascal.pas"/>54 <UnitName Value=" UAnalyzerPascal"/>53 <Filename Value="Modules\Pascal\AnalyzerPascal.pas"/> 54 <UnitName Value="AnalyzerPascal"/> 55 55 </Item7> 56 56 <Item8> 57 <Filename Value="Target\Dynamic C\ UProducerDynamicc.pas"/>58 <UnitName Value=" UProducerDynamicC"/>57 <Filename Value="Target\Dynamic C\ProducerDynamicC.pas"/> 58 <UnitName Value="ProducerDynamicC"/> 59 59 </Item8> 60 60 <Item9> 61 <Filename Value="Modules\ASM8051\ UProducerASM8051.pas"/>62 <UnitName Value=" UProducerAsm8051"/>61 <Filename Value="Modules\ASM8051\ProducerASM8051.pas"/> 62 <UnitName Value="ProducerASM8051"/> 63 63 </Item9> 64 64 <Item10> 65 <Filename Value="Modules\ASM8051\ UTargetASM8051.pas"/>66 <UnitName Value=" UTargetASM8051"/>65 <Filename Value="Modules\ASM8051\TargetASM8051.pas"/> 66 <UnitName Value="TargetASM8051"/> 67 67 </Item10> 68 68 <Item11> 69 <Filename Value="Modules\GCC\ UTargetGCC.pas"/>70 <UnitName Value=" UTargetGCC"/>69 <Filename Value="Modules\GCC\TargetGCC.pas"/> 70 <UnitName Value="TargetGCC"/> 71 71 </Item11> 72 72 <Item12> 73 <Filename Value="Modules\GCC\ UProducerGCC.pas"/>74 <UnitName Value=" UProducerGCC"/>73 <Filename Value="Modules\GCC\ProducerGCC.pas"/> 74 <UnitName Value="ProducerGCC"/> 75 75 </Item12> 76 76 <Item13> 77 <Filename Value="Modules\Delphi\ UProducerDelphi.pas"/>78 <UnitName Value=" UProducerDelphi"/>77 <Filename Value="Modules\Delphi\ProducerDelphi.pas"/> 78 <UnitName Value="ProducerDelphi"/> 79 79 </Item13> 80 80 <Item14> 81 <Filename Value="Modules\Delphi\ UModuleDelphi.pas"/>82 <UnitName Value=" UModuleDelphi"/>81 <Filename Value="Modules\Delphi\ModuleDelphi.pas"/> 82 <UnitName Value="ModuleDelphi"/> 83 83 </Item14> 84 84 <Item15> 85 <Filename Value="Target\PHP\ UTargetPHP.pas"/>86 <UnitName Value=" UTargetPHP"/>85 <Filename Value="Target\PHP\TargetPHP.pas"/> 86 <UnitName Value="TargetPHP"/> 87 87 </Item15> 88 88 <Item16> 89 <Filename Value="Target\Java\ UTargetJava.pas"/>90 <UnitName Value=" UTargetJava"/>89 <Filename Value="Target\Java\TargetJava.pas"/> 90 <UnitName Value="TargetJava"/> 91 91 </Item16> 92 92 <Item17> 93 <Filename Value="Target\XML\ UTargetXML.pas"/>94 <UnitName Value=" UTargetXML"/>93 <Filename Value="Target\XML\TargetXML.pas"/> 94 <UnitName Value="TargetXML"/> 95 95 </Item17> 96 96 <Item18> 97 <Filename Value="Modules\Interpretter\ UModuleInterpretter.pas"/>98 <UnitName Value=" UModuleInterpretter"/>97 <Filename Value="Modules\Interpretter\ModuleInterpretter.pas"/> 98 <UnitName Value="ModuleInterpretter"/> 99 99 </Item18> 100 100 <Item19> 101 <Filename Value="Target\NASM\ UTargetNASM.pas"/>102 <UnitName Value=" UTargetNASM"/>101 <Filename Value="Target\NASM\TargetNASM.pas"/> 102 <UnitName Value="TargetNASM"/> 103 103 </Item19> 104 104 <Item20> 105 <Filename Value="Modules\Pascal\ UModulePascal.pas"/>106 <UnitName Value=" UModulePascal"/>105 <Filename Value="Modules\Pascal\ModulePascal.pas"/> 106 <UnitName Value="ModulePascal"/> 107 107 </Item20> 108 108 <Item21> 109 <Filename Value=" UCompilerAPI.pas"/>110 <UnitName Value=" UCompilerAPI"/>109 <Filename Value="CompilerAPI.pas"/> 110 <UnitName Value="CompilerAPI"/> 111 111 </Item21> 112 112 <Item22> 113 <Filename Value="Modules\GCC\ UModuleGCC.pas"/>114 <UnitName Value=" UModuleGCC"/>113 <Filename Value="Modules\GCC\ModuleGCC.pas"/> 114 <UnitName Value="ModuleGCC"/> 115 115 </Item22> 116 116 <Item23> 117 <Filename Value=" USourceConvertor.pas"/>118 <UnitName Value=" USourceConvertor"/>117 <Filename Value="SourceConvertor.pas"/> 118 <UnitName Value="SourceConvertor"/> 119 119 </Item23> 120 120 <Item24> 121 <Filename Value="Modules\Brainfuck\ UModuleBrainfuck.pas"/>122 <UnitName Value=" UModuleBrainfuck"/>121 <Filename Value="Modules\Brainfuck\ModuleBrainfuck.pas"/> 122 <UnitName Value="ModuleBrainfuck"/> 123 123 </Item24> 124 124 <Item25> 125 <Filename Value="Modules\PHP\ UModulePHP.pas"/>126 <UnitName Value=" UModulePHP"/>125 <Filename Value="Modules\PHP\ModulePHP.pas"/> 126 <UnitName Value="ModulePHP"/> 127 127 </Item25> 128 128 <Item26> 129 <Filename Value="Modules\Java\ UModuleJava.pas"/>130 <UnitName Value=" UModuleJava"/>129 <Filename Value="Modules\Java\ModuleJava.pas"/> 130 <UnitName Value="ModuleJava"/> 131 131 </Item26> 132 132 <Item27> 133 <Filename Value="Modules\ASM8051\ UModuleASM8051.pas"/>134 <UnitName Value=" UModuleASM8051"/>133 <Filename Value="Modules\ASM8051\ModuleASM8051.pas"/> 134 <UnitName Value="ModuleASM8051"/> 135 135 </Item27> 136 <Item28> 137 <Filename Value="Target\GCC\ProducerGCC.pas"/> 138 <UnitName Value="ProducerGCC"/> 139 </Item28> 136 140 </Files> 137 <RequiredPkgs Count="4"> 141 <CompatibilityMode Value="True"/> 142 <RequiredPkgs Count="3"> 138 143 <Item1> 139 144 <PackageName Value="ModularSystem"/> … … 141 146 </Item1> 142 147 <Item2> 143 <PackageName Value=" TemplateGenerics"/>148 <PackageName Value="LCL"/> 144 149 </Item2> 145 150 <Item3> 146 <PackageName Value="LCL"/>147 </Item3>148 <Item4>149 151 <PackageName Value="FCL"/> 150 152 <MinVersion Major="1" Valid="True"/> 151 </Item 4>153 </Item3> 152 154 </RequiredPkgs> 153 155 <UsageOptions> -
trunk/Compiler/TranspascalCompiler.pas
r74 r75 9 9 10 10 uses 11 UCompiler, USourceCodePascal, UProducer, UAnalyzer, UTarget, UExecutor,12 UAnalyzerPascal, UProducerDynamicc, UProducerASM8051, UTargetASM8051,13 UTargetGCC, UProducerGCC, UProducerDelphi, UModuleDelphi, UTargetPHP,14 UTargetJava, UTargetXML, UModuleInterpretter, UTargetNASM, UModulePascal,15 UCompilerAPI, UModuleGCC, USourceConvertor, UModuleBrainfuck, UModulePHP,16 UModuleJava, UModuleASM8051,LazarusPackageIntf;11 Compiler, SourceCodePascal, Producer, Analyzer, Target, Executor, 12 AnalyzerPascal, ProducerDynamicC, ProducerASM8051, TargetASM8051, TargetGCC, 13 ProducerGCC, ProducerDelphi, ModuleDelphi, TargetPHP, TargetJava, TargetXML, 14 ModuleInterpretter, TargetNASM, ModulePascal, CompilerAPI, ModuleGCC, 15 SourceConvertor, ModuleBrainfuck, ModulePHP, ModuleJava, ModuleASM8051, 16 LazarusPackageIntf; 17 17 18 18 implementation
Note:
See TracChangeset
for help on using the changeset viewer.