Ignore:
Timestamp:
Aug 5, 2010, 3:13:03 PM (14 years ago)
Author:
george
Message:

Enhanced C code generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/UPascalSource.pas

    r41 r42  
    4545
    4646  TCommand = class
     47    Parent: TObject;
    4748    CommonBlock: TCommonBlock;
    4849  end;
     
    5657
    5758  TMethodCall = class(TCommand)
    58     Method: TMethod;
     59    Method: TFunction;
    5960  end;
    6061
     
    9192  end;
    9293
     94  { TIfThenElse }
     95
    9396  TIfThenElse = class(TCommand)
    9497    Condition: TExpression;
    9598    Command: TCommand;
    9699    ElseCommand: TCommand;
     100    constructor Create;
     101    destructor Destroy; override;
    97102  end;
    98103
     
    322327begin
    323328  I := 0;
    324   while (I < Count) and (TConstant(Items[I]).Name <> Name) do Inc(I);
     329  while (I < Count) and (LowerCase(TConstant(Items[I]).Name) <> Name) do Inc(I);
    325330  if I < Count then Result := TConstant(Items[I]) else begin
    326331    if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name)
     
    377382  Methods.Parent := Self;
    378383  Code := TBeginEnd.Create;
     384  Code.Parent := Self;
    379385  Code.CommonBlock := Self;
    380386end;
     
    402408begin
    403409  I := 0;
    404   while (I < Count) and (TType(Items[I]).Name <> Name) do Inc(I);
     410  while (I < Count) and (LowerCase(TType(Items[I]).Name) <> Name) do Inc(I);
    405411  if I < Count then Result := TType(Items[I]) else begin
    406412    if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name)
     
    423429begin
    424430  I := 0;
    425   while (I < Count) and (TVariable(Items[I]).Name <> Name) do Inc(I);
     431  while (I < Count) and (LowerCase(TVariable(Items[I]).Name) <> Name) do Inc(I);
    426432  if I < Count then Result := TVariable(Items[I]) else begin
    427433    if Assigned(Parent.Parent) then
     
    448454begin
    449455  I := 0;
    450   while (I < Count) and (TFunction(Items[I]).Name <> Name) do Inc(I);
     456  while (I < Count) and (LowerCase(TFunction(Items[I]).Name) <> Name) do Inc(I);
    451457  if I < Count then Result := TFunction(Items[I]) else begin
    452458    if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name)
     
    487493
    488494destructor TOperationList.Destroy;
    489 var
    490   I: Integer;
    491 begin
    492   for I := 0 to Count - 1 do
    493     TOperation(Items[I]).Free;
     495begin
    494496  inherited;
    495497end;
     
    536538constructor TBeginEnd.Create;
    537539begin
     540  inherited;
    538541  Commands := TCommandList.Create;
    539542end;
     
    587590end;
    588591
     592{ TIfThenElse }
     593
     594constructor TIfThenElse.Create;
     595begin
     596  Condition := TExpression.Create;
     597end;
     598
     599destructor TIfThenElse.Destroy;
     600begin
     601  Condition.Destroy;
     602  inherited Destroy;
     603end;
     604
    589605end.
    590606
Note: See TracChangeset for help on using the changeset viewer.