Ignore:
Timestamp:
Aug 9, 2010, 3:05:26 PM (14 years ago)
Author:
george
Message:

Added support for loop for-to-do.
System types and functions are not generated to output code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/Visual/USourceTree.pas

    r48 r50  
    2727    procedure AddNodeProgram(Node: TTreeNode; Code: TProgram);
    2828    procedure AddNodeWhileDo(Node: TTreeNode; WhileDo: TWhileDo);
     29    procedure AddNodeForToDo(Node: TTreeNode; ForToDo: TForToDo);
    2930    procedure AddNodeCommand(Node: TTreeNode; Command: TCommand);
    3031    procedure AddNodeExpression(Node: TTreeNode; Expression: TExpression);
     
    5859  I: Integer;
    5960begin
    60   NewNode := TreeView.Items.AddChild(Node, 'while-do');
     61  NewNode := TreeView.Items.AddChild(Node, 'while');
    6162  NewNode2 := TreeView.Items.AddChild(NewNode, 'condition');
    6263  AddNodeExpression(NewNode2, WhileDo.Condition);
    63   NewNode2 := TreeView.Items.AddChild(NewNode, 'command');
     64  NewNode2 := TreeView.Items.AddChild(NewNode, 'do');
    6465  AddNodeCommand(NewNode2, WhileDo.Command);
     66end;
     67
     68procedure TSourceTree.AddNodeForToDo(Node: TTreeNode; ForToDo: TForToDo);
     69var
     70  NewNode: TTreeNode;
     71  NewNode2: TTreeNode;
     72  NewNode3: TTreeNode;
     73  I: Integer;
     74begin
     75  with ForToDo do begin
     76    NewNode := TreeView.Items.AddChild(Node, 'for');
     77    NewNode2 := TreeView.Items.AddChild(NewNode, 'control');
     78    NewNode3 := TreeView.Items.AddChild(NewNode2, ControlVariable.Name);
     79    NewNode2 := TreeView.Items.AddChild(NewNode, 'from');
     80    AddNodeExpression(NewNode2, Start);
     81    NewNode2 := TreeView.Items.AddChild(NewNode, 'to');
     82    AddNodeExpression(NewNode2, Stop);
     83    NewNode2 := TreeView.Items.AddChild(NewNode, 'do');
     84    AddNodeCommand(NewNode2, Command);
     85  end;
    6586end;
    6687
     
    101122begin
    102123  if Command is TBeginEnd then
    103     AddNodeBeginEnd(Node, TBeginEnd(Command));
     124    AddNodeBeginEnd(Node, TBeginEnd(Command))
     125  else
    104126  if Command is TWhileDo then
    105     AddNodeWhileDo(Node, TWhileDo(Command));
     127    AddNodeWhileDo(Node, TWhileDo(Command))
     128  else
    106129  if Command is TFunctionCall then
    107     AddNodeMethodCall(Node, TFunctionCall(Command));
     130    AddNodeMethodCall(Node, TFunctionCall(Command))
     131  else
    108132  if Command is TIfThenElse then
    109     AddNodeIfThenElse(Node, TIfThenElse(Command));
     133    AddNodeIfThenElse(Node, TIfThenElse(Command))
     134  else
     135  if Command is TForToDo then
     136    AddNodeForToDo(Node, TForToDo(Command))
     137  else
    110138  if Command is TAssignment then
    111139    AddNodeAssignment(Node, TAssignment(Command));
     
    172200    NewNode := TreeView.Items.AddChild(Node, 'type');
    173201    for I := 0 to Types.Count - 1 do
    174     with TType(Types[I]) do begin
     202    with TType(Types[I]) do
     203    if not System then begin
    175204      NewNode2 := TreeView.Items.AddChild(NewNode, Name + ' = ');
    176205    end;
     
    186215begin
    187216  for I := 0 to Methods.Count - 1 do
    188   with TFunction(Methods[I]) do begin
     217  with TFunction(Methods[I]) do
     218  if not System then begin
    189219    if HaveResult then
    190220      NewNode := TreeView.Items.AddChild(Node, 'function ' + Name)
Note: See TracChangeset for help on using the changeset viewer.