Changeset 74 for trunk/Compiler


Ignore:
Timestamp:
Jan 18, 2018, 11:54:13 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Build under Lazarus 1.8.0.
Location:
trunk/Compiler
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Modules/GCC/UModuleGCC.pas

    r73 r74  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, UProducerGCC, UTargetGCC;
     8  Classes, SysUtils, UModularSystem, UProducerGCC, UTargetGCC, UCompilerAPI;
    99
    1010type
     
    4343begin
    4444  Target := TTargetGCC.Create;
     45  with TCompilerAPI(API) do begin
     46    RegisterTarget(TTargetGCC);
     47  end;
    4548  inherited;
    4649end;
     
    4851procedure TModuleGCC.DoUninstall;
    4952begin
     53  with TCompilerAPI(API) do begin
     54    UnregisterTarget(TTargetGCC);
     55  end;
    5056  inherited;
    5157end;
  • trunk/Compiler/Modules/Pascal/UAnalyzerPascal.pas

    r72 r74  
    14711471{ TParserUsedModuleList }
    14721472
    1473 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModuleList; AExported: Boolean = False): Boolean;
     1473function TAnalyzerPascal.ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
    14741474var
    14751475  NewUsedModule: TUsedModule;
  • trunk/Compiler/TranspascalCompiler.lpk

    r72 r74  
    1 <?xml version="1.0"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<CONFIG>
    33  <Package Version="4">
    44    <PathDelim Value="\"/>
    55    <Name Value="TranspascalCompiler"/>
     6    <Type Value="RunAndDesignTime"/>
    67    <AddToProjectUsesSection Value="True"/>
    78    <CompilerOptions>
     
    910      <PathDelim Value="\"/>
    1011      <SearchPaths>
    11         <OtherUnitFiles Value="Analyze;Target;Target\Interpretter;Target\ASM8051;Target\Java;Target\GCC;Target\PHP;Target\Delphi;Target\Dynamic C;Target\XML;Target\NASM;Modules\Pascal;Modules\GCC;Modules\ASM8051;Modules\Brainfuck;Modules\Interpretter;Modules\Delphi"/>
     12        <OtherUnitFiles Value="Analyze;Target;Target\Interpretter;Target\ASM8051;Target\Java;Target\GCC;Target\PHP;Target\Delphi;Target\Dynamic C;Target\XML;Target\NASM;Modules\Pascal;Modules\GCC;Modules\ASM8051;Modules\Brainfuck;Modules\Interpretter;Modules\Delphi;Modules\PHP;Modules\Java"/>
    1213        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1314      </SearchPaths>
     
    1920      <Other>
    2021        <CompilerMessages>
    21           <IgnoredMessages idx5023="True" idx5024="True" idx5025="True" idx5026="True" idx5027="True" idx5028="True" idx5029="True" idx5030="True" idx5031="True"/>
     22          <IgnoredMessages idx5031="True" idx5030="True" idx5029="True" idx5028="True" idx5027="True" idx5026="True" idx5025="True" idx5024="True" idx5023="True"/>
    2223        </CompilerMessages>
    23         <CompilerPath Value="$(CompPath)"/>
    2424      </Other>
    2525    </CompilerOptions>
    2626    <Version Minor="1"/>
    27     <Files Count="24">
     27    <Files Count="27">
    2828      <Item1>
    2929        <Filename Value="UCompiler.pas"/>
     
    122122        <UnitName Value="UModuleBrainfuck"/>
    123123      </Item24>
     124      <Item25>
     125        <Filename Value="Modules\PHP\UModulePHP.pas"/>
     126        <UnitName Value="UModulePHP"/>
     127      </Item25>
     128      <Item26>
     129        <Filename Value="Modules\Java\UModuleJava.pas"/>
     130        <UnitName Value="UModuleJava"/>
     131      </Item26>
     132      <Item27>
     133        <Filename Value="Modules\ASM8051\UModuleASM8051.pas"/>
     134        <UnitName Value="UModuleASM8051"/>
     135      </Item27>
    124136    </Files>
    125     <Type Value="RunAndDesignTime"/>
    126137    <RequiredPkgs Count="4">
    127138      <Item1>
  • trunk/Compiler/TranspascalCompiler.pas

    r72 r74  
    55unit TranspascalCompiler;
    66
     7{$warn 5023 off : no warning about unused units}
    78interface
    89
     
    1213  UTargetGCC, UProducerGCC, UProducerDelphi, UModuleDelphi, UTargetPHP,
    1314  UTargetJava, UTargetXML, UModuleInterpretter, UTargetNASM, UModulePascal,
    14   UCompilerAPI, UModuleGCC, USourceConvertor, UModuleBrainfuck,
    15   LazarusPackageIntf;
     15  UCompilerAPI, UModuleGCC, USourceConvertor, UModuleBrainfuck, UModulePHP,
     16  UModuleJava, UModuleASM8051, LazarusPackageIntf;
    1617
    1718implementation
  • trunk/Compiler/UCompiler.pas

    r72 r74  
    77uses
    88  SysUtils, Variants, Classes, Contnrs, FileUtil, UModularSystem, UCompilerAPI,
    9   Dialogs, USourceCodePascal, UProducer, UAnalyzer, SpecializedList, UTarget;
     9  Dialogs, USourceCodePascal, UProducer, UAnalyzer, SpecializedList, UTarget,
     10  fgl;
    1011
    1112type
     
    4445  public
    4546    AbstractCode: TProgram;
    46     ErrorMessages: TListObject; // TListObject<TErrorMessage>
     47    ErrorMessages: TFPGObjectList<TErrorMessage>;
    4748    CompiledFolder: string;
    4849
     
    7677resourcestring
    7778  SNothingToAnalyze = 'Nothing to analyze';
    78   SRewritingExistedTarget = 'Reqriting existing target file %s';
     79  SRewritingExistedTarget = 'Rewriting existing target file %s';
    7980
    8081{ TSourceFileManager }
     
    99100begin
    100101  try
    101     ForceDirectoriesUTF8(ExtractFileDir(FileName));
    102     if FileExistsUTF8(FileName) then
     102    ForceDirectories(ExtractFileDir(FileName));
     103    if FileExists(FileName) then
    103104      F := TFileStream.Create(UTF8Decode(FileName), fmOpenWrite)
    104105      else F := TFileStream.Create(UTF8Decode(FileName), fmCreate);
     
    118119  while (I < Files.Count) and (ExtractFileName(Files[I]) <> Name) do Inc(I);
    119120  if I < Files.Count then begin
    120     if FileExistsUTF8(Files[I]) then begin
     121    if FileExists(Files[I]) then begin
    121122      Content := LoadStringFromFile(Files[I]);
    122123      Result := True;
     
    172173  Executors := TListObject.Create;
    173174  API := TCompilerAPI.Create;
     175  API.Compiler := Self;
    174176  AbstractCode := TProgram.Create;
    175   ErrorMessages := TListObject.Create;
     177  ErrorMessages := TFPGObjectList<TErrorMessage>.Create;
    176178  CompiledFolder := 'Compiled';
    177179  ModuleManager := TModuleManager.Create(nil);
  • trunk/Compiler/UCompilerAPI.pas

    r73 r74  
    1515  TCompilerAPI = class(TAPI)
    1616    Compiler: TObject; //TCompiler;
     17    procedure RegisterTarget(AClass: TTargetClass);
     18    procedure UnregisterTarget(AClass: TTargetClass);
    1719    procedure RegisterConvertor(AClass: TConvertorClass);
    1820    procedure UnregisterConvertor(AClass: TConvertorClass);
     
    3032
    3133{ TCompilerAPI }
     34
     35procedure TCompilerAPI.RegisterTarget(AClass: TTargetClass);
     36begin
     37  TCompiler(Compiler).Targets.Add(AClass.Create);
     38end;
     39
     40procedure TCompilerAPI.UnregisterTarget(AClass: TTargetClass);
     41begin
     42  TCompiler(Compiler).Targets.Remove(TObject(AClass));
     43end;
    3244
    3345procedure TCompilerAPI.RegisterConvertor(AClass: TConvertorClass);
  • trunk/Compiler/UProducer.pas

    r72 r74  
    5555  Line: string;
    5656begin
    57   if not FileExistsUTF8(CompilerPath) then Exit;
     57  if not FileExists(CompilerPath) then Exit;
    5858  Text := '';
    5959  try
  • trunk/Compiler/UTarget.pas

    r60 r74  
    2121    destructor Destroy; override;
    2222  end;
     23
     24  TTargetClass = class of TTarget;
    2325
    2426  { TListTarget }
Note: See TracChangeset for help on using the changeset viewer.