Ignore:
Timestamp:
Nov 8, 2010, 2:14:13 PM (14 years ago)
Author:
george
Message:
  • Modified: Enhanced Delphi producer.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Produce/UProducerDynamicC.pas

    r12 r17  
    1717    function TranslateType(Name: string): string;
    1818    function TranslateOperator(Name: string): string;
    19     procedure Emit(AText: string);
    20     procedure EmitLn(AText: string = '');
    2119    procedure GenerateUses(UsedModules: TUsedModuleList);
    2220    procedure GenerateModule(Module: TModule);
     
    3937    function GenerateExpression(Expression: TExpression): string;
    4038  public
    41     TextSource: TStringList;
    42     IndentationLength: Integer;
    43     Indetation: Integer;
    4439    procedure AssignToStringList(Target: TStringList); override;
    4540    procedure Produce(Module: TModule); override;
     
    5449constructor TProducerDynamicC.Create;
    5550begin
    56   TextSource := TStringList.Create;
    57   IndentationLength := 2;
    5851  Name := 'Dynamic C';
    5952end;
     
    9083  else if Name = 'xor' then Result := '^'
    9184  else Result := Name;
    92 end;
    93 
    94 procedure TProducerDynamicC.EmitLn(AText: string = '');
    95 begin
    96   Emit(AText);
    97   TextSource.Add('');
    98 end;
    99 
    100 procedure TProducerDynamicC.Emit(AText: string);
    101 begin
    102   with TextSource do begin
    103     if Count = 0 then Add('');
    104     if Strings[Count - 1] = '' then
    105       Strings[Count - 1] := Strings[Count - 1] + DupeString(' ', IndentationLength * Indetation);
    106     Strings[Count - 1] := Strings[Count - 1] + AText;
    107   end;
    10885end;
    10986
Note: See TracChangeset for help on using the changeset viewer.