Ignore:
Timestamp:
Jul 17, 2012, 10:54:18 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Procedure/function header and body not paired properly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Target/XML/UTargetXML.pas

    r42 r63  
    66
    77uses
    8   Classes, SysUtils, UTarget;
     8  Classes, SysUtils, UTarget, UProducer, USourceCode;
    99
    1010type
     
    1616  end;
    1717
     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
    1832implementation
     33
     34{ TProducerXML }
     35
     36procedure TProducerXML.GenerateModule(Module: TModule);
     37begin
     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);
     50end;
     51
     52procedure TProducerXML.GenerateUnit(Module: TModule);
     53begin
     54  EmitLn('<?xml version="1.0"?>');
     55  EmitLn('<unit>');
     56  //GenerateUses(UsedModules);
     57  //GenerateCommonBlockImplementation(Body, '');
     58  EmitLn('</unit');
     59end;
     60
     61procedure TProducerXML.GenerateLibrary(Module: TModule);
     62begin
     63  EmitLn('<?xml version="1.0"?>');
     64  EmitLn('<library>');
     65  //GenerateUses(UsedModules);
     66  //GenerateCommonBlockImplementation(Body, '');
     67  EmitLn('</library>');
     68end;
     69
     70procedure TProducerXML.GeneratePackage(Module: TModule);
     71begin
     72  EmitLn('<?xml version="1.0"?>');
     73  EmitLn('<package>');
     74  //GenerateUses(UsedModules);
     75  //GenerateCommonBlockImplementation(Body, '');
     76  EmitLn('</package>');
     77end;
     78
     79procedure TProducerXML.Produce(Module: TModule);
     80begin
     81  GenerateModule(Module);
     82end;
     83
     84procedure TProducerXML.AssignToStringList(Target: TStringList);
     85begin
     86  Target.Assign(TextSource);
     87end;
    1988
    2089{ TTargetXML }
     
    2594  SysName := 'XML';
    2695  Name := 'XML';
     96  Producer := TProducerXML.Create;
    2797end;
    2898
Note: See TracChangeset for help on using the changeset viewer.