mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 12:00:02 +02:00
IDE: codeexplorer: started ignoring constants in debugging calls
git-svn-id: trunk@19498 -
This commit is contained in:
parent
fd0c8eea1e
commit
80c266b7c7
@ -90,11 +90,28 @@ const
|
|||||||
DefaultFigLongParamListCount = 6;
|
DefaultFigLongParamListCount = 6;
|
||||||
DefaultFigNestedProcCount = 3;
|
DefaultFigNestedProcCount = 3;
|
||||||
DefaultFigureCharConst = false;
|
DefaultFigureCharConst = false;
|
||||||
DefaultNotFigureConstants: array[1..2] of ansistring // Note: keep this asciiz
|
DefaultIgnoreFigureConstants: array[1..2] of ansistring // Note: keep this asciiz
|
||||||
= (
|
= (
|
||||||
'0',
|
'0',
|
||||||
'1'
|
'1'
|
||||||
);
|
);
|
||||||
|
DefaultIgnoreFigConstInFuncs: array[1..14] of ansistring // Note: keep this asciiz
|
||||||
|
= (
|
||||||
|
'Debug',
|
||||||
|
'DebugLn',
|
||||||
|
'DbgOut',
|
||||||
|
'write',
|
||||||
|
'writeln',
|
||||||
|
'Format',
|
||||||
|
'FormatBuf',
|
||||||
|
'StrFmt',
|
||||||
|
'StrLFmt',
|
||||||
|
'FmtStr',
|
||||||
|
'FloatToStrF',
|
||||||
|
'FloatToStr',
|
||||||
|
'CurrToStrF',
|
||||||
|
'FormatDateTime'
|
||||||
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -102,6 +119,7 @@ type
|
|||||||
private
|
private
|
||||||
FCategories: TCodeExplorerCategories;
|
FCategories: TCodeExplorerCategories;
|
||||||
FFigureCharConst: boolean;
|
FFigureCharConst: boolean;
|
||||||
|
FIgnoreFigConstInFuncs: TStringToStringTree;
|
||||||
FLongParamListCount: integer;
|
FLongParamListCount: integer;
|
||||||
FLongProcLineCount: integer;
|
FLongProcLineCount: integer;
|
||||||
FNestedProcCount: integer;
|
FNestedProcCount: integer;
|
||||||
@ -120,27 +138,41 @@ type
|
|||||||
procedure Save;
|
procedure Save;
|
||||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||||
function CreateListOfNotFigureConstants: TStrings;
|
public
|
||||||
procedure Clear_IgnoreFigureConstants;
|
// figure: ignore constants
|
||||||
|
function CreateListOfIgnoreFigureConstants: TStrings;
|
||||||
procedure SetListOf_IgnoreFigureConstants(List: TStrings; Add: boolean);
|
procedure SetListOf_IgnoreFigureConstants(List: TStrings; Add: boolean);
|
||||||
procedure LoadDefaults_IgnoreFigureConstants;
|
function IgnoreFigureConstant(p: PChar): boolean;// test if atom is in IgnoreFigureConstants
|
||||||
function IgnoreFigureConstant(p: PChar): boolean;// test if atom is in NotFigureConstants
|
function IgnoreFigureConstants_AreDefault(Exactly: boolean): boolean; // true if IgnoreFigureConstants contain/are default values
|
||||||
|
function IgnoreFigureConstant_IsDefault(const Atom: string): boolean; // true if Atom is in default values
|
||||||
procedure Add_IgnoreFigureConstant(const Atom: string);
|
procedure Add_IgnoreFigureConstant(const Atom: string);
|
||||||
function IgnoreFigureConstants_AreDefault(Exactly: boolean): boolean;
|
procedure Clear_IgnoreFigureConstants;
|
||||||
function IgnoreFigureConstant_IsDefault(const Atom: string): boolean;
|
procedure LoadDefaults_IgnoreFigureConstants;
|
||||||
|
public
|
||||||
|
// figure: ignore constants in functions
|
||||||
|
function CreateListOfIgnoreFigConstInFuncs: TStrings;
|
||||||
|
procedure SetListOf_IgnoreFigConstInFuncs(List: TStrings; Add: boolean);
|
||||||
|
function IgnoreFigConstInFunc(const Func: string): boolean;// test if function is in IgnoreFigConstInFuncs
|
||||||
|
function IgnoreFigConstInFuncs_AreDefault(Exactly: boolean): boolean; // true if IgnoreFigConstInFuncs contain/are default values
|
||||||
|
function IgnoreFigConstInFuncs_IsDefault(const Func: string): boolean; // true if Atom is in default values
|
||||||
|
procedure Add_IgnoreFigConstInFuncs(const Func: string);
|
||||||
|
procedure Clear_IgnoreFigConstInFuncs;
|
||||||
|
procedure LoadDefaults_IgnoreFigConstInFuncs;
|
||||||
public
|
public
|
||||||
property Refresh: TCodeExplorerRefresh read FRefresh write FRefresh default cerSwitchEditorPage;
|
property Refresh: TCodeExplorerRefresh read FRefresh write FRefresh default cerSwitchEditorPage;
|
||||||
property Mode: TCodeExplorerMode read FMode write FMode default cemCategory;
|
property Mode: TCodeExplorerMode read FMode write FMode default cemCategory;
|
||||||
property OptionsFilename: string read FOptionsFilename write FOptionsFilename;
|
property OptionsFilename: string read FOptionsFilename write FOptionsFilename;
|
||||||
property FollowCursor: boolean read FFollowCursor write FFollowCursor default true;
|
property FollowCursor: boolean read FFollowCursor write FFollowCursor default true;
|
||||||
property Categories: TCodeExplorerCategories read FCategories write FCategories default DefaultCodeExplorerCategories;
|
property Categories: TCodeExplorerCategories read FCategories write FCategories default DefaultCodeExplorerCategories;
|
||||||
|
public
|
||||||
// Figures
|
// Figures
|
||||||
property Figures: TCEFigureCategories read FFigures write FFigures default DefaultCodeExplorerFigureCategories;
|
|
||||||
property LongProcLineCount: integer read FLongProcLineCount write FLongProcLineCount default DefaultFigLongProcLineCount;
|
|
||||||
property LongParamListCount: integer read FLongParamListCount write FLongParamListCount default DefaultFigLongParamListCount;
|
|
||||||
property NestedProcCount: integer read FNestedProcCount write FNestedProcCount default DefaultFigNestedProcCount;
|
|
||||||
property FigureCharConst: boolean read FFigureCharConst write FFigureCharConst default DefaultFigureCharConst;
|
property FigureCharConst: boolean read FFigureCharConst write FFigureCharConst default DefaultFigureCharConst;
|
||||||
|
property Figures: TCEFigureCategories read FFigures write FFigures default DefaultCodeExplorerFigureCategories;
|
||||||
property IgnoreFigureConstants: TAvgLvlTree read FIgnoreFigureConstants;
|
property IgnoreFigureConstants: TAvgLvlTree read FIgnoreFigureConstants;
|
||||||
|
property IgnoreFigConstInFuncs: TStringToStringTree read FIgnoreFigConstInFuncs;
|
||||||
|
property LongParamListCount: integer read FLongParamListCount write FLongParamListCount default DefaultFigLongParamListCount;
|
||||||
|
property LongProcLineCount: integer read FLongProcLineCount write FLongProcLineCount default DefaultFigLongProcLineCount;
|
||||||
|
property NestedProcCount: integer read FNestedProcCount write FNestedProcCount default DefaultFigNestedProcCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -260,15 +292,17 @@ begin
|
|||||||
FOptionsFilename:=
|
FOptionsFilename:=
|
||||||
AppendPathDelim(GetPrimaryConfigPath)+'codeexploreroptions.xml';
|
AppendPathDelim(GetPrimaryConfigPath)+'codeexploreroptions.xml';
|
||||||
FIgnoreFigureConstants:=TAvgLvlTree.Create(TListSortCompare(@CompareAtom));
|
FIgnoreFigureConstants:=TAvgLvlTree.Create(TListSortCompare(@CompareAtom));
|
||||||
|
FIgnoreFigConstInFuncs:=TStringToStringTree.Create(false);
|
||||||
Clear;
|
Clear;
|
||||||
Add_IgnoreFigureConstant('0');
|
LoadDefaults_IgnoreFigureConstants;
|
||||||
Add_IgnoreFigureConstant('1');
|
LoadDefaults_IgnoreFigConstInFuncs;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCodeExplorerOptions.Destroy;
|
destructor TCodeExplorerOptions.Destroy;
|
||||||
begin
|
begin
|
||||||
Clear_IgnoreFigureConstants;
|
Clear_IgnoreFigureConstants;
|
||||||
FreeAndNil(FIgnoreFigureConstants);
|
FreeAndNil(FIgnoreFigureConstants);
|
||||||
|
FreeAndNil(FIgnoreFigConstInFuncs);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -284,6 +318,7 @@ begin
|
|||||||
FNestedProcCount:=DefaultFigNestedProcCount;
|
FNestedProcCount:=DefaultFigNestedProcCount;
|
||||||
FFigureCharConst:=DefaultFigureCharConst;
|
FFigureCharConst:=DefaultFigureCharConst;
|
||||||
Clear_IgnoreFigureConstants;
|
Clear_IgnoreFigureConstants;
|
||||||
|
Clear_IgnoreFigConstInFuncs;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeExplorerOptions.Assign(Source: TPersistent);
|
procedure TCodeExplorerOptions.Assign(Source: TPersistent);
|
||||||
@ -302,12 +337,18 @@ begin
|
|||||||
FLongParamListCount:=Src.LongParamListCount;
|
FLongParamListCount:=Src.LongParamListCount;
|
||||||
FNestedProcCount:=Src.NestedProcCount;
|
FNestedProcCount:=Src.NestedProcCount;
|
||||||
FFigureCharConst:=Src.FigureCharConst;
|
FFigureCharConst:=Src.FigureCharConst;
|
||||||
List:=Src.CreateListOfNotFigureConstants;
|
List:=Src.CreateListOfIgnoreFigureConstants;
|
||||||
try
|
try
|
||||||
SetListOf_IgnoreFigureConstants(List,false);
|
SetListOf_IgnoreFigureConstants(List,false);
|
||||||
finally
|
finally
|
||||||
List.Free;
|
List.Free;
|
||||||
end;
|
end;
|
||||||
|
List:=Src.CreateListOfIgnoreFigConstInFuncs;
|
||||||
|
try
|
||||||
|
SetListOf_IgnoreFigConstInFuncs(List,false);
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
inherited Assign(Source);
|
inherited Assign(Source);
|
||||||
end;
|
end;
|
||||||
@ -404,6 +445,17 @@ begin
|
|||||||
finally
|
finally
|
||||||
List.Free;
|
List.Free;
|
||||||
end;
|
end;
|
||||||
|
// load standard IgnoreFigConstInFuncs
|
||||||
|
if XMLConfig.GetValue(CurPath+'IgnoreInFuncs/ContainsDefaults',true) then
|
||||||
|
LoadDefaults_IgnoreFigConstInFuncs;
|
||||||
|
// load custom IgnoreFigConstInFuncs
|
||||||
|
List:=TStringList.Create;
|
||||||
|
try
|
||||||
|
LoadStringList(XMLConfig,List,CurPath+'IgnoreFuncs/');
|
||||||
|
SetListOf_IgnoreFigConstInFuncs(List,true);
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -454,7 +506,7 @@ begin
|
|||||||
XMLConfig.SetDeleteValue(CurPath+'Ignore/ContainsDefaults',
|
XMLConfig.SetDeleteValue(CurPath+'Ignore/ContainsDefaults',
|
||||||
ContainsDefaults,true);
|
ContainsDefaults,true);
|
||||||
// save IgnoreFigureConstants
|
// save IgnoreFigureConstants
|
||||||
List:=CreateListOfNotFigureConstants;
|
List:=CreateListOfIgnoreFigureConstants;
|
||||||
try
|
try
|
||||||
for i:=List.Count-1 downto 0 do
|
for i:=List.Count-1 downto 0 do
|
||||||
if IgnoreFigureConstant_IsDefault(List[i]) then
|
if IgnoreFigureConstant_IsDefault(List[i]) then
|
||||||
@ -463,27 +515,37 @@ begin
|
|||||||
finally
|
finally
|
||||||
List.Free;
|
List.Free;
|
||||||
end;
|
end;
|
||||||
|
// save standard IgnoreFigConstInFuncs
|
||||||
|
ContainsDefaults:=IgnoreFigConstInFuncs_AreDefault(false);
|
||||||
|
XMLConfig.SetDeleteValue(CurPath+'IgnoreInFuncs/ContainsDefaults',
|
||||||
|
ContainsDefaults,true);
|
||||||
|
// save IgnoreFigConstInFuncs
|
||||||
|
List:=CreateListOfIgnoreFigConstInFuncs;
|
||||||
|
try
|
||||||
|
for i:=List.Count-1 downto 0 do
|
||||||
|
if IgnoreFigConstInFuncs_IsDefault(List[i]) then
|
||||||
|
List.Delete(i);
|
||||||
|
SaveStringList(XMLConfig,List,CurPath+'IgnoreInFuncs/');
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeExplorerOptions.CreateListOfNotFigureConstants: TStrings;
|
function TCodeExplorerOptions.CreateListOfIgnoreFigureConstants: TStrings;
|
||||||
var
|
var
|
||||||
AVLNode: TAvgLvlTreeNode;
|
AVLNode: TAvgLvlTreeNode;
|
||||||
i: Integer;
|
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
Result:=TStringList.Create;
|
Result:=TStringList.Create;
|
||||||
AVLNode:=IgnoreFigureConstants.FindLowest;
|
AVLNode:=IgnoreFigureConstants.FindLowest;
|
||||||
i:=0;
|
|
||||||
while AVLNode<>nil do begin
|
while AVLNode<>nil do begin
|
||||||
s:=GetAtomString(PChar(AVLNode.Data),false);
|
s:=GetAtomString(PChar(AVLNode.Data),false);
|
||||||
if s<>'' then begin
|
if s<>'' then
|
||||||
inc(i);
|
|
||||||
Result.Add(s);
|
Result.Add(s);
|
||||||
end;
|
|
||||||
AVLNode:=IgnoreFigureConstants.FindSuccessor(AVLNode);
|
AVLNode:=IgnoreFigureConstants.FindSuccessor(AVLNode);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -521,8 +583,87 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Clear_IgnoreFigureConstants;
|
Clear_IgnoreFigureConstants;
|
||||||
for i:=low(DefaultNotFigureConstants) to high(DefaultNotFigureConstants) do
|
for i:=low(DefaultIgnoreFigureConstants) to high(DefaultIgnoreFigureConstants) do
|
||||||
Add_IgnoreFigureConstant(DefaultNotFigureConstants[i]);
|
Add_IgnoreFigureConstant(DefaultIgnoreFigureConstants[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCodeExplorerOptions.CreateListOfIgnoreFigConstInFuncs: TStrings;
|
||||||
|
var
|
||||||
|
AVLNode: TAvgLvlTreeNode;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
Result:=TStringList.Create;
|
||||||
|
AVLNode:=IgnoreFigConstInFuncs.Tree.FindLowest;
|
||||||
|
while AVLNode<>nil do begin
|
||||||
|
s:=PStringToStringItem(AVLNode.Data)^.Name;
|
||||||
|
if s<>'' then
|
||||||
|
Result.Add(s);
|
||||||
|
AVLNode:=IgnoreFigConstInFuncs.Tree.FindSuccessor(AVLNode);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCodeExplorerOptions.SetListOf_IgnoreFigConstInFuncs(List: TStrings;
|
||||||
|
Add: boolean);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if not Add then
|
||||||
|
Clear_IgnoreFigConstInFuncs;
|
||||||
|
for i:=0 to List.Count-1 do
|
||||||
|
Add_IgnoreFigConstInFuncs(List[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCodeExplorerOptions.IgnoreFigConstInFunc(const Func: string): boolean;
|
||||||
|
begin
|
||||||
|
Result:=FIgnoreFigConstInFuncs.Contains(Func);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCodeExplorerOptions.IgnoreFigConstInFuncs_AreDefault(Exactly: boolean
|
||||||
|
): boolean;
|
||||||
|
const
|
||||||
|
DefCount = high(DefaultIgnoreFigConstInFuncs)-Low(DefaultIgnoreFigConstInFuncs)+1;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if Exactly and (FIgnoreFigConstInFuncs.Count=DefCount) then
|
||||||
|
exit(false);
|
||||||
|
if FIgnoreFigConstInFuncs.Count<DefCount then exit(false);
|
||||||
|
for i:=low(DefaultIgnoreFigConstInFuncs) to high(DefaultIgnoreFigConstInFuncs) do
|
||||||
|
if not IgnoreFigConstInFunc(DefaultIgnoreFigConstInFuncs[i]) then
|
||||||
|
exit(false);
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCodeExplorerOptions.IgnoreFigConstInFuncs_IsDefault(const Func: string
|
||||||
|
): boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i:=low(DefaultIgnoreFigureConstants) to high(DefaultIgnoreFigureConstants) do
|
||||||
|
if SysUtils.CompareText(Func,DefaultIgnoreFigureConstants[i])=0 then
|
||||||
|
exit(true);
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCodeExplorerOptions.Add_IgnoreFigConstInFuncs(const Func: string);
|
||||||
|
begin
|
||||||
|
if Func='' then exit;
|
||||||
|
if IgnoreFigConstInFunc(Func) then exit;
|
||||||
|
FIgnoreFigConstInFuncs.Values[Func]:='';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCodeExplorerOptions.Clear_IgnoreFigConstInFuncs;
|
||||||
|
begin
|
||||||
|
FIgnoreFigConstInFuncs.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCodeExplorerOptions.LoadDefaults_IgnoreFigConstInFuncs;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Clear_IgnoreFigConstInFuncs;
|
||||||
|
for i:=low(DefaultIgnoreFigConstInFuncs) to high(DefaultIgnoreFigConstInFuncs) do
|
||||||
|
Add_IgnoreFigConstInFuncs(DefaultIgnoreFigConstInFuncs[i]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeExplorerOptions.IgnoreFigureConstant(p: PChar): boolean;
|
function TCodeExplorerOptions.IgnoreFigureConstant(p: PChar): boolean;
|
||||||
@ -544,15 +685,16 @@ end;
|
|||||||
function TCodeExplorerOptions.IgnoreFigureConstants_AreDefault(Exactly: boolean
|
function TCodeExplorerOptions.IgnoreFigureConstants_AreDefault(Exactly: boolean
|
||||||
): boolean;
|
): boolean;
|
||||||
const
|
const
|
||||||
DefCount = high(DefaultNotFigureConstants)-Low(DefaultNotFigureConstants)+1;
|
DefCount = high(DefaultIgnoreFigureConstants)-Low(DefaultIgnoreFigureConstants)+1;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if Exactly and (FIgnoreFigureConstants.Count=DefCount) then
|
if Exactly and (FIgnoreFigureConstants.Count=DefCount) then
|
||||||
exit(false);
|
exit(false);
|
||||||
if FIgnoreFigureConstants.Count<DefCount then exit(false);
|
if FIgnoreFigureConstants.Count<DefCount then exit(false);
|
||||||
for i:=low(DefaultNotFigureConstants) to high(DefaultNotFigureConstants) do
|
for i:=low(DefaultIgnoreFigureConstants) to high(DefaultIgnoreFigureConstants) do
|
||||||
if not IgnoreFigureConstant(PChar(DefaultNotFigureConstants[i])) then exit(false);
|
if not IgnoreFigureConstant(PChar(DefaultIgnoreFigureConstants[i])) then
|
||||||
|
exit(false);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -561,8 +703,8 @@ function TCodeExplorerOptions.IgnoreFigureConstant_IsDefault(const Atom: string
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=low(DefaultNotFigureConstants) to high(DefaultNotFigureConstants) do
|
for i:=low(DefaultIgnoreFigureConstants) to high(DefaultIgnoreFigureConstants) do
|
||||||
if CompareAtom(PChar(Atom),PChar(DefaultNotFigureConstants[i]),false)=0 then
|
if CompareAtom(PChar(Atom),PChar(DefaultIgnoreFigureConstants[i]),false)=0 then
|
||||||
exit(true);
|
exit(true);
|
||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
@ -92,7 +92,7 @@ begin
|
|||||||
LongParamListCountSpinEdit.Value := LongParamListCount;
|
LongParamListCountSpinEdit.Value := LongParamListCount;
|
||||||
NestedProcCountSpinEdit.Value := NestedProcCount;
|
NestedProcCountSpinEdit.Value := NestedProcCount;
|
||||||
FigureCharConstCheckBox.Checked := FigureCharConst;
|
FigureCharConstCheckBox.Checked := FigureCharConst;
|
||||||
Tmp := CreateListOfNotFigureConstants;
|
Tmp := CreateListOfIgnoreFigureConstants;
|
||||||
IgnoreFigureConstantsMemo.Lines.Assign(Tmp);
|
IgnoreFigureConstantsMemo.Lines.Assign(Tmp);
|
||||||
Tmp.Free;
|
Tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user