mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 01:27:39 +01:00
IDE: using UTF8CompareText
git-svn-id: trunk@37960 -
This commit is contained in:
parent
413a275982
commit
a99a34ebd2
@ -1804,7 +1804,7 @@ function TDesignerMainMenu.GetDesignerMenuItem(DMenuItem: TDesignerMenuItem;
|
||||
begin
|
||||
Result:=nil;
|
||||
if DMenuItem=nil then exit;
|
||||
if (AnsiCompareText(DMenuItem.ID,Ident)=0) then
|
||||
if (CompareText(DMenuItem.ID,Ident)=0) then
|
||||
Result:=DMenuItem
|
||||
else
|
||||
begin
|
||||
|
||||
@ -402,14 +402,14 @@ end;
|
||||
function IDEDirectiveNameToDirective(const DirectiveName: string): TIDEDirective;
|
||||
begin
|
||||
for Result:=Low(TIDEDirective) to High(TIDEDirective) do
|
||||
if AnsiCompareText(IDEDirectiveNames[Result],DirectiveName)=0 then exit;
|
||||
if CompareText(IDEDirectiveNames[Result],DirectiveName)=0 then exit;
|
||||
Result:=idedNone;
|
||||
end;
|
||||
|
||||
function IDEDirBuildScanFlagNameToFlag(const FlagName: string): TIDEDirBuildScanFlag;
|
||||
begin
|
||||
for Result:=Low(TIDEDirBuildScanFlag) to High(TIDEDirBuildScanFlag) do
|
||||
if AnsiCompareText(IDEDirBuildScanFlagNames[Result],FlagName)=0 then
|
||||
if CompareText(IDEDirBuildScanFlagNames[Result],FlagName)=0 then
|
||||
exit;
|
||||
Result:=idedbsfNone;
|
||||
end;
|
||||
@ -443,7 +443,7 @@ end;
|
||||
function IDEDirRunFlagNameToFlag(const FlagName: string): TIDEDirRunFlag;
|
||||
begin
|
||||
for Result:=Low(TIDEDirRunFlag) to High(TIDEDirRunFlag) do
|
||||
if AnsiCompareText(IDEDirRunFlagNames[Result],FlagName)=0 then
|
||||
if CompareText(IDEDirRunFlagNames[Result],FlagName)=0 then
|
||||
exit;
|
||||
Result:=idedrfNone;
|
||||
end;
|
||||
|
||||
@ -29,9 +29,9 @@ unit BuildModeDiffDlg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
|
||||
StdCtrls, ComCtrls,
|
||||
LazarusIDEStrConsts, Project, CompilerOptions, CompOptsModes;
|
||||
Classes, SysUtils, FileUtil, LazUTF8, Forms, Controls, Graphics, Dialogs,
|
||||
ButtonPanel, StdCtrls, ComCtrls, LazarusIDEStrConsts, Project,
|
||||
CompilerOptions, CompOptsModes;
|
||||
|
||||
type
|
||||
|
||||
@ -94,7 +94,7 @@ var
|
||||
begin
|
||||
if fProject<>nil then
|
||||
for i:=0 to fProject.BuildModes.Count-1 do
|
||||
if SysUtils.AnsiCompareText(fProject.BuildModes[i].GetCaption,ModeComboBox.Text)=0
|
||||
if UTF8CompareText(fProject.BuildModes[i].GetCaption,ModeComboBox.Text)=0
|
||||
then begin
|
||||
fBaseMode:=fProject.BuildModes[i];
|
||||
FillDiffTreeView;
|
||||
|
||||
@ -31,11 +31,11 @@ unit BuildProfileManager;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Laz2_XMLCfg, LazLogger, LazFileUtils, LResources,
|
||||
Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons, StdCtrls, ComCtrls,
|
||||
Contnrs, ButtonPanel, DefineTemplates, IDEImagesIntf, IDEMsgIntf, IDEHelpIntf,
|
||||
IDEDialogs, LazarusIDEStrConsts, LazConf, InterfaceBase, IDEProcs,
|
||||
TransferMacros, CompilerOptions, EnvironmentOpts;
|
||||
Classes, SysUtils, FileUtil, Laz2_XMLCfg, LazLogger, LazFileUtils, LazUTF8,
|
||||
LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons, StdCtrls,
|
||||
ComCtrls, Contnrs, ButtonPanel, DefineTemplates, IDEImagesIntf, IDEMsgIntf,
|
||||
IDEHelpIntf, IDEDialogs, LazarusIDEStrConsts, LazConf, InterfaceBase,
|
||||
IDEProcs, TransferMacros, CompilerOptions, EnvironmentOpts;
|
||||
|
||||
type
|
||||
|
||||
@ -354,7 +354,7 @@ end;
|
||||
function TBuildLazarusProfiles.IndexByName(AName: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(Items[Result].Name,AName)<>0) do
|
||||
while (Result>=0) and (UTF8CompareText(Items[Result].Name,AName)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -464,7 +464,7 @@ begin
|
||||
TokenStartX:=length(s)+1;
|
||||
j:=length(TemplateName);
|
||||
while (j>0)
|
||||
and (AnsiCompareText(copy(TemplateName,1,j),copy(s,TokenStartX-j,j))<>0) do
|
||||
and (UTF8CompareText(copy(TemplateName,1,j),copy(s,TokenStartX-j,j))<>0) do
|
||||
dec(j);
|
||||
dec(TokenStartX,j);
|
||||
AEditor.BlockBegin := Point(TokenStartX, p.y);
|
||||
|
||||
@ -1557,7 +1557,7 @@ end;
|
||||
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
|
||||
begin
|
||||
for Result := Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do
|
||||
if (AnsiCompareText(s, LazSyntaxHighlighterNames[Result]) = 0) then
|
||||
if (CompareText(s, LazSyntaxHighlighterNames[Result]) = 0) then
|
||||
exit;
|
||||
Result := lshFreePascal;
|
||||
end;
|
||||
@ -2464,7 +2464,7 @@ end;
|
||||
function TEditOptLangList.FindByName(const Name: String): Integer;
|
||||
begin
|
||||
Result := Count - 1;
|
||||
while (Result >= 0) and (AnsiCompareText(
|
||||
while (Result >= 0) and (UTF8CompareText(
|
||||
Items[Result].SynClass.GetLanguageName, Name) <> 0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
@ -421,7 +421,7 @@ var
|
||||
begin
|
||||
i:=TypeRadiogroup.ItemIndex;
|
||||
for Result:=Low(TEncloseSelectionType) to High(TEncloseSelectionType) do
|
||||
if AnsiCompareText(TypeRadiogroup.Items[i],
|
||||
if UTF8CompareText(TypeRadiogroup.Items[i],
|
||||
EncloseSelectionTypeDescription(Result))=0
|
||||
then
|
||||
exit;
|
||||
|
||||
@ -166,7 +166,7 @@ procedure TEditorMouseOptionsAdvFrame.ActionGridCompareCells(Sender: TObject; AC
|
||||
Result := ord(TSynEditMouseAction(TStringGrid(Sender).Objects[0, BRow]).ClickDir)
|
||||
- ord(TSynEditMouseAction(TStringGrid(Sender).Objects[0, ARow]).ClickDir);
|
||||
else
|
||||
Result := AnsiCompareText(TStringGrid(Sender).Cells[i, ARow], TStringGrid(Sender).Cells[i, BRow]);
|
||||
Result := UTF8CompareText(TStringGrid(Sender).Cells[i, ARow], TStringGrid(Sender).Cells[i, BRow]);
|
||||
end;
|
||||
end;
|
||||
var
|
||||
|
||||
@ -93,7 +93,7 @@ begin
|
||||
cmp := 1;
|
||||
while (NewPos < FormsAvailFormsListBox.Items.Count) do
|
||||
begin
|
||||
cmp := AnsiCompareText(FormsAvailFormsListBox.Items[NewPos], OldFormName);
|
||||
cmp := CompareText(FormsAvailFormsListBox.Items[NewPos], OldFormName);
|
||||
if cmp < 0 then
|
||||
Inc(NewPos)
|
||||
else
|
||||
@ -222,7 +222,7 @@ var
|
||||
p := Pos(':', FormsAutoCreatedListBox.Items[Result]);
|
||||
if p < 1 then
|
||||
p := Length(FormsAutoCreatedListBox.Items[Result]) + 1;
|
||||
if AnsiCompareText(copy(FormsAutoCreatedListBox.Items[Result], 1, p - 1),
|
||||
if CompareText(copy(FormsAutoCreatedListBox.Items[Result], 1, p - 1),
|
||||
FormName) = 0 then
|
||||
Exit;
|
||||
Dec(Result);
|
||||
|
||||
@ -265,7 +265,7 @@ procedure CheckList(List: TList; TestListNil, TestDoubles, TestNils: boolean);
|
||||
procedure CheckList(List: TFPList; TestListNil, TestDoubles, TestNils: boolean);
|
||||
procedure CheckEmptyListCut(List1, List2: TList);
|
||||
procedure RemoveDoubles(List: TStrings);
|
||||
function AnsiSearchInStringList(List: TStrings; const s: string): integer;
|
||||
function UTF8SearchInStringList(List: TStrings; const s: string): integer;
|
||||
procedure ReverseList(List: TList);
|
||||
procedure ReverseList(List: TFPList);
|
||||
procedure FreeListObjects(List: TList; FreeList: boolean);
|
||||
@ -1365,13 +1365,13 @@ begin
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
function AnsiSearchInStringList(List: TStrings; const s: string): integer;
|
||||
function UTF8SearchInStringList(List: TStrings; const s: string): integer;
|
||||
-------------------------------------------------------------------------------}
|
||||
function AnsiSearchInStringList(List: TStrings; const s: string): integer;
|
||||
function UTF8SearchInStringList(List: TStrings; const s: string): integer;
|
||||
begin
|
||||
if List=nil then exit(-1);
|
||||
Result:=List.Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(List[Result],s)<>0) do dec(Result);
|
||||
while (Result>=0) and (UTF8CompareText(List[Result],s)<>0) do dec(Result);
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
@ -2751,7 +2751,7 @@ begin
|
||||
for i:=0 to List.Count-1 do begin
|
||||
case Cmp of
|
||||
cstCaseSensitive: if List[i]=s then exit(i);
|
||||
cstCaseInsensitive: if AnsiCompareText(List[i],s)=0 then exit(i);
|
||||
cstCaseInsensitive: if UTF8CompareText(List[i],s)=0 then exit(i);
|
||||
cstFilename: if CompareFilenames(List[i],s)=0 then exit(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -930,7 +930,7 @@ end;
|
||||
function THistoryLists.IndexOfName(const Name: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(Items[Result].Name,Name)<>0) do
|
||||
while (Result>=0) and (UTF8CompareText(Items[Result].Name,Name)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
|
||||
10
ide/main.pp
10
ide/main.pp
@ -7404,7 +7404,7 @@ begin
|
||||
GetFixupReferenceNames(CurRoot,ReferenceRootNames);
|
||||
for j:=0 to ReferenceRootNames.Count-1 do begin
|
||||
RefRootName:=ReferenceRootNames[j];
|
||||
if AnsiSearchInStringList(LoadingReferenceNames,RefRootName)>=0
|
||||
if UTF8SearchInStringList(LoadingReferenceNames,RefRootName)>=0
|
||||
then
|
||||
continue;
|
||||
ReferenceInstanceNames.Clear;
|
||||
@ -12029,12 +12029,12 @@ begin
|
||||
try
|
||||
if not CodeToolBoss.FindUsedUnitNames(MainUnitInfo.Source,
|
||||
MainUsesSection,ImplementationUsesSection) then exit;
|
||||
if (AnsiSearchInStringList(MainUsesSection,'forms')<0)
|
||||
and (AnsiSearchInStringList(ImplementationUsesSection,'forms')<0) then
|
||||
if (UTF8SearchInStringList(MainUsesSection,'forms')<0)
|
||||
and (UTF8SearchInStringList(ImplementationUsesSection,'forms')<0) then
|
||||
exit;
|
||||
// project uses lcl unit Forms
|
||||
if (AnsiSearchInStringList(MainUsesSection,'interfaces')>=0)
|
||||
or (AnsiSearchInStringList(ImplementationUsesSection,'interfaces')>=0) then
|
||||
if (UTF8SearchInStringList(MainUsesSection,'interfaces')>=0)
|
||||
or (UTF8SearchInStringList(ImplementationUsesSection,'interfaces')>=0) then
|
||||
exit;
|
||||
// project uses lcl unit Forms, but not unit interfaces
|
||||
// this will result in strange linker error
|
||||
|
||||
@ -521,7 +521,7 @@ var
|
||||
begin
|
||||
if Identifier<>'' then begin
|
||||
for i:=0 to ResStrWithSameValuesCombobox.Items.Count-1 do begin
|
||||
if AnsiCompareText(Identifier,ResStrWithSameValuesCombobox.Items[i])=0
|
||||
if CompareText(Identifier,ResStrWithSameValuesCombobox.Items[i])=0
|
||||
then begin
|
||||
Result:=true;
|
||||
exit;
|
||||
|
||||
@ -123,14 +123,14 @@ const
|
||||
function SortDirectionNameToType(const s: string): TSortDirection;
|
||||
begin
|
||||
for Result:=Low(TSortDirection) to High(TSortDirection) do
|
||||
if AnsiCompareText(SortDirectionNames[Result],s)=0 then exit;
|
||||
if CompareText(SortDirectionNames[Result],s)=0 then exit;
|
||||
Result:=sdAscending;
|
||||
end;
|
||||
|
||||
function SortDomainNameToType(const s: string): TSortDomain;
|
||||
begin
|
||||
for Result:=Low(TSortDomain) to High(TSortDomain) do
|
||||
if AnsiCompareText(SortDomainNames[Result],s)=0 then exit;
|
||||
if CompareText(SortDomainNames[Result],s)=0 then exit;
|
||||
Result:=sdLines;
|
||||
end;
|
||||
|
||||
@ -139,14 +139,14 @@ function ResourcestringInsertPolicyNameToType(
|
||||
begin
|
||||
for Result:=Low(TResourcestringInsertPolicy)
|
||||
to High(TResourcestringInsertPolicy) do
|
||||
if AnsiCompareText(ResourcestringInsertPolicyNames[Result],s)=0 then exit;
|
||||
if CompareText(ResourcestringInsertPolicyNames[Result],s)=0 then exit;
|
||||
Result:=rsipAppend;
|
||||
end;
|
||||
|
||||
function FindRenameScopeNameToScope(const s: string): TFindRenameScope;
|
||||
begin
|
||||
for Result:=Low(TFindRenameScope) to High(TFindRenameScope) do
|
||||
if AnsiCompareText(FindRenameScopeNames[Result],s)=0 then exit;
|
||||
if CompareText(FindRenameScopeNames[Result],s)=0 then exit;
|
||||
Result:=frAllOpenProjectsAndPackages;
|
||||
end;
|
||||
|
||||
|
||||
@ -471,7 +471,7 @@ end;
|
||||
function TNewLazIDEItemCategories.IndexOf(const CategoryName: string): integer;
|
||||
begin
|
||||
Result := Count - 1;
|
||||
while (Result >= 0) and (AnsiCompareText(CategoryName, Items[Result].Name) <> 0) do
|
||||
while (Result >= 0) and (UTF8CompareText(CategoryName, Items[Result].Name) <> 0) do
|
||||
Dec(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -4076,9 +4076,9 @@ begin
|
||||
if ((OnlyProjectUnits and Units[Result].IsPartOfProject)
|
||||
or (not OnlyProjectUnits))
|
||||
and (IgnoreUnit<>Units[Result]) then begin
|
||||
if (AnsiCompareText(Units[Result].ComponentName,AComponentName)=0)
|
||||
if (CompareText(Units[Result].ComponentName,AComponentName)=0)
|
||||
or ((Units[Result].Component<>nil)
|
||||
and (AnsiCompareText(Units[Result].Component.Name,AComponentName)=0))
|
||||
and (CompareText(Units[Result].Component.Name,AComponentName)=0))
|
||||
then
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -1074,7 +1074,7 @@ end;
|
||||
function TLazProjectFileDescriptors.IndexOf(const Name: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(Name,Items[Result].Name)<>0) do
|
||||
while (Result>=0) and (UTF8CompareText(Name,Items[Result].Name)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
@ -1198,7 +1198,7 @@ end;
|
||||
function TLazProjectDescriptors.IndexOf(const Name: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(Name,Items[Result].Name)<>0) do
|
||||
while (Result>=0) and (UTF8CompareText(Name,Items[Result].Name)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -1945,7 +1945,7 @@ begin
|
||||
while (x<=length(s)) and (s[x]<>#3) do inc(x);
|
||||
if x<length(s) then begin
|
||||
inc(x,2);
|
||||
if AnsiCompareText(CurStr,copy(s,x,length(CurStr)))=0 then begin
|
||||
if UTF8CompareText(CurStr,copy(s,x,length(CurStr)))=0 then begin
|
||||
APosition:=i;
|
||||
break;
|
||||
end;
|
||||
@ -4006,7 +4006,7 @@ begin
|
||||
else
|
||||
SrcToken:=copy(Line,length(Line)-length(AToken)+1,length(AToken));
|
||||
//DebugLn(['TSourceEditor.AutoCompleteChar ',AToken,' SrcToken=',SrcToken,' CatName=',CatName,' Index=',Manager.CodeTemplateModul.CompletionAttributes[i].IndexOfName(CatName)]);
|
||||
if (AnsiCompareText(AToken,SrcToken)=0)
|
||||
if (UTF8CompareText(AToken,SrcToken)=0)
|
||||
and (Manager.CodeTemplateModul.CompletionAttributes[i].IndexOfName(CatName)>=0)
|
||||
and ( (not FEditor.SelAvail) or
|
||||
(Manager.CodeTemplateModul.CompletionAttributes[i].IndexOfName(
|
||||
@ -9373,7 +9373,7 @@ var
|
||||
for a := 0 to SourceEditorCount - 1 do begin
|
||||
if (SourceEditors[a] <> IgnoreEditor) and
|
||||
(not SourceEditors[a].IsSharedWith(IgnoreEditor)) and
|
||||
(AnsiCompareText(AName, SourceEditors[a].PageName) = 0)
|
||||
(CompareText(AName, SourceEditors[a].PageName) = 0)
|
||||
then begin
|
||||
Result:=true;
|
||||
exit;
|
||||
|
||||
@ -261,7 +261,7 @@ begin
|
||||
m:=0;
|
||||
while l<=r do begin
|
||||
m:=(l+r) shr 1;
|
||||
cmp:=AnsiCompareText(NewMacro.Name,Items[m].Name);
|
||||
cmp:=UTF8CompareText(NewMacro.Name,Items[m].Name);
|
||||
if cmp<0 then
|
||||
r:=m-1
|
||||
else if cmp>0 then
|
||||
@ -269,7 +269,7 @@ begin
|
||||
else
|
||||
break;
|
||||
end;
|
||||
if (m<fItems.Count) and (AnsiCompareText(NewMacro.Name,Items[m].Name)>0) then
|
||||
if (m<fItems.Count) and (UTF8CompareText(NewMacro.Name,Items[m].Name)>0) then
|
||||
inc(m);
|
||||
fItems.Insert(m,NewMacro);
|
||||
//if NewMacro.MacroFunction<>nil then
|
||||
@ -483,7 +483,7 @@ begin
|
||||
while l<=r do begin
|
||||
m:=(l+r) shr 1;
|
||||
Result:=Items[m];
|
||||
cmp:=AnsiCompareText(MacroName,Result.Name);
|
||||
cmp:=UTF8CompareText(MacroName,Result.Name);
|
||||
if cmp<0 then
|
||||
r:=m-1
|
||||
else if cmp>0 then
|
||||
|
||||
@ -849,7 +849,7 @@ begin
|
||||
end;
|
||||
|
||||
// check unitname - filename redundancy
|
||||
if AnsiCompareText(Params.Unit_name,ExtractFileNameOnly(Params.UnitFilename))<>0
|
||||
if CompareText(Params.Unit_name,ExtractFileNameOnly(Params.UnitFilename))<>0
|
||||
then begin
|
||||
IDEMessageDialog(lisA2PUnitNameInvalid,
|
||||
Format(lisA2PTheUnitNameDoesNotCorrespondToTheFilename, ['"',Params.Unit_Name, '"']),
|
||||
@ -866,7 +866,7 @@ begin
|
||||
end;
|
||||
|
||||
// check classname<>ancestortype
|
||||
if AnsiCompareText(Params.NewClassName,Params.AncestorType)=0 then begin
|
||||
if CompareText(Params.NewClassName,Params.AncestorType)=0 then begin
|
||||
IDEMessageDialog(lisA2PInvalidCircularDependency,
|
||||
Format(lisA2PTheClassNameAndAncestorTypeAreTheSame, ['"',Params.NewClassName, '"', '"', Params.AncestorType, '"']),
|
||||
mtError,[mbCancel]);
|
||||
|
||||
@ -4726,7 +4726,7 @@ end;
|
||||
function TLazPackageDescriptors.IndexOf(const Name: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (AnsiCompareText(Name,Items[Result].Name)<>0) do
|
||||
while (Result>=0) and (UTF8CompareText(Name,Items[Result].Name)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, FileUtil, lazutf8classes, IDEProcs, UFrmAddComponent;
|
||||
Buttons, FileUtil, lazutf8classes, LazUTF8, IDEProcs, UFrmAddComponent;
|
||||
|
||||
Type
|
||||
TRComponent = class(TObject)
|
||||
@ -376,7 +376,7 @@ begin
|
||||
MyObj2 := ListComps.Items.Objects[J] as TRComponent;
|
||||
//messagedlg('Comparing object '+MyObj.Name+' at '+inttostr(I)+' with '+MyObj2.Name, mtInformation,[mbOk],0);
|
||||
if assigned(MyOBj2) then begin
|
||||
Found := AnsiCompareText(MyObj2.Unit_Name,Myobj.Unit_Name)=0;
|
||||
Found := CompareText(MyObj2.Unit_Name,Myobj.Unit_Name)=0;
|
||||
end; // if assigned
|
||||
end; // for J
|
||||
end; // For I
|
||||
|
||||
Loading…
Reference in New Issue
Block a user