Changeset 63 for trunk/Compiler/Target/XML/UTargetXML.pas
- Timestamp:
- Jul 17, 2012, 10:54:18 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.