mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 22:58:14 +02:00
Components: Reduce calls to LowerCase().
git-svn-id: trunk@64515 -
This commit is contained in:
parent
db235fb49a
commit
77e6853ca6
@ -6,11 +6,11 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, types, typinfo, math,
|
||||
// LazUtils
|
||||
FileUtil, LazConfigStorage,
|
||||
// LCL
|
||||
LCLProc, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls, StdCtrls,
|
||||
Buttons, Menus,
|
||||
// LazUtils
|
||||
FileUtil, LazConfigStorage, LazStringUtils,
|
||||
// IdeIntf
|
||||
BaseIDEIntf, MenuIntf, LazIDEIntf, ObjectInspector, PropEdits,
|
||||
// IdeInspector
|
||||
@ -150,7 +150,7 @@ const
|
||||
// Extra additions
|
||||
'ssMeta', 'ssSuper', 'ssHyper', 'ssAltGr', 'ssCaps', 'ssNum',
|
||||
'ssScroll', 'ssTriple', 'ssQuad', 'ssExtra1', 'ssExtra2'
|
||||
{$IF FPC_FULLVERSION >= 30101}
|
||||
{$IF FPC_FULLVERSION >= 30301}
|
||||
, 'ssScrollH'
|
||||
{$ENDIF}
|
||||
);
|
||||
@ -292,7 +292,7 @@ begin
|
||||
s2 := copy(s2, i, length(s));
|
||||
if s2<>'' then
|
||||
s := s + ' ' + s2;
|
||||
i := pos('line ', LowerCase(s));
|
||||
i := PosI('line ', s);
|
||||
if i > 0 then begin
|
||||
s2 := Trim(copy(s, i+4, length(s2)));
|
||||
i := pos(' ', s2)-1;
|
||||
|
@ -1147,9 +1147,8 @@ begin
|
||||
if CompOpts=nil then exit;
|
||||
SyntaxMode:=CompOpts.SyntaxMode;
|
||||
if SyntaxMode<>'' then begin
|
||||
Result:='{$mode '+lowercase(SyntaxMode)+'}';
|
||||
if CompOpts.UseAnsiStrings
|
||||
and (SysUtils.CompareText(SyntaxMode,'Delphi')<>0) then
|
||||
Result:='{$mode '+SyntaxMode+'}';
|
||||
if CompOpts.UseAnsiStrings and (CompareText(SyntaxMode,'Delphi')<>0) then
|
||||
Result:=Result+'{$H+}';
|
||||
end;
|
||||
end;
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, strutils, Laz_AVL_Tree,
|
||||
// LazUtils
|
||||
LazFileUtils, LazUTF8,
|
||||
LazFileUtils, LazStringUtils, LazUTF8,
|
||||
// Codetools
|
||||
SourceLog, KeywordFuncLists, FileProcs;
|
||||
|
||||
@ -359,14 +359,13 @@ function AddResourceCode(Source:TSourceLog; const AddCode:string):boolean;
|
||||
// form components
|
||||
function FindFormClassDefinitionInSource(const Source, FormClassName:string;
|
||||
var FormClassNameStartPos, FormBodyStartPos: integer):boolean;
|
||||
function FindFormComponentInSource(const Source: string;
|
||||
FormBodyStartPos: integer;
|
||||
function FindFormComponentInSource(const Source: string; FormBodyStartPos: integer;
|
||||
const ComponentName, ComponentClassName: string): integer;
|
||||
function AddFormComponentToSource(Source:TSourceLog; FormBodyStartPos: integer;
|
||||
const ComponentName, ComponentClassName: string): boolean;
|
||||
function RemoveFormComponentFromSource(Source:TSourceLog;
|
||||
FormBodyStartPos: integer;
|
||||
ComponentName, ComponentClassName: string): boolean;
|
||||
const ComponentName, ComponentClassName: string): boolean;
|
||||
function FindClassAncestorName(const Source, FormClassName: string): string;
|
||||
|
||||
// procedure specifiers
|
||||
@ -435,10 +434,10 @@ begin
|
||||
// search for include directives
|
||||
repeat
|
||||
Atom:=ReadNextPascalAtom(Source,Position,AtomStart);
|
||||
if (copy(Atom,1,2)='{$') or (copy(Atom,1,3)='(*$') then begin
|
||||
if StartsStr('{$',Atom) or StartsStr('(*$', Atom) then begin
|
||||
SplitCompilerDirective(Atom,DirectiveName,Filename);
|
||||
DirectiveName:=lowercase(DirectiveName);
|
||||
if (DirectiveName='i') or (DirectiveName='include') then begin
|
||||
if (DirectiveName='i') or (DirectiveName='I')
|
||||
or (CompareText(DirectiveName,'include')=0) then begin
|
||||
// include directive
|
||||
dec(Index);
|
||||
if Index=0 then begin
|
||||
@ -486,8 +485,8 @@ function SplitCompilerDirective(const Directive:string;
|
||||
out DirectiveName,Parameters:string):boolean;
|
||||
var EndPos,DirStart,DirEnd:integer;
|
||||
begin
|
||||
if (copy(Directive,1,2)='{$') or (copy(Directive,1,3)='(*$') then begin
|
||||
if copy(Directive,1,2)='{$' then begin
|
||||
if StartsStr('{$',Directive) or StartsStr('(*$',Directive) then begin
|
||||
if StartsStr('{$',Directive) then begin
|
||||
DirStart:=3;
|
||||
DirEnd:=length(Directive);
|
||||
end else begin
|
||||
@ -675,14 +674,14 @@ begin
|
||||
UsesEnd:=ProgramTermEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then begin
|
||||
// no uses section in interface -> add one
|
||||
Source.Insert(ProgramTermEnd,LineEnding+LineEnding+'uses'+LineEnding+' ;');
|
||||
UsesEnd:=ProgramTermEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
end;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then exit;
|
||||
Result:=RenameUnitInUsesSection(Source,UsesStart,OldUnitName
|
||||
,NewUnitName,NewInFile);
|
||||
@ -709,14 +708,14 @@ begin
|
||||
UsesEnd:=ProgramTermEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then begin
|
||||
// no uses section after program term -> add one
|
||||
Source.Insert(ProgramTermEnd,LineEnding+LineEnding+'uses'+LineEnding+' ;');
|
||||
UsesEnd:=ProgramTermEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
end;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then exit;
|
||||
Result:=AddUnitToUsesSection(Source,AUnitName,InFileName,UsesStart);
|
||||
end;
|
||||
@ -735,14 +734,14 @@ begin
|
||||
UsesEnd:=InterfaceWordEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then begin
|
||||
// no uses section in interface -> add one
|
||||
Source.Insert(InterfaceWordEnd,LineEnding+LineEnding+'uses'+LineEnding+' ;');
|
||||
UsesEnd:=InterfaceWordEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
end;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then exit;
|
||||
Result:=RenameUnitInUsesSection(Source,UsesStart,OldUnitName
|
||||
,NewUnitName,NewInFile);
|
||||
@ -763,14 +762,14 @@ begin
|
||||
UsesEnd:=InterfaceWordEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then begin
|
||||
// no uses section in interface -> add one
|
||||
Source.Insert(InterfaceWordEnd,LineEnding+LineEnding+'uses'+LineEnding+' ;');
|
||||
UsesEnd:=InterfaceWordEnd;
|
||||
ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
end;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,UsesEnd-UsesStart))='uses')
|
||||
if CompareText(copy(Source.Source,UsesStart,UsesEnd-UsesStart),'uses')<>0
|
||||
then exit;
|
||||
Result:=AddUnitToUsesSection(Source,AUnitName,InFileName,UsesStart);
|
||||
end;
|
||||
@ -796,7 +795,7 @@ begin
|
||||
UsesEnd:=ProgramTermEnd;
|
||||
Atom:=ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(Atom)='uses') then exit;
|
||||
if CompareText(Atom,'uses')<>0 then exit;
|
||||
Result:=RemoveUnitFromUsesSection(Source,AUnitName,UsesStart);
|
||||
end;
|
||||
|
||||
@ -816,7 +815,7 @@ begin
|
||||
UsesEnd:=InterfaceWordEnd;
|
||||
Atom:=ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if UsesEnd>length(Source.Source) then exit;
|
||||
if not (lowercase(Atom)='uses') then exit;
|
||||
if CompareText(Atom,'uses')<>0 then exit;
|
||||
Result:=RemoveUnitFromUsesSection(Source,AUnitName,UsesStart);
|
||||
end;
|
||||
|
||||
@ -828,12 +827,12 @@ begin
|
||||
Result:=false;
|
||||
if SrcUnitName='' then exit;
|
||||
if UsesStart<1 then exit;
|
||||
if not (lowercase(copy(Source,UsesStart,4))='uses') then exit;
|
||||
if CompareText(copy(Source,UsesStart,4),'uses')<>0 then exit;
|
||||
UsesEnd:=UsesStart+4;
|
||||
// parse through all used units and see if it is there
|
||||
repeat
|
||||
Atom:=ReadNextPascalAtom(Source,UsesEnd,UsesStart);
|
||||
if (lowercase(Atom)=lowercase(SrcUnitName)) then begin
|
||||
if CompareText(Atom,SrcUnitName)=0 then begin
|
||||
// unit found
|
||||
Result:=true;
|
||||
exit;
|
||||
@ -861,7 +860,7 @@ begin
|
||||
if (NewUnitName='') or (NewUnitName=';')
|
||||
or (OldUnitName=';') or (UsesStart<1) then exit;
|
||||
UsesEnd:=UsesStart+4;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,4))='uses') then exit;
|
||||
if CompareText(copy(Source.Source,UsesStart,4),'uses')<>0 then exit;
|
||||
// parse through all used units and see if it is already there
|
||||
if NewInFile<>'' then
|
||||
NewUnitTerm:=NewUnitName+' in '''+NewInFile+''''
|
||||
@ -870,7 +869,7 @@ begin
|
||||
s:=', ';
|
||||
repeat
|
||||
Atom:=ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if (lowercase(Atom)=lowercase(OldUnitName)) then begin
|
||||
if CompareText(Atom,OldUnitName)=0 then begin
|
||||
// unit already used
|
||||
OldUsesStart:=UsesStart;
|
||||
// find comma or semicolon
|
||||
@ -905,12 +904,12 @@ begin
|
||||
Result:=false;
|
||||
if (AnUnitName='') or (AnUnitName=';') or (UsesStart<1) then exit;
|
||||
UsesEnd:=UsesStart+4;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,4))='uses') then exit;
|
||||
if CompareText(copy(Source.Source,UsesStart,4),'uses')<>0 then exit;
|
||||
// parse through all used units and see if it is already there
|
||||
s:=', ';
|
||||
repeat
|
||||
Atom:=ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if (lowercase(Atom)=lowercase(AnUnitName)) then begin
|
||||
if CompareText(Atom,AnUnitName)=0 then begin
|
||||
// unit found
|
||||
Result:=true;
|
||||
exit;
|
||||
@ -944,12 +943,12 @@ begin
|
||||
exit;
|
||||
// search interface section
|
||||
UsesEnd:=UsesStart+4;
|
||||
if not (lowercase(copy(Source.Source,UsesStart,4))='uses') then exit;
|
||||
if CompareText(copy(Source.Source,UsesStart,4),'uses')<>0 then exit;
|
||||
// parse through all used units and see if it is there
|
||||
OldUsesEnd:=-1;
|
||||
repeat
|
||||
Atom:=ReadNextPascalAtom(Source.Source,UsesEnd,UsesStart);
|
||||
if (lowercase(Atom)=lowercase(AnUnitName)) then begin
|
||||
if CompareText(Atom,AnUnitName)=0 then begin
|
||||
// unit found
|
||||
OldUsesStart:=UsesStart;
|
||||
// find comma or semicolon
|
||||
@ -1087,14 +1086,12 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function FindFormComponentInSource(const Source: string;
|
||||
FormBodyStartPos: integer;
|
||||
function FindFormComponentInSource(const Source: string; FormBodyStartPos: integer;
|
||||
const ComponentName, ComponentClassName: string): integer;
|
||||
var AtomStart, OldPos: integer;
|
||||
Atom,LowComponentName,LowComponentClassName: string;
|
||||
var
|
||||
AtomStart, OldPos: integer;
|
||||
Atom: string;
|
||||
begin
|
||||
LowComponentName:=lowercase(ComponentName);
|
||||
LowComponentClassName:=lowercase(ComponentClassName);
|
||||
Result:=FormBodyStartPos;
|
||||
repeat
|
||||
Atom:=lowercase(ReadNextPascalAtom(Source,Result,AtomStart));
|
||||
@ -1104,10 +1101,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
OldPos:=Result;
|
||||
if (lowercase(ReadNextPascalAtom(Source,Result,AtomStart))=LowComponentName)
|
||||
if (CompareText(ReadNextPascalAtom(Source,Result,AtomStart),ComponentName)=0)
|
||||
and (ReadNextPascalAtom(Source,Result,AtomStart)=':')
|
||||
and (lowercase(ReadNextPascalAtom(Source,Result,AtomStart))=
|
||||
LowComponentClassName)
|
||||
and (CompareText(ReadNextPascalAtom(Source,Result,AtomStart),ComponentClassName)=0)
|
||||
and (ReadNextPascalAtom(Source,Result,AtomStart)=';') then begin
|
||||
Result:=OldPos;
|
||||
exit;
|
||||
@ -1158,12 +1154,10 @@ end;
|
||||
|
||||
function RemoveFormComponentFromSource(Source:TSourceLog;
|
||||
FormBodyStartPos: integer;
|
||||
ComponentName, ComponentClassName: string): boolean;
|
||||
const ComponentName, ComponentClassName: string): boolean;
|
||||
var AtomStart, Position, ComponentStart, LineStart, LineEnd: integer;
|
||||
Atom: string;
|
||||
begin
|
||||
ComponentName:=lowercase(ComponentName);
|
||||
ComponentClassName:=lowercase(ComponentClassName);
|
||||
Position:=FormBodyStartPos;
|
||||
repeat
|
||||
Atom:=lowercase(ReadNextPascalAtom(Source.Source,Position,AtomStart));
|
||||
@ -1172,11 +1166,10 @@ begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end;
|
||||
if (Atom=ComponentName) then begin
|
||||
if CompareText(Atom,ComponentName)=0 then begin
|
||||
ComponentStart:=AtomStart;
|
||||
if (ReadNextPascalAtom(Source.Source,Position,AtomStart)=':')
|
||||
and (lowercase(ReadNextPascalAtom(Source.Source,Position,AtomStart))=
|
||||
ComponentClassName)
|
||||
and (CompareText(ReadNextPascalAtom(Source.Source,Position,AtomStart),ComponentClassName)=0)
|
||||
then begin
|
||||
GetLineStartEndAtPosition(Source.Source,ComponentStart,LineStart,LineEnd);
|
||||
if (LineEnd<=length(Source.Source))
|
||||
|
@ -3896,14 +3896,13 @@ end;
|
||||
|
||||
function IsPas2jsTargetOS(TargetOS: string): boolean;
|
||||
begin
|
||||
TargetOS:=LowerCase(TargetOS);
|
||||
Result:=(TargetOS='browser') or (TargetOS='nodejs');
|
||||
Result:=(CompareText(TargetOS,'browser')=0)
|
||||
or (CompareText(TargetOS,'nodejs')=0);
|
||||
end;
|
||||
|
||||
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
|
||||
begin
|
||||
TargetCPU:=LowerCase(TargetCPU);
|
||||
Result:=Pos('ecmascript',TargetCPU)>0;
|
||||
Result:=PosI('ecmascript',TargetCPU)>0;
|
||||
end;
|
||||
|
||||
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean;
|
||||
@ -3938,14 +3937,14 @@ function GuessPascalCompilerFromExeName(Filename: string): TPascalCompiler;
|
||||
var
|
||||
ShortFilename: String;
|
||||
begin
|
||||
ShortFilename:=LowerCase(ExtractFileNameOnly(Filename));
|
||||
ShortFilename:=ExtractFileNameOnly(Filename);
|
||||
|
||||
// *pas2js*
|
||||
if Pos('pas2js',ShortFilename)>0 then
|
||||
if PosI('pas2js',ShortFilename)>0 then
|
||||
exit(pcPas2js);
|
||||
|
||||
// dcc*.exe
|
||||
if (LeftStr(ShortFilename,3)='dcc')
|
||||
if LazStartsText('dcc',ShortFilename)
|
||||
and ((ExeExt='') or (CompareFileExt(Filename,ExeExt)=0))
|
||||
then
|
||||
exit(pcDelphi);
|
||||
@ -4042,13 +4041,13 @@ begin
|
||||
if not Result then exit;
|
||||
|
||||
// allow scripts like fpc*.sh and fpc*.bat
|
||||
ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename));
|
||||
ShortFilename:=ExtractFileNameOnly(AFilename);
|
||||
//debugln(['IsFPCExecutable Short=',ShortFilename]);
|
||||
if (LeftStr(ShortFilename,3)='fpc') then
|
||||
if LazStartsText('fpc',ShortFilename) then
|
||||
exit(true);
|
||||
|
||||
// allow ppcxxx.exe
|
||||
if (LeftStr(ShortFilename,3)='ppc')
|
||||
if (LazStartsText('ppc',ShortFilename))
|
||||
and ((ExeExt='') or (CompareFileExt(AFilename,ExeExt)=0))
|
||||
then
|
||||
exit(true);
|
||||
@ -4071,8 +4070,8 @@ begin
|
||||
if not Result then exit;
|
||||
|
||||
// allow scripts like *pas2js*
|
||||
ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename));
|
||||
if Pos('pas2js',ShortFilename)>0 then
|
||||
ShortFilename:=ExtractFileNameOnly(AFilename);
|
||||
if PosI('pas2js',ShortFilename)>0 then
|
||||
exit(true);
|
||||
|
||||
ErrorMsg:='pas2js executable should start with pas2js';
|
||||
@ -6347,7 +6346,7 @@ begin
|
||||
try
|
||||
TheProcess.Executable:=CompilerPath;
|
||||
Params.Add('-va');
|
||||
if (Pos('pas2js',lowercase(ExtractFileName(CompilerPath)))<1)
|
||||
if (PosI('pas2js',ExtractFileName(CompilerPath))<1)
|
||||
and FileExistsCached(EnglishErrorMsgFilename) then
|
||||
Params.Add('-Fr'+EnglishErrorMsgFilename);
|
||||
if CompilerOptions<>'' then
|
||||
@ -8150,8 +8149,7 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
if RulesSortedForFilenameStart=nil then
|
||||
RulesSortedForFilenameStart:=
|
||||
TAVLTree.Create(@CompareFPCSourceRulesViaFilename);
|
||||
RulesSortedForFilenameStart:=TAVLTree.Create(@CompareFPCSourceRulesViaFilename);
|
||||
for i:=0 to Count-1 do
|
||||
if Items[i].FitsTargets(Targets) then
|
||||
RulesSortedForFilenameStart.Add(Items[i]);
|
||||
|
@ -3016,8 +3016,8 @@ end;
|
||||
function TFindDeclarationTool.FindUnitFileInUsesSection(
|
||||
UsesNode: TCodeTreeNode; const AFilename: string): TCodeTreeNode;
|
||||
var
|
||||
TargetLoUnitName: string;
|
||||
TargetLoShortFilename: string;
|
||||
TargetUnitName: string;
|
||||
TargetShortFilename: string;
|
||||
|
||||
function CheckUseNode(Node: TCodeTreeNode): boolean;
|
||||
var
|
||||
@ -3033,9 +3033,9 @@ var
|
||||
|
||||
// quick check: compare unitname
|
||||
if UnitInFilename<>'' then begin
|
||||
if lowercase(ExtractFilename(UnitInFilename))<>TargetLoShortFilename then
|
||||
if CompareText(ExtractFilename(UnitInFilename),TargetShortFilename)<>0 then
|
||||
exit;
|
||||
end else if LowerCase(AUnitName)<>TargetLoUnitName then
|
||||
end else if CompareText(AUnitName,TargetUnitName)<>0 then
|
||||
exit;
|
||||
|
||||
// search in search paths
|
||||
@ -3046,9 +3046,9 @@ var
|
||||
begin
|
||||
Result:=nil;
|
||||
if (UsesNode=nil) or (UsesNode.Desc<>ctnUsesSection) then exit;
|
||||
TargetLoUnitName:=LowerCase(ExtractFileNameOnly(AFilename));
|
||||
TargetLoShortFilename:=LowerCase(ExtractFileName(AFilename));
|
||||
if TargetLoShortFilename='' then exit;
|
||||
TargetUnitName:=ExtractFileNameOnly(AFilename);
|
||||
TargetShortFilename:=ExtractFileName(AFilename);
|
||||
if TargetShortFilename='' then exit;
|
||||
Result:=UsesNode.LastChild;
|
||||
while Result<>nil do begin
|
||||
if CheckUseNode(Result) then exit;
|
||||
|
@ -6587,8 +6587,9 @@ var
|
||||
begin
|
||||
i := MDebuggerClasses.Count - 1;
|
||||
while i >= 0 do begin
|
||||
if LowerCase(TDebuggerClass(MDebuggerClasses.Objects[i]).ClassName) = LowerCase(AIndex) then
|
||||
exit(TDebuggerClass(MDebuggerClasses.Objects[i]));
|
||||
Result := TDebuggerClass(MDebuggerClasses.Objects[i]);
|
||||
if CompareText(Result.ClassName, AIndex) = 0 then
|
||||
exit;
|
||||
dec(i);
|
||||
end;
|
||||
Result := nil;
|
||||
|
@ -40,7 +40,7 @@ uses
|
||||
LResources, Forms, Controls, Graphics, Dialogs, ComCtrls, Buttons, StdCtrls,
|
||||
ExtCtrls, ButtonPanel, HelpIntfs,
|
||||
// LazUtils
|
||||
FileUtil, LazFileUtils, LazConfigStorage, LazLoggerBase, LazUTF8,
|
||||
FileUtil, LazFileUtils, LazStringUtils, LazConfigStorage, LazLoggerBase, LazUTF8,
|
||||
// IdeIntf
|
||||
LazHelpIntf, PackageIntf, MacroIntf, IDEOptionsIntf, IDEOptEditorIntf,
|
||||
LazIDEIntf, BaseIDEIntf, IDEDialogs, IDEImagesIntf, SrcEditorIntf;
|
||||
@ -1418,7 +1418,7 @@ begin
|
||||
if (ContextList.Count>0) and (ContextList.List[0].Descriptor=pihcFilename)
|
||||
then begin
|
||||
// extract unit filename
|
||||
AUnitName:=lowercase(ExtractFileNameOnly(ContextList.List[0].Context));
|
||||
AUnitName:=ExtractFileNameOnly(ContextList.List[0].Context);
|
||||
DebugLn('TExternalHelpDatabase.ShowHelp A Unitname=',AUnitname,' NewNode.HelpType=',dbgs(ord(NewNode.HelpType)),' NewNode.Title=',NewNode.Title,' NewNode.URL=',NewNode.URL);
|
||||
if AUnitName<>'' then begin
|
||||
|
||||
@ -1452,7 +1452,7 @@ begin
|
||||
// replace special macros (Identifier)
|
||||
URL:=NewNode.URL;
|
||||
repeat
|
||||
p:=System.Pos('$(identifier)',lowercase(URL));
|
||||
p:=PosI('$(identifier)',URL);
|
||||
if p<1 then break;
|
||||
URL:=copy(URL,1,p-1)+Identifier
|
||||
+copy(URL,p+length('$(identifier)'),length(URL));
|
||||
|
@ -815,7 +815,8 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
||||
protected
|
||||
//copied from TFpSymbolDwarfDataProc
|
||||
function GetNestedSymbolEx(AIndex: Int64; out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolExByName(const AIndex: String; out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolExByName(const AIndex: String;
|
||||
out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolCount: Integer; override;
|
||||
|
||||
// TODO: deal with DW_TAG_pointer_type
|
||||
@ -990,7 +991,8 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
||||
function DoReadSize(const AValueObj: TFpValue; out ASize: TFpDbgValueSize): Boolean; override;
|
||||
|
||||
function GetNestedSymbolEx(AIndex: Int64; out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolExByName(const AIndex: String; out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolExByName(const AIndex: String;
|
||||
out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol; override;
|
||||
function GetNestedSymbolCount: Integer; override;
|
||||
|
||||
public
|
||||
@ -4754,21 +4756,20 @@ begin
|
||||
Result := FLastMember;
|
||||
end;
|
||||
|
||||
function TFpSymbolDwarfTypeSubroutine.GetNestedSymbolExByName(
|
||||
const AIndex: String; out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol;
|
||||
function TFpSymbolDwarfTypeSubroutine.GetNestedSymbolExByName(const AIndex: String;
|
||||
out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol;
|
||||
var
|
||||
Info: TDwarfInformationEntry;
|
||||
s, s2: String;
|
||||
s: String;
|
||||
i: Integer;
|
||||
begin
|
||||
CreateMembers;
|
||||
AnParentTypeSymbol := Self;
|
||||
s2 := LowerCase(AIndex);
|
||||
FLastMember.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FLastMember, 'TFpSymbolDwarfDataProc.FLastMember'){$ENDIF};
|
||||
FLastMember := nil;;
|
||||
FLastMember := nil;
|
||||
for i := 0 to FProcMembers.Count - 1 do begin
|
||||
Info := TDwarfInformationEntry(FProcMembers[i]);
|
||||
if Info.ReadName(s) and (LowerCase(s) = s2) then begin
|
||||
if Info.ReadName(s) and (CompareText(s, AIndex) = 0) then begin
|
||||
FLastMember := TFpSymbolDwarf.CreateSubClass('', Info);
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}FLastMember.DbgRenameReference(@FLastMember, 'TFpSymbolDwarfDataProc.FLastMember');{$ENDIF}
|
||||
break;
|
||||
@ -5876,17 +5877,16 @@ function TFpSymbolDwarfTypeProc.GetNestedSymbolExByName(const AIndex: String;
|
||||
out AnParentTypeSymbol: TFpSymbolDwarfType): TFpSymbol;
|
||||
var
|
||||
Info: TDwarfInformationEntry;
|
||||
s, s2: String;
|
||||
s: String;
|
||||
i: Integer;
|
||||
begin
|
||||
CreateMembers;
|
||||
AnParentTypeSymbol := nil;
|
||||
s2 := LowerCase(AIndex);
|
||||
FLastMember.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FLastMember, 'TFpSymbolDwarfDataProc.FLastMember'){$ENDIF};
|
||||
FLastMember := nil;;
|
||||
FLastMember := nil;
|
||||
for i := 0 to FProcMembers.Count - 1 do begin
|
||||
Info := TDwarfInformationEntry(FProcMembers[i]);
|
||||
if Info.ReadName(s) and (LowerCase(s) = s2) then begin
|
||||
if Info.ReadName(s) and (CompareText(s, AIndex) = 0) then begin
|
||||
FLastMember := TFpSymbolDwarf.CreateSubClass('', Info);
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}FLastMember.DbgRenameReference(@FLastMember, 'TFpSymbolDwarfDataProc.FLastMember');{$ENDIF}
|
||||
break;
|
||||
|
@ -6,9 +6,11 @@ unit FpDbgDwarfFreePascal;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Types, math, FpDbgDwarfDataClasses, FpDbgDwarf, FpDbgInfo,
|
||||
FpDbgUtil, FpDbgDwarfConst, FpErrorMessages, FpdMemoryTools, DbgIntfBaseTypes,
|
||||
LazLoggerBase;
|
||||
Classes, SysUtils, Types, math,
|
||||
FpDbgDwarfDataClasses, FpDbgDwarf, FpDbgInfo,
|
||||
FpDbgUtil, FpDbgDwarfConst, FpErrorMessages, FpdMemoryTools,
|
||||
DbgIntfBaseTypes,
|
||||
LazLoggerBase, LazStringUtils;
|
||||
|
||||
type
|
||||
|
||||
@ -258,8 +260,8 @@ var
|
||||
i, j, AVersion: Integer;
|
||||
begin
|
||||
AVersion := 0;
|
||||
s := LowerCase(ACU.Producer)+' ';
|
||||
i := pos('free pascal', s) + 11;
|
||||
s := ACU.Producer+' ';
|
||||
i := PosI('free pascal', s) + 11;
|
||||
|
||||
if i > 11 then begin
|
||||
while (i < Length(s)) and (s[i] in [' ', #9]) do
|
||||
@ -299,11 +301,8 @@ begin
|
||||
end;
|
||||
|
||||
class function TFpDwarfFreePascalSymbolClassMap.ClassCanHandleCompUnit(ACU: TDwarfCompilationUnit): Boolean;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
s := LowerCase(ACU.Producer);
|
||||
Result := pos('free pascal', s) > 0;
|
||||
Result := PosI('free pascal', ACU.Producer) > 0;
|
||||
end;
|
||||
|
||||
var
|
||||
|
@ -1533,20 +1533,19 @@ begin
|
||||
s := GetText;
|
||||
Result := FExpression.GetDbgSymbolForIdentifier(s);
|
||||
if Result = nil then begin
|
||||
s := LowerCase(s);
|
||||
if s = 'nil' then begin
|
||||
if CompareText(s, 'nil') = 0 then begin
|
||||
tmp := TFpValueConstAddress.Create(NilLoc);
|
||||
Result := TFpPasParserValueAddressOf.Create(tmp, Expression.Context.LocationContext);
|
||||
tmp.ReleaseReference;
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}Result.DbgRenameReference(nil, 'DoGetResultValue');{$ENDIF}
|
||||
end
|
||||
else
|
||||
if s = 'true' then begin
|
||||
if CompareText(s, 'true') = 0 then begin
|
||||
Result := TFpValueConstBool.Create(True);
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}Result.DbgRenameReference(nil, 'DoGetResultValue');{$ENDIF}
|
||||
end
|
||||
else
|
||||
if s = 'false' then begin
|
||||
if CompareText(s, 'false') = 0 then begin
|
||||
Result := TFpValueConstBool.Create(False);
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}Result.DbgRenameReference(nil, 'DoGetResultValue');{$ENDIF}
|
||||
end
|
||||
@ -3026,14 +3025,14 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
if LowerCase(GetText) = 'div' then begin
|
||||
if CompareText(GetText, 'div') = 0 then begin
|
||||
case tmp1.Kind of
|
||||
skInteger: Result := NumDivIntByValue(tmp1, tmp2);
|
||||
skCardinal: Result := NumDivCardinalByValue(tmp1, tmp2);
|
||||
end;
|
||||
end
|
||||
else
|
||||
if LowerCase(GetText) = 'mod' then begin
|
||||
if CompareText(GetText, 'mod') = 0 then begin
|
||||
case tmp1.Kind of
|
||||
skInteger: Result := NumModIntByValue(tmp1, tmp2);
|
||||
skCardinal: Result := NumModCardinalByValue(tmp1, tmp2);
|
||||
|
@ -27,15 +27,13 @@ begin
|
||||
|
||||
try
|
||||
xml.Filename := AFileName;
|
||||
|
||||
pkgtype := LowerCase(xml.GetValue('Package/Type/Value', ''));
|
||||
|
||||
pkgtype := xml.GetValue('Package/Type/Value', '');
|
||||
//default
|
||||
Result := lpRunTime;
|
||||
|
||||
if pkgtype = 'designtime' then
|
||||
Result := lpDesignTime;
|
||||
if pkgtype = 'runanddesigntime' then
|
||||
if CompareText(pkgtype, 'designtime') = 0 then
|
||||
Result := lpDesignTime
|
||||
else if CompareText(pkgtype, 'runanddesigntime') = 0 then
|
||||
Result := lpBoth;
|
||||
|
||||
finally
|
||||
|
@ -773,10 +773,10 @@ begin
|
||||
end;
|
||||
|
||||
//add images to supported packages
|
||||
if LowerCase(pkg.Support) = 'fpc' then
|
||||
if CompareText(pkg.Support, 'fpc') = 0 then
|
||||
li.ImageIndex := FPC_SUPPORTED
|
||||
else
|
||||
if LowerCase(pkg.Support) = 'lazarus' then
|
||||
if CompareText(pkg.Support, 'lazarus') = 0 then
|
||||
li.ImageIndex := LAZARUS_SUPPORTED
|
||||
else
|
||||
li.ImageIndex := COMMUNITY_SUPPORTED;
|
||||
|
@ -28,6 +28,8 @@ uses
|
||||
Classes, SysUtils,
|
||||
// LCL
|
||||
Controls, Buttons, Forms, StdCtrls, Graphics, ComCtrls, Grids,
|
||||
// LazUtils
|
||||
LazStringUtils,
|
||||
// BuildIntf
|
||||
IDEOptionsIntf,
|
||||
// IdeIntf
|
||||
@ -371,8 +373,6 @@ begin
|
||||
end;
|
||||
|
||||
function TAbstractIDEOptionsEditor.ContainsTextInCaption(AText: string): Boolean;
|
||||
var
|
||||
LowerText: String;
|
||||
|
||||
function SearchComboBox({%H-}AControl: TCustomComboBox): Boolean;
|
||||
begin
|
||||
@ -385,10 +385,10 @@ var
|
||||
begin
|
||||
Result:=False;
|
||||
for i := 0 to AControl.Items.Count-1 do begin
|
||||
if Pos(LowerText, LowerCase(AControl.Items[i]))>0 then begin
|
||||
//if Length(LowerText)>2 then
|
||||
if PosI(AText, AControl.Items[i])>0 then begin
|
||||
//if Length(AText)>2 then
|
||||
// DebugLn('TAbstractIDEOptionsEditor.ContainsTextInCaption: Searching "',
|
||||
// LowerText, '", Found "', AControl.Items[i], '", in ListBox ', AControl.Name);
|
||||
// AText, '", Found "', AControl.Items[i], '", in ListBox ', AControl.Name);
|
||||
// ToDo: Indicate found item somehow.
|
||||
Result:=True;
|
||||
end;
|
||||
@ -439,7 +439,7 @@ var
|
||||
else if AControl is TCustomMemo then
|
||||
Result:=SearchMemo(TCustomMemo(AControl))
|
||||
else begin
|
||||
Result:=Pos(LowerText, LowerCase(AControl.Caption))>0;
|
||||
Result:=PosI(AText, AControl.Caption)>0;
|
||||
// Indicate the match
|
||||
if Result then
|
||||
AControl.Font.Style:=MatchFontStyle
|
||||
@ -463,7 +463,6 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
LowerText:=LowerCase(AText);
|
||||
Result:=Search(Self);
|
||||
end;
|
||||
|
||||
|
@ -34,7 +34,8 @@ For use when the JCL string functions are not avaialable
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, StrUtils;
|
||||
SysUtils, Classes, StrUtils,
|
||||
LazStringUtils;
|
||||
|
||||
const
|
||||
NativeNull = Char(#0);
|
||||
@ -125,11 +126,10 @@ function StrStrCount(const S, SubS: string): Integer;
|
||||
function StrRepeat(const S: string; Count: Integer): string;
|
||||
procedure StrReplace(var S: string; const Search, Replace: string; Flags: TReplaceFlags = []);
|
||||
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
function StrFind(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
|
||||
function BooleanToStr(B: Boolean): string;
|
||||
function StrToBoolean(const S: string): Boolean;
|
||||
|
||||
function StrFind(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
function StrIsOneOf(const S: string; const List: array of string): Boolean;
|
||||
|
||||
procedure TrimStrings(const List: TStrings; DeleteIfEmpty: Boolean = True);
|
||||
@ -405,9 +405,15 @@ end;
|
||||
|
||||
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
begin
|
||||
// Paul: I expect original code was more efficient :)
|
||||
Result := Pos(SubStr, Copy(S, Index, Length(S)));
|
||||
if Result > 0 then
|
||||
Result := Result + Index - 1;
|
||||
end;
|
||||
|
||||
function StrFind(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
// Case-insensitive version of StrSearch.
|
||||
begin
|
||||
Result := PosI(SubStr, Copy(S, Index, Length(S)));
|
||||
if Result > 0 then
|
||||
Result := Result + Index - 1;
|
||||
end;
|
||||
@ -437,13 +443,6 @@ begin
|
||||
raise EJcfConversionError.Create('Cannot convert string [' + S + '] to boolean');
|
||||
end;
|
||||
|
||||
|
||||
function StrFind(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
begin
|
||||
// Paul: original code used comparision by char case table
|
||||
Result := StrSearch(LowerCase(SubStr), LowerCase(S), Index);
|
||||
end;
|
||||
|
||||
function StrIsOneOf(const S: string; const List: array of string): Boolean;
|
||||
var
|
||||
i: integer;
|
||||
|
@ -2217,8 +2217,8 @@ var
|
||||
List: TGDBMINameValueList;
|
||||
begin
|
||||
if (FErrorMsg = '') or
|
||||
(pos('no such file', LowerCase(FErrorMsg)) > 0) or
|
||||
(pos('not exist', LowerCase(FErrorMsg)) < 0)
|
||||
(PosI('no such file', FErrorMsg) > 0) or
|
||||
(PosI('not exist', FErrorMsg) < 0)
|
||||
then begin
|
||||
List := TGDBMINameValueList.Create(R);
|
||||
FErrorMsg := DeleteEscapeChars((List.Values['msg']));
|
||||
@ -2484,9 +2484,9 @@ function TGDBMIDebuggerInstruction.ProcessInputFromGdb(const AData: String): Boo
|
||||
DebugLn(DBG_VERBOSE, '[Debugger] Log output: ', Line);
|
||||
if Line = '&"kill\n"'
|
||||
then FResultData.State := dsStop
|
||||
else if LeftStr(Line, 8) = '&"Error '
|
||||
else if LazStartsText('&"Error ', Line)
|
||||
then FResultData.State := dsError;
|
||||
if LowerCase(copy(Line, 1, length(FLogWarnings))) = FLogWarnings
|
||||
if LazStartsText(FLogWarnings, Line)
|
||||
then FInLogWarning := True;
|
||||
if FInLogWarning
|
||||
then FLogWarnings := FLogWarnings + copy(Line, 3, length(Line)-5) + LineEnding;
|
||||
@ -3105,10 +3105,10 @@ var
|
||||
begin
|
||||
DebugLn(DBG_VERBOSE, '[Debugger] Log output: ', Line);
|
||||
Warning := Line;
|
||||
if Copy(Warning, 1, 2) = '&"' then
|
||||
if StartsStr('&"', Warning) then
|
||||
Delete(Warning, 1, 2);
|
||||
if Copy(Warning, Length(Warning) - 2, 3) = '\n"' then
|
||||
Delete(Warning, Length(Warning) - 2, 3);
|
||||
if EndsStr('\n"', Warning) then
|
||||
SetLength(Warning, Length(Warning) - 3);
|
||||
if InLogWarning then
|
||||
begin
|
||||
Warning := MakePrintable(UnEscapeBackslashed(Trim(Warning), [uefOctal, uefTab, uefNewLine]));
|
||||
@ -3147,9 +3147,9 @@ var
|
||||
exit;
|
||||
|
||||
i := 1;
|
||||
if (Line[1] = '&') and (Line[2] = '"') then
|
||||
if (Line[1] = '&') and (Line[2] = '"') then
|
||||
i := 3;
|
||||
if LowerCase(Copy(Line, i, Length(LogWarning))) = LogWarning then
|
||||
if LazStartsText(LogWarning, Line) then
|
||||
AInLogWarning := True;
|
||||
//Delete(Line, 1, Length(LogWarning));
|
||||
|
||||
@ -3560,7 +3560,7 @@ begin
|
||||
if ExecuteCommand('set target-async on', R, []) and (R.State <> dsError) then begin
|
||||
ExecuteCommand('show target-async', R, []);
|
||||
FTheDebugger.FAsyncModeEnabled := (R.State <> dsError) and
|
||||
(pos('mode is on', LowerCase(R.Values)) > 0);
|
||||
(PosI('mode is on', R.Values) > 0);
|
||||
end;
|
||||
if not FTheDebugger.FAsyncModeEnabled then
|
||||
ExecuteCommand('set target-async off', R, []);
|
||||
@ -8782,18 +8782,18 @@ function TGDBMIDebuggerBase.CheckForInternalError(ALine, ACurCommandText: String
|
||||
|
||||
function IsErrorLine(const L: String): Boolean;
|
||||
begin
|
||||
Result := (Pos('internal-error:', LowerCase(L)) > 0) or
|
||||
(Pos('internal to gdb has been detected', LowerCase(L)) > 0) or
|
||||
(Pos('further debugging may prove unreliable', LowerCase(L)) > 0) or
|
||||
(Pos('command aborted.', LowerCase(L)) > 0);
|
||||
Result := (PosI('internal-error:', L) > 0) or
|
||||
(PosI('internal to gdb has been detected', L) > 0) or
|
||||
(PosI('further debugging may prove unreliable', L) > 0) or
|
||||
(PosI('command aborted.', L) > 0);
|
||||
end;
|
||||
function IsErrorContinued(const L: String): Boolean;
|
||||
begin
|
||||
Result := (L <> '') and (L[1] = '&') and
|
||||
(
|
||||
IsErrorLine(L) or
|
||||
(Pos('this is a bug, please report it', LowerCase(L)) > 0) or
|
||||
( (Pos('for instructions', LowerCase(L)) > 0) and (Pos('bugs', LowerCase(L)) > 0) ) or
|
||||
(PosI('this is a bug, please report it',L) > 0) or
|
||||
( (PosI('for instructions',L) > 0) and (PosI('bugs',L) > 0) ) or
|
||||
(L = '&"\n\n"')
|
||||
);
|
||||
end;
|
||||
@ -8979,7 +8979,7 @@ begin
|
||||
BreakPoint := TGDBMIBreakPoint(FindBreakpoint(i));
|
||||
if (BreakPoint <> nil) and (BreakPoint.Valid = vsPending) and
|
||||
(List.IndexOf('pending') < 0) and
|
||||
(pos('pend', lowercase(List.Values['addr'])) <= 0)
|
||||
(PosI('pend', List.Values['addr']) <= 0)
|
||||
then
|
||||
BreakPoint.SetPendingToValid(vsValid);
|
||||
List.Free;
|
||||
@ -9991,7 +9991,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
else
|
||||
if pos('path for the index cache', LowerCase(Line)) < 1 then
|
||||
if PosI('path for the index cache', Line) < 1 then
|
||||
S := S + Line + LineEnding;
|
||||
end;
|
||||
Line := ReadLine;
|
||||
@ -10300,7 +10300,7 @@ begin
|
||||
then
|
||||
Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed);
|
||||
APending := (ResultList.IndexOf('pending') >= 0) or
|
||||
(pos('pend', lowercase(ResultList.Values['addr'])) > 0);
|
||||
(PosI('pend', ResultList.Values['addr']) > 0);
|
||||
if APending and (DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwUserBreakPoint])
|
||||
then
|
||||
Include(FTheDebugger.FDebuggerFlags, dfSetBreakPending);
|
||||
@ -10961,7 +10961,7 @@ function TGDBMIDebuggerCommandLocals.DoExecute: Boolean;
|
||||
* newer GDB may return AnsiString/PChar prefixed with an address (shortstring have no address)
|
||||
{name="ARGANSISTRING",value="0x43cc84 'Ansi'"}
|
||||
*)
|
||||
if (lowercase(copy(Value, 1, 8)) = '(pchar) ') then begin
|
||||
if LazStartsText('(pchar) ', Value) then begin
|
||||
delete(Value, 1, 8);
|
||||
if GetLeadingAddr(Value, addr) then begin
|
||||
if addr = 0
|
||||
@ -10970,7 +10970,7 @@ function TGDBMIDebuggerCommandLocals.DoExecute: Boolean;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (lowercase(copy(Value, 1, 13)) = '(ansistring) ') then begin
|
||||
if LazStartsText('(ansistring) ', Value) then begin
|
||||
delete(Value, 1, 13);
|
||||
if GetLeadingAddr(Value, addr) then begin
|
||||
if addr = 0
|
||||
@ -11773,7 +11773,7 @@ begin
|
||||
|
||||
if TestForceBreak then begin
|
||||
if (AResult.State = dsError) then begin
|
||||
if pos('unknown option', LowerCase(AResult.Values)) > 0 then
|
||||
if PosI('unknown option', AResult.Values) > 0 then
|
||||
Include(FTheDebugger.FDebuggerFlags, dfForceBreakDetected);
|
||||
s := '-break-insert ' + copy(ACommand, 17, MaxInt);
|
||||
|
||||
@ -11782,7 +11782,7 @@ begin
|
||||
if AResult.State <> dsError then
|
||||
Include(FTheDebugger.FDebuggerFlags, dfForceBreakDetected)
|
||||
else
|
||||
if pos('unknown option', LowerCase(AResult.Values)) > 0 then // still unknow option, diff opt caused the err
|
||||
if PosI('unknown option', AResult.Values) > 0 then // still unknow option, diff opt caused the err
|
||||
Exclude(FTheDebugger.FDebuggerFlags, dfForceBreakDetected);
|
||||
end
|
||||
else begin
|
||||
@ -11841,14 +11841,14 @@ begin
|
||||
if (s = '') or (s = '#') then
|
||||
continue;
|
||||
|
||||
if copy(s,1,2) = '#!' then begin
|
||||
if StartsStr('#!', s) then begin
|
||||
delete(s, 1, 2);
|
||||
s := LowerCase(Trim(s));
|
||||
if copy(s, 1, length(OptTimeout)) = OptTimeout then begin
|
||||
if StartsStr(OptTimeout, s) then begin
|
||||
t := StrToIntDef(copy(s, 1+length(OptTimeout), MaxInt), DefaultTimeOut);
|
||||
end;
|
||||
|
||||
if copy(s, 1, length(OptTimeoutWarn)) = OptTimeoutWarn then begin
|
||||
if StartsStr(OptTimeoutWarn, s) then begin
|
||||
if copy(s, 1+length(OptTimeout), MaxInt) = 'true' then
|
||||
f := []
|
||||
else
|
||||
@ -12774,7 +12774,7 @@ begin
|
||||
if (not Result) and (ALoc in [iblAsterix, iblNamed]) then begin
|
||||
if ALoc = iblAsterix then
|
||||
Delete(ABreakLoc, 1,1); // *name
|
||||
FNoSymErr := pos('no symbol \"'+LowerCase(ABreakLoc)+'\" ', LowerCase(R.Values)) > 0;
|
||||
FNoSymErr := PosI('no symbol \"'+ABreakLoc+'\" ', R.Values) > 0;
|
||||
end;
|
||||
if not Result then exit;
|
||||
FEnabled := True; // TODO: What if some bp are disabled?
|
||||
@ -14127,11 +14127,11 @@ var
|
||||
Val(addrtxt, addr, e);
|
||||
if e <> 0 then
|
||||
Exit;
|
||||
|
||||
AnExpression := Lowercase(ResultInfo.TypeName);
|
||||
case StringCase(AnExpression, ['char', 'character', 'ansistring', '__vtbl_ptr_type',
|
||||
'wchar', 'widechar', 'widestring', 'unicodestring',
|
||||
'pointer'])
|
||||
//AnExpression := Lowercase(ResultInfo.TypeName);
|
||||
case StringCase(ResultInfo.TypeName,
|
||||
['char', 'character', 'ansistring', '__vtbl_ptr_type',
|
||||
'wchar', 'widechar', 'widestring', 'unicodestring',
|
||||
'pointer'], True, False)
|
||||
of
|
||||
0, 1, 2: begin // 'char', 'character', 'ansistring'
|
||||
// check for addr 'text' / 0x1234 'abc'
|
||||
@ -14180,7 +14180,8 @@ var
|
||||
if AnExpression[1] = 't'
|
||||
then begin
|
||||
AnExpression[1] := 'T';
|
||||
if Length(AnExpression) > 1 then AnExpression[2] := UpperCase(AnExpression[2])[1];
|
||||
if Length(AnExpression) > 1 then
|
||||
AnExpression[2] := UpCase(AnExpression[2]);
|
||||
end;
|
||||
FTextValue := PascalizePointer(UnEscapeBackslashed(FTextValue), AnExpression);
|
||||
end;
|
||||
@ -14250,9 +14251,9 @@ var
|
||||
UseAt := True;
|
||||
case TypeInfo.Kind of // (skClass, skRecord, skEnum, skSet, skProcedure, skFunction, skSimple, skPointer, skVariant)
|
||||
skPointer: begin
|
||||
case StringCase(Lowercase(TypeInfo.TypeName),
|
||||
['char', 'character', 'ansistring', '__vtbl_ptr_type', 'wchar', 'widechar', 'pointer']
|
||||
)
|
||||
case StringCase(TypeInfo.TypeName,
|
||||
['char', 'character', 'ansistring', '__vtbl_ptr_type',
|
||||
'wchar', 'widechar', 'pointer'], True, False)
|
||||
of
|
||||
2: UseAt := False;
|
||||
3: UseAt := False;
|
||||
|
@ -426,7 +426,8 @@ begin
|
||||
i := 1;
|
||||
if (ALine[1] = '&') and (ALine[2] = '"') then
|
||||
i := 3;
|
||||
if (not AnInLogWarning) and (LowerCase(Copy(ALine, i, Length(LogDisconnect))) = LogDisconnect) then begin
|
||||
if (not AnInLogWarning)
|
||||
and (StrLIComp(LogDisconnect, @ALine[i], Length(LogDisconnect)) = 0) then begin
|
||||
AHandled := True;
|
||||
AForceStop := True;
|
||||
AStoppedParams := '';
|
||||
|
@ -492,46 +492,46 @@ var
|
||||
case CurPtr^ of
|
||||
's', 'S': begin
|
||||
if (LineEndPtr - CurPtr >= 6 )
|
||||
and (UpperCase(copy(CurPtr, 1, 7)) = 'SET OF ')
|
||||
and (StrLIComp('SET OF ', CurPtr, 7) = 0)
|
||||
then
|
||||
Result := ptprkSet;
|
||||
end;
|
||||
'r', 'R': begin
|
||||
if (LineEndPtr - CurPtr >= 5 )
|
||||
and (UpperCase(copy(CurPtr, 1, 6)) = 'RECORD')
|
||||
and (StrLIComp('RECORD', CurPtr, 6) = 0)
|
||||
and ((CurPtr+6)^ in [' ', ')', #13, #0])
|
||||
then
|
||||
Result := ptprkRecord;
|
||||
end;
|
||||
'c', 'C': begin
|
||||
if (LineEndPtr - CurPtr >= 4 )
|
||||
and (UpperCase(copy(CurPtr, 1, 5)) = 'CLASS')
|
||||
and (StrLIComp('CLASS', CurPtr, 5) = 0)
|
||||
and ((CurPtr+5)^ in [' ', ')', #13, #0])
|
||||
then
|
||||
Result := ptprkClass;
|
||||
end;
|
||||
'a', 'A': begin
|
||||
if (LineEndPtr - CurPtr >= 5 )
|
||||
and (UpperCase(copy(CurPtr, 1, 6)) = 'ARRAY ')
|
||||
and (StrLIComp('ARRAY ', CurPtr, 6) = 0)
|
||||
then
|
||||
Result := ptprkArray;
|
||||
end;
|
||||
'<': begin
|
||||
if (LineEndPtr - CurPtr >= 35 )
|
||||
and (copy(CurPtr, 1, 36) = '<invalid unnamed pascal type code 8>')
|
||||
and (StrLComp('<invalid unnamed pascal type code 8>', CurPtr, 36) = 0)
|
||||
then
|
||||
Result := ptprkSet;
|
||||
end;
|
||||
'p', 'P': begin
|
||||
if (LineEndPtr - CurPtr >= 8 )
|
||||
and (UpperCase(copy(CurPtr, 1, 9)) = 'PROCEDURE')
|
||||
and (StrLIComp('PROCEDURE', CurPtr, 9) = 0)
|
||||
and ((CurPtr+9)^ in [' ', '(', ')', #13, #0])
|
||||
then
|
||||
Result := ptprkProcedure;
|
||||
end;
|
||||
'f', 'F': begin
|
||||
if (LineEndPtr - CurPtr >= 7 )
|
||||
and (UpperCase(copy(CurPtr, 1, 8)) = 'FUNCTION')
|
||||
and (StrLIComp('FUNCTION', CurPtr, 8) = 0)
|
||||
and ((CurPtr+8)^ in [' ', '(', ')', #13, #0])
|
||||
then
|
||||
Result := ptprkFunction;
|
||||
@ -827,16 +827,16 @@ begin
|
||||
// deal with https://sourceware.org/bugzilla/show_bug.cgi?id=16016
|
||||
i := i + 7;
|
||||
if ATypeText[i] = '^' then inc(i);
|
||||
if (UpperCase(copy(ATypeText, i, 9)) <> 'TOBJECT =') then begin
|
||||
if CompareText(copy(ATypeText, i, 9), 'TOBJECT =') <> 0 then begin
|
||||
while (i < Length(ATypeText)) and not(ATypeText[i] in [#0..#32,'=',':']) do
|
||||
inc(i);
|
||||
if (UpperCase(copy(ATypeText, i, 9)) = ' = CLASS ') and
|
||||
if (CompareText(copy(ATypeText, i, 9), ' = CLASS ') = 0) and
|
||||
(Length(ATypeText) > i + 9) and
|
||||
(ATypeText[i+9] in [#10, #13])
|
||||
then begin
|
||||
j := i + 10;
|
||||
if (ATypeText[j] in [#10, #13]) then inc(j);
|
||||
if (uppercase(copy(ATypeText, j, 8)) = ' PUBLIC') and
|
||||
if (CompareText(copy(ATypeText, j, 8), ' PUBLIC') = 0) and
|
||||
(Length(ATypeText) > j + 8) and
|
||||
(ATypeText[j+8] in [#10, #13])
|
||||
then
|
||||
@ -2305,8 +2305,8 @@ var
|
||||
end;
|
||||
|
||||
FMaybeShortString := (FFields.Count = 2) and // shortstring have 2 fields: length and st
|
||||
(lowercase(FFields[0].Name) = 'length') and
|
||||
(lowercase(FFields[1].Name) = 'st');
|
||||
(CompareText(FFields[0].Name, 'length') = 0) and
|
||||
(CompareText(FFields[1].Name, 'st') = 0);
|
||||
|
||||
if (FTypeName = 'Variant') or
|
||||
(FTypeName = 'VARIANT') then
|
||||
@ -2411,8 +2411,9 @@ var
|
||||
l := Length(S2);
|
||||
j := 1;
|
||||
while true do begin
|
||||
while (j <= l) and (S2[j] in ['^','(', ' ']) do inc(j);
|
||||
if (lowercase(copy(S2, j, 6)) = 'array ') then begin
|
||||
while (j <= l) and (S2[j] in ['^','(', ' ']) do
|
||||
inc(j);
|
||||
if StrLIComp('array ', @S2[j], 6) = 0 then begin
|
||||
inc(j, 5+3);
|
||||
while (j <= l) and
|
||||
not ( (S2[j-3] = ' ') and (S2[j-2] in ['o','O']) and (S2[j-1] in ['f','F']) and (S2[j] = ' ') )
|
||||
@ -2422,7 +2423,7 @@ var
|
||||
end;
|
||||
break;
|
||||
end;
|
||||
if (lowercase(copy(S2, j, 7)) = 'record ') and
|
||||
if (StrLIComp('record ', @S2[j], 7) = 0) and
|
||||
not( (copy(S2, j+7, 1) = ';') or (copy(S2, j+7, 6) = '{...};') )
|
||||
then begin
|
||||
i := 1;
|
||||
@ -2564,7 +2565,8 @@ var
|
||||
begin
|
||||
if IsReqError(gptrPtypeCustomAutoCast) or
|
||||
(not(FReqResults[gptrPtypeCustomAutoCast].Result.Kind = ptprkClass)) or
|
||||
(LowerCase(FAutoTypeCastName) = LowerCase(PCLenToString(FReqResults[gptrPTypeExpr].Result.BaseName))) // don't typecast to itself
|
||||
(CompareText(FAutoTypeCastName, // don't typecast to itself
|
||||
PCLenToString(FReqResults[gptrPTypeExpr].Result.BaseName)) = 0)
|
||||
then begin
|
||||
FinishProcessClass; // normal class finish
|
||||
exit;
|
||||
|
@ -5,26 +5,14 @@ unit FPDServerDebugger;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes,
|
||||
ssockets,
|
||||
fgl,
|
||||
forms,
|
||||
DbgIntfDebuggerBase,
|
||||
DbgIntfBaseTypes,
|
||||
maps,
|
||||
fpjson,
|
||||
Classes, strutils, SysUtils, ssockets, fgl, process, syncobjs, fpjson,
|
||||
forms, dialogs,
|
||||
DbgIntfDebuggerBase, DbgIntfBaseTypes,
|
||||
// jsonparser,
|
||||
{$IFDEF UNIX}
|
||||
BaseUnix,
|
||||
{$ENDIF}
|
||||
LazLoggerBase,
|
||||
process,
|
||||
dialogs,
|
||||
syncobjs,
|
||||
lazCollections,
|
||||
LazSysUtils,
|
||||
strutils,
|
||||
SysUtils, UTF8Process;
|
||||
LazLoggerBase, lazCollections, LazSysUtils, LazStringUtils, UTF8Process, maps;
|
||||
|
||||
type
|
||||
TThreadedQueueString = specialize TLazThreadedQueue<string>;
|
||||
@ -1149,7 +1137,7 @@ begin
|
||||
begin
|
||||
result := false;
|
||||
port := -1;
|
||||
if pos('gdb', LowerCase(ExtractFileName(ExternalDebugger)))>0 then
|
||||
if PosI('gdb', ExtractFileName(ExternalDebugger)) > 0 then
|
||||
ShowMessage('The name of the external debugger contains ''gdb''. The currently selected FPDebug-debugger can not work in combination with gdb. The debugger will most likely fail to start.');
|
||||
FDebugProcess := TProcessUTF8.Create(nil);
|
||||
try
|
||||
|
@ -19,6 +19,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, strutils, math,
|
||||
// LazUtils
|
||||
LazStringUtils,
|
||||
// DebuggerIntf
|
||||
DbgIntfBaseTypes;
|
||||
|
||||
|
@ -379,7 +379,7 @@ begin
|
||||
Result := 0;
|
||||
while Result < ALength do begin
|
||||
p := pos(Sep, Self[Result]);
|
||||
if (p >= 0) and (LowerCase(trim(Copy(Self[Result], 1, p-1))) = LowerCase(AName)) then
|
||||
if (p >= 0) and (CompareText(trim(Copy(Self[Result], 1, p-1)), AName) = 0 then
|
||||
exit;
|
||||
inc(Result);
|
||||
end;
|
||||
@ -1788,7 +1788,7 @@ begin
|
||||
v := AContext.WatchVal.Value;
|
||||
debugln([' expect ',Expect.ExpFullArrayLen,' got "',v,'"' ]);
|
||||
|
||||
if (LowerCase(v) = 'nil') then begin
|
||||
if CompareText(v, 'nil') = 0 then begin
|
||||
Result := TestEquals('Length/nil', Expect.ExpFullArrayLen, 0, AContext, AnIgnoreRsn);
|
||||
exit;
|
||||
end;
|
||||
@ -1858,14 +1858,16 @@ begin
|
||||
|
||||
if AContext.WatchVal.TypeInfo <> nil then begin
|
||||
a := AContext.WatchVal.TypeInfo.Fields.Count -1;
|
||||
while (a >= 0) and (LowerCase(AContext.WatchVal.TypeInfo.Fields[a].Name) <> LowerCase(sr.ExpFieldName)) do
|
||||
while (a >= 0)
|
||||
and (CompareText(AContext.WatchVal.TypeInfo.Fields[a].Name, sr.ExpFieldName) <> 0) do
|
||||
dec(a);
|
||||
TestTrue('typeinfo has field '+sr.ExpFieldName, a >= 0, AContext, AnIgnoreRsn);
|
||||
end;
|
||||
|
||||
if EvalCallResDBGType <> nil then begin
|
||||
a := EvalCallResDBGType.Fields.Count -1;
|
||||
while (a >= 0) and (LowerCase(EvalCallResDBGType.Fields[a].Name) <> LowerCase(sr.ExpFieldName)) do
|
||||
while (a >= 0)
|
||||
and (CompareText(EvalCallResDBGType.Fields[a].Name, sr.ExpFieldName) <> 0) do
|
||||
dec(a);
|
||||
TestTrue('EvalCallResDBGType has field '+sr.ExpFieldName, a >= 0, AContext, AnIgnoreRsn);
|
||||
end;
|
||||
|
@ -339,8 +339,8 @@ begin
|
||||
//property status
|
||||
SubItems.Add(StatusItem.PropStatus);
|
||||
//check if file is versioned
|
||||
if (LowerCase(StatusItem.ItemStatus) <> 'unversioned') and
|
||||
(LowerCase(StatusItem.ItemStatus) <> 'added') then
|
||||
if (CompareText(StatusItem.ItemStatus, 'unversioned') <> 0) and
|
||||
(CompareText(StatusItem.ItemStatus, 'added') <> 0) then
|
||||
begin
|
||||
//revision
|
||||
SubItems.Add(IntToStr(StatusItem.Revision));
|
||||
|
@ -94,9 +94,9 @@ begin
|
||||
while (FnPos>=1) and (Filename[FnPos]<>'.') do dec(FnPos);
|
||||
if FnPos < 1 then
|
||||
exit(false); // no extension in filename
|
||||
FnExt := LowerCase(Copy(Filename, FnPos, length(FileName)));
|
||||
FnExt := Copy(Filename, FnPos, length(FileName));
|
||||
for i:=Low(PascalFileExt) to High(PascalFileExt) do
|
||||
if CompareStr(FnExt,PascalFileExt[i])=0 then
|
||||
if CompareText(FnExt,PascalFileExt[i])=0 then
|
||||
exit(true);
|
||||
Result:=false;
|
||||
end;
|
||||
|
@ -14,7 +14,7 @@ uses
|
||||
// LCL
|
||||
Forms, StdCtrls, Dialogs, Spin,
|
||||
// LazUtils
|
||||
LazFileCache, LazFileUtils, FileUtil,
|
||||
LazFileCache, LazFileUtils, LazStringUtils, FileUtil,
|
||||
// IdeIntf
|
||||
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEDialogs,
|
||||
// Pas2Js
|
||||
@ -205,7 +205,7 @@ begin
|
||||
IDEMessageDialog('Error',ErrMsg,mtError,[mbOk]);
|
||||
exit(false);
|
||||
end;
|
||||
if Pos('pas2js',lowercase(ExtractFileNameOnly(NewExe)))<1 then
|
||||
if PosI('pas2js',ExtractFileNameOnly(NewExe))<1 then
|
||||
begin
|
||||
IDEMessageDialog('Warning','The pas2js executable filename "'+NewExe+'" does not look like pas2js',mtWarning,[mbOk]);
|
||||
exit(true);
|
||||
|
@ -1,4 +1,4 @@
|
||||
unit sqldbstrconst;
|
||||
unit SqlDbStrConst;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
|
@ -5,9 +5,18 @@ unit SQLStringsPropertyEditorDlg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, strutils,
|
||||
SynEdit, ButtonPanel, SynHighlighterSQL, ComCtrls, SQLDb, db, DBGrids, Menus,
|
||||
SrcEditorIntf, clipbrd, StdCtrls, fpsqltree, fpsqlparser, sqldbstrconst;
|
||||
Classes, SysUtils, StrUtils, SQLDb, db, fpsqltree, fpsqlparser,
|
||||
// LCL
|
||||
Forms, Controls, Graphics, Dialogs, ButtonPanel, ComCtrls, StdCtrls, Clipbrd,
|
||||
DBGrids, Menus,
|
||||
// LazUtils
|
||||
FileUtil, LazStringUtils,
|
||||
// IdeIntf
|
||||
SrcEditorIntf,
|
||||
// SynEdit
|
||||
SynEdit, SynHighlighterSQL,
|
||||
// SqlDb
|
||||
sqldbstrconst;
|
||||
|
||||
type
|
||||
|
||||
@ -162,11 +171,11 @@ begin
|
||||
D:=sqlStandard;
|
||||
If Assigned(FConnection) then
|
||||
begin
|
||||
if (copy(LowerCase(FConnection.ClassName),1,3)='tib') then
|
||||
if LazStartsText('tib', FConnection.ClassName) then
|
||||
D:=sqlinterbase6
|
||||
else if (copy(LowerCase(FConnection.ClassName),1,7)='toracle') then
|
||||
else if LazStartsText('toracle', FConnection.ClassName) then
|
||||
D:=sqloracle
|
||||
else if (Copy(LowerCase(FConnection.ClassName),1,6)='tmysql') then
|
||||
else if LazStartsText('tmysql', FConnection.ClassName) then
|
||||
D:=sqlmysql;
|
||||
end;
|
||||
if (CheckConnection) then
|
||||
|
@ -645,17 +645,16 @@ var
|
||||
begin
|
||||
if FDict.Count > 0 then
|
||||
exit;
|
||||
|
||||
SetLength(FNextTermWIthSameWord, FTerms.Count);
|
||||
|
||||
for i := 0 to FTerms.Count - 1 do begin
|
||||
FNextTermWIthSameWord[i] := -1;
|
||||
if not FTerms[i].Enabled then
|
||||
Continue;
|
||||
s := LowerCase(FTerms[i].SearchTerm);
|
||||
s := FTerms[i].SearchTerm;
|
||||
FDict.Add(FTerms[i].SearchTerm, i);
|
||||
for j := i + 1 to FTerms.Count - 1 do
|
||||
if LowerCase(FTerms[j].SearchTerm) = s then begin
|
||||
if CompareText(FTerms[j].SearchTerm, s) = 0 then begin
|
||||
FNextTermWIthSameWord[i] := j;
|
||||
break;
|
||||
end;
|
||||
@ -1341,8 +1340,7 @@ begin
|
||||
inc(Result);
|
||||
end
|
||||
else begin
|
||||
ATerm := LowerCase(ATerm);
|
||||
while (Result < c) and (LowerCase(Items[Result].SearchTerm) <> ATerm) do
|
||||
while (Result < c) and (CompareText(Items[Result].SearchTerm, ATerm) <> 0) do
|
||||
inc(Result);
|
||||
end;
|
||||
if Result >= c then
|
||||
|
@ -400,15 +400,12 @@ end;
|
||||
|
||||
function TSynPoSyn.IsKeyword(const AKeyword: string): boolean;
|
||||
var
|
||||
Token: String;
|
||||
i: Integer;
|
||||
begin
|
||||
//There are only 3 keywords, so no need to make a hashtable
|
||||
Token := LowerCase(AKeyWord);
|
||||
for i := 1 to PoKeysCount do if (PoKeys[i] = Token) then
|
||||
begin
|
||||
Exit(True);
|
||||
end;
|
||||
for i := 1 to PoKeysCount do
|
||||
if CompareText(PoKeys[i], AKeyWord) = 0 then
|
||||
Exit(True);
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
@ -1276,15 +1276,15 @@ var
|
||||
xitDef: ReadDef;
|
||||
xitOpenSymbol: CurRange.OpenSymbol.Symbol:=GetData(xitOpenSymbol);
|
||||
xitCloseSymbol: CurRange.CloseSymbol.Symbol:=GetData(xitCloseSymbol);
|
||||
xitCloseOnTerm: CurRange.CloseOnTerm:=lowercase(GetData(xitCloseOnTerm))='true';
|
||||
xitCloseOnEol: CurRange.CloseOnEol:=lowercase(GetData(xitCloseOnEol))='true';
|
||||
xitAnyTerm: if Lowercase(GetData(xitAnyTerm))='true' then
|
||||
xitCloseOnTerm: CurRange.CloseOnTerm:=CompareText(GetData(xitCloseOnTerm),'true')=0;
|
||||
xitCloseOnEol: CurRange.CloseOnEol:=CompareText(GetData(xitCloseOnEol),'true')=0;
|
||||
xitAnyTerm: if CompareText(GetData(xitAnyTerm),'true')=0 then
|
||||
CurRange.OpenSymbol.BrakeType:=btAny
|
||||
else
|
||||
CurRange.OpenSymbol.BrakeType:=btTerm;
|
||||
xitDelimiterChars: CurRange.TermSymbols:=String2Set(GetData(xitDelimiterChars));
|
||||
xitNum: ReadNum;
|
||||
xitCaseSensitive: CurRange.CaseSensitive:=lowercase(GetData(xitCaseSensitive))='true';
|
||||
xitCaseSensitive: CurRange.CaseSensitive:=CompareText(GetData(xitCaseSensitive),'true')=0;
|
||||
xitKW: begin
|
||||
NewSymbolGroup:=TSynSymbolGroup.Create('',CurRange.AddNewAttribs('unknown'));
|
||||
NewSymbolGroup.Name:=Param;
|
||||
@ -2584,15 +2584,15 @@ var
|
||||
xitDef: ReadDef;
|
||||
xitOpenSymbol: CurRange.OpenSymbol.Symbol:=GetData(xitOpenSymbol);
|
||||
xitCloseSymbol: CurRange.CloseSymbol.Symbol:=GetData(xitCloseSymbol);
|
||||
xitCloseOnTerm: CurRange.CloseOnTerm:=lowercase(GetData(xitCloseOnTerm))='true';
|
||||
xitCloseOnEol: CurRange.CloseOnEol:=lowercase(GetData(xitCloseOnEol))='true';
|
||||
xitAnyTerm: if Lowercase(GetData(xitAnyTerm))='true' then
|
||||
xitCloseOnTerm: CurRange.CloseOnTerm:=CompareText(GetData(xitCloseOnTerm),'true')=0;
|
||||
xitCloseOnEol: CurRange.CloseOnEol:=CompareText(GetData(xitCloseOnEol),'true')=0;
|
||||
xitAnyTerm: if CompareText(GetData(xitAnyTerm),'true')=0 then
|
||||
CurRange.OpenSymbol.BrakeType:=btAny
|
||||
else
|
||||
CurRange.OpenSymbol.BrakeType:=btTerm;
|
||||
xitDelimiterChars: CurRange.TermSymbols:=String2Set(GetData(xitDelimiterChars));
|
||||
xitNum: ReadNum;
|
||||
xitCaseSensitive: CurRange.CaseSensitive:=lowercase(GetData(xitCaseSensitive))='true';
|
||||
xitCaseSensitive: CurRange.CaseSensitive:=CompareText(GetData(xitCaseSensitive),'true')=0;
|
||||
xitKW: begin
|
||||
NewSymbolGroup:=TSynSymbolGroup.Create('',CurRange.AddNewAttribs('unknown'));
|
||||
NewSymbolGroup.Name:=Param;
|
||||
|
@ -327,10 +327,10 @@ class procedure TToDoListCore.CreateToDoItem(aTLFile: TTLScannedFile;
|
||||
const aTokenString: string; aLineNumber: Integer);
|
||||
|
||||
var
|
||||
lParsingString, lLowerString, lTokenToCheckFor : string;
|
||||
lParsingString, lTokenToCheckFor : string;
|
||||
lToDoTokenFound: boolean;
|
||||
lTodoType, lFoundToDoType: TToDoType;
|
||||
lTokenStyle, lFoundTokenStyle:TTokenStyle;
|
||||
lTokenStyle, lFoundTokenStyle: TTokenStyle;
|
||||
lParts: TStringList;
|
||||
|
||||
begin
|
||||
@ -341,7 +341,6 @@ begin
|
||||
// Remove leading and trailing blanks from input
|
||||
lParsingString := Trim(lParsingString);
|
||||
// See if it's a TODO or DONE item
|
||||
lLowerString := LowerCase(lParsingString);
|
||||
|
||||
lToDoTokenFound:=False;
|
||||
|
||||
@ -351,10 +350,11 @@ begin
|
||||
begin
|
||||
for lTodoType := Low(TToDoType) to High (TToDoType) do
|
||||
begin
|
||||
lTokenToCheckFor := LowerCase(TODO_TOKENS[lTokenStyle, lTodoType]);
|
||||
if (Pos(lTokenToCheckFor, lLowerString) = 1) // Token match
|
||||
and ((Length(lLowerString)=Length(lTokenToCheckFor)) // Exact match, no further chars. Should not happen?
|
||||
or not (lLowerString[Length(lTokenToCheckFor) + 1] in ['a'..'z'])) then // Extra char is not alpha
|
||||
lTokenToCheckFor := TODO_TOKENS[lTokenStyle, lTodoType];
|
||||
if (LazStartsText(lTokenToCheckFor, lParsingString)) // Token match
|
||||
and ( (Length(lParsingString)=Length(lTokenToCheckFor)) // Exact match, no further chars. Should not happen?
|
||||
or not (lParsingString[Length(lTokenToCheckFor)+1] in ['A'..'Z','a'..'z'])
|
||||
) then // Extra char is not alpha
|
||||
begin
|
||||
lToDoTokenFound := True;
|
||||
lFoundToDoType := lTodoType;
|
||||
|
@ -207,7 +207,7 @@ end;
|
||||
function FontWeightFromString(S: String): TCSSFontWeight;
|
||||
begin
|
||||
Result := cfwNormal;
|
||||
S := trim(LowerCase(S));
|
||||
S := trim(S);
|
||||
case S[1] of
|
||||
'1': if S = '100' then Result := cfw100;
|
||||
'2': if S = '200' then Result := cfw200;
|
||||
@ -218,9 +218,9 @@ begin
|
||||
'7': if S = '700' then Result := cfw700;
|
||||
'8': if S = '800' then Result := cfw800;
|
||||
'9': if S = '900' then Result := cfw900;
|
||||
'b': if S = 'bold' then Result := cfwBold
|
||||
else if S = 'bolder' then Result := cfwBolder;
|
||||
'l': if S = 'lighter' then Result := cfwLighter;
|
||||
'B','b': if CompareText(S, 'bold') = 0 then Result := cfwBold
|
||||
else if CompareText(S, 'bolder') = 0 then Result := cfwBolder;
|
||||
'L','l': if CompareText(S, 'lighter') = 0 then Result := cfwLighter;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -513,27 +513,26 @@ end;
|
||||
|
||||
function SizePxFromString(S: String): Integer;
|
||||
begin
|
||||
S := Copy(S, 1, PosI('PX',S)-1);
|
||||
S := Copy(S, 1, PosI('px',S)-1);
|
||||
Result := StrToIntDef(S, 0);
|
||||
end;
|
||||
|
||||
function StrToCssMargin(S: string): TCSSMargin;
|
||||
function StrToCssMargin(const S: string): TCSSMargin;
|
||||
var
|
||||
i: SizeInt;
|
||||
begin
|
||||
S:=lowercase(S);
|
||||
Result.Style:=cmsAuto;
|
||||
Result.Size:=0;
|
||||
if (S='') or (S='auto') then exit;
|
||||
if (S='') or (CompareText(S,'auto')=0) then exit;
|
||||
|
||||
i:=Pos('px',S);
|
||||
i:=PosI('px',S);
|
||||
if i>0 then begin
|
||||
Result.Style:=cmsPx;
|
||||
Result.Size:=StrToIntDef(copy(S,1,i-1),0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
i:=Pos('em',S);
|
||||
i:=PosI('em',S);
|
||||
if i>0 then begin
|
||||
Result.Style:=cmsEm;
|
||||
Result.Size:=StrToIntDef(copy(S,1,i-1),0);
|
||||
@ -865,32 +864,32 @@ procedure TCSSProps.ReadCommands(ACommands: TStrings);
|
||||
var
|
||||
Args: TStringlist;
|
||||
ACommand: String;
|
||||
Command: String;
|
||||
Cmd: String;
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to ACommands.Count-1 do
|
||||
begin
|
||||
ACommand := ACommands[I];
|
||||
if ACommand='' then continue;
|
||||
Command := LowerCase(GetCommandName(ACommand));
|
||||
if Command='' then continue;
|
||||
Cmd := LowerCase(GetCommandName(ACommand));
|
||||
if Cmd='' then continue;
|
||||
|
||||
Args := GetCommandArgs(ACommand);
|
||||
try
|
||||
case Command[1] of
|
||||
'c': if Command = 'color' then
|
||||
case Cmd[1] of
|
||||
'c': if Cmd = 'color' then
|
||||
if Args.Count > 0 then
|
||||
Color := ColorFromString(Args[0])
|
||||
else
|
||||
Color := clDefault;
|
||||
|
||||
'b': if Command = 'background-color' then begin
|
||||
'b': if Cmd = 'background-color' then begin
|
||||
if Args.Count > 0 then
|
||||
BGColor := ColorFromString(Args[0])
|
||||
else
|
||||
BGColor := clDefault;
|
||||
end else
|
||||
if Command = 'background' then
|
||||
if Cmd = 'background' then
|
||||
begin
|
||||
if Args.Count > 0 then BGColor := ColorFromString(Args[0]);
|
||||
if Args.Count > 1 then ; // background image
|
||||
@ -898,37 +897,37 @@ begin
|
||||
if Args.Count > 3 then ; // background attachment
|
||||
if Args.Count > 4 then ; // background position
|
||||
end
|
||||
else if Command = 'border' then
|
||||
else if Cmd = 'border' then
|
||||
begin
|
||||
if Args.Count > 0 then Border.Width := SizePxFromString(Args[0]);
|
||||
if Args.Count > 1 then Border.Style := BorderStyleFromString(Args[1]);
|
||||
if Args.Count > 2 then Border.Color := ColorFromString(Args[2]);
|
||||
end
|
||||
else if Command = 'border-width' then
|
||||
else if Cmd = 'border-width' then
|
||||
begin
|
||||
if Args.Count > 0 then Border.Width := SizePxFromString(Args[0]);
|
||||
end
|
||||
else if Command = 'border-color' then
|
||||
else if Cmd = 'border-color' then
|
||||
begin
|
||||
if Args.Count > 0 then Border.Color := ColorFromString(Args[0]);
|
||||
end
|
||||
else if Command = 'border-style' then
|
||||
else if Cmd = 'border-style' then
|
||||
begin
|
||||
if Args.Count > 0 then Border.Style := BorderStyleFromString(Args[0]);
|
||||
end;
|
||||
|
||||
'm':
|
||||
if Command = 'margin-top' then begin
|
||||
if Cmd = 'margin-top' then begin
|
||||
if Args.Count > 0 then MarginTop := StrToCssMargin(Args[0]);
|
||||
end
|
||||
else if Command = 'margin-left' then begin
|
||||
else if Cmd = 'margin-left' then begin
|
||||
if Args.Count > 0 then MarginLeft := StrToCssMargin(Args[0]);
|
||||
end
|
||||
else if Command = 'margin-bottom' then begin
|
||||
else if Cmd = 'margin-bottom' then begin
|
||||
if Args.Count > 0 then MarginBottom := StrToCssMargin(Args[0]);
|
||||
end else if Command = 'margin-right' then begin
|
||||
end else if Cmd = 'margin-right' then begin
|
||||
if Args.Count > 0 then MarginRight := StrToCssMargin(Args[0]);
|
||||
end else if Command = 'margin' then begin
|
||||
end else if Cmd = 'margin' then begin
|
||||
case Args.Count of
|
||||
1:begin
|
||||
// 1 arg: all four the same
|
||||
@ -960,25 +959,25 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
't': if (Command = 'text-align') then
|
||||
't': if (Cmd = 'text-align') then
|
||||
begin
|
||||
if Args.Count > 0 then Alignment := GetAlignmentForStr(Args[0]);
|
||||
end;
|
||||
|
||||
'f':
|
||||
if (Length(Command) > 7) and (Args.Count > 0) then
|
||||
case Command[7] of
|
||||
'a': if (Command = 'font-family') then
|
||||
if (Length(Cmd) > 7) and (Args.Count > 0) then
|
||||
case Cmd[7] of
|
||||
'a': if (Cmd = 'font-family') then
|
||||
Font.Name := Args.CommaText; //Args[0];
|
||||
'i': if (Command = 'font-size') then
|
||||
'i': if (Cmd = 'font-size') then
|
||||
Font.Size := Args[0];
|
||||
't': if (Command = 'font-style') then
|
||||
't': if (Cmd = 'font-style') then
|
||||
Font.Style := CSSFontStyleFromName(Args[0]);
|
||||
'e': if (Command = 'font-weight') then
|
||||
'e': if (Cmd = 'font-weight') then
|
||||
Font.Weight := FontWeightFromString(Args[0]);
|
||||
end;
|
||||
'w':
|
||||
if (Command = 'width') and (Args.Count > 0) then
|
||||
if (Cmd = 'width') and (Args.Count > 0) then
|
||||
FWidth := StrToCSSLength(Args[0]);
|
||||
end;
|
||||
finally
|
||||
|
@ -5497,7 +5497,7 @@ begin
|
||||
Content := FindAttribute(htmlAttrCONTENT);
|
||||
if not FHasBOM then begin
|
||||
if SameText(HttpEquiv, 'content-type') then begin
|
||||
j := pos('charset=', lowercase(Content));
|
||||
j := PosI('charset=', Content);
|
||||
if j>0 then begin
|
||||
j := j+8;
|
||||
i := j;
|
||||
@ -5511,7 +5511,7 @@ begin
|
||||
end
|
||||
else
|
||||
fDocCharset := FindAttribute(htmlAttrCHARSET);
|
||||
if pos('windows', Lowercase(fDocCharset)) = 1 then
|
||||
if LazStartsText('windows', fDocCharset) then
|
||||
fDocCharset := NormalizeEncoding(StringReplace(fDocCharset, 'windows', 'cp', [rfIgnoreCase]));
|
||||
end;
|
||||
Scheme := FindAttribute(htmlAttrSCHEME);
|
||||
@ -14428,9 +14428,8 @@ begin
|
||||
raise EIpHtmlException.Create(SHtmlNoDataProvider);
|
||||
if not FDataProvider.DoCheckURL(St, ResourceType) then
|
||||
raise EIpHtmlException.Create(SHtmlResUnavail + St);
|
||||
ResourceType := LowerCase(ResourceType);
|
||||
|
||||
if ( Pos('text/', ResourceType) <> 1) and (pos('image/', ResourceType) <> 1) then begin
|
||||
if ( PosI('text/', ResourceType) <> 1) and (PosI('image/', ResourceType) <> 1) then begin
|
||||
FViewer.FHotURL := St;
|
||||
FViewer.DoHotClick;
|
||||
Result := True;
|
||||
@ -14609,13 +14608,12 @@ begin
|
||||
raise EIpHtmlException.Create(SHtmlResUnavail + St);
|
||||
IsImage := False;
|
||||
S := nil;
|
||||
ResourceType := Lowercase(ResourceType);
|
||||
if pos('image/', ResourceType) = 1 then begin
|
||||
if PosI('image/', ResourceType) = 1 then begin
|
||||
IsImage := True;
|
||||
S := BuildImagePage(St);
|
||||
end else
|
||||
|
||||
if Pos('text/', ResourceType) <> 1 then begin
|
||||
if PosI('text/', ResourceType) <> 1 then begin
|
||||
FViewer.FHotURL := St;
|
||||
FViewer.DoHotClick;
|
||||
Exit;
|
||||
|
@ -42,7 +42,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
LCLType, LCLIntf,
|
||||
LazFileUtils,
|
||||
LazFileUtils, LazStringUtils,
|
||||
IpStrms, IpUtils, IpConst;
|
||||
|
||||
type
|
||||
@ -103,8 +103,6 @@ type
|
||||
private
|
||||
FCollection : TIpHeaderCollection;
|
||||
FName : string;
|
||||
FNameL : string;
|
||||
{ Lower case version of FName. Used to speed up header searches. }
|
||||
FProperty : Boolean;
|
||||
FValue : TStringList;
|
||||
protected
|
||||
@ -117,8 +115,6 @@ type
|
||||
property Collection : TIpHeaderCollection
|
||||
read FCollection write FCollection;
|
||||
property Name : string read FName write SetName;
|
||||
property NameL : string read FNameL;
|
||||
{ Lower case version of Name property. }
|
||||
property IsProperty : Boolean read FProperty write FProperty;
|
||||
{ Set to True if this header is exposed via an iPRO property. }
|
||||
property Value : TStringList read FValue write SetValue;
|
||||
@ -136,7 +132,7 @@ type
|
||||
public
|
||||
constructor Create (AOwner : TPersistent);
|
||||
|
||||
function HasHeader (AName : string) : Integer;
|
||||
function HasHeader(const AName: string): Integer;
|
||||
procedure HeaderByName (AName : string;
|
||||
Headers : TStringList);
|
||||
procedure LoadHeaders (AHeaderList : TStringList;
|
||||
@ -1052,7 +1048,6 @@ end;
|
||||
procedure TIpHeaderItem.SetName(const Name : string);
|
||||
begin
|
||||
FName := Name;
|
||||
FNameL := LowerCase(Name);
|
||||
end;
|
||||
|
||||
procedure TIpHeaderItem.SetValue (v : TStringList);
|
||||
@ -1078,18 +1073,15 @@ begin
|
||||
Result := FOwner;
|
||||
end;
|
||||
|
||||
function TIpHeaderCollection.HasHeader (AName : string) : Integer;
|
||||
function TIpHeaderCollection.HasHeader(const AName : string) : Integer;
|
||||
var
|
||||
i : Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
AName := LowerCase(AName);
|
||||
for i := 0 to Count - 1 do
|
||||
if Items[i].NameL = AName then begin
|
||||
Result := i;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if CompareText(Items[i].Name, AName) = 0 then
|
||||
Exit(i);
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
procedure TIpHeaderCollection.HeaderByName (AName : string;
|
||||
Headers : TStringList);
|
||||
@ -3085,7 +3077,7 @@ var
|
||||
asBegin : begin
|
||||
if s[i] in [' ', #09] then
|
||||
Inc (i)
|
||||
else if LowerCase (Copy (s, i, 5)) = 'begin' then begin
|
||||
else if CompareText(Copy(s,i,5), 'begin') = 0 then begin
|
||||
State := asHaveBegin;
|
||||
Inc (i, 5);
|
||||
end else
|
||||
@ -3209,22 +3201,14 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
function IsAttachmentEnd (const s : string) : Boolean;
|
||||
begin
|
||||
if LowerCase (Copy (s, 1, 3)) = 'end' then
|
||||
Result := True
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure CheckForAttachment (const s : string);
|
||||
begin
|
||||
if IsAttachmentStart (s) then begin
|
||||
if AttDepth = 0 then
|
||||
Inc (FAttachmentCount);
|
||||
Inc (AttDepth);
|
||||
end else if (IsAttachmentEnd (s)) and
|
||||
(FAttachmentCount > 0) then
|
||||
end
|
||||
else if LazStartsText('end', s) and (FAttachmentCount > 0) then
|
||||
Dec (AttDepth);
|
||||
end;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user