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/UMainForm.pas

    r41 r42  
    2727    procedure ErrorMessage(Text: string);
    2828  private
    29     procedure FillTreeView;
    3029  public
    3130    Compiler: TCompiler;
     
    5251  SourceTree.Code := Compiler.ProgramCode;
    5352  SourceTree.Fill;
    54   //FillTreeView;
    5553  Memo2.Clear;
    5654  if Compiler.Producer is TAssemblerProducer then begin
     
    6866begin
    6967  MainForm.Memo3.Lines.Add(Text);
    70 end;
    71 
    72 procedure TMainForm.FillTreeView;
    73 var
    74   NewNode: TTreeNode;
    75   NewNode2: TTreeNode;
    76   NewNode3: TTreeNode;
    77   ModuleNode: TTreeNode;
    78   I: Integer;
    79   II: Integer;
    80   M: Integer;
    81 begin
    82   with TreeView1, Items, Compiler do begin
    83     BeginUpdate;
    84     Clear;
    85     AddChild(nil, 'Projekt');
    86     for M := 0 to ProgramCode.Modules.Count - 1 do
    87       with TModule(ProgramCode.Modules[M]) do begin
    88         ModuleNode := AddChild(TopItem, Name);
    89         NewNode := AddChild(ModuleNode, 'Typy');
    90         for I := 0 to Types.Count - 1 do
    91         with TType(Types[I]) do
    92           NewNode2 := AddChild(NewNode, Name);
    93         NewNode := AddChild(ModuleNode, 'Funkce');
    94         for I := 0 to Methods.Count - 1 do
    95         with TFunction(Methods[I]) do begin
    96           NewNode2 := AddChild(NewNode, Name);
    97           with NewNode2 do begin
    98             NewNode3 := AddChild(NewNode2, 'Parametery');
    99             for II := 0 to Parameters.Count - 1 do
    100               AddChild(NewNode3, TParameter(Parameters[II]).Name + ':' + TParameter(Parameters[II]).ValueType.Name);
    101           end;
    102         end;
    103         NewNode := AddChild(ModuleNode, 'Promìnné');
    104         for I := 0 to Variables.Count - 1 do
    105         with TVariable(Variables[I]) do
    106           NewNode2 := AddChild(NewNode, Name + ':' + ValueType.Name);
    107         NewNode := AddChild(ModuleNode, 'Konstanty');
    108         for I := 0 to Constants.Count - 1 do
    109         with TConstant(Constants[I]) do
    110           NewNode2 := AddChild(NewNode, Name + ':' + ValueType.Name + '=' + Value);
    111         NewNode := AddChild(ModuleNode, 'Program');
    112         for I := 0 to Code.Commands.Count - 1 do begin
    113           if TObject(Code.Commands[I]) is TBeginEnd then begin
    114             NewNode2 := AddChild(NewNode, 'Begin-End');
    115 
    116           end else
    117           if TObject(Code.Commands[I]) is TWhileDo then begin
    118             NewNode2 := AddChild(NewNode, 'While-Do');
    119             NewNode3 := AddChild(NewNode2, 'Podmínka');
    120 
    121             NewNode3 := AddChild(NewNode2, 'Povel');
    122           end else
    123           if TObject(Code.Commands[I]) is TAssignment then begin
    124             NewNode2 := AddChild(NewNode, TAssignment(Code.Commands[I]).Target.Name + ' := exp');
    125 
    126           end;
    127         end;
    128 
    129       end;
    130     TopItem.Expand(True);
    131     EndUpdate;
    132   end;
    13368end;
    13469
     
    15388procedure TMainForm.FormShow(Sender: TObject);
    15489begin
     90  WindowState := wsMaximized;
    15591  Memo1.Lines.LoadFromFile(ExampleFileName);
    15692  Button1Click(Self);
Note: See TracChangeset for help on using the changeset viewer.