add helper for integer, refactor ` = 0` with equals(0)

This commit is contained in:
Basile Burg 2020-07-05 14:24:32 +02:00
parent eea8f7158b
commit 0196068b06
27 changed files with 119 additions and 102 deletions

View File

@ -582,7 +582,7 @@ var
src: string; src: string;
i: Integer; i: Integer;
begin begin
if fSrcs.Count = 0 then if fSrcs.Count.equals(0) then
exit; exit;
allMissing := true; allMissing := true;
for i:= 0 to fSrcs.Count-1 do for i:= 0 to fSrcs.Count-1 do
@ -783,7 +783,7 @@ begin
processOutputToStrings(prc, lst); processOutputToStrings(prc, lst);
while prc.Running do while prc.Running do
sleep(1); sleep(1);
com := prc.ExitStatus = 0; com := prc.ExitStatus.equals(0);
for j := 0 to lst.Count -1 do for j := 0 to lst.Count -1 do
fMsgs.message(lst[j], fAsProjectItf, amcProj, amkAuto); fMsgs.message(lst[j], fAsProjectItf, amcProj, amkAuto);
finally finally
@ -818,7 +818,7 @@ begin
if poUsePipes in prc.Options then if poUsePipes in prc.Options then
runProcOutput(prc); runProcOutput(prc);
finally finally
result := prc.ExitStatus = 0; result := prc.ExitStatus.equals(0);
prc.Free; prc.Free;
end; end;
end; end;
@ -862,7 +862,7 @@ begin
if not runPrePostProcess(config.preBuildProcess) then if not runPrePostProcess(config.preBuildProcess) then
fMsgs.message('warning: pre-compilation process or commands not properly executed', fMsgs.message('warning: pre-compilation process or commands not properly executed',
fAsProjectItf, amcProj, amkWarn); fAsProjectItf, amcProj, amkWarn);
if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then if Sources.Count.equals(0) and config.pathsOptions.extraSources.Count.equals(0) then
exit; exit;
prjname := shortenPath(filename, 25); prjname := shortenPath(filename, 25);
@ -991,7 +991,7 @@ var
begin begin
compProcOutput(proc); compProcOutput(proc);
prjname := shortenPath(filename); prjname := shortenPath(filename);
fCompiled := fCompilProc.ExitStatus = 0; fCompiled := fCompilProc.ExitStatus.equals(0);
updateOutFilename; updateOutFilename;
if fCompiled then if fCompiled then
fMsgs.message(prjname + ' has been successfully compiled', fMsgs.message(prjname + ' has been successfully compiled',

View File

@ -93,6 +93,14 @@ type
function normalizePath: string; function normalizePath: string;
end; end;
TDexedInt64Helper = type helper for Int64
function equals(const value: integer): boolean; inline;
end;
TDexedLongIntHelper = type helper(TIntegerHelper) for LongInt
function equals(const value: integer): boolean; inline;
end;
TStringsHelper = class helper for TStrings TStringsHelper = class helper for TStrings
// Same as text but without the additional line terminator. // Same as text but without the additional line terminator.
function strictText: string; function strictText: string;
@ -521,13 +529,22 @@ begin
exit(TrimFilename(self)); exit(TrimFilename(self));
end; end;
function TDexedInt64Helper.equals(const value: integer): boolean; inline;
begin
result := value = self;
end;
function TDexedLongIntHelper.equals(const value: integer): boolean; inline;
begin
result := value = self;
end;
function TStringsHelper.strictText: string; function TStringsHelper.strictText: string;
begin begin
result := self.Text; result := self.Text;
setLength(result, result.length - self.LineBreak.length); setLength(result, result.length - self.LineBreak.length);
end; end;
function TJSONObjectHelper.findObject(const key: TJSONStringType; out value: TJSONObject): boolean; function TJSONObjectHelper.findObject(const key: TJSONStringType; out value: TJSONObject): boolean;
var var
v: TJSONData; v: TJSONData;

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, ComCtrls, ExtCtrls, buttons, Graphics, Classes, SysUtils, Forms, Controls, ComCtrls, ExtCtrls, buttons, Graphics,
Menus, Clipbrd; Menus, Clipbrd, u_common;
type type
TPageControlButton = (pbClose, pbMoveLeft, pbMoveRight, pbAdd, pbSplit); TPageControlButton = (pbClose, pbMoveLeft, pbMoveRight, pbAdd, pbSplit);
@ -410,7 +410,7 @@ begin
leftp := getPage(fPageIndex); leftp := getPage(fPageIndex);
leftp.Align := alLeft; leftp.Align := alLeft;
if fOldSplitPos = 0 then if fOldSplitPos.equals(0) then
leftp.Width:= (fContent.Width - fSplitter.Width) div 2 leftp.Width:= (fContent.Width - fSplitter.Width) div 2
else else
leftp.Width:= fOldSplitPos; leftp.Width:= fOldSplitPos;
@ -469,7 +469,7 @@ begin
{$POP} {$POP}
end; end;
if fPages.Count = 0 then if fPages.Count.equals(0) then
fPageIndex:=-1; fPageIndex:=-1;
updateButtonsState; updateButtonsState;
@ -744,7 +744,7 @@ begin
exit; exit;
c := getColumnIndex; c := getColumnIndex;
if c = 0 then if c.equals(0) then
s := fList.Selected.Caption s := fList.Selected.Caption
else else
s := fList.Selected.SubItems[c-1]; s := fList.Selected.SubItems[c-1];
@ -778,7 +778,7 @@ begin
exit; exit;
c := getColumnIndex; c := getColumnIndex;
if c = 0 then if c.equals(0) then
begin begin
for i := 0 to fList.Items.Count - 1 do for i := 0 to fList.Items.Count - 1 do
s += fList.Items[i].Caption + LineEnding; s += fList.Items[i].Caption + LineEnding;

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, Graphics, Classes, SysUtils, Graphics,
SynEditHighlighter, SynEditHighlighterFoldBase, SynEditTypes, SynEditHighlighter, SynEditHighlighterFoldBase, SynEditTypes,
u_dlangutils,u_dlangmaps; u_dlangutils, u_dlangmaps, u_common;
type type
@ -444,7 +444,7 @@ begin
readerReset; readerReset;
// script line // script line
if (LineIndex = 0) and (fTokStart = 1) and readDelim(reader, fTokStop, '#!') then if LineIndex.equals(0) and fTokStart.equals(1) and readDelim(reader, fTokStop, '#!') then
begin begin
fTokKind := tkCommt; fTokKind := tkCommt;
readLine(reader, fTokStop); readLine(reader, fTokStop);
@ -613,11 +613,11 @@ begin
end else readerNext; end else readerNext;
end; end;
end; end;
if fCurrRange.nestedCommentsCount = 0 then if fCurrRange.nestedCommentsCount.equals(0) then
begin begin
if (fTokKind = tkCommt) then if fTokKind = tkCommt then
EndCodeFoldBlock(fkComments2 in fFoldKinds) EndCodeFoldBlock(fkComments2 in fFoldKinds)
else if (fTokKind = tkDDocs) then else if fTokKind = tkDDocs then
EndCodeFoldBlock(fkDDoc in fFoldKinds); EndCodeFoldBlock(fkDDoc in fFoldKinds);
fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2]; fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2];
end; end;
@ -741,7 +741,7 @@ begin
if readUntil(reader, fTokStop, ')"') then if readUntil(reader, fTokStop, ')"') then
begin begin
fCurrRange.nestedQParensStrings -= 1; fCurrRange.nestedQParensStrings -= 1;
if fCurrRange.nestedQParensStrings = 0 then if fCurrRange.nestedQParensStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
@ -757,7 +757,7 @@ begin
if readUntil(reader, fTokStop, ')"') then if readUntil(reader, fTokStop, ')"') then
begin begin
fCurrRange.nestedQParensStrings -= 1; fCurrRange.nestedQParensStrings -= 1;
if fCurrRange.nestedQParensStrings = 0 then if fCurrRange.nestedQParensStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rangeKinds -= [rkStringQParen]; fCurrRange.rangeKinds -= [rkStringQParen];
@ -776,7 +776,7 @@ begin
if readUntil(reader, fTokStop, ']"') then if readUntil(reader, fTokStop, ']"') then
begin begin
fCurrRange.nestedQSquareStrings -= 1; fCurrRange.nestedQSquareStrings -= 1;
if fCurrRange.nestedQSquareStrings = 0 then if fCurrRange.nestedQSquareStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
@ -792,7 +792,7 @@ begin
if readUntil(reader, fTokStop, ']"') then if readUntil(reader, fTokStop, ']"') then
begin begin
fCurrRange.nestedQSquareStrings -= 1; fCurrRange.nestedQSquareStrings -= 1;
if fCurrRange.nestedQSquareStrings = 0 then if fCurrRange.nestedQSquareStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rangeKinds -= [rkStringQSquare]; fCurrRange.rangeKinds -= [rkStringQSquare];
@ -811,7 +811,7 @@ begin
if readUntil(reader, fTokStop, '>"') then if readUntil(reader, fTokStop, '>"') then
begin begin
fCurrRange.nestedQGeStrings -= 1; fCurrRange.nestedQGeStrings -= 1;
if fCurrRange.nestedQGeStrings = 0 then if fCurrRange.nestedQGeStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
@ -827,7 +827,7 @@ begin
if readUntil(reader, fTokStop, ')"') then if readUntil(reader, fTokStop, ')"') then
begin begin
fCurrRange.nestedQGeStrings -= 1; fCurrRange.nestedQGeStrings -= 1;
if fCurrRange.nestedQGeStrings = 0 then if fCurrRange.nestedQGeStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rangeKinds -= [rkStringQGe]; fCurrRange.rangeKinds -= [rkStringQGe];
@ -846,7 +846,7 @@ begin
if readUntil(reader, fTokStop, '}"') then if readUntil(reader, fTokStop, '}"') then
begin begin
fCurrRange.nestedQCurlyStrings -= 1; fCurrRange.nestedQCurlyStrings -= 1;
if fCurrRange.nestedQCurlyStrings = 0 then if fCurrRange.nestedQCurlyStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
@ -862,7 +862,7 @@ begin
if readUntil(reader, fTokStop, '}"') then if readUntil(reader, fTokStop, '}"') then
begin begin
fCurrRange.nestedQCurlyStrings -= 1; fCurrRange.nestedQCurlyStrings -= 1;
if fCurrRange.nestedQCurlyStrings = 0 then if fCurrRange.nestedQCurlyStrings.equals(0) then
begin begin
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rangeKinds -= [rStringQCurly]; fCurrRange.rangeKinds -= [rStringQCurly];
@ -1023,7 +1023,7 @@ begin
if rkAttrib in fCurrRange.rangeKinds then if rkAttrib in fCurrRange.rangeKinds then
begin begin
fCurrRange.attribParenCount -= 1; fCurrRange.attribParenCount -= 1;
if fCurrRange.attribParenCount = 0 then if fCurrRange.attribParenCount.equals(0) then
begin begin
fCurrRange.rangeKinds -= [rkAttrib]; fCurrRange.rangeKinds -= [rkAttrib];
fTokKind := tkAttri; fTokKind := tkAttri;

View File

@ -507,7 +507,7 @@ begin
fTempLines.Clear; fTempLines.Clear;
processOutputToStrings(fClient, fTempLines); processOutputToStrings(fClient, fTempLines);
while fClient.Running do ; while fClient.Running do ;
if fTempLines.Count = 0 then if fTempLines.Count.equals(0) then
begin begin
updateServerlistening; updateServerlistening;
exit; exit;
@ -559,7 +559,7 @@ begin
fTempLines.Clear; fTempLines.Clear;
processOutputToStrings(fClient, fTempLines); processOutputToStrings(fClient, fTempLines);
while fClient.Running do ; while fClient.Running do ;
if fTempLines.Count = 0 then if fTempLines.Count.equals(0) then
begin begin
updateServerlistening; updateServerlistening;
exit; exit;
@ -611,7 +611,7 @@ begin
exit; exit;
i := fDoc.MouseBytePosition; i := fDoc.MouseBytePosition;
if i = 0 then if i.equals(0) then
exit; exit;
terminateClient; terminateClient;

View File

@ -185,9 +185,9 @@ begin
fReaderHead := text; fReaderHead := text;
while (LineAnColumn <> colAndLine) do while (LineAnColumn <> colAndLine) do
Next; Next;
//
// editor not 0 based ln index // editor not 0 based ln index
if fLineIndex = 0 then if fLineIndex.equals(0) then
fLineIndex := 1; fLineIndex := 1;
end; end;
@ -848,7 +848,7 @@ begin
begin begin
tokenStringBraceBalance -= Byte(reader.head^ = '}'); tokenStringBraceBalance -= Byte(reader.head^ = '}');
tokenStringBraceBalance += Byte(reader.head^ = '{'); tokenStringBraceBalance += Byte(reader.head^ = '{');
if tokenStringBraceBalance = 0 then if tokenStringBraceBalance.equals(0) then
begin begin
if (reader.head^ = '}') and ((reader.head + 1)^ in stringPostfixes) and not if (reader.head^ = '}') and ((reader.head + 1)^ in stringPostfixes) and not
isIdentifier((reader.head + 2)^) then isIdentifier((reader.head + 2)^) then
@ -1123,7 +1123,7 @@ begin
if t^.kind <> TLexTokenKind.ltkSymbol then if t^.kind <> TLexTokenKind.ltkSymbol then
continue; continue;
// skip parens pairs, if not already skipping square bracket pairs // skip parens pairs, if not already skipping square bracket pairs
if (s = 0) then if s.equals(0) then
begin begin
p += byte(t^.Data = '('); p += byte(t^.Data = '(');
p -= byte(t^.Data = ')'); p -= byte(t^.Data = ')');
@ -1131,14 +1131,14 @@ begin
continue; continue;
end; end;
// skip square bracket pairs, if not already skipping parens pairs // skip square bracket pairs, if not already skipping parens pairs
if (p = 0) then if p.equals(0) then
begin begin
s += byte(t^.Data = '['); s += byte(t^.Data = '[');
s -= byte(t^.Data = ']'); s -= byte(t^.Data = ']');
if s > 0 then if s > 0 then
continue; continue;
end; end;
if (s = 0) and (p = 0) and (t^.Data = ',') then if s.equals(0) and p.equals(0) and (t^.Data = ',') then
result += 1; result += 1;
end; end;
end; end;
@ -1179,13 +1179,13 @@ begin
p += Byte((t^.kind = TLexTokenKind.ltkSymbol) and (t^.Data = ')')); p += Byte((t^.kind = TLexTokenKind.ltkSymbol) and (t^.Data = ')'));
p -= Byte((t^.kind = TLexTokenKind.ltkSymbol) and (t^.Data = '(')); p -= Byte((t^.kind = TLexTokenKind.ltkSymbol) and (t^.Data = '('));
// (a.(b).c|.d) -> a.(b).c // (a.(b).c|.d) -> a.(b).c
if p = 0 then if p.equals(0) then
begin begin
li := i+1; li := i+1;
break; break;
end; end;
end; end;
if (li <> -1) and (ri >= li) then if not li.equals(-1) and (ri >= li) then
begin begin
for i := li to ri do for i := li to ri do
result += tokens[i]^.Data; result += tokens[i]^.Data;

View File

@ -749,7 +749,7 @@ begin
list.Add('-main'); list.Add('-main');
if baseopt.fRelease or fRelease then if baseopt.fRelease or fRelease then
list.Add('-release'); list.Add('-release');
if (fVerIds.Count = 0) then if fVerIds.Count.equals(0) then
for str in baseopt.fVerIds do for str in baseopt.fVerIds do
begin begin
if not isStringDisabled(str) then if not isStringDisabled(str) then
@ -931,11 +931,11 @@ begin
baseopt := TDebugOpts(base); baseopt := TDebugOpts(base);
if baseopt.fDebugConditions or fDebugConditions then if baseopt.fDebugConditions or fDebugConditions then
list.Add('-debug'); list.Add('-debug');
if (baseopt.fDbgLevel <> 0) and (fDbgLevel = 0) then if not baseopt.fDbgLevel.equals(0) and fDbgLevel.equals(0) then
list.Add('-debug=' + intToStr(baseopt.fDbgLevel)) list.Add('-debug=' + intToStr(baseopt.fDbgLevel))
else if fDbgLevel <> 0 then else if not fDbgLevel.equals(0) then
list.Add('-debug=' + intToStr(fDbgLevel)); list.Add('-debug=' + intToStr(fDbgLevel));
if fDbgIdents.Count = 0 then if fDbgIdents.Count.equals(0) then
for idt in baseopt.fDbgIdents do for idt in baseopt.fDbgIdents do
list.Add('-debug=' + idt) list.Add('-debug=' + idt)
else for idt in fDbgIdents do else for idt in fDbgIdents do
@ -1154,7 +1154,7 @@ begin
end else end else
begin begin
baseopt := TPathsOpts(base); baseopt := TPathsOpts(base);
if fExtraSrcs.Count = 0 then if fExtraSrcs.Count.equals(0) then
rightList := baseopt.fExtraSrcs rightList := baseopt.fExtraSrcs
else else
rightList := fExtraSrcs; rightList := fExtraSrcs;
@ -1175,8 +1175,8 @@ begin
finally finally
exts.Free; exts.Free;
end; end;
//
if fImpMod.Count = 0 then if fImpMod.Count.equals(0) then
rightList := baseopt.fImpMod rightList := baseopt.fImpMod
else else
rightList := fImpMod; rightList := fImpMod;
@ -1189,8 +1189,8 @@ begin
str := c + str; str := c + str;
list.Add('-I'+ fSymStringExpander.expand(str)); list.Add('-I'+ fSymStringExpander.expand(str));
end; end;
//
if fImpStr.Count = 0 then if fImpStr.Count.equals(0) then
rightList := baseopt.fImpStr rightList := baseopt.fImpStr
else else
rightList := fImpStr; rightList := fImpStr;
@ -1389,7 +1389,7 @@ begin
end else end else
begin begin
baseopt := TOtherOpts(base); baseopt := TOtherOpts(base);
if fCustom.Count = 0 then if fCustom.Count.equals(0) then
rightList := baseopt.fCustom rightList := baseopt.fCustom
else else
rightList := fCustom; rightList := fCustom;
@ -1439,17 +1439,17 @@ begin
baseopt := TOtherOpts(base); baseopt := TOtherOpts(base);
case compiler of case compiler of
dmd: dmd:
if fDmdOthers.Count = 0 then if fDmdOthers.Count.equals(0) then
lst := baseopt.fDmdOthers lst := baseopt.fDmdOthers
else else
lst := fDmdOthers; lst := fDmdOthers;
ldc, ldmd: ldc, ldmd:
if fLdcOthers.Count = 0 then if fLdcOthers.Count.equals(0) then
lst := baseopt.fLdcOthers lst := baseopt.fLdcOthers
else else
lst := fLdcOthers; lst := fLdcOthers;
gdc, gdmd: gdc, gdmd:
if fGdcOthers.Count = 0 then if fGdcOthers.Count.equals(0) then
lst := baseopt.fGdcOthers lst := baseopt.fGdcOthers
else else
lst := fGdcOthers; lst := fGdcOthers;

View File

@ -448,7 +448,7 @@ begin
break; break;
end; end;
end; end;
if (j = 0) then if j.equals(0) then
continue; continue;
n := s[1..j-1]; n := s[1..j-1];
@ -1085,7 +1085,7 @@ begin
fCompiled := fDubProc.ExitStatus = 0; fCompiled := fDubProc.ExitStatus = 0;
// note: fCompiled is also used to indicate if there's something produced // note: fCompiled is also used to indicate if there's something produced
// so the 'or' RHS is there for fNextTerminatedCommand <> dcBuild; // so the 'or' RHS is there for fNextTerminatedCommand <> dcBuild;
if fCompiled or (fDubProc.ExitStatus = 0) then if fCompiled or fDubProc.ExitStatus.equals(0) then
begin begin
fMsgs.message(n + ' has been successfully ' + fMsgs.message(n + ' has been successfully ' +
dubCmd2PostMsg[fNextTerminatedCommand], fAsProjectItf, amcProj, amkInf) dubCmd2PostMsg[fNextTerminatedCommand], fAsProjectItf, amcProj, amkInf)
@ -1593,7 +1593,7 @@ procedure TDubProject.updateImportPathsFromJson;
Parameters.Add(n); Parameters.Add(n);
Execute; Execute;
while Running do ; while Running do ;
if ExitStatus = 0 then if ExitStatus.equals(0) then
begin begin
TDubLocalPackages.setNeedUpdate; TDubLocalPackages.setNeedUpdate;
TDubLocalPackages.update(); TDubLocalPackages.update();
@ -1652,7 +1652,7 @@ procedure TDubProject.updateImportPathsFromJson;
Parameters.Add('--version=' + p); Parameters.Add('--version=' + p);
Execute; Execute;
while Running do ; while Running do ;
if ExitStatus = 0 then if ExitStatus.equals(0) then
begin begin
TDubLocalPackages.setNeedUpdate; TDubLocalPackages.setNeedUpdate;
TDubLocalPackages.update(); TDubLocalPackages.update();

View File

@ -470,9 +470,9 @@ var
begin begin
if fSelectedNode.isNil then if fSelectedNode.isNil then
exit; exit;
if fSelectedNode.Level = 0 then if fSelectedNode.Level.equals(0) then
exit; exit;
if (fSelectedNode.Text = 'name') and (fSelectedNode.Level = 0) then if (fSelectedNode.Text = 'name') and fSelectedNode.Level.equals(0) then
exit; exit;
if fSelectedNode.Data.isNil then if fSelectedNode.Data.isNil then
exit; exit;

View File

@ -846,7 +846,7 @@ var
dc1: TDexedMemo = nil; dc1: TDexedMemo = nil;
dc2: TDexedMemo = nil; dc2: TDexedMemo = nil;
begin begin
if page.isNil or (page.ControlCount = 0) then if page.isNil or page.ControlCount.equals(0) then
exit; exit;
if pageControl.splitPage.isNotNil and if pageControl.splitPage.isNotNil and
(page <> pageControl.splitPage) then (page <> pageControl.splitPage) then

View File

@ -1203,7 +1203,7 @@ begin
p := projectByIndex[i]; p := projectByIndex[i];
if not p.filename.fileExists or p.filename.isEmpty then if not p.filename.fileExists or p.filename.isEmpty then
fProjects.Delete(i) fProjects.Delete(i)
else if (p.arguments.Count = 0) and (p.environmentPaths.Count = 0) and else if p.arguments.Count.equals(0) and p.environmentPaths.Count.equals(0) and
(p.workingDirectory = '') and (p.queryArguments = false) then (p.workingDirectory = '') and (p.queryArguments = false) then
fProjects.Delete(i); fProjects.Delete(i);
end; end;
@ -1754,7 +1754,7 @@ begin
end; end;
'{': '{':
begin begin
if t = 0 then if t.equals(0) then
writeIndent() writeIndent()
else else
newLineAndIndent(); newLineAndIndent();
@ -2268,7 +2268,7 @@ var
rng: TStringRange = (ptr: nil; pos: 0; len: 0); rng: TStringRange = (ptr: nil; pos: 0; len: 0);
begin begin
json.Clear; json.Clear;
if str.length = 0 then if str.length.equals(0) then
exit; exit;
rng.init(str); rng.init(str);
json.Arrays['OUT'] := TJSONArray.Create; json.Arrays['OUT'] := TJSONArray.Create;
@ -2867,7 +2867,7 @@ begin
case fEvalKind of case fEvalKind of
gekCustom: gekCustom:
begin begin
if fOptions.customEvalHistory.Count = 0 then if fOptions.customEvalHistory.Count.equals(0) then
fOptions.customEvalHistory.Add('<enter a custom expression to evaluate>'); fOptions.customEvalHistory.Add('<enter a custom expression to evaluate>');
e := InputComboEx('Evaluate', 'Expression', fOptions.customEvalHistory, true); e := InputComboEx('Evaluate', 'Expression', fOptions.customEvalHistory, true);
if not e.isBlank then if not e.isBlank then

View File

@ -196,7 +196,7 @@ procedure THalsteadMetrics.Measure(document: TDexedMemo);
if val.isNil then if val.isNil then
exit; exit;
n1 := val.AsInteger; n1 := val.AsInteger;
if n1 = 0 then if n1.equals(0) then
exit; exit;
val := obj.Find('n1Sum'); val := obj.Find('n1Sum');
@ -208,7 +208,7 @@ procedure THalsteadMetrics.Measure(document: TDexedMemo);
if val.isNil then if val.isNil then
exit; exit;
n2 := val.AsInteger; n2 := val.AsInteger;
if n2 = 0 then if n2.equals(0) then
exit; exit;
val := obj.Find('n2Sum'); val := obj.Find('n2Sum');
@ -269,7 +269,7 @@ var
i: integer; i: integer;
begin begin
if not fShowAllResults if not fShowAllResults
and ((maxBugsPerFunction = 0) and (maxBugsPerModule = 0) and (maxVolumePerFunction = 0)) then and (maxBugsPerFunction = 0) and (maxBugsPerModule = 0) and (maxVolumePerFunction = 0) then
exit; exit;
if not assigned(fMsgs) then if not assigned(fMsgs) then

View File

@ -846,7 +846,7 @@ procedure TLibManEditorWidget.btnMoveUpClick(Sender: TObject);
var var
i: integer; i: integer;
begin begin
if list.Selected.isNil or (list.Selected.Index = 0) then if list.Selected.isNil or list.Selected.Index.equals(0) then
exit; exit;
i := list.Selected.Index; i := list.Selected.Index;

View File

@ -723,7 +723,7 @@ end;
procedure TRunnableOptions.afterLoad; procedure TRunnableOptions.afterLoad;
begin begin
inherited; inherited;
if fStaticSwitches.Count = 0 then if fStaticSwitches.Count.equals(0) then
setDefaultSwitches setDefaultSwitches
else else
sanitizeSwitches; sanitizeSwitches;
@ -2978,7 +2978,7 @@ var
form: TForm; form: TForm;
memo: TMemo; memo: TMemo;
begin begin
if fRunnablesOptions.fStaticSwitches.Count = 0 then if fRunnablesOptions.fStaticSwitches.Count.equals(0) then
fRunnablesOptions.setDefaultSwitches; fRunnablesOptions.setDefaultSwitches;
form := TForm.Create(nil); form := TForm.Create(nil);
form.BorderIcons:= [biSystemMenu]; form.BorderIcons:= [biSystemMenu];
@ -3021,7 +3021,7 @@ begin
result := false; result := false;
fMsgs.clearByData(fDoc); fMsgs.clearByData(fDoc);
FreeRunnableProc; FreeRunnableProc;
if fDoc.isNil or (fDoc.Lines.Count = 0) then if fDoc.isNil or fDoc.Lines.Count.equals(0) then
exit; exit;
firstlineFlags := fDoc.Lines[0]; firstlineFlags := fDoc.Lines[0];
@ -3071,7 +3071,7 @@ begin
fDoc.saveTempFile; fDoc.saveTempFile;
fname := runnableExename.stripFileExt; fname := runnableExename.stripFileExt;
if fRunnablesOptions.staticSwitches.Count = 0 then if fRunnablesOptions.staticSwitches.Count.equals(0) then
fRunnablesOptions.setDefaultSwitches; fRunnablesOptions.setDefaultSwitches;
{$IFDEF RELEASE} {$IFDEF RELEASE}
dmdProc.ShowWindow := swoHIDE; dmdProc.ShowWindow := swoHIDE;
@ -3168,7 +3168,7 @@ begin
if not asObj then if not asObj then
sysutils.DeleteFile(fname + objExt); sysutils.DeleteFile(fname + objExt);
if (dmdProc.ExitStatus = 0) then if dmdProc.ExitStatus.equals(0) then
begin begin
result := true; result := true;
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled', fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
@ -3250,7 +3250,7 @@ const
ic : array[boolean] of TAppMessageKind = (amkWarn, amkInf); ic : array[boolean] of TAppMessageKind = (amkWarn, amkInf);
begin begin
asyncprocTerminate(sender); asyncprocTerminate(sender);
if fCovModUt and assigned(fRunProc) and (fRunProc.ExitStatus = 0) then if fCovModUt and assigned(fRunProc) and fRunProc.ExitStatus.equals(0) then
begin begin
fname := fDoc.fileName.stripFileExt; fname := fDoc.fileName.stripFileExt;
fullcov := true; fullcov := true;
@ -3587,7 +3587,7 @@ begin
if sender.isNil then if sender.isNil then
exit; exit;
act := TAction(sender); act := TAction(sender);
if act.Tag = 0 then if act.Tag.equals(0) then
exit; exit;
widg := TDexedWidget(act.Tag); widg := TDexedWidget(act.Tag);
@ -4310,7 +4310,7 @@ var
begin begin
if checkProjectLock then if checkProjectLock then
exit; exit;
if fProjectGroup.projectCount = 0 then if fProjectGroup.projectCount.equals(0) then
exit; exit;
fProjBeforeGroup := fProj; fProjBeforeGroup := fProj;
fGroupCompilationCnt := 0; fGroupCompilationCnt := 0;

View File

@ -852,7 +852,7 @@ begin
m.Caption := d[i]; m.Caption := d[i];
m.OnClick := @mnuDriveItemClick; m.OnClick := @mnuDriveItemClick;
mnuDrives.Items.Add(m); mnuDrives.Items.Add(m);
if i = 0 then if i.equals(0) then
treeFolders.Root:= m.Caption; treeFolders.Root:= m.Caption;
end; end;
m := Tmenuitem.Create(self); m := Tmenuitem.Create(self);

View File

@ -113,9 +113,9 @@ var
i: integer; i: integer;
begin begin
i := indexOf(value); i := indexOf(value);
if i = -1 then if i.equals(-1) then
exit(true); exit(true);
if i = 0 then if i.equals(0) then
exit(false); exit(false);
if Count < 2 then if Count < 2 then
exit(false); exit(false);

View File

@ -124,7 +124,7 @@ var
begin begin
if assigned(observer) then if assigned(observer) then
begin begin
if selCat.Items.Count = 0 then if selCat.Items.Count.equals(0) then
updateCategories; updateCategories;
n := selCat.Items.FindNodeWithText(observer.optionedWantCategory()); n := selCat.Items.FindNodeWithText(observer.optionedWantCategory());
if n.isNotNil then if n.isNotNil then

View File

@ -64,7 +64,7 @@ begin
fname := getDocPath + OptsFname; fname := getDocPath + OptsFname;
if OptsFname.fileExists then if OptsFname.fileExists then
fMru.LoadFromFile(fname); fMru.LoadFromFile(fname);
if fMru.Count = 0 then if fMru.Count.equals(0) then
fMru.Insert(0, '(your input here)'); fMru.Insert(0, '(your input here)');
case GetIconScaledSize of case GetIconScaledSize of
@ -153,7 +153,7 @@ procedure TProcInputWidget.sendInput;
var var
inp: string; inp: string;
begin begin
if fProc.Input.isNil or (fProc.Input.Handle = 0) then if fProc.Input.isNil or fProc.Input.Handle.equals(0) then
exit; exit;
fMru.Insert(0,txtInp.Text); fMru.Insert(0,txtInp.Text);

View File

@ -422,7 +422,7 @@ var
if not fOptions.hideAttributes then if not fOptions.hideAttributes then
exit; exit;
p := pos('(', idt); p := pos('(', idt);
if p = 0 then if p.equals(0) then
p := integer.MaxValue; p := integer.MaxValue;
for s in a do for s in a do
begin begin
@ -450,7 +450,7 @@ begin
free; free;
end; end;
if log.length = 0 then if log.length.equals(0) then
exit; exit;
// ======== Timer Is 35.... ============ // ======== Timer Is 35.... ============

View File

@ -689,7 +689,7 @@ end;
procedure TProjectGroupWidget.btnMoveUpClick(Sender: TObject); procedure TProjectGroupWidget.btnMoveUpClick(Sender: TObject);
begin begin
if (lstProj.ItemIndex = -1) or (lstProj.ItemIndex = 0) then if lstProj.ItemIndex.equals(-1) or lstProj.ItemIndex.equals(0) then
exit; exit;
projectGroup.items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1); projectGroup.items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1);
lstProj.Items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1); lstProj.Items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1);

View File

@ -685,12 +685,12 @@ begin
chd := nil; chd := nil;
fld := rng.takeUntil(['/','\']).yield; fld := rng.takeUntil(['/','\']).yield;
chd := itm.FindNode(fld); chd := itm.FindNode(fld);
if chd.isNil and ((rng.empty and (j = 1)) or (not rng.empty and (j = 0))) then if chd.isNil and ((rng.empty and j.equals(1)) or (not rng.empty and j.equals(0))) then
chd := Tree.Items.AddChild(itm, fld); chd := Tree.Items.AddChild(itm, fld);
if chd.isNotNil then if chd.isNotNil then
itm := chd; itm := chd;
// reached fname // reached fname
if rng.empty and (j = 1) then if rng.empty and j.equals(1) then
begin begin
itm.Data:= NewStr(fProj.sourceAbsolute(i)); itm.Data:= NewStr(fProj.sourceAbsolute(i));
itm.ImageIndex := 2; itm.ImageIndex := 2;

View File

@ -246,14 +246,14 @@ begin
end; end;
deleteDups(lst); deleteDups(lst);
// issue 300 when no moduleDeclaration lst can be empty // issue 300 when no moduleDeclaration lst can be empty
if (lst.Count = 0) and (project.sourcesCount > 0) then if lst.Count.equals(0) and not project.sourcesCount.equals(0) then
begin begin
for i := 0 to project.sourcesCount-1 do for i := 0 to project.sourcesCount-1 do
lst.Add(project.sourceAbsolute(i)); lst.Add(project.sourceAbsolute(i));
result := commonFolder(lst); result := commonFolder(lst);
result := result.extractFileDir; result := result.extractFileDir;
end end
else if (project.sourcesCount = 0) then else if project.sourcesCount.equals(0) then
result := '' result := ''
else else
begin begin

View File

@ -414,7 +414,7 @@ begin
c.LoadFromFile(f); c.LoadFromFile(f);
s += findAll(f, c, false); s += findAll(f, c, false);
end; end;
if s = 0 then if s.equals(0) then
begin begin
m := getMessageDisplay; m := getMessageDisplay;
m.message(format('0 result for the pattern <%s>', [fToFind]), m.message(format('0 result for the pattern <%s>', [fToFind]),
@ -435,7 +435,7 @@ begin
f := h.getDocument(i).fileName; f := h.getDocument(i).fileName;
s += findAll(f, h.getDocument(i).Lines, false); s += findAll(f, h.getDocument(i).Lines, false);
end; end;
if s = 0 then if s.equals(0) then
begin begin
m := getMessageDisplay; m := getMessageDisplay;
m.message(format('0 result for the pattern <%s>', [fToFind]), m.message(format('0 result for the pattern <%s>', [fToFind]),
@ -585,7 +585,7 @@ begin
else else
fDoc.CaretX := fDoc.CaretX + 1; fDoc.CaretX := fDoc.CaretX + 1;
end; end;
if fDoc.SearchReplace(fToFind, '', getOptions) = 0 then if fDoc.SearchReplace(fToFind, '', getOptions).equals(0) then
begin begin
s := format('the expression cannot be found, restart from the %s ?', [r[chkBack.Checked]]); s := format('the expression cannot be found, restart from the %s ?', [r[chkBack.Checked]]);
if dlgOkCancel(s) = mrOk then if dlgOkCancel(s) = mrOk then
@ -668,7 +668,7 @@ begin
end; end;
while(true) do while(true) do
begin begin
if fDoc.SearchReplace(fToFind, fReplaceWth, opts) = 0 then if fDoc.SearchReplace(fToFind, fReplaceWth, opts).equals(0) then
break; break;
if fCancelAll then if fCancelAll then
begin begin

View File

@ -239,7 +239,7 @@ end;
function TShortcutEditor.anItemIsSelected: boolean; function TShortcutEditor.anItemIsSelected: boolean;
begin begin
result := true; result := true;
if tree.Selected.isNil or (tree.Selected.Level = 0) or tree.Selected.Data.isNil then if tree.Selected.isNil or tree.Selected.Level.equals(0) or tree.Selected.Data.isNil then
result := false; result := false;
end; end;
{$ENDREGION} {$ENDREGION}

View File

@ -738,7 +738,7 @@ begin
exit; exit;
if fDoc.isNil then if fDoc.isNil then
exit; exit;
if (fDoc.Lines.Count = 0) or not fDoc.isDSource then if fDoc.Lines.Count.equals(0) or not fDoc.isDSource then
begin begin
clearTree; clearTree;
updateVisibleCat; updateVisibleCat;

View File

@ -1704,9 +1704,9 @@ begin
end; end;
if (t <> 0) and (s <> 0) then if (t <> 0) and (s <> 0) then
result := imMixed result := imMixed
else if t = 0 then else if t.equals(0) then
result := imSpaces result := imSpaces
else if s = 0 then else if s.equals(0) then
result := imTabs result := imTabs
else else
result := imNone; result := imNone;
@ -1741,7 +1741,7 @@ begin
if not fIsDSource and not alwaysAdvancedFeatures then if not fIsDSource and not alwaysAdvancedFeatures then
exit; exit;
BeginUndoBlock; BeginUndoBlock;
if ((CaretX-1) and 1) = 0 then if ((CaretX-1) and 1).equals(0) then
ExecuteCommand(ecChar, ' ', nil); ExecuteCommand(ecChar, ' ', nil);
ExecuteCommand(ecChar, c, nil); ExecuteCommand(ecChar, c, nil);
EndUndoBlock; EndUndoBlock;
@ -1879,7 +1879,7 @@ begin
if (line.length > 1) and (line[1..2] = '//') then if (line.length > 1) and (line[1..2] = '//') then
numUndo += 1; numUndo += 1;
end; end;
if numUndo = 0 then if numUndo.equals(0) then
mustUndo := false mustUndo := false
else if numUndo = BlockEnd.Y + 1 - BlockBegin.Y then else if numUndo = BlockEnd.Y + 1 - BlockBegin.Y then
mustUndo := true; mustUndo := true;
@ -2067,7 +2067,7 @@ begin
exit; exit;
old := GetWordAtRowCol(LogicalCaretXY); old := GetWordAtRowCol(LogicalCaretXY);
DcdWrapper.getLocalSymbolUsageFromCursor(locs); DcdWrapper.getLocalSymbolUsageFromCursor(locs);
if length(locs) = 0 then if length(locs).equals(0) then
begin begin
dlgOkInfo('Unknown, ambiguous or non-local symbol for "'+ old +'"'); dlgOkInfo('Unknown, ambiguous or non-local symbol for "'+ old +'"');
exit; exit;
@ -2839,7 +2839,7 @@ begin
caretX := caretX + 1; caretX := caretX + 1;
getCompletionList(); getCompletionList();
if fCompletion.TheForm.ItemList.Count = 0 then if fCompletion.TheForm.ItemList.Count.equals(0) then
begin begin
fCompletion.TheForm.Close; fCompletion.TheForm.Close;
exit; exit;
@ -2950,7 +2950,7 @@ end;
procedure TDexedMemo.AutoDotTimerEvent(sender: TObject); procedure TDexedMemo.AutoDotTimerEvent(sender: TObject);
begin begin
if (not fCanAutoDot) or (fAutoDotDelay = 0) then if not fCanAutoDot or fAutoDotDelay.equals(0) then
exit; exit;
fCanAutoDot := false; fCanAutoDot := false;
@ -3153,7 +3153,7 @@ begin
if fHasModuleDeclaration then if fHasModuleDeclaration then
result := getModuleName(fLexToks); result := getModuleName(fLexToks);
end; end;
if result.length = 0 then if result.length.equals(0) then
begin begin
if fFilename.length > 0 then if fFilename.length > 0 then
result := fFilename.extractFileName result := fFilename.extractFileName
@ -3234,7 +3234,7 @@ begin
exit(braceCloseInvalid); exit(braceCloseInvalid);
c += byte((tok^.kind = TLexTokenKind.ltkSymbol) and (((tok^.Data = '{')) or (tok^.Data = 'q{'))); c += byte((tok^.kind = TLexTokenKind.ltkSymbol) and (((tok^.Data = '{')) or (tok^.Data = 'q{')));
c -= byte((tok^.kind = TLexTokenKind.ltkSymbol) and (tok^.Data = '}')); c -= byte((tok^.kind = TLexTokenKind.ltkSymbol) and (tok^.Data = '}'));
if bet and (c = 0) then if bet and c.equals(0) then
exit(braceCloseLessEven); exit(braceCloseLessEven);
end; end;
if (tok <> nil) and (tok^.kind = ltkIllegal) then if (tok <> nil) and (tok^.kind = ltkIllegal) then

View File

@ -434,7 +434,7 @@ begin
c := getContext; c := getContext;
case c of case c of
tcNone: exit; tcNone: exit;
tcProject: if (fProj = nil) or (fProj.sourcesCount = 0) then tcProject: if (fProj = nil) or fProj.sourcesCount.equals(0) then
exit; exit;
tcFile: if fDoc = nil then tcFile: if fDoc = nil then
exit; exit;
@ -613,7 +613,7 @@ var
col: Integer; col: Integer;
begin begin
col := lstItems.SortColumn; col := lstItems.SortColumn;
if col = 0 then if col.equals(0) then
begin begin
txt1 := item1.Caption; txt1 := item1.Caption;
txt2 := item2.Caption; txt2 := item2.Caption;