Ignore:
Timestamp:
Aug 4, 2010, 3:10:20 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Metody pro rozkládání bloků rozděleny do samostatných tříd.
  • Upraveno: Seznamy typu TList přepsány na TObjectList.
Location:
branches/DelphiToC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC

    • Property svn:ignore
      •  

        old new  
        55*.dcu
        66ProjectGroup1.bdsgroup
         7ParseLog.txt
  • branches/DelphiToC/UPascalSource.pas

    r20 r34  
    55uses
    66  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, StdCtrls;
     7  Dialogs, StdCtrls, Contnrs;
    88
    99type
     
    102102  TCaseOfEnd = class(TCommand)
    103103    Expression: TExpression;
    104     Branches: TList; // TList<TCaseOfEndBranche>
     104    Branches: TObjectList; // TObjectList<TCaseOfEndBranche>
    105105    ElseCommand: TCommand;
     106    constructor Create;
     107    destructor Destroy; override;
    106108  end;
    107109
     
    116118  end;
    117119
    118   TCommandList = class(TList)
     120  TCommandList = class(TObjectList)
    119121
    120122  end;
     
    146148
    147149  TTypeRecord = class
    148     Items: TList; // TList<TTypeRecordItem>
     150    Items: TObjectList; // TObjectList<TTypeRecordItem>
    149151  end;
    150152
     
    154156  end;
    155157
    156   TTypeList = class(TList)
     158  TTypeList = class(TObjectList)
    157159    Parent: TCommonBlock;
    158160    function Search(Name: string): TType;
     
    166168  end;
    167169
    168   TConstantList = class(TList)
     170  TConstantList = class(TObjectList)
    169171    Parent: TCommonBlock;
    170172    function Search(Name: string): TConstant;
     
    178180  end;
    179181
    180   TVariableList = class(TList)
     182  TVariableList = class(TObjectList)
    181183    Parent: TCommonBlock;
    182184    function Search(Name: string): TVariable;
     
    190192  end;
    191193
    192   TParameterList = class(TList)
     194  TParameterList = class(TObjectList)
    193195    Parent: TFunction;
    194196    function Search(Name: string): TParameter;
     
    208210  end;
    209211
    210   TExpressionList = class(TList)
     212  TExpressionList = class(TObjectList)
    211213    destructor Destroy; override;
    212214  end;
     
    221223  end;
    222224
    223   TOperationList = class(TList)
     225  TOperationList = class(TObjectList)
    224226    destructor Destroy; override;
    225227  end;
     
    227229  TFunction = class(TCommonBlock)
    228230  public
    229     Parameters: TList; // TList<TVariable>
     231    Parameters: TObjectList; // TObjectList<TVariable>
    230232    ResultType: TType;
    231233    constructor Create; override;
     
    233235  end;
    234236
    235   TFunctionList = class(TList)
     237  TFunctionList = class(TObjectList)
    236238    Parent: TCommonBlock;
    237239    function Search(Name: string): TFunction;
     
    242244  public
    243245    ModuleType: TModuleType;
    244     UsedModules: TList; // TList<TModule>
     246    UsedModules: TObjectList; // TObjectList<TModule>
    245247    constructor Create; override;
    246248    procedure Clear;
     
    250252  TProgram = class
    251253    Device: TDevice;
    252     Modules: TList; // TList<TModule>
     254    Modules: TObjectList; // TObjectList<TModule>
    253255    constructor Create;
    254256    destructor Destroy; override;
     
    290292begin
    291293  Device := TDevice.Create;
    292   Modules := TList.Create;
     294  Modules := TObjectList.Create;
    293295end;
    294296
    295297destructor TProgram.Destroy;
    296 var
    297   I: Integer;
    298 begin
    299   for I := 0 to Modules.Count - 1 do
    300     TModule(Modules[I]).Free;
     298begin
    301299  Modules.Free;
    302300  Device.Free;
     
    323321  I := 0;
    324322  while (I < Count) and (TConstant(Items[I]).Name <> Name) do Inc(I);
    325   if I < Count then Result := Items[I] else begin
     323  if I < Count then Result := TConstant(Items[I]) else begin
    326324    if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name)
    327325      else begin
     
    344342begin
    345343  inherited;
    346   UsedModules := TList.Create;
     344  UsedModules := TObjectList.Create;
    347345end;
    348346
     
    406404  I := 0;
    407405  while (I < Count) and (TType(Items[I]).Name <> Name) do Inc(I);
    408   if I < Count then Result := Items[I] else begin
     406  if I < Count then Result := TType(Items[I]) else begin
    409407    if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name)
    410408      else begin
     
    417415
    418416destructor TVariableList.Destroy;
    419 var
    420   I: Integer;
    421 begin
    422   for I := 0 to Count - 1 do
    423     TVariable(Items[I]).Free;
     417begin
    424418  inherited;
    425419end;
     
    431425  I := 0;
    432426  while (I < Count) and (TVariable(Items[I]).Name <> Name) do Inc(I);
    433   if I < Count then Result := Items[I] else begin
     427  if I < Count then Result := TVariable(Items[I]) else begin
    434428    if Assigned(Parent.Parent) then Result := Parent.Parent.Variables.Search(Name)
    435429      else begin
     
    461455  I := 0;
    462456  while (I < Count) and (TFunction(Items[I]).Name <> Name) do Inc(I);
    463   if I < Count then Result := Items[I] else begin
     457  if I < Count then Result := TFunction(Items[I]) else begin
    464458    if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name)
    465459      else begin
     
    530524  I := 0;
    531525  while (I < Count) and (TParameter(Items[I]).Name <> Name) do Inc(I);
    532   if I < Count then Result := Items[I] else Result := nil;
     526  if I < Count then Result := TParameter(Items[I])
     527    else Result := nil;
    533528end;
    534529
     
    579574end;
    580575
     576{ TCaseOfEnd }
     577
     578constructor TCaseOfEnd.Create;
     579begin
     580  Branches := TObjectList.Create
     581end;
     582
     583destructor TCaseOfEnd.Destroy;
     584begin
     585  Branches.Destroy;
     586  inherited;
     587end;
     588
    581589end.
    582590
Note: See TracChangeset for help on using the changeset viewer.