Changeset 63
- Timestamp:
- Jul 17, 2012, 10:54:18 AM (12 years ago)
- Location:
- trunk/Compiler
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyze/UAnalyzerPascal.pas
r62 r63 76 76 SUnitNotFound = 'Unit "%s" not found.'; 77 77 SFunctionNotDeclared = 'Function "%s" not declared.'; 78 SFunctionRedefinition = 'Function "%s" redefined.'; 78 79 SUnknownProcName = 'Unknown proc name "%s".'; 79 80 SUnknownModuleType = 'Unknown module name "%s".'; … … 703 704 end; 704 705 end else begin 705 // Create new function 706 UseFunction := TFunction.Create; 707 UseFunction.Parent := SourceCode.Parent; 708 UseFunction.Name := UseName; 709 UseFunction.FunctionType := FunctionType; 710 UseFunction.Exported := Exported; 711 Add(UseFunction); 712 UseFunction.Parent.Order.Add(UseFunction); 713 ValidParams := False; 706 UseFunction := SourceCode.Search(UseName, True); 707 if not Assigned(UseFunction) then begin 708 // Create new function 709 UseFunction := TFunction.Create; 710 UseFunction.Parent := SourceCode.Parent; 711 UseFunction.Name := UseName; 712 UseFunction.FunctionType := FunctionType; 713 UseFunction.Exported := Exported; 714 Add(UseFunction); 715 UseFunction.Parent.Order.Add(UseFunction); 716 ValidParams := False; 717 end else begin 718 if not UseFunction.BodyLoaded then UseFunction.BodyLoaded := True 719 else begin 720 ErrorMessage(SFunctionRedefinition, [UseName]); 721 Exit; 722 end; 723 end; 714 724 end; 715 725 with UseFunction do begin -
trunk/Compiler/Target/Delphi/UProducerPascal.pas
r61 r63 101 101 Module.TargetFile := Module.Name + '.dpr'; 102 102 EmitLn('program ' + Name + ';'); 103 EmitLn; 104 EnitLn('{$APPTYPE Console}'); 103 105 EmitLn; 104 106 GenerateUses(UsedModules); … … 505 507 end; 506 508 507 508 509 509 end. -
trunk/Compiler/Target/XML/UTargetXML.pas
r42 r63 6 6 7 7 uses 8 Classes, SysUtils, UTarget ;8 Classes, SysUtils, UTarget, UProducer, USourceCode; 9 9 10 10 type … … 16 16 end; 17 17 18 { TProducerXML } 19 20 TProducerXML = class(TProducer) 21 private 22 procedure GenerateModule(Module: TModule); 23 procedure GenerateUnit(Module: TModule); 24 procedure GenerateLibrary(Module: TModule); 25 procedure GeneratePackage(Module: TModule); 26 public 27 procedure AssignToStringList(Target: TStringList); override; 28 procedure Produce(Module: TModule); override; 29 end; 30 31 18 32 implementation 33 34 { TProducerXML } 35 36 procedure TProducerXML.GenerateModule(Module: TModule); 37 begin 38 Module.TargetFile := Module.Name + '.xml'; 39 if Module is TModuleProgram then 40 with TModuleProgram(Module) do begin 41 EmitLn('<?xml version="1.0"?>'); 42 EmitLn('<program>'); 43 //GenerateUses(UsedModules); 44 //GenerateCommonBlockImplementation(Body, ''); 45 EmitLn('</program>'); 46 end; 47 if Module is TModuleUnit then GenerateUnit(Module) 48 else if Module is TModuleLibrary then GenerateLibrary(Module) 49 else if Module is TModulePackage then GeneratePackage(Module); 50 end; 51 52 procedure TProducerXML.GenerateUnit(Module: TModule); 53 begin 54 EmitLn('<?xml version="1.0"?>'); 55 EmitLn('<unit>'); 56 //GenerateUses(UsedModules); 57 //GenerateCommonBlockImplementation(Body, ''); 58 EmitLn('</unit'); 59 end; 60 61 procedure TProducerXML.GenerateLibrary(Module: TModule); 62 begin 63 EmitLn('<?xml version="1.0"?>'); 64 EmitLn('<library>'); 65 //GenerateUses(UsedModules); 66 //GenerateCommonBlockImplementation(Body, ''); 67 EmitLn('</library>'); 68 end; 69 70 procedure TProducerXML.GeneratePackage(Module: TModule); 71 begin 72 EmitLn('<?xml version="1.0"?>'); 73 EmitLn('<package>'); 74 //GenerateUses(UsedModules); 75 //GenerateCommonBlockImplementation(Body, ''); 76 EmitLn('</package>'); 77 end; 78 79 procedure TProducerXML.Produce(Module: TModule); 80 begin 81 GenerateModule(Module); 82 end; 83 84 procedure TProducerXML.AssignToStringList(Target: TStringList); 85 begin 86 Target.Assign(TextSource); 87 end; 19 88 20 89 { TTargetXML } … … 25 94 SysName := 'XML'; 26 95 Name := 'XML'; 96 Producer := TProducerXML.Create; 27 97 end; 28 98 -
trunk/Compiler/USourceCode.pas
r56 r63 305 305 ResultType: TType; 306 306 Exported: Boolean; 307 BodyLoaded: Boolean; 307 308 constructor Create; override; 308 309 destructor Destroy; override;
Note:
See TracChangeset
for help on using the changeset viewer.