Changeset 19 for branches/DelphiToC/UMainForm.pas
- Timestamp:
- Apr 9, 2009, 2:08:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UMainForm.pas
r14 r19 5 5 uses 6 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls, UPascalSource, UPascalCompiler, UAssemblerSource; 7 Dialogs, StdCtrls, UPascalSource, UPascalCompiler, UAssemblerSource, 8 UCSource, ComCtrls; 8 9 9 10 type … … 13 14 Memo2: TMemo; 14 15 Memo3: TMemo; 16 TreeView1: TTreeView; 15 17 procedure FormShow(Sender: TObject); 16 18 procedure FormClose(Sender: TObject; var Action: TCloseAction); … … 20 22 procedure ErrorMessage(Text: string); 21 23 private 22 { Private declarations }24 procedure FillTreeView; 23 25 public 24 26 Compiler: TCompiler; … … 41 43 Compiler.SourceCode.Assign(Memo1.Lines); 42 44 Compiler.Compile; 45 FillTreeView; 43 46 Memo2.Clear; 44 with TAssemblerProducer(Compiler.Producer) do 45 for I := 0 to AssemblyCode.Count - 1 do 46 Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString); 47 if Compiler.Producer is TAssemblerProducer then begin 48 with TAssemblerProducer(Compiler.Producer) do 49 for I := 0 to AssemblyCode.Count - 1 do 50 Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString); 51 end else 52 if Compiler.Producer is TCProducer then begin 53 with TCProducer(Compiler.Producer) do 54 Memo2.Lines.Assign(TextSource); 55 end; 47 56 end; 48 57 … … 50 59 begin 51 60 MainForm.Memo3.Lines.Add(Text); 61 end; 62 63 procedure TMainForm.FillTreeView; 64 var 65 NewNode: TTreeNode; 66 NewNode2: TTreeNode; 67 ModuleNode: TTreeNode; 68 I: Integer; 69 M: Integer; 70 begin 71 with TreeView1, Items, Compiler do begin 72 BeginUpdate; 73 Clear; 74 AddChild(nil, 'Projekt'); 75 for M := 0 to ProgramCode.Modules.Count - 1 do 76 with TModule(ProgramCode.Modules[M]) do begin 77 ModuleNode := AddChild(TopItem, Name); 78 NewNode := AddChild(ModuleNode, 'Typy'); 79 for I := 0 to Types.Count - 1 do 80 with TType(Types[I]) do 81 NewNode2 := AddChild(NewNode, Name); 82 NewNode := AddChild(ModuleNode, 'Funkce'); 83 for I := 0 to Methods.Count - 1 do 84 with TFunction(Methods[I]) do 85 NewNode2 := AddChild(NewNode, Name); 86 NewNode := AddChild(ModuleNode, 'Promìnné'); 87 for I := 0 to Variables.Count - 1 do 88 with TVariable(Variables[I]) do 89 NewNode2 := AddChild(NewNode, Name); 90 NewNode := AddChild(ModuleNode, 'Konstanty'); 91 for I := 0 to Constants.Count - 1 do 92 with TConstant(Constants[I]) do 93 NewNode2 := AddChild(NewNode, Name); 94 NewNode := AddChild(ModuleNode, 'Program'); 95 end; 96 TopItem.Expand(True); 97 EndUpdate; 98 end; 52 99 end; 53 100
Note:
See TracChangeset
for help on using the changeset viewer.