Changeset 68


Ignore:
Timestamp:
Jul 30, 2012, 3:52:56 PM (12 years ago)
Author:
chronos
Message:
  • Added: Addon modules support.
  • Modified: Restored usage of URegistry unit.
Location:
trunk
Files:
4 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Analyze/UAnalyzerPascal.pas

    r67 r68  
    2929    function ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
    3030    function ParseUsesItem(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
    31     function ParseModule(ProgramCode: TProgram): TModule; override;
     31    function ParseModule(ProgramCode: TProgram): TSourceModule; override;
    3232    function ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean;
    3333    function ParseUnitInterface(SourceCode: TModuleUnit): Boolean;
     
    106106var
    107107  Parser: TAnalyzerPascal;
    108   NewModule: TModule;
     108  NewModule: TSourceModule;
    109109begin
    110110  try
     
    420420{ TParserModule }
    421421
    422 function TAnalyzerPascal.ParseModule(ProgramCode: TProgram): TModule;
     422function TAnalyzerPascal.ParseModule(ProgramCode: TProgram): TSourceModule;
    423423begin
    424424  Self.ProgramCode := ProgramCode;
     
    454454function TAnalyzerPascal.ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean;
    455455var
    456   NewModule: TModule;
     456  NewModule: TSourceModule;
    457457  NewCommand: TCommand;
    458458begin
  • trunk/Compiler/Target/ASM8051/UProducerASM8051.pas

    r44 r68  
    3535    procedure GenerateExpression(Expression: TExpression; LabelPrefix: string);
    3636    procedure GenerateProgram(ProgramBlock: TProgram);
    37     procedure GenerateModule(Module: TModule);
     37    procedure GenerateModule(Module: TSourceModule);
    3838  public
    3939    AssemblyCode: TObjectList; // TList<TAssemblerLine>
    4040    procedure AssignToStringList(Target: TStringList); override;
    41     procedure Produce(Module: TModule); override;
     41    procedure Produce(Module: TSourceModule); override;
    4242    constructor Create;
    4343    destructor Destroy; override;
     
    189189//  with ProgramBlock do
    190190//  for I := 0 to Modules.Count - 1 do
    191 //    GenerateCommonBlock(TModule(Modules[I]), '');
    192 end;
    193 
    194 procedure TProducerAsm8051.GenerateModule(Module: TModule);
     191//    GenerateCommonBlock(TSourceModuleTSourceModule(Modules[I]), '');
     192end;
     193
     194procedure TProducerAsm8051.GenerateModule(Module: TSourceModule);
    195195begin
    196196  Module.TargetFile := Module.Name + '.asm';
     
    207207end;
    208208
    209 procedure TProducerAsm8051.Produce(Module: TModule);
     209procedure TProducerAsm8051.Produce(Module: TSourceModule);
    210210begin
    211211  GenerateModule(Module);
  • trunk/Compiler/Target/Delphi/UProducerPascal.pas

    r65 r68  
    1616  private
    1717    procedure GenerateUses(UsedModules: TUsedModuleList);
    18     procedure GenerateModule(Module: TModule);
    19     procedure GenerateUnit(Module: TModule);
    20     procedure GenerateLibrary(Module: TModule);
    21     procedure GeneratePackage(Module: TModule);
     18    procedure GenerateModule(Module: TSourceModule);
     19    procedure GenerateUnit(Module: TSourceModule);
     20    procedure GenerateLibrary(Module: TSourceModule);
     21    procedure GeneratePackage(Module: TSourceModule);
    2222    procedure GenerateType(AType: TType; AssignSymbol: Char = ':');
    2323    procedure GenerateTypes(Types: TTypeList);
     
    4343  public
    4444    procedure AssignToStringList(Target: TStringList); override;
    45     procedure Produce(Module: TModule); override;
     45    procedure Produce(Module: TSourceModule); override;
    4646    constructor Create;
    4747    destructor Destroy; override;
     
    9494end;
    9595
    96 procedure TProducerPascal.GenerateModule(Module: TModule);
     96procedure TProducerPascal.GenerateModule(Module: TSourceModule);
    9797begin
    9898  Module.TargetFile := Module.Name + '.pas';
     
    113113end;
    114114
    115 procedure TProducerPascal.GenerateUnit(Module: TModule);
     115procedure TProducerPascal.GenerateUnit(Module: TSourceModule);
    116116begin
    117117  EmitLn('unit ' + TModuleUnit(Module).Name + ';');
     
    127127end;
    128128
    129 procedure TProducerPascal.GenerateLibrary(Module: TModule);
    130 begin
    131 
    132 end;
    133 
    134 procedure TProducerPascal.GeneratePackage(Module: TModule);
     129procedure TProducerPascal.GenerateLibrary(Module: TSourceModule);
     130begin
     131
     132end;
     133
     134procedure TProducerPascal.GeneratePackage(Module: TSourceModule);
    135135begin
    136136
     
    196196end;
    197197
    198 procedure TProducerPascal.Produce(Module: TModule);
     198procedure TProducerPascal.Produce(Module: TSourceModule);
    199199var
    200200  I: Integer;
     
    206206  with Module.ParentProgram do
    207207  for I := 0 to Modules.Count - 1 do
    208     if TModule(Modules[I]).Name = 'System' then
    209       TModule(Modules[I]).Name := 'System2';
     208    if TSourceModule(Modules[I]).Name = 'System' then
     209      TSourceModule(Modules[I]).Name := 'System2';
    210210
    211211  GenerateModule(Module);
  • trunk/Compiler/Target/Dynamic C/UProducerDynamicc.pas

    r44 r68  
    1818    function TranslateOperator(Name: string): string;
    1919    procedure GenerateUses(UsedModules: TUsedModuleList);
    20     procedure GenerateModule(Module: TModule);
     20    procedure GenerateModule(Module: TSourceModule);
    2121    procedure GenerateCommonBlock(CommonBlock: TCommonBlock;
    2222      LabelPrefix: string);
     
    3838  public
    3939    procedure AssignToStringList(Target: TStringList); override;
    40     procedure Produce(Module: TModule); override;
     40    procedure Produce(Module: TSourceModule); override;
    4141    constructor Create;
    4242    destructor Destroy; override;
     
    9696end;
    9797
    98 procedure TProducerDynamicC.GenerateModule(Module: TModule);
     98procedure TProducerDynamicC.GenerateModule(Module: TSourceModule);
    9999begin
    100100  if Module is TModuleProgram then begin
     
    133133end;
    134134
    135 procedure TProducerDynamicC.Produce(Module: TModule);
     135procedure TProducerDynamicC.Produce(Module: TSourceModule);
    136136begin
    137137  inherited;
     
    147147  with ProgramBlock do
    148148  for I := 0 to Modules.Count - 1 do
    149     GenerateModule(TModule(Modules[I]));
     149    GenerateModule(TSourceModule(Modules[I]));
    150150end;
    151151
  • trunk/Compiler/Target/GCC/UProducerGCC.pas

    r44 r68  
    2020    procedure EmitLn(AText: string = '');
    2121    procedure GenerateUses(UsedModules: TUsedModuleList);
    22     procedure GenerateModule(Module: TModule);
     22    procedure GenerateModule(Module: TSourceModule);
    2323    procedure GenerateCommonBlock(CommonBlock: TCommonBlock;
    2424      LabelPrefix: string);
     
    4343    Indetation: Integer;
    4444    procedure AssignToStringList(Target: TStringList); override;
    45     procedure Produce(Module: TModule); override;
     45    procedure Produce(Module: TSourceModule); override;
    4646    constructor Create;
    4747    destructor Destroy; override;
     
    122122end;
    123123
    124 procedure TProducerGCCC.GenerateModule(Module: TModule);
     124procedure TProducerGCCC.GenerateModule(Module: TSourceModule);
    125125begin
    126126  Module.TargetFile := Module.Name + '.c';
     
    138138end;
    139139
    140 procedure TProducerGCCC.Produce(Module: TModule);
     140procedure TProducerGCCC.Produce(Module: TSourceModule);
    141141begin
    142142  inherited;
     
    152152  with ProgramBlock do
    153153  for I := 0 to Modules.Count - 1 do
    154     GenerateModule(TModule(Modules[I]));
     154    GenerateModule(TSourceModule(Modules[I]));
    155155end;
    156156
  • trunk/Compiler/Target/XML/UTargetXML.pas

    r63 r68  
    2020  TProducerXML = class(TProducer)
    2121  private
    22     procedure GenerateModule(Module: TModule);
    23     procedure GenerateUnit(Module: TModule);
    24     procedure GenerateLibrary(Module: TModule);
    25     procedure GeneratePackage(Module: TModule);
     22    procedure GenerateModule(Module: TSourceModule);
     23    procedure GenerateUnit(Module: TSourceModule);
     24    procedure GenerateLibrary(Module: TSourceModule);
     25    procedure GeneratePackage(Module: TSourceModule);
    2626  public
    2727    procedure AssignToStringList(Target: TStringList); override;
    28     procedure Produce(Module: TModule); override;
     28    procedure Produce(Module: TSourceModule); override;
    2929  end;
    3030
     
    3434{ TProducerXML }
    3535
    36 procedure TProducerXML.GenerateModule(Module: TModule);
     36procedure TProducerXML.GenerateModule(Module: TSourceModule);
    3737begin
    3838  Module.TargetFile := Module.Name + '.xml';
     
    5050end;
    5151
    52 procedure TProducerXML.GenerateUnit(Module: TModule);
     52procedure TProducerXML.GenerateUnit(Module: TSourceModule);
    5353begin
    5454  EmitLn('<?xml version="1.0"?>');
     
    5959end;
    6060
    61 procedure TProducerXML.GenerateLibrary(Module: TModule);
     61procedure TProducerXML.GenerateLibrary(Module: TSourceModule);
    6262begin
    6363  EmitLn('<?xml version="1.0"?>');
     
    6868end;
    6969
    70 procedure TProducerXML.GeneratePackage(Module: TModule);
     70procedure TProducerXML.GeneratePackage(Module: TSourceModule);
    7171begin
    7272  EmitLn('<?xml version="1.0"?>');
     
    7777end;
    7878
    79 procedure TProducerXML.Produce(Module: TModule);
     79procedure TProducerXML.Produce(Module: TSourceModule);
    8080begin
    8181  GenerateModule(Module);
  • trunk/Compiler/UAnalyzer.pas

    r65 r68  
    7777    procedure Process;
    7878    procedure Log(Text: string);
    79     function ParseModule(ProgramCode: TProgram): TModule; virtual; abstract;
     79    function ParseModule(ProgramCode: TProgram): TSourceModule; virtual; abstract;
    8080    property FileName: string read FFileName write FFileName;
    8181    property OnGetSource: TGetSourceEvent read FOnGetSource
  • trunk/Compiler/UCompiler.pas

    r66 r68  
    221221procedure TCompiler.ProduceAll;
    222222var
    223   NewModule: TModule;
     223  NewModule: TSourceModule;
    224224  ProducedCode: TStringList;
    225225  I: Integer;
     
    231231    with AbstractCode do
    232232    for I := 0 to Modules.Count - 1 do begin
    233       Target.Producer.Produce(TModule(Modules[I]));
     233      Target.Producer.Produce(TSourceModule(Modules[I]));
    234234      Target.Producer.AssignToStringList(ProducedCode);
    235       TargetFileName := TargetFolder + DirectorySeparator + TModule(Modules[I]).TargetFile;
     235      TargetFileName := TargetFolder + DirectorySeparator + TSourceModule(Modules[I]).TargetFile;
    236236      if Assigned(Target.Producer.OnWriteTarget) then
    237237        Target.Producer.OnWriteTarget(TargetFileName, ProducedCode.Text);
  • trunk/Compiler/UProducer.pas

    r61 r68  
    3030    procedure EmitLn(AText: string = '');
    3131    procedure AssignToStringList(Target: TStringList); virtual; abstract;
    32     procedure Produce(Module: TModule); virtual; abstract;
     32    procedure Produce(Module: TSourceModule); virtual; abstract;
    3333    procedure ExternalExecute(CommandLine: string);
    3434    constructor Create;
  • trunk/Compiler/USourceCode.pas

    r63 r68  
    3131  TVariable = class;
    3232  TConstant = class;
    33   TModule = class;
     33  TSourceModule = class;
    3434  TProgram = class;
    3535
     
    149149    Name: string;
    150150    Parent: TCommonBlock;
    151     ParentModule: TModule;
     151    ParentModule: TSourceModule;
    152152    Constants: TConstantList;
    153153    Types: TTypeList;
     
    322322    Name: string;
    323323    Location: string;
    324     Module: TModule;
     324    Module: TSourceModule;
    325325    Exported: Boolean;
    326326  end;
     
    330330
    331331  TUsedModuleList = class(TListUsedModule)
    332     ParentModule: TModule;
    333   end;
    334 
    335   { TModule }
    336 
    337   TModule = class
     332    ParentModule: TSourceModule;
     333  end;
     334
     335  { TSourceModule }
     336
     337  TSourceModule = class
    338338  public
    339339    ParentProgram: TProgram;
     
    342342    UsedModules: TUsedModuleList;
    343343    Body: TCommonBlock;
     344    Internal: Boolean;
    344345    function SearchVariable(Name: string; Outside: Boolean): TVariable; virtual;
    345346    function SearchConstant(Name: string; Outside: Boolean): TConstant; virtual;
     
    352353  { TModuleProgram }
    353354
    354   TModuleProgram = class(TModule)
     355  TModuleProgram = class(TSourceModule)
    355356    constructor Create;
    356357    destructor Destroy; override;
     
    359360  { TModuleUnit }
    360361
    361   TModuleUnit = class(TModule)
     362  TModuleUnit = class(TSourceModule)
    362363    InititializeSection: TCommonBlock;
    363364    FinalalizeSection: TCommonBlock;
     
    366367  end;
    367368
    368   TModulePackage = class(TModule)
    369 
    370   end;
    371 
    372   TModuleLibrary = class(TModule)
     369  TModulePackage = class(TSourceModule)
     370
     371  end;
     372
     373  TModuleLibrary = class(TSourceModule)
    373374  end;
    374375
     
    379380
    380381  TModuleList = class(TListModule)
    381     function Search(Name: string): TModule;
     382    function Search(Name: string): TSourceModule;
    382383  end;
    383384
     
    387388    Device: TDevice;
    388389    Modules: TModuleList;
    389     MainModule: TModule;
     390    MainModule: TSourceModule;
    390391    procedure Clear;
    391392    constructor Create;
     
    470471end;
    471472
    472 { TModule }
    473 
    474 constructor TModule.Create;
     473{ TSourceModule }
     474
     475constructor TSourceModule.Create;
    475476begin
    476477  inherited;
     
    481482end;
    482483
    483 destructor TModule.Destroy;
     484destructor TSourceModule.Destroy;
    484485begin
    485486  Body.Free;
     
    790791{ TModuleList }
    791792
    792 function TModuleList.Search(Name: string): TModule;
     793function TModuleList.Search(Name: string): TSourceModule;
    793794var
    794795  I: Integer;
    795796begin
    796797  I := 0;
    797   while (I < Count) and (LowerCase(TModule(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
    798   if I < Count then Result := TModule(Items[I])
     798  while (I < Count) and (LowerCase(TSourceModule(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     799  if I < Count then Result := TSourceModule(Items[I])
    799800    else Result := nil;
    800801end;
     
    802803{ TModuleProgram }
    803804
    804 function TModule.SearchVariable(Name: string; Outside: Boolean): TVariable;
     805function TSourceModule.SearchVariable(Name: string; Outside: Boolean): TVariable;
    805806var
    806807  I: Integer;
     
    817818end;
    818819
    819 function TModule.SearchConstant(Name: string; Outside: Boolean): TConstant;
    820 begin
    821 
    822 end;
    823 
    824 function TModule.SearchType(AName: string; Outside: Boolean): TType;
     820function TSourceModule.SearchConstant(Name: string; Outside: Boolean): TConstant;
     821begin
     822
     823end;
     824
     825function TSourceModule.SearchType(AName: string; Outside: Boolean): TType;
    825826var
    826827  I: Integer;
     
    840841end;
    841842
    842 function TModule.SearchFunction(Name: string; Outside: Boolean): TFunction;
     843function TSourceModule.SearchFunction(Name: string; Outside: Boolean): TFunction;
    843844var
    844845  I: Integer;
  • trunk/Demos/Simple/System.pas

    r66 r68  
    99function ReadLn: string; internal;
    1010procedure WriteLn(Text: string); internal;
     11procedure SetPort(Index: Integer; Value: Byte);
     12function GetPort(Index: Integer): Byte;
     13property Port[Index: Integer]: Byte read GetPort write SetPort;
    1114
    1215implementation
  • trunk/IDE/Forms/UFormMain.lfm

    r66 r68  
    55  Width = 695
    66  Caption = 'Transpascal IDE'
    7   ClientHeight = 476
     7  ClientHeight = 482
    88  ClientWidth = 695
    99  Font.Height = -11
     
    2020    Left = 0
    2121    Height = 5
    22     Top = 471
     22    Top = 477
    2323    Width = 695
    2424    Align = alBottom
     
    8989    object ComboBoxTarget: TComboBox
    9090      Left = 230
    91       Height = 27
     91      Height = 21
    9292      Top = 2
    9393      Width = 100
    94       ItemHeight = 0
     94      ItemHeight = 13
    9595      OnChange = ComboBoxTargetChange
    9696      Style = csDropDownList
     
    105105  object Splitter1: TSplitter
    106106    Left = 490
    107     Height = 339
     107    Height = 345
    108108    Top = 26
    109109    Width = 5
     
    113113  object PageControlRight: TPageControl
    114114    Left = 495
    115     Height = 339
     115    Height = 345
    116116    Top = 26
    117117    Width = 200
     
    137137    Left = 0
    138138    Height = 101
    139     Top = 370
     139    Top = 376
    140140    Width = 695
    141141    ActivePage = TabSheetMessages
     
    155155    Left = 0
    156156    Height = 5
    157     Top = 365
     157    Top = 371
    158158    Width = 695
    159159    Align = alBottom
     
    162162  object PageControlMain: TPageControl
    163163    Left = 0
    164     Height = 339
     164    Height = 345
    165165    Top = 26
    166166    Width = 490
  • trunk/IDE/Forms/UFormMain.pas

    r66 r68  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
    9   ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,
     9  ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, Registry,
    1010  UProject, FileUtil, Menus, ActnList, DateUtils,
    11   UFormTargetCode, UFormCodeTree, UGeneralRegistry;
     11  UFormTargetCode, UFormCodeTree, URegistry;
    1212
    1313type
     
    146146    procedure ProducerProcessOutput(Text: string);
    147147  public
    148     procedure LoadFromRegistry(Root: Integer; const Key: string);
    149     procedure SaveToRegistry(Root: Integer; const Key: string);
     148    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     149    procedure SaveToRegistry(Root: HKEY; const Key: string);
    150150    procedure OpenRecentClick(Sender: TObject);
    151151    function GetSource(Name: string; var SourceCode: string): Boolean;
     
    402402end;
    403403
    404 procedure TFormMain.LoadFromRegistry(Root: Integer; const Key: string);
    405 begin
    406   with TGeneralRegistry.Create(nil) do
     404procedure TFormMain.LoadFromRegistry(Root: HKEY; const Key: string);
     405begin
     406  with TRegistryEx.Create do
    407407    try
    408       CurrentRoot := Root;
     408      RootKey := Root;
    409409      OpenKey(Key, True);
    410410      if ValueExists('RightPanelWidth') then
     
    419419end;
    420420
    421 procedure TFormMain.SaveToRegistry(Root: Integer; const Key: string);
    422 begin
    423   with TGeneralRegistry.Create(nil) do
     421procedure TFormMain.SaveToRegistry(Root: HKEY; const Key: string);
     422begin
     423  with TRegistryEx.Create do
    424424    try
    425       CurrentRoot := Root;
     425      RootKey := Root;
    426426      OpenKey(Key, True);
    427427      WriteInteger('RightPanelWidth', PageControlRight.Width);
     
    477477begin
    478478  AProjectClose.Execute;
    479   Core.SaveToRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     479  Core.SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    480480end;
    481481
     
    503503procedure TFormMain.FormShow(Sender: TObject);
    504504begin
    505   Core.LoadFromRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     505  Core.LoadFromRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    506506  DockInit;
    507507  Core.ProjectTemplatesInit;
  • trunk/IDE/Transpascal.lpi

    r66 r68  
    110110      </Item8>
    111111    </RequiredPackages>
    112     <Units Count="18">
     112    <Units Count="21">
    113113      <Unit0>
    114114        <Filename Value="Transpascal.lpr"/>
     
    240240        <UnitName Value="UFormExternalProducerOutput"/>
    241241      </Unit17>
     242      <Unit18>
     243        <Filename Value="Notes.txt"/>
     244        <IsPartOfProject Value="True"/>
     245      </Unit18>
     246      <Unit19>
     247        <Filename Value="Common\UModule.pas"/>
     248        <IsPartOfProject Value="True"/>
     249        <UnitName Value="UModule"/>
     250      </Unit19>
     251      <Unit20>
     252        <Filename Value="Modules\Pascal\UModulePascal.pas"/>
     253        <IsPartOfProject Value="True"/>
     254        <UnitName Value="UModulePascal"/>
     255      </Unit20>
    242256    </Units>
    243257  </ProjectOptions>
     
    250264    <SearchPaths>
    251265      <IncludeFiles Value="$(ProjOutDir)"/>
    252       <OtherUnitFiles Value="Forms"/>
     266      <OtherUnitFiles Value="Forms;Common;Modules\Pascal"/>
    253267      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    254268    </SearchPaths>
  • trunk/IDE/Transpascal.lpr

    r61 r68  
    1414  UFormAbout, UFormOptions, UFormTargets,
    1515UFormProjectNew, UProjectTemplates, UFormTargetProject, UCore,
    16 UFormTargetOptions, UFormExternalProducerOutput;
     16UFormTargetOptions, UFormExternalProducerOutput, UModule, UModulePascal;
    1717
    1818{$R *.res}
  • trunk/IDE/UCore.lfm

    r66 r68  
    3737    EmailContact = 'robie@centrum.cz'
    3838    AppName = 'Transpascal IDE'
    39     ReleaseDate = 41107
     39    ReleaseDate = 41120
    4040    RegistryKey = '\Software\Chronosoft\Transpascal'
    41     RegistryRoot = rrApplicationUser
     41    RegistryRoot = rrKeyCurrentUser
    4242    left = 48
    4343    top = 200
  • trunk/IDE/UCore.pas

    r66 r68  
    77uses
    88  Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo,
    9   UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget;
     9  UCompiler, URegistry, Registry, UDebugLog, UCoolTranslator, UTarget,
     10  USourceCode, UModule;
    1011
    1112type
     
    1314
    1415  TCustomCompiler = class(TCompiler)
     16  private
     17    procedure InitSystemModule;
     18  public
    1519    StartTime: TDateTime;
    1620    SourceFiles: TSourceFileManager;
     
    1822    procedure Init; override;
    1923    function ElapsedTime: TDateTime;
    20     procedure LoadFromRegistry(Root: Integer; const Key: string);
    21     procedure SaveToRegistry(Root: Integer; const Key: string);
     24    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     25    procedure SaveToRegistry(Root: HKEY; const Key: string);
    2226    constructor Create; override;
    2327    destructor Destroy; override;
     
    4549    TargetProject: TProject;
    4650    Compiler: TCustomCompiler;
     51    ModuleManager: TModuleManager;
    4752    procedure ProjectTemplatesInit;
    4853    procedure ProjectOpen(FileName: string);
    4954    procedure ProjectNew;
    5055    procedure CompilerDebugLog(Text: string);
    51     procedure LoadFromRegistry(Root: Integer; const Key: string);
    52     procedure SaveToRegistry(Root: Integer; const Key: string);
     56    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     57    procedure SaveToRegistry(Root: HKEY; const Key: string);
    5358  end;
    5459
     
    100105  ReopenLastOpenedFile := True;
    101106  LogParsing := False;
     107
     108  ModuleManager := TModuleManager.Create;
    102109end;
    103110
    104111procedure TCore.DataModuleDestroy(Sender: TObject);
    105112begin
     113  ModuleManager.Free;
    106114  ProjectTemplates.Free;
    107115  LastOpenedFiles.Free;
     
    142150end;
    143151
    144 procedure TCore.LoadFromRegistry(Root: Integer; const Key: string);
    145 begin
    146   with TGeneralRegistry.Create(nil) do
     152procedure TCore.LoadFromRegistry(Root: HKEY; const Key: string);
     153begin
     154  with TRegistryEx.Create do
    147155    try
    148       CurrentRoot := Root;
     156      RootKey := Root;
    149157      OpenKey(Key, True);
    150158      if ValueExists('ReopenLastOpenedFile') then
     
    163171      Free;
    164172    end;
    165   LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles');
     173  LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles'); //Root, Key + '\LastOpenedFiles');
    166174  Compiler.LoadFromRegistry(Root, Key + '\Compiler');
    167175  FormMain.LoadFromRegistry(Root, Key);
    168176end;
    169177
    170 procedure TCore.SaveToRegistry(Root: Integer; const Key: string);
    171 begin
    172   with TGeneralRegistry.Create(nil) do
     178procedure TCore.SaveToRegistry(Root: HKEY; const Key: string);
     179begin
     180  with TRegistryEx.Create do
    173181    try
    174       CurrentRoot := Root;
     182      RootKey := Root;
    175183      OpenKey(Key, True);
    176184      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
     
    192200{ TCustomCompiler }
    193201
     202procedure TCustomCompiler.InitSystemModule;
     203var
     204  SystemModule: TSourceModule;
     205begin
     206  SystemModule := TSourceModule.Create;
     207  with SystemModule do begin
     208    Name := 'System';
     209    Internal := True;
     210    with TType(Body.Types.AddNew(TType.Create)) do begin
     211      Name := 'Byte';
     212      Size := 1;
     213      Internal := True;
     214    end;
     215    with TType(Body.Types.AddNew(TType.Create)) do begin
     216      Name := 'ShortInt';
     217      Size := 1;
     218      Internal := True;
     219    end;
     220    with TType(Body.Types.AddNew(TType.Create)) do begin
     221      Name := 'Word';
     222      Size := 2;
     223      Internal := True;
     224    end;
     225    with TType(Body.Types.AddNew(TType.Create)) do begin
     226      Name := 'SmallInt';
     227      Size := 2;
     228      Internal := True;
     229    end;
     230    with TType(Body.Types.AddNew(TType.Create)) do begin
     231      Name := 'Cardinal';
     232      Size := 4;
     233      Internal := True;
     234    end;
     235    with TType(Body.Types.AddNew(TType.Create)) do begin
     236      Name := 'Integer';
     237      Size := 4;
     238      Internal := True;
     239    end;
     240    with TType(Body.Types.AddNew(TType.Create)) do begin
     241      Name := 'UInt64';
     242      Size := 8;
     243      Internal := True;
     244    end;
     245    with TType(Body.Types.AddNew(TType.Create)) do begin
     246      Name := 'Int64';
     247      Size := 8;
     248      Internal := True;
     249    end;
     250    with TFunction(Body.Functions.AddNew(TFunction.Create)) do begin
     251      Name := 'WriteLn';
     252      Internal := True;
     253    end;
     254    ParentProgram := AbstractCode;
     255  end;
     256  AbstractCode.Modules.Add(SystemModule);
     257end;
     258
    194259procedure TCustomCompiler.Init;
    195260begin
    196261  inherited;
    197262  StartTime := Now;
     263  InitSystemModule;
    198264end;
    199265
     
    203269end;
    204270
    205 procedure TCustomCompiler.LoadFromRegistry(Root: Integer; const Key: string);
     271procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; const Key: string);
    206272var
    207273  I: Integer;
    208274begin
    209   with TGeneralRegistry.Create(nil) do
     275  with TRegistryEx.Create do
    210276    try
    211       CurrentRoot := Root;
     277      RootKey := Root;
    212278      for I := 0 to Targets.Count - 1 do
    213279      with TTarget(Targets[I]) do begin
     
    225291end;
    226292
    227 procedure TCustomCompiler.SaveToRegistry(Root: Integer; const Key: string);
     293procedure TCustomCompiler.SaveToRegistry(Root: HKEY; const Key: string);
    228294var
    229295  I: Integer;
    230296begin
    231   with TGeneralRegistry.Create(nil) do
     297  with TRegistryEx.Create do
    232298    try
    233       CurrentRoot := Root;
     299      RootKey := Root;
    234300      for I := 0 to Targets.Count - 1 do
    235301      with TTarget(Targets[I]) do begin
Note: See TracChangeset for help on using the changeset viewer.