From 41dc46374f68771d0d36256fc773b76615e9dcff Mon Sep 17 00:00:00 2001 From: juha Date: Wed, 25 Jul 2018 23:44:54 +0000 Subject: [PATCH] LazUtils: Move string manipulation functions from LazUtilities to LazStringUtils. git-svn-id: trunk@58634 - --- components/aarre/src/aarrepkglist.pas | 2 +- components/codetools/codetoolmanager.pas | 2 +- components/codetools/ctunitgraph.pas | 2 +- components/codetools/definetemplates.pas | 4 +- components/codetools/directorycacher.pas | 3 +- components/ideintf/srceditorintf.pas | 4 +- components/lazutils/lazlogger.pas | 2 +- components/lazutils/lazstringutils.pas | 276 ++++++++++++++++++----- components/lazutils/lazutilities.pas | 158 ------------- ide/buildmanager.pas | 2 +- ide/buildprojectdlg.pas | 2 +- ide/codebrowser.pas | 2 +- ide/codetoolsdefines.pas | 4 +- ide/fpdoceditwindow.pas | 2 +- ide/frames/compiler_config_target.pas | 2 +- ide/ideprocs.pp | 2 +- ide/lazbuild.lpr | 4 +- ide/sourceeditprocs.pas | 2 +- ide/unitdependencies.pas | 2 +- lcl/dialogs.pp | 4 +- lcl/interfaces/carbon/carbonstrings.pp | 2 +- lcl/interfaces/gtk2/gtk2int.pas | 2 +- lcl/interfaces/qt/qtint.pp | 2 +- lcl/interfaces/qt5/qtint.pp | 2 +- lcl/lclproc.pas | 6 - packager/openinstalledpkgdlg.pas | 2 +- packager/pkggraphexplorer.pas | 2 +- 27 files changed, 249 insertions(+), 250 deletions(-) diff --git a/components/aarre/src/aarrepkglist.pas b/components/aarre/src/aarrepkglist.pas index 43db97f357..5f39c9bfca 100644 --- a/components/aarre/src/aarrepkglist.pas +++ b/components/aarre/src/aarrepkglist.pas @@ -35,7 +35,7 @@ interface uses Classes, SysUtils, zstream, Laz2_XMLCfg, LazUTF8, LConvEncoding, - LazFileUtils, LazUtilities; + LazFileUtils, LazStringUtils, LazUtilities; type TAPackageType = ( diff --git a/components/codetools/codetoolmanager.pas b/components/codetools/codetoolmanager.pas index d2a694d032..0b93c4d971 100644 --- a/components/codetools/codetoolmanager.pas +++ b/components/codetools/codetoolmanager.pas @@ -43,7 +43,7 @@ uses Classes, SysUtils, contnrs, TypInfo, types, Laz_AVL_Tree, // LazUtils LazFileUtils, LazFileCache, LazMethodList, LazDbgLog, AvgLvlTree, - LazUtilities, + LazStringUtils, // Codetools FileProcs, BasicCodeTools, CodeToolsStrConsts, EventCodeTool, CodeTree, CodeAtom, SourceChanger, DefineTemplates, CodeCache, diff --git a/components/codetools/ctunitgraph.pas b/components/codetools/ctunitgraph.pas index 7cd3343bb9..39c412a0a8 100644 --- a/components/codetools/ctunitgraph.pas +++ b/components/codetools/ctunitgraph.pas @@ -32,7 +32,7 @@ interface uses Classes, SysUtils, Laz_AVL_Tree, // LazUtils - LazFileUtils, LazUtilities, + LazFileUtils, LazStringUtils, // Codetools FileProcs, FindDeclarationTool, CodeBeautifier, CodeCache, StdCodeTools, DirectoryCacher, LinkScanner, CustomCodeTool, CodeTree, CodeToolsStructs; diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index 877398f0e9..008574830a 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -59,8 +59,8 @@ uses CodeToolsStrConsts, ExprEval, DirectoryCacher, BasicCodeTools, CodeToolsStructs, KeywordFuncLists, LinkScanner, FileProcs, // LazUtils - LazUtilities, LazUTF8, LazUTF8Classes, LazFileUtils, UTF8Process, - LazFileCache, LazDbgLog, AvgLvlTree, Laz2_XMLCfg; + LazStringUtils, LazFileUtils, LazFileCache, + LazUTF8, LazUTF8Classes, UTF8Process, LazDbgLog, AvgLvlTree, Laz2_XMLCfg; const ExternalMacroStart = ExprEval.ExternalMacroStart; diff --git a/components/codetools/directorycacher.pas b/components/codetools/directorycacher.pas index 5ecc8a41e5..12e54972d4 100644 --- a/components/codetools/directorycacher.pas +++ b/components/codetools/directorycacher.pas @@ -40,7 +40,8 @@ uses // CodeTools FileProcs, // LazUtils - LazUTF8, LazFileCache, LazFileUtils, LazUtilities, AvgLvlTree, LazDbgLog; + LazUTF8, LazFileCache, LazFileUtils, LazUtilities, LazStringUtils, LazDbgLog, + AvgLvlTree; // verbosity { $DEFINE CTDEBUG} diff --git a/components/ideintf/srceditorintf.pas b/components/ideintf/srceditorintf.pas index 4c9ea7f920..392a614c4c 100644 --- a/components/ideintf/srceditorintf.pas +++ b/components/ideintf/srceditorintf.pas @@ -16,9 +16,9 @@ interface uses Classes, SysUtils, // LCL - LCLProc, LCLType, Forms, Controls, Graphics, + LCLType, Forms, Controls, Graphics, // LazUtils - FileUtil, Laz2_XMLCfg, + FileUtil, Laz2_XMLCfg, LazStringUtils, // IdeIntf ProjectIntf, IDECommands; diff --git a/components/lazutils/lazlogger.pas b/components/lazutils/lazlogger.pas index 437b3445d0..a41aed3f74 100644 --- a/components/lazutils/lazlogger.pas +++ b/components/lazutils/lazlogger.pas @@ -15,7 +15,7 @@ interface uses Classes, SysUtils, types, math, // LazUtils - LazLoggerBase, LazClasses, LazFileUtils, LazUtilities, LazUTF8; + LazLoggerBase, LazClasses, LazFileUtils, LazStringUtils, LazUTF8; type diff --git a/components/lazutils/lazstringutils.pas b/components/lazutils/lazstringutils.pas index 4572afc8b1..7950ed0468 100644 --- a/components/lazutils/lazstringutils.pas +++ b/components/lazutils/lazstringutils.pas @@ -37,8 +37,14 @@ type const EndOfLine: shortstring = LineEnding; +// Functions for line endings function LineEndingCount(const Txt: string; var LengthOfLastLine: integer): integer; function ChangeLineEndings(const s, NewLineEnding: string): string; +function LineBreaksToSystemLineBreaks(const s: string): string; +function LineBreaksToDelimiter(const s: string; Delimiter: char): string; +function ConvertLineEndings(const s: string): string; + +// Conversions function TabsToSpaces(const s: string; TabWidth: integer; UseUTF8: boolean): string; //function CommentLines(const s: string): string; function CommentText(const s: string; CommentType: TCommentType): string; @@ -47,13 +53,14 @@ function CommentText(const s: string; CommentType: TCommentType): string; // const SpecialChars: string): string; function SimpleSyntaxToRegExpr(const Src: string): string; function BinaryStrToText(const s: string): string; +function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string; +function SpecialCharsToHex(const s: string): string; +function BreakString(const s: string; MaxLineLength, Indent: integer): string; + +// Conversions to and from a StringList function SplitString(const s: string; Delimiter: char): TStrings; procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings; ClearList: boolean = true); -function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string; -function SpecialCharsToHex(const s: string): string; -function LineBreaksToSystemLineBreaks(const s: string): string; -function LineBreaksToDelimiter(const s: string; Delimiter: char): string; function StringListToText(List: TStrings; const Delimiter: string; IgnoreEmptyLines: boolean = false): string; function StringListPartToText(List: TStrings; FromIndex, ToIndex: integer; @@ -63,6 +70,15 @@ function StringListToString(List: TStrings; FromIndex, ToIndex: integer; IgnoreEmptyLines: boolean = false): string; procedure StringToStringList(const s: string; List: TStrings); +// Text with delimiters +function GetNextDelimitedItem(const List: string; Delimiter: char; + var Position: integer): string; +function HasDelimitedItem(const List: string; Delimiter: char; FindItem: string + ): boolean; +function FindNextDelimitedItem(const List: string; Delimiter: char; + var Position: integer; FindItem: string): string; +function MergeWithDelimiter(const a, b: string; Delimiter: char): string; + implementation @@ -143,6 +159,59 @@ begin //if Src-1<>@s[length(s)] then RaiseGDBException(''); end; +function LineBreaksToSystemLineBreaks(const s: string): string; +begin + Result:=ChangeLineEndings(s,LineEnding); +end; + +function LineBreaksToDelimiter(const s: string; Delimiter: char): string; +var + p: Integer; + StartPos: LongInt; +begin + Result:=s; + p:=1; + while (p<=length(Result)) do begin + if Result[p] in [#10,#13] then begin + StartPos:=p; + repeat + inc(p); + until (p>length(Result)) or (not (Result[p] in [#10,#13])); + if p<=length(Result) then + Result:=copy(Result,1,StartPos-1)+Delimiter+copy(Result,p,length(Result)) + else + Result:=copy(Result,1,StartPos-1); + end else begin + inc(p); + end; + end; +end; + +function ConvertLineEndings(const s: string): string; +var + i: Integer; + EndingStart: LongInt; +begin + Result:=s; + i:=1; + while (i<=length(Result)) do begin + if Result[i] in [#10,#13] then begin + EndingStart:=i; + inc(i); + if (i<=length(Result)) and (Result[i] in [#10,#13]) + and (Result[i]<>Result[i-1]) then + inc(i); + if (length(LineEnding)<>i-EndingStart) + or (LineEnding<>copy(Result,EndingStart,length(LineEnding))) then begin + // line end differs => replace with current LineEnding + Result:=copy(Result,1,EndingStart-1)+LineEnding+copy(Result,i,length(Result)); + i:=EndingStart+length(LineEnding); + end; + end else + inc(i); + end; +end; + function TabsToSpaces(const s: string; TabWidth: integer; UseUTF8: boolean): string; // Convert all tabs to TabWidth number of spaces. @@ -602,37 +671,6 @@ begin RaiseGDBException('ERROR: BinaryStrToText: '+IntToStr(NewLen)+'<>'+IntToStr(NewPos-1)); end; -function SplitString(const s: string; Delimiter: char): TStrings; -begin - Result:=TStringList.Create; - SplitString(s,Delimiter,Result,false); -end; - -procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings; - ClearList: boolean); -var - SLen: Integer; - StartPos: Integer; - EndPos: Integer; -begin - if ClearList then - AddTo.Clear; - SLen:=length(s); - StartPos:=1; - EndPos:=1; - repeat - if (EndPos<=sLen) and (s[EndPos]<>Delimiter) then - inc(EndPos) - else begin - if EndPos>StartPos then - AddTo.Add(copy(s,StartPos,EndPos-StartPos)); - StartPos:=EndPos+1; - if StartPos>sLen then exit; - inc(EndPos); - end; - until false; -end; - function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string; // Converts illegal characters to spaces. Trim leading and trailing spaces. var @@ -676,32 +714,116 @@ begin +copy(Result,i+1,length(Result)); end; -function LineBreaksToSystemLineBreaks(const s: string): string; +function BreakString(const s: string; MaxLineLength, Indent: integer): string; +var + SrcLen: Integer; + APos: Integer; + Src: String; + SplitPos: Integer; + CurMaxLineLength: Integer; begin - Result:=ChangeLineEndings(s,LineEnding); + Result:=''; + Src:=s; + CurMaxLineLength:=MaxLineLength; + if Indent>MaxLineLength-2 then + Indent:=MaxLineLength-2; + if Indent<0 then + MaxLineLength:=0; + repeat + SrcLen:=length(Src); + if SrcLen<=CurMaxLineLength then begin + Result:=Result+Src; + break; + end; + // split line + SplitPos:=0; + // search new line chars + APos:=1; + while (APos<=CurMaxLineLength) do begin + if Src[APos] in [#13,#10] then begin + SplitPos:=APos; + break; + end; + inc(APos); + end; + // search a space boundary + if SplitPos=0 then begin + APos:=CurMaxLineLength; + while APos>1 do begin + if (Src[APos-1] in [' ',#9]) + and (not (Src[APos] in [' ',#9])) then begin + SplitPos:=APos; + break; + end; + dec(APos); + end; + end; + // search a word boundary + if SplitPos=0 then begin + APos:=CurMaxLineLength; + while APos>1 do begin + if (Src[APos] in ['A'..'Z','a'..'z']) + and (not (Src[APos-1] in ['A'..'Z','a'..'z'])) then begin + SplitPos:=APos; + break; + end; + dec(APos); + end; + end; + if SplitPos=0 then begin + // no word boundary found -> split chars + SplitPos:=CurMaxLineLength; + end; + // append part and newline + if (SplitPos<=SrcLen) and (Src[SplitPos] in [#10,#13]) then begin + // there is already a new line char at position + inc(SplitPos); + if (SplitPos<=SrcLen) and (Src[SplitPos] in [#10,#13]) + and (Src[SplitPos]<>Src[SplitPos-1]) then + inc(SplitPos); + Result:=Result+copy(Src,1,SplitPos-1); + end else begin + Result:=Result+copy(Src,1,SplitPos-1)+LineEnding; + end; + // append indent + if Indent>0 then + Result:=Result+StringOfChar(' ',Indent); + // calculate new LineLength + CurMaxLineLength:=MaxLineLength-Indent; + // cut string + Src:=copy(Src,SplitPos,length(Src)-SplitPos+1); + until false; end; -function LineBreaksToDelimiter(const s: string; Delimiter: char): string; -var - p: Integer; - StartPos: LongInt; +function SplitString(const s: string; Delimiter: char): TStrings; begin - Result:=s; - p:=1; - while (p<=length(Result)) do begin - if Result[p] in [#10,#13] then begin - StartPos:=p; - repeat - inc(p); - until (p>length(Result)) or (not (Result[p] in [#10,#13])); - if p<=length(Result) then - Result:=copy(Result,1,StartPos-1)+Delimiter+copy(Result,p,length(Result)) - else - Result:=copy(Result,1,StartPos-1); - end else begin - inc(p); + Result:=TStringList.Create; + SplitString(s,Delimiter,Result,false); +end; + +procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings; + ClearList: boolean); +var + SLen: Integer; + StartPos: Integer; + EndPos: Integer; +begin + if ClearList then + AddTo.Clear; + SLen:=length(s); + StartPos:=1; + EndPos:=1; + repeat + if (EndPos<=sLen) and (s[EndPos]<>Delimiter) then + inc(EndPos) + else begin + if EndPos>StartPos then + AddTo.Add(copy(s,StartPos,EndPos-StartPos)); + StartPos:=EndPos+1; + if StartPos>sLen then exit; + inc(EndPos); end; - end; + until false; end; function StringListToText(List: TStrings; const Delimiter: string; @@ -880,5 +1002,47 @@ begin end; end; +function GetNextDelimitedItem(const List: string; Delimiter: char; + var Position: integer): string; +var + StartPos: LongInt; +begin + StartPos:=Position; + while (Position<=length(List)) and (List[Position]<>Delimiter) do + inc(Position); + Result:=copy(List,StartPos,Position-StartPos); + if Position<=length(List) then inc(Position); // skip Delimiter +end; + +function HasDelimitedItem(const List: string; Delimiter: char; FindItem: string + ): boolean; +var + p: Integer; +begin + p:=1; + Result:=FindNextDelimitedItem(List,Delimiter,p,FindItem)<>''; +end; + +function FindNextDelimitedItem(const List: string; Delimiter: char; + var Position: integer; FindItem: string): string; +begin + while Position<=length(List) do begin + Result:=GetNextDelimitedItem(List,Delimiter,Position); + if Result=FindItem then exit; + end; + Result:=''; +end; + +function MergeWithDelimiter(const a, b: string; Delimiter: char): string; +begin + if a<>'' then begin + if b<>'' then + Result:=a+Delimiter+b + else + Result:=a; + end else + Result:=b; +end; + end. diff --git a/components/lazutils/lazutilities.pas b/components/lazutils/lazutilities.pas index 9589c1098c..49125fcacc 100644 --- a/components/lazutils/lazutilities.pas +++ b/components/lazutils/lazutilities.pas @@ -25,16 +25,6 @@ function CompareBoolean(b1, b2: boolean): integer; procedure MergeSortWithLen(List: PPointer; ListLength: PtrInt; const Compare: TListSortCompare); -function GetNextDelimitedItem(const List: string; Delimiter: char; - var Position: integer): string; -function HasDelimitedItem(const List: string; Delimiter: char; FindItem: string - ): boolean; -function FindNextDelimitedItem(const List: string; Delimiter: char; - var Position: integer; FindItem: string): string; -function MergeWithDelimiter(const a, b: string; Delimiter: char): string; -function BreakString(const s: string; MaxLineLength, Indent: integer): string; -function ConvertLineEndings(const s: string): string; - var ConsoleVerbosity: integer = 0; // 0=normal, -1=quiet, 1=verbose, 2=very verbose @@ -141,153 +131,5 @@ begin end; end; -function GetNextDelimitedItem(const List: string; Delimiter: char; - var Position: integer): string; -var - StartPos: LongInt; -begin - StartPos:=Position; - while (Position<=length(List)) and (List[Position]<>Delimiter) do - inc(Position); - Result:=copy(List,StartPos,Position-StartPos); - if Position<=length(List) then inc(Position); // skip Delimiter -end; - -function HasDelimitedItem(const List: string; Delimiter: char; FindItem: string - ): boolean; -var - p: Integer; -begin - p:=1; - Result:=FindNextDelimitedItem(List,Delimiter,p,FindItem)<>''; -end; - -function FindNextDelimitedItem(const List: string; Delimiter: char; - var Position: integer; FindItem: string): string; -begin - while Position<=length(List) do begin - Result:=GetNextDelimitedItem(List,Delimiter,Position); - if Result=FindItem then exit; - end; - Result:=''; -end; - -function MergeWithDelimiter(const a, b: string; Delimiter: char): string; -begin - if a<>'' then begin - if b<>'' then - Result:=a+Delimiter+b - else - Result:=a; - end else - Result:=b; -end; - -function BreakString(const s: string; MaxLineLength, Indent: integer): string; -var - SrcLen: Integer; - APos: Integer; - Src: String; - SplitPos: Integer; - CurMaxLineLength: Integer; -begin - Result:=''; - Src:=s; - CurMaxLineLength:=MaxLineLength; - if Indent>MaxLineLength-2 then - Indent:=MaxLineLength-2; - if Indent<0 then - MaxLineLength:=0; - repeat - SrcLen:=length(Src); - if SrcLen<=CurMaxLineLength then begin - Result:=Result+Src; - break; - end; - // split line - SplitPos:=0; - // search new line chars - APos:=1; - while (APos<=CurMaxLineLength) do begin - if Src[APos] in [#13,#10] then begin - SplitPos:=APos; - break; - end; - inc(APos); - end; - // search a space boundary - if SplitPos=0 then begin - APos:=CurMaxLineLength; - while APos>1 do begin - if (Src[APos-1] in [' ',#9]) - and (not (Src[APos] in [' ',#9])) then begin - SplitPos:=APos; - break; - end; - dec(APos); - end; - end; - // search a word boundary - if SplitPos=0 then begin - APos:=CurMaxLineLength; - while APos>1 do begin - if (Src[APos] in ['A'..'Z','a'..'z']) - and (not (Src[APos-1] in ['A'..'Z','a'..'z'])) then begin - SplitPos:=APos; - break; - end; - dec(APos); - end; - end; - if SplitPos=0 then begin - // no word boundary found -> split chars - SplitPos:=CurMaxLineLength; - end; - // append part and newline - if (SplitPos<=SrcLen) and (Src[SplitPos] in [#10,#13]) then begin - // there is already a new line char at position - inc(SplitPos); - if (SplitPos<=SrcLen) and (Src[SplitPos] in [#10,#13]) - and (Src[SplitPos]<>Src[SplitPos-1]) then - inc(SplitPos); - Result:=Result+copy(Src,1,SplitPos-1); - end else begin - Result:=Result+copy(Src,1,SplitPos-1)+LineEnding; - end; - // append indent - if Indent>0 then - Result:=Result+StringOfChar(' ',Indent); - // calculate new LineLength - CurMaxLineLength:=MaxLineLength-Indent; - // cut string - Src:=copy(Src,SplitPos,length(Src)-SplitPos+1); - until false; -end; - -function ConvertLineEndings(const s: string): string; -var - i: Integer; - EndingStart: LongInt; -begin - Result:=s; - i:=1; - while (i<=length(Result)) do begin - if Result[i] in [#10,#13] then begin - EndingStart:=i; - inc(i); - if (i<=length(Result)) and (Result[i] in [#10,#13]) - and (Result[i]<>Result[i-1]) then - inc(i); - if (length(LineEnding)<>i-EndingStart) - or (LineEnding<>copy(Result,EndingStart,length(LineEnding))) then begin - // line end differs => replace with current LineEnding - Result:=copy(Result,1,EndingStart-1)+LineEnding+copy(Result,i,length(Result)); - i:=EndingStart+length(LineEnding); - end; - end else - inc(i); - end; -end; - end. diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 88f4c01d18..fa9745f54f 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -43,7 +43,7 @@ uses FileProcs, CodeToolsCfgScript, LinkScanner, // LazUtils LConvEncoding, FileUtil, LazFileUtils, LazFileCache, LazUTF8, Laz2_XMLCfg, - LazUtilities, LazMethodList, + LazUtilities, LazStringUtils, LazMethodList, // IDEIntf BaseIDEIntf, IDEOptionsIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf, CompOptsIntf, LazIDEIntf, MacroDefIntf, IDEMsgIntf, PackageDependencyIntf, diff --git a/ide/buildprojectdlg.pas b/ide/buildprojectdlg.pas index 877d034ffd..83ba9fe7a4 100644 --- a/ide/buildprojectdlg.pas +++ b/ide/buildprojectdlg.pas @@ -32,7 +32,7 @@ uses // LCL Forms, Controls, Dialogs, ButtonPanel, StdCtrls, ComCtrls, Masks, LCLIntf, // LazUtils - LazFileUtils, LazFileCache, LazUtilities, AvgLvlTree, + LazFileUtils, LazFileCache, LazStringUtils, AvgLvlTree, // codetools FileProcs, CodeToolManager, DirectoryCacher, // IDEIntf diff --git a/ide/codebrowser.pas b/ide/codebrowser.pas index a1ff8c5c94..4fdf9d3c9e 100644 --- a/ide/codebrowser.pas +++ b/ide/codebrowser.pas @@ -54,7 +54,7 @@ uses BasicCodeTools, DefineTemplates, CodeTree, CodeCache, CodeToolManager, PascalParserTool, LinkScanner, FileProcs, CodeIndex, StdCodeTools, SourceLog, // LazUtils - LazFileUtils, LazUtilities, AvgLvlTree, + LazFileUtils, LazStringUtils, AvgLvlTree, // IDEIntf IDEWindowIntf, SrcEditorIntf, IDEMsgIntf, IDEDialogs, LazConfigStorage, IDEHelpIntf, PackageIntf, IDECommands, LazIDEIntf, IDEExternToolIntf, diff --git a/ide/codetoolsdefines.pas b/ide/codetoolsdefines.pas index 1ea0942a5c..711d547a70 100644 --- a/ide/codetoolsdefines.pas +++ b/ide/codetoolsdefines.pas @@ -44,14 +44,12 @@ unit CodeToolsDefines; interface uses - //Classes, SysUtils, Math, LCLIntf, Forms, Controls, Buttons, StdCtrls, - //ComCtrls, LCLType, ExtCtrls, Menus, LCLProc, Graphics, Dialogs, ButtonPanel, Classes, SysUtils, Math, // LCL LCLType, LCLIntf, Forms, Controls, Buttons, StdCtrls, ComCtrls, ExtCtrls, Menus, Graphics, Dialogs, ButtonPanel, // LazUtils - LazFileUtils, LazLogger, LazUtilities, + LazFileUtils, LazLogger, LazStringUtils, // SynEdit SynEdit, // Codetools diff --git a/ide/fpdoceditwindow.pas b/ide/fpdoceditwindow.pas index 89d503f8ae..40ee143d8e 100644 --- a/ide/fpdoceditwindow.pas +++ b/ide/fpdoceditwindow.pas @@ -33,7 +33,7 @@ uses // FCL Classes, SysUtils, // LazUtils - Laz2_DOM, Laz2_XMLRead, LazUtilities, LazTracer, + Laz2_DOM, Laz2_XMLRead, LazStringUtils, LazTracer, // LCL LResources, StdCtrls, Buttons, ComCtrls, Controls, Dialogs, ExtCtrls, Forms, Graphics, LCLType, LCLProc, diff --git a/ide/frames/compiler_config_target.pas b/ide/frames/compiler_config_target.pas index 42f7c02294..3a9ab0e227 100644 --- a/ide/frames/compiler_config_target.pas +++ b/ide/frames/compiler_config_target.pas @@ -32,7 +32,7 @@ uses // LCL Controls, Dialogs, Graphics, StdCtrls, // LazUtils - LazFileUtils, LazUtilities, + LazFileUtils, LazStringUtils, // CodeTools DefineTemplates, // IdeIntf diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index 74f6db4dab..13a1297088 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -40,7 +40,7 @@ uses // CodeTools BasicCodeTools, FileProcs, CodeToolManager, CodeToolsConfig, CodeCache, // IDE - IDECmdLine, LazConf; + LazConf; type // copy diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index 51cd559745..a4ba41de25 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -32,14 +32,14 @@ uses Interfaces, // this includes the NoGUI widgetset // LazUtils Masks, LConvEncoding, FileUtil, LazFileUtils, LazLoggerBase, LazUtilities, - LazUTF8, Laz2_XMLCfg, UITypes, + LazUTF8, Laz2_XMLCfg, UITypes, LazStringUtils, // LCL LCLPlatformDef, Forms, // Codetools CodeCache, CodeToolManager, DefineTemplates, FileProcs, // IDEIntf BaseIDEIntf, MacroIntf, PackageIntf, LazMsgDialogs, ProjectIntf, IDEExternToolIntf, - CompOptsIntf, IDEOptionsIntf, LazIDEIntf, PackageDependencyIntf, + CompOptsIntf, IDEOptionsIntf, PackageDependencyIntf, // IDE IDEProcs, InitialSetupProc, ExtTools, CompilerOptions, ApplicationBundle, TransferMacros, EnvironmentOpts, IDETranslations, diff --git a/ide/sourceeditprocs.pas b/ide/sourceeditprocs.pas index 62458b8d8c..00001ae3e6 100644 --- a/ide/sourceeditprocs.pas +++ b/ide/sourceeditprocs.pas @@ -40,7 +40,7 @@ uses // LCL LCLType, Graphics, Controls, // LazUtils - LazFileUtils, LazUtilities, + LazFileUtils, LazStringUtils, // SynEdit SynCompletion, // CodeTools diff --git a/ide/unitdependencies.pas b/ide/unitdependencies.pas index 305b66476a..d07986279a 100644 --- a/ide/unitdependencies.pas +++ b/ide/unitdependencies.pas @@ -43,7 +43,7 @@ uses CodeToolManager, DefineTemplates, CTUnitGraph, CTUnitGroupGraph, FileProcs, CodeCache, AvgLvlTree, // LazUtils - LazLoggerBase, LazFileUtils, LazFileCache, LazUtilities, LazUTF8, LvlGraphCtrl, + LazLoggerBase, LazFileUtils, LazFileCache, LazStringUtils, LazUTF8, LvlGraphCtrl, // IDE interface LazIDEIntf, ProjectIntf, IDEWindowIntf, PackageIntf, SrcEditorIntf, IDEImagesIntf, IDEMsgIntf, IDEExternToolIntf, IDECommands, IDEDialogs, diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index 4794756286..bf0bcdbb39 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -24,11 +24,11 @@ uses // RTL + FCL Types, typinfo, Classes, SysUtils, // LCL - LMessages, LResources, LCLIntf, InterfaceBase, LCLStrConsts, LCLType, LCLProc, + LMessages, LResources, LCLIntf, InterfaceBase, LCLStrConsts, LCLType, Forms, Controls, Themes, GraphType, Graphics, Buttons, ButtonPanel, StdCtrls, ExtCtrls, LCLClasses, ClipBrd, Menus, LCLTaskDialog, // LazUtils - UITypes, FileUtil, LazFileUtils; + UITypes, FileUtil, LazFileUtils, LazStringUtils, LazLoggerBase; type // Aliases for types in UITypes. diff --git a/lcl/interfaces/carbon/carbonstrings.pp b/lcl/interfaces/carbon/carbonstrings.pp index 6d717c7956..8d18e4e4da 100644 --- a/lcl/interfaces/carbon/carbonstrings.pp +++ b/lcl/interfaces/carbon/carbonstrings.pp @@ -28,7 +28,7 @@ uses // LCL LCLProc, LCLType, Graphics, Controls, StdCtrls, // LazUtils - LazUtf8Classes, TextStrings, + LazUtf8Classes, TextStrings, LazStringUtils, // LCL Carbon CarbonEdits, CarbonListViews; diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index 57396cc2ef..6b1e3dce58 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -39,7 +39,7 @@ uses {$EndIf} gdk2pixbuf, gtk2, gdk2, glib2, Pango, // LazUtils - LazFileUtils, LazUTF8, DynHashArray, Maps, IntegerList, LazLoggerBase, LazUtilities, + LazFileUtils, LazUTF8, DynHashArray, Maps, IntegerList, LazLoggerBase, LazStringUtils, // LCL Dialogs, Controls, Forms, LCLStrConsts, LMessages, LCLProc, LCLIntf, LCLType, GraphType, GraphMath, diff --git a/lcl/interfaces/qt/qtint.pp b/lcl/interfaces/qt/qtint.pp index d16ed43771..cfc0033832 100644 --- a/lcl/interfaces/qt/qtint.pp +++ b/lcl/interfaces/qt/qtint.pp @@ -38,7 +38,7 @@ uses // FPC Classes, SysUtils, Math, Types, // LazUtils - LazUTF8, Maps, LazUtilities, + LazUTF8, Maps, LazStringUtils, // LCL LCLPlatformDef, InterfaceBase, LCLProc, LCLType, LCLIntf, LMessages, LCLMessageGlue, LCLStrConsts, diff --git a/lcl/interfaces/qt5/qtint.pp b/lcl/interfaces/qt5/qtint.pp index 6103300381..b4def9a91a 100644 --- a/lcl/interfaces/qt5/qtint.pp +++ b/lcl/interfaces/qt5/qtint.pp @@ -37,7 +37,7 @@ uses // FPC Classes, SysUtils, Math, Types, maps, // LazUtils - LazUtilities, + LazStringUtils, // LCL InterfaceBase, LCLPlatformDef, LCLProc, LazUTF8, LCLType, LMessages, LCLMessageGlue, LCLStrConsts, Controls, ExtCtrls, Forms, diff --git a/lcl/lclproc.pas b/lcl/lclproc.pas index 08713ce095..19386185d5 100644 --- a/lcl/lclproc.pas +++ b/lcl/lclproc.pas @@ -244,7 +244,6 @@ procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string); overload procedure CloseDebugOutput; {$ENDIF} -function ConvertLineEndings(const s: string): string; inline; function DbgS(const c: cardinal): string; overload; inline; function DbgS(const i: longint): string; overload; inline; function DbgS(const i: int64): string; overload; inline; @@ -1838,11 +1837,6 @@ begin end; {$ENDIF} -function ConvertLineEndings(const s: string): string; -begin - Result:=LazUtilities.ConvertLineEndings(s); -end; - function DbgS(const c: cardinal): string; begin Result:=LazLoggerBase.DbgS(c); diff --git a/packager/openinstalledpkgdlg.pas b/packager/openinstalledpkgdlg.pas index bd28a6a7ee..7493359461 100644 --- a/packager/openinstalledpkgdlg.pas +++ b/packager/openinstalledpkgdlg.pas @@ -35,7 +35,7 @@ uses // LCL Forms, Controls, ComCtrls, StdCtrls, ExtCtrls, LCLType, ButtonPanel, // LazUtils - LazUtilities, + LazStringUtils, // LazControls ListViewFilterEdit, // IdeIntf diff --git a/packager/pkggraphexplorer.pas b/packager/pkggraphexplorer.pas index aa23a71f4a..0b6d017fd6 100644 --- a/packager/pkggraphexplorer.pas +++ b/packager/pkggraphexplorer.pas @@ -42,7 +42,7 @@ uses LCLType, LCLIntf, Forms, Controls, ComCtrls, StdCtrls, ExtCtrls, Menus, ButtonPanel, // LazUtils - LazLoggerBase, LazUtilities, LazTracer, + LazLoggerBase, LazTracer, LazStringUtils, // LazControls LvlGraphCtrl, // IdeIntf