cody: view code node info: added Scanner links

git-svn-id: trunk@39757 -
This commit is contained in:
mattias 2013-01-03 20:42:28 +00:00
parent f66348186c
commit 054ca147eb
11 changed files with 113 additions and 12 deletions

View File

@ -10,8 +10,8 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
LCLVersion = '1.1' LCLVersion = '1.1'
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 42 Height = 36
Top = 419 Top = 425
Width = 569 Width = 569
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
@ -26,7 +26,7 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 413 Height = 419
Top = 0 Top = 0
Width = 581 Width = 581
ActivePage = CodeBuffersTabSheet ActivePage = CodeBuffersTabSheet
@ -35,13 +35,13 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
TabOrder = 1 TabOrder = 1
object ReportTabSheet: TTabSheet object ReportTabSheet: TTabSheet
Caption = 'ReportTabSheet' Caption = 'ReportTabSheet'
ClientHeight = 381 ClientHeight = 390
ClientWidth = 575 ClientWidth = 577
object ReportMemo: TMemo object ReportMemo: TMemo
Left = 0 Left = 0
Height = 381 Height = 390
Top = 0 Top = 0
Width = 575 Width = 577
Align = alClient Align = alClient
Lines.Strings = ( Lines.Strings = (
'ReportMemo' 'ReportMemo'
@ -53,13 +53,13 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
end end
object CodeBuffersTabSheet: TTabSheet object CodeBuffersTabSheet: TTabSheet
Caption = 'CodeBuffersTabSheet' Caption = 'CodeBuffersTabSheet'
ClientHeight = 381 ClientHeight = 390
ClientWidth = 575 ClientWidth = 577
object CodeBuffersComboBox: TComboBox object CodeBuffersComboBox: TComboBox
Left = 0 Left = 0
Height = 27 Height = 27
Top = 0 Top = 0
Width = 575 Width = 577
Align = alTop Align = alTop
ItemHeight = 0 ItemHeight = 0
OnSelect = CodeBuffersComboBoxSelect OnSelect = CodeBuffersComboBoxSelect
@ -68,9 +68,9 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
end end
object CodeBufferMemo: TMemo object CodeBufferMemo: TMemo
Left = 0 Left = 0
Height = 354 Height = 363
Top = 27 Top = 27
Width = 575 Width = 577
Align = alClient Align = alClient
Lines.Strings = ( Lines.Strings = (
'CodeBufferMemo' 'CodeBufferMemo'
@ -79,5 +79,22 @@ object CodyNodeInfoDialog: TCodyNodeInfoDialog
TabOrder = 1 TabOrder = 1
end end
end end
object LinksTabSheet: TTabSheet
Caption = 'LinksTabSheet'
ClientHeight = 390
ClientWidth = 577
object LinksMemo: TMemo
Left = 0
Height = 390
Top = 0
Width = 577
Align = alClient
Lines.Strings = (
'LinksMemo'
)
ScrollBars = ssBoth
TabOrder = 0
end
end
end end
end end

View File

@ -47,10 +47,12 @@ type
ButtonPanel1: TButtonPanel; ButtonPanel1: TButtonPanel;
CodeBufferMemo: TMemo; CodeBufferMemo: TMemo;
CodeBuffersComboBox: TComboBox; CodeBuffersComboBox: TComboBox;
LinksMemo: TMemo;
PageControl1: TPageControl; PageControl1: TPageControl;
ReportMemo: TMemo; ReportMemo: TMemo;
ReportTabSheet: TTabSheet; ReportTabSheet: TTabSheet;
CodeBuffersTabSheet: TTabSheet; CodeBuffersTabSheet: TTabSheet;
LinksTabSheet: TTabSheet;
procedure CodeBuffersComboBoxSelect(Sender: TObject); procedure CodeBuffersComboBoxSelect(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
private private
@ -86,6 +88,7 @@ begin
Caption:=crsCodeNodeInformation; Caption:=crsCodeNodeInformation;
ReportTabSheet.Caption:=crsReport; ReportTabSheet.Caption:=crsReport;
CodeBuffersTabSheet.Caption:=crsCodeBuffers; CodeBuffersTabSheet.Caption:=crsCodeBuffers;
LinksTabSheet.Caption:=crsLinks;
ButtonPanel1.CloseButton.Caption:=crsClose; ButtonPanel1.CloseButton.Caption:=crsClose;
PageControl1.PageIndex:=0; PageControl1.PageIndex:=0;
UpdateReport; UpdateReport;
@ -217,7 +220,12 @@ var
AVLNode: TAVLTreeNode; AVLNode: TAVLTreeNode;
Filenames: TStringList; Filenames: TStringList;
CodeBuf: TCodeBuffer; CodeBuf: TCodeBuffer;
Scanner: TLinkScanner;
Link: TSourceLink;
LinkSize: Integer;
s: String;
begin begin
Tool:=nil;
sl:=TStringList.Create; sl:=TStringList.Create;
try try
SrcEdit:=SourceEditorManagerIntf.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
@ -241,6 +249,8 @@ begin
sl.Add('Unit='+Tool.MainFilename); sl.Add('Unit='+Tool.MainFilename);
Tool.BuildTreeAndGetCleanPos(trTillCursor,lsrEnd,CursorPos,CleanPos, Tool.BuildTreeAndGetCleanPos(trTillCursor,lsrEnd,CursorPos,CleanPos,
[btSetIgnoreErrorPos]); [btSetIgnoreErrorPos]);
// nodes
sl.Add('Scanner.ScannedRange='+dbgs(Tool.Scanner.ScannedRange)); sl.Add('Scanner.ScannedRange='+dbgs(Tool.Scanner.ScannedRange));
sl.Add('Tool.ScannedRange='+dbgs(Tool.ScannedRange)); sl.Add('Tool.ScannedRange='+dbgs(Tool.ScannedRange));
Node:=Tool.FindDeepestNodeAtPos(CleanPos,false); Node:=Tool.FindDeepestNodeAtPos(CleanPos,false);
@ -269,6 +279,7 @@ begin
ReportAllNodes(sl,Tool); ReportAllNodes(sl,Tool);
end; end;
// codebuffers
Filenames:=TStringList.Create; Filenames:=TStringList.Create;
if Tool.Scanner<>nil then begin if Tool.Scanner<>nil then begin
UsedCodeBuffers:=Tool.Scanner.CreateTreeOfSourceCodes; UsedCodeBuffers:=Tool.Scanner.CreateTreeOfSourceCodes;
@ -288,6 +299,7 @@ begin
end else begin end else begin
CodeBuffersComboBox.Text:=''; CodeBuffersComboBox.Text:='';
end; end;
except except
on e: Exception do CodeToolBoss.HandleException(e); on e: Exception do CodeToolBoss.HandleException(e);
end; end;
@ -303,6 +315,45 @@ begin
ReportMemo.Lines.Assign(sl); ReportMemo.Lines.Assign(sl);
sl.Free; sl.Free;
end; end;
// links
sl:=TStringList.Create;
try
sl.Clear;
if Tool.Scanner<>nil then begin
Scanner:=Tool.Scanner;
sl.Add('MainFilename:'+Scanner.MainFilename);
sl.Add('ScannedRange='+dbgs(Scanner.ScannedRange));
sl.Add('===================================');
sl.Add('InitialValues:');
sl.Add(Scanner.InitialValues.AsString);
sl.Add('===================================');
sl.Add('Values:');
sl.Add(Scanner.Values.AsString);
sl.Add('===================================');
sl.Add('IsUnit='+dbgs(Scanner.IsUnit));
sl.Add('SourceName='+Scanner.SourceName);
sl.Add('===================================');
sl.Add('Links:');
for i:=0 to Scanner.LinkCount-1 do begin
Link:=Scanner.Links[i];
s:=dbgs(i)+'/'+dbgs(Scanner.LinkCount)+': Kind='+dbgs(Link.Kind);
if Link.Code<>nil then
s+=',Code='+ExtractFileName(TCodeBuffer(Link.Code).Filename);
s+=',CleanedPos='+dbgs(Link.CleanedPos)+',SrcPos='+dbgs(Link.SrcPos);
LinkSize:=Scanner.LinkSize(i);
s+=',Size='+dbgs(LinkSize);
if LinkSize>60 then
s+=dbgstr(Scanner.CleanedSrc,Link.CleanedPos,30)+'...'+dbgstr(Scanner.CleanedSrc,Link.CleanedPos+LinkSize-30,30)
else
s+=dbgstr(Scanner.CleanedSrc,Link.CleanedPos,LinkSize);
sl.Add(s);
end;
sl.Add('===================================');
end;
LinksMemo.Lines.Assign(sl);
finally
sl.Free;
end;
end; end;
{$R *.lfm} {$R *.lfm}

View File

@ -73,6 +73,7 @@ resourcestring
crsProjectOutput = 'Project Output'; crsProjectOutput = 'Project Output';
crsHelp = '&Help'; crsHelp = '&Help';
crsClose = '&Close'; crsClose = '&Close';
crsLinks = 'Links';
crsCodeBuffers = 'CodeBuffers'; crsCodeBuffers = 'CodeBuffers';
crsAddAssignMethod = 'Add Assign Method'; crsAddAssignMethod = 'Add Assign Method';
crsShowCodeToolsNodeInfo = 'Show CodeTools Node Info ...'; crsShowCodeToolsNodeInfo = 'Show CodeTools Node Info ...';

View File

@ -393,6 +393,10 @@ msgstr "ك بايت"
msgid "Linked files" msgid "Linked files"
msgstr "الملفات المرتبطة" msgstr "الملفات المرتبطة"
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "" msgstr ""

View File

@ -389,6 +389,10 @@ msgstr ""
msgid "Linked files" msgid "Linked files"
msgstr "" msgstr ""
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "Lade Wörterbuch nach %s" msgstr "Lade Wörterbuch nach %s"

View File

@ -389,6 +389,10 @@ msgstr "Kbyte"
msgid "Linked files" msgid "Linked files"
msgstr "" msgstr ""
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "" msgstr ""

View File

@ -391,6 +391,10 @@ msgstr "kiB"
msgid "Linked files" msgid "Linked files"
msgstr "Saistyti failai" msgstr "Saistyti failai"
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "Žodyną įkelti po %s" msgstr "Žodyną įkelti po %s"

View File

@ -381,6 +381,10 @@ msgstr ""
msgid "Linked files" msgid "Linked files"
msgstr "" msgstr ""
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "" msgstr ""

View File

@ -398,6 +398,10 @@ msgstr "kbytes"
msgid "Linked files" msgid "Linked files"
msgstr "Arquivos vinculados" msgstr "Arquivos vinculados"
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "Carregar dicionário após %s" msgstr "Carregar dicionário após %s"

View File

@ -399,6 +399,10 @@ msgstr "кБ"
msgid "Linked files" msgid "Linked files"
msgstr "Скомпонованные файлы" msgstr "Скомпонованные файлы"
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "Загружать словарь спустя %s" msgstr "Загружать словарь спустя %s"

View File

@ -401,6 +401,10 @@ msgstr "кБ"
msgid "Linked files" msgid "Linked files"
msgstr "Зв'язані файли" msgstr "Зв'язані файли"
#: codystrconsts.crslinks
msgid "Links"
msgstr ""
#: codystrconsts.crsloaddictionaryafter #: codystrconsts.crsloaddictionaryafter
msgid "Load dictionary after %s" msgid "Load dictionary after %s"
msgstr "" msgstr ""