mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-07 21:18:43 +01:00
Jedi code format: cleanup, remove compiler hints.
This commit is contained in:
parent
5f520b62b9
commit
eacf519cbb
@ -120,12 +120,14 @@ const
|
|||||||
CurlyLeft = '{'; //widechar(123);
|
CurlyLeft = '{'; //widechar(123);
|
||||||
CurlyRight = '}'; //widechar(125);
|
CurlyRight = '}'; //widechar(125);
|
||||||
|
|
||||||
|
{$push}{$warn 5024 off}
|
||||||
function CheckMultiByte(const pcChar: char): boolean;
|
function CheckMultiByte(const pcChar: char): boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
// if GetRegSettings.CheckMultiByteChars then
|
// if GetRegSettings.CheckMultiByteChars then
|
||||||
// Result := IsMultiByte(pcChar); //IsMultiByte(pcChar)-->Result := IsDBCSLeadByte(Byte(pcChar));
|
// Result := IsMultiByte(pcChar); //IsMultiByte(pcChar)-->Result := IsDBCSLeadByte(Byte(pcChar));
|
||||||
end;
|
end;
|
||||||
|
{$pop}
|
||||||
|
|
||||||
function CharIsOctDigit(const c: Char): Boolean;
|
function CharIsOctDigit(const c: Char): Boolean;
|
||||||
const
|
const
|
||||||
|
|||||||
@ -194,7 +194,7 @@ const
|
|||||||
MethodHeadings: TParseTreeNodeTypeSet =
|
MethodHeadings: TParseTreeNodeTypeSet =
|
||||||
[nFunctionHeading, nProcedureHeading, nConstructorHeading, nDestructorHeading];
|
[nFunctionHeading, nProcedureHeading, nConstructorHeading, nDestructorHeading];
|
||||||
|
|
||||||
function NodeTypeToString(const pe: TParseTreeNodeType): string; inline;
|
function NodeTypeToString(const pe: TParseTreeNodeType): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,8 @@ uses
|
|||||||
SourceToken, FormatFlags, JcfSettings, SetReturns,
|
SourceToken, FormatFlags, JcfSettings, SetReturns,
|
||||||
TokenUtils, JcfMiscFunctions, Tokens, ParseTreeNodeType;
|
TokenUtils, JcfMiscFunctions, Tokens, ParseTreeNodeType;
|
||||||
|
|
||||||
|
{$WARN 6058 off} // supress note: function/procedure marked as inline is not inlined
|
||||||
|
|
||||||
function IsLineBreaker(const pcToken: TSourceToken): boolean;
|
function IsLineBreaker(const pcToken: TSourceToken): boolean;
|
||||||
begin
|
begin
|
||||||
Result := (pcToken.TokenType in [ttReturn, ttConditionalCompilationRemoved]) or
|
Result := (pcToken.TokenType in [ttReturn, ttConditionalCompilationRemoved]) or
|
||||||
|
|||||||
@ -81,9 +81,6 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
|
||||||
MAX_TOKENS = 100000;
|
|
||||||
|
|
||||||
{ TCodeWriter }
|
{ TCodeWriter }
|
||||||
|
|
||||||
constructor TCodeWriter.Create;
|
constructor TCodeWriter.Create;
|
||||||
|
|||||||
@ -495,8 +495,10 @@ var
|
|||||||
begin
|
begin
|
||||||
//WRAPPING the inputCode in a fake unit
|
//WRAPPING the inputCode in a fake unit
|
||||||
sourceCodeLowerCase := LowerCase(fsInputCode);
|
sourceCodeLowerCase := LowerCase(fsInputCode);
|
||||||
|
{$push}{$warn 5057 off}
|
||||||
hasInterface := HasStringAtLineStart(sourceCodeLowerCase, 'interface', liInterfacePos);
|
hasInterface := HasStringAtLineStart(sourceCodeLowerCase, 'interface', liInterfacePos);
|
||||||
hasImplementation := HasStringAtLineStart(sourceCodeLowerCase, 'implementation', liImplementationPos);
|
hasImplementation := HasStringAtLineStart(sourceCodeLowerCase, 'implementation', liImplementationPos);
|
||||||
|
{$pop}
|
||||||
sourceCode := '';
|
sourceCode := '';
|
||||||
AddFakeUnit;
|
AddFakeUnit;
|
||||||
if hasInterface = False then
|
if hasInterface = False then
|
||||||
|
|||||||
@ -30,9 +30,7 @@ See http://www.gnu.org/licenses/gpl.html
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils;
|
||||||
{ local }
|
|
||||||
Converter;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TStringsConverter = class(TObject)
|
TStringsConverter = class(TObject)
|
||||||
@ -44,10 +42,10 @@ type
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
function OriginalFileName: string;
|
function OriginalFileName: string;
|
||||||
|
{$push}{$warn 5024 off}
|
||||||
procedure SendStatusMessage(const psFile, psMessage: string;
|
procedure SendStatusMessage(const psFile, psMessage: string;
|
||||||
const piY, piX: integer);
|
const piY, piX: integer);
|
||||||
|
{$pop}
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
|
|
||||||
@ -90,6 +88,7 @@ begin
|
|||||||
fcMessageStrings := pcStrings;
|
fcMessageStrings := pcStrings;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$push}{$warn 5024 off}
|
||||||
procedure TStringsConverter.SendStatusMessage(const psFile, psMessage: string;
|
procedure TStringsConverter.SendStatusMessage(const psFile, psMessage: string;
|
||||||
const piY, piX: integer);
|
const piY, piX: integer);
|
||||||
var
|
var
|
||||||
@ -101,11 +100,9 @@ begin
|
|||||||
if (piY >= 0) and (piX >= 0) then
|
if (piY >= 0) and (piX >= 0) then
|
||||||
lsWholeMessage := lsWholeMessage + ' at line ' + IntToStr(piY) +
|
lsWholeMessage := lsWholeMessage + ' at line ' + IntToStr(piY) +
|
||||||
' col ' + IntToStr(piX);
|
' col ' + IntToStr(piX);
|
||||||
|
|
||||||
|
|
||||||
fcMessageStrings.Add(lsWholeMessage);
|
fcMessageStrings.Add(lsWholeMessage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
{$pop}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -56,8 +56,9 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure OpenSection(const psName: string); override;
|
procedure OpenSection(const psName: string); override;
|
||||||
|
{$push}{$warn 5024 off}
|
||||||
procedure CloseSection(const psName: string); override;
|
procedure CloseSection(const psName: string); override;
|
||||||
|
{$pop}
|
||||||
procedure Write(const psTagName, psValue: string); override;
|
procedure Write(const psTagName, psValue: string); override;
|
||||||
procedure Write(const psTagName: string; const piValue: integer); override;
|
procedure Write(const psTagName: string; const piValue: integer); override;
|
||||||
procedure Write(const psTagName: string; const pbValue: boolean); override;
|
procedure Write(const psTagName: string; const pbValue: boolean); override;
|
||||||
@ -122,10 +123,12 @@ begin
|
|||||||
fsSection := psName;
|
fsSection := psName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$push}{$warn 5024 off}
|
||||||
procedure TSettingsRegistryOutput.CloseSection(const psName: string);
|
procedure TSettingsRegistryOutput.CloseSection(const psName: string);
|
||||||
begin
|
begin
|
||||||
fsSection := '';
|
fsSection := '';
|
||||||
end;
|
end;
|
||||||
|
{$pop}
|
||||||
|
|
||||||
procedure TSettingsRegistryOutput.Write(const psTagName, psValue: string);
|
procedure TSettingsRegistryOutput.Write(const psTagName, psValue: string);
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -58,6 +58,8 @@ implementation
|
|||||||
|
|
||||||
{ TIntList }
|
{ TIntList }
|
||||||
|
|
||||||
|
{$WARN 6058 off} // supress note: function/procedure marked as inline is not inlined
|
||||||
|
|
||||||
procedure TIntList.ChangeValue(const liIndex, liDelta: integer);
|
procedure TIntList.ChangeValue(const liIndex, liDelta: integer);
|
||||||
begin
|
begin
|
||||||
{ can fall out of bounds, easiest to ignore it here }
|
{ can fall out of bounds, easiest to ignore it here }
|
||||||
|
|||||||
@ -313,12 +313,14 @@ begin
|
|||||||
Result := Length(AString) - (Pos1 + Length(NativeLineBreak));
|
Result := Length(AString) - (Pos1 + Length(NativeLineBreak));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$push}{$warn 5091 off}
|
||||||
function ReadFileToUTF8String(AFilename: string): string;
|
function ReadFileToUTF8String(AFilename: string): string;
|
||||||
var
|
var
|
||||||
lMs: TMemorystream;
|
lMs: TMemorystream;
|
||||||
lS: string;
|
lS: string;
|
||||||
begin
|
begin
|
||||||
lMs := TMemoryStream.Create;
|
lMs := TMemoryStream.Create;
|
||||||
|
Result := '';
|
||||||
try
|
try
|
||||||
lMs.LoadFromFile(AFileName);
|
lMs.LoadFromFile(AFileName);
|
||||||
SetLength(lS, lMs.Size);
|
SetLength(lS, lMs.Size);
|
||||||
@ -328,5 +330,6 @@ begin
|
|||||||
lMs.Free;
|
lMs.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$pop}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -126,7 +126,7 @@ function StrCharCount(const S: string; C: Char): Integer;
|
|||||||
function StrStrCount(const S, SubS: string): Integer;
|
function StrStrCount(const S, SubS: string): Integer;
|
||||||
function StrRepeat(const S: string; Count: Integer): string;
|
function StrRepeat(const S: string; Count: Integer): string;
|
||||||
procedure StrReplace(var S: string; const Search, Replace: string; Flags: TReplaceFlags = []);
|
procedure StrReplace(var S: string; const Search, Replace: string; Flags: TReplaceFlags = []);
|
||||||
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer; inline;
|
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer; inline; deprecated 'Use Pos instead';
|
||||||
function StrFind(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 BooleanToStr(B: Boolean): string;
|
||||||
@ -294,7 +294,7 @@ function StrAfter(const SubStr, S: string): string;
|
|||||||
var
|
var
|
||||||
P: Integer;
|
P: Integer;
|
||||||
begin
|
begin
|
||||||
P := StrSearch(SubStr, S, 1);
|
P := Pos(SubStr, S, 1);
|
||||||
if P > 0 then
|
if P > 0 then
|
||||||
Result := Copy(S, P + Length(SubStr), Length(S))
|
Result := Copy(S, P + Length(SubStr), Length(S))
|
||||||
else
|
else
|
||||||
@ -305,7 +305,7 @@ function StrBefore(const SubStr, S: string): string;
|
|||||||
var
|
var
|
||||||
P: Integer;
|
P: Integer;
|
||||||
begin
|
begin
|
||||||
P := StrSearch(SubStr, S, 1);
|
P := Pos(SubStr, S, 1);
|
||||||
if P > 0 then
|
if P > 0 then
|
||||||
Result := Copy(S, 1, P - 1)
|
Result := Copy(S, 1, P - 1)
|
||||||
else
|
else
|
||||||
@ -324,7 +324,7 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
while Result < Length(S) do
|
while Result < Length(S) do
|
||||||
begin
|
begin
|
||||||
NewPos := StrSearch(SubStr, S, Result + 1);
|
NewPos := Pos(SubStr, S, Result + 1);
|
||||||
if NewPos > 0 then
|
if NewPos > 0 then
|
||||||
Result := NewPos
|
Result := NewPos
|
||||||
else
|
else
|
||||||
@ -383,7 +383,7 @@ begin
|
|||||||
P := 1;
|
P := 1;
|
||||||
while P < Length(S) do
|
while P < Length(S) do
|
||||||
begin
|
begin
|
||||||
P := StrSearch(Subs, S, P);
|
P := Pos(Subs, S, P);
|
||||||
if P > 0 then
|
if P > 0 then
|
||||||
begin
|
begin
|
||||||
inc(Result);
|
inc(Result);
|
||||||
@ -480,6 +480,7 @@ var
|
|||||||
S: TStream;
|
S: TStream;
|
||||||
begin
|
begin
|
||||||
S := nil;
|
S := nil;
|
||||||
|
Result := '';
|
||||||
try
|
try
|
||||||
S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
|
S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
|
||||||
SetLength(Result, S.Size);
|
SetLength(Result, S.Size);
|
||||||
@ -502,12 +503,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$push}{$warn 5094 off}
|
||||||
function StrFillChar(const C: Char; Count: Integer): string;
|
function StrFillChar(const C: Char; Count: Integer): string;
|
||||||
begin
|
begin
|
||||||
SetLength(Result, Count);
|
SetLength(Result, Count);
|
||||||
if Count > 0 then
|
if Count > 0 then
|
||||||
FillChar(Result[1], Count, C);
|
FillChar(Result[1], Count, C);
|
||||||
end;
|
end;
|
||||||
|
{$pop}
|
||||||
|
|
||||||
function IntToStrZeroPad(Value, Count: Integer): String;
|
function IntToStrZeroPad(Value, Count: Integer): String;
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -161,6 +161,7 @@ var
|
|||||||
liBytesRemaining: integer;
|
liBytesRemaining: integer;
|
||||||
lsContents8bit: AnsiString;
|
lsContents8bit: AnsiString;
|
||||||
begin
|
begin
|
||||||
|
{$push}{$warn 5091 off}
|
||||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||||
// read the bytes into a string
|
// read the bytes into a string
|
||||||
SetLength(lsContents8bit, liBytesRemaining);
|
SetLength(lsContents8bit, liBytesRemaining);
|
||||||
@ -169,6 +170,7 @@ begin
|
|||||||
pcFileStream.ReadBuffer(lsContents8bit[1], liBytesRemaining);
|
pcFileStream.ReadBuffer(lsContents8bit[1], liBytesRemaining);
|
||||||
end;
|
end;
|
||||||
Result := lsContents8bit;
|
Result := lsContents8bit;
|
||||||
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +179,8 @@ var
|
|||||||
liBytesRemaining: integer;
|
liBytesRemaining: integer;
|
||||||
lsContents: AnsiString;
|
lsContents: AnsiString;
|
||||||
begin
|
begin
|
||||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
{$push}{$warn 5091 off}
|
||||||
|
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||||
// read the bytes into a string
|
// read the bytes into a string
|
||||||
SetLength(lsContents, liBytesRemaining);
|
SetLength(lsContents, liBytesRemaining);
|
||||||
if pcFileStream.Size > 0 then
|
if pcFileStream.Size > 0 then
|
||||||
@ -185,6 +188,7 @@ begin
|
|||||||
pcFileStream.ReadBuffer(lsContents[1], liBytesRemaining);
|
pcFileStream.ReadBuffer(lsContents[1], liBytesRemaining);
|
||||||
end;
|
end;
|
||||||
Result := lsContents;
|
Result := lsContents;
|
||||||
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -194,6 +198,7 @@ var
|
|||||||
liLoop: integer;
|
liLoop: integer;
|
||||||
lsWideContents: WideString;
|
lsWideContents: WideString;
|
||||||
begin
|
begin
|
||||||
|
{$push}{$warn 5091 off}
|
||||||
// read it
|
// read it
|
||||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||||
SetLength(lsWideContents, liBytesRemaining div 2);
|
SetLength(lsWideContents, liBytesRemaining div 2);
|
||||||
@ -207,6 +212,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Result := lsWideContents;
|
Result := lsWideContents;
|
||||||
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SwapWords(const value: UCS4Char): UCS4Char;
|
function SwapWords(const value: UCS4Char): UCS4Char;
|
||||||
@ -232,6 +238,7 @@ var
|
|||||||
ucs4Chars: UCS4String;
|
ucs4Chars: UCS4String;
|
||||||
liLoop: integer;
|
liLoop: integer;
|
||||||
begin
|
begin
|
||||||
|
{$push}{$warn 5091 off}
|
||||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||||
charsRemaining := liBytesRemaining div 4;
|
charsRemaining := liBytesRemaining div 4;
|
||||||
|
|
||||||
@ -246,6 +253,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Result := UCS4StringToWideString(ucs4Chars);
|
Result := UCS4StringToWideString(ucs4Chars);
|
||||||
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ read in a text file,
|
{ read in a text file,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user