Changeset 37 for trunk/Compiler


Ignore:
Timestamp:
Feb 14, 2012, 7:33:51 AM (13 years ago)
Author:
chronos
Message:
  • Added: Form containing list of supported compiler producers. Path to real compiler can be changed.
Location:
trunk/Compiler/Produce
Files:
5 edited

Legend:

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

    r30 r37  
    1717    TextSource: TStringList;
    1818    IndentationLength: Integer;
    19     Indetation: Integer;
     19    Indentation: Integer;
     20    CompilerPath: string;
    2021    procedure Emit(AText: string);
    2122    procedure EmitLn(AText: string = '');
     
    5657    if Count = 0 then Add('');
    5758    if Strings[Count - 1] = '' then
    58       Strings[Count - 1] := Strings[Count - 1] + DupeString(' ', IndentationLength * Indetation);
     59      Strings[Count - 1] := Strings[Count - 1] + DupeString(' ', IndentationLength * Indentation);
    5960    Strings[Count - 1] := Strings[Count - 1] + AText;
    6061  end;
  • trunk/Compiler/Produce/UProducerAsm8051.pas

    r12 r37  
    109109  AssemblyCode := TObjectList.Create;
    110110  Name := 'ASM 8051';
     111  {$IFDEF Windows}
     112  CompilerPath := 'c:\ASM8051\ASM51.EXE';
     113  {$ENDIF}
    111114end;
    112115
  • trunk/Compiler/Produce/UProducerDynamicC.pas

    r17 r37  
    5050begin
    5151  Name := 'Dynamic C';
     52  {$IFDEF Windows}
     53  CompilerPath := 'c:\Program Files\Dynamic C Rabbit 9.62\Dcrab_9.62.exe';
     54  {$ENDIF}
    5255end;
    5356
     
    142145  I: Integer;
    143146begin
    144   Indetation := 0;
     147  Indentation := 0;
    145148  with ProgramBlock do
    146149  for I := 0 to Modules.Count - 1 do
     
    180183begin
    181184  EmitLn('{');
    182   Inc(Indetation);
     185  Inc(Indentation);
    183186
    184187  // Variables
     
    191194    GenerateCommand(TCommand(BeginEnd.Commands[I]));
    192195
    193   Dec(Indetation);
     196  Dec(Indentation);
    194197  EmitLn('}');
    195198end;
     
    320323    EmitLn('struct');
    321324    EmitLn('{');
    322     Inc(Indetation);
     325    Inc(Indentation);
    323326    GenerateVariableList(TTypeRecord(AType).CommonBlock.Variables);
    324     Dec(Indetation);
     327    Dec(Indentation);
    325328    EmitLn('} ' + TranslateType(AType.Name) + ';');
    326329    EmitLn;
     
    363366begin
    364367  if Types.Count > 0 then begin
    365     Inc(Indetation);
     368    Inc(Indentation);
    366369    for I := 0 to Types.Count - 1 do
    367370    with TType(Types[I]) do
     
    371374      EmitLn(';');
    372375    end;
    373     Dec(Indetation);
     376    Dec(Indentation);
    374377    EmitLn('');
    375378  end;
  • trunk/Compiler/Produce/UProducerGCCC.pas

    r12 r37  
    5757  IndentationLength := 2;
    5858  Name := 'GCC C';
     59  {$IFDEF Windows}
     60  CompilerPath := 'c:\Program Files\MinGW\bin\gcc.exe -o %1:s';
     61  {$ENDIF}
     62  {$IFDEF Linux}
     63  CompilerPath := '/usr/bin/gcc';
     64  {$ENDIF}
    5965end;
    6066
  • trunk/Compiler/Produce/UProducerPascal.pas

    r26 r37  
    5656  inherited;
    5757  Name := 'Delphi';
     58  {$IFDEF Windows}
     59  CompilerPath := 'c:\Program Files\Embarcadero\RAD Studio\9.0\bin\DCC32.EXE';
     60  {$ENDIF}
    5861end;
    5962
     
    6972begin
    7073  EmitLn('uses');
    71   Inc(Indetation);
     74  Inc(Indentation);
    7275  for I := 0 to UsedModules.Count - 1 do begin
    7376    if Assigned(TUsedModule(UsedModules[I]).Module) then
     
    8386  end;
    8487  EmitLn(';');
    85   Dec(Indetation);
     88  Dec(Indentation);
    8689  EmitLn;
    8790end;
     
    134137  if AType is TTypeRecord then begin
    135138    EmitLn('record');
    136     Inc(Indetation);
     139    Inc(Indentation);
    137140    with TTypeRecord(AType).CommonBlock do
    138141    for I := 0 to Variables.Count - 1 do begin
     
    141144      EmitLn(';');
    142145    end;
    143     Dec(Indetation);
     146    Dec(Indentation);
    144147    Emit('end');
    145148  end else
     
    174177  if Types.Count > 0 then begin
    175178    EmitLn('type');
    176     Inc(Indetation);
     179    Inc(Indentation);
    177180    for I := 0 to Types.Count - 1 do
    178181    with TType(Types[I]) do
     
    182185      EmitLn(';');
    183186    end;
    184     Dec(Indetation);
     187    Dec(Indentation);
    185188    EmitLn;
    186189  end;
     
    257260  if Constants.Count > 0 then begin
    258261    EmitLn('const');
    259     Inc(Indetation);
     262    Inc(Indentation);
    260263    for I := 0 to Constants.Count - 1 do
    261264      GenerateConstant(TConstant(Constants[I]));
    262     Dec(Indetation);
     265    Dec(Indentation);
    263266    Emit('');
    264267  end;
     
    279282begin
    280283  EmitLn('begin');
    281   Inc(Indetation);
     284  Inc(Indentation);
    282285  // Commands
    283286  for I := 0 to BeginEnd.Commands.Count - 1 do begin
     
    286289  end;
    287290
    288   Dec(Indetation);
     291  Dec(Indentation);
    289292  Emit('end');
    290293end;
     
    295298begin
    296299  EmitLn('var');
    297   Inc(Indetation);
     300  Inc(Indentation);
    298301  for I := 0 to Variables.Count - 1 do
    299302    GenerateVariable(TVariable(Variables[I]));
    300   Dec(Indetation);
     303  Dec(Indentation);
    301304  EmitLn;
    302305end;
     
    404407  Section: TCommonBlockSection;
    405408begin
    406   Inc(Indetation);
     409  Inc(Indentation);
    407410  with CommonBlock do begin
    408411    for I := 0 to Order.Count - 1 do begin
     
    410413        if Section <> cbsType then begin
    411414          EmitLn;
    412           Dec(Indetation);
     415          Dec(Indentation);
    413416          EmitLn('type');
    414           Inc(Indetation);
     417          Inc(Indentation);
    415418        end;
    416419        Emit(TType(Order[I]).Name + ' = ');
     
    422425        if Section <> cbsVariable then begin
    423426          EmitLn;
    424           Dec(Indetation);
     427          Dec(Indentation);
    425428          EmitLn('var');
    426           Inc(Indetation);
     429          Inc(Indentation);
    427430        end;
    428431        GenerateVariable(TVariable(Order[I]));
     
    432435        if Section <> cbsConstant then begin
    433436          EmitLn;
    434           Dec(Indetation);
     437          Dec(Indentation);
    435438          EmitLn('const');
    436           Inc(Indetation);
     439          Inc(Indentation);
    437440        end;
    438441        GenerateConstant(TConstant(Order[I]));
     
    444447    end;
    445448  end;
    446   Dec(Indetation);
     449  Dec(Indentation);
    447450end;
    448451
     
    454457  Section: TCommonBlockSection;
    455458begin
    456   Inc(Indetation);
     459  Inc(Indentation);
    457460  with CommonBlock do begin
    458461    for I := 0 to Order.Count - 1 do begin
     
    460463        if Section <> cbsType then begin
    461464          EmitLn;
    462           Dec(Indetation);
     465          Dec(Indentation);
    463466          EmitLn('type');
    464           Inc(Indetation);
     467          Inc(Indentation);
    465468        end;
    466469        Emit(TType(Order[I]).Name + ' = ');
     
    472475        if Section <> cbsVariable then begin
    473476          EmitLn;
    474           Dec(Indetation);
     477          Dec(Indentation);
    475478          EmitLn('var');
    476           Inc(Indetation);
     479          Inc(Indentation);
    477480        end;
    478481        GenerateVariable(TVariable(Order[I]));
     
    482485        if Section <> cbsConstant then begin
    483486          EmitLn;
    484           Dec(Indetation);
     487          Dec(Indentation);
    485488          EmitLn('const');
    486           Inc(Indetation);
     489          Inc(Indentation);
    487490        end;
    488491        GenerateConstant(TConstant(Order[I]));
     
    495498    GenerateBeginEnd(Code);
    496499  end;
    497   Dec(Indetation);
     500  Dec(Indentation);
    498501end;
    499502
Note: See TracChangeset for help on using the changeset viewer.