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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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