Typo errors and little improvements inspired by ACBr
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@251 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
23
synafpc.pas
23
synafpc.pas
@ -61,6 +61,13 @@
|
|||||||
{$ZEROBASEDSTRINGS OFF}
|
{$ZEROBASEDSTRINGS OFF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IfDef DELPHI2009_UP}
|
||||||
|
{$DEFINE HAS_CHARINSET}
|
||||||
|
{$EndIf}
|
||||||
|
{$IfDef FPC}
|
||||||
|
{$DEFINE HAS_CHARINSET}
|
||||||
|
{$EndIf}
|
||||||
|
|
||||||
unit synafpc;
|
unit synafpc;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -118,6 +125,10 @@ function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): P
|
|||||||
function StrLComp(const Str1, Str2: PANSIChar; MaxLen: Cardinal): Integer;
|
function StrLComp(const Str1, Str2: PANSIChar; MaxLen: Cardinal): Integer;
|
||||||
procedure Sleep(milliseconds: Cardinal);
|
procedure Sleep(milliseconds: Cardinal);
|
||||||
|
|
||||||
|
{$IfNDef HAS_CHARINSET}
|
||||||
|
function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean;
|
||||||
|
{$EndIf}
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -162,7 +173,7 @@ begin
|
|||||||
{$EndIf}
|
{$EndIf}
|
||||||
{$Else}
|
{$Else}
|
||||||
Result := SysUtils.StrLCopy(Dest, Source, MaxLen);
|
Result := SysUtils.StrLCopy(Dest, Source, MaxLen);
|
||||||
{$IfEnd}
|
{$ENDIF}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -179,7 +190,7 @@ begin
|
|||||||
{$EndIf}
|
{$EndIf}
|
||||||
{$Else}
|
{$Else}
|
||||||
Result := SysUtils.StrLComp(Str1, Str2, MaxLen);
|
Result := SysUtils.StrLComp(Str1, Str2, MaxLen);
|
||||||
{$IfEnd}
|
{$ENDIF}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -194,7 +205,13 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
sysutils.sleep(milliseconds);
|
sysutils.sleep(milliseconds);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IfNDef HAS_CHARINSET}
|
||||||
|
function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean;
|
||||||
|
begin
|
||||||
|
result := C in CharSet;
|
||||||
|
end;
|
||||||
|
{$EndIf}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
25
synautil.pas
25
synautil.pas
@ -59,6 +59,11 @@
|
|||||||
{$WARN IMPLICIT_STRING_CAST OFF}
|
{$WARN IMPLICIT_STRING_CAST OFF}
|
||||||
{$WARN IMPLICIT_STRING_CAST_LOSS OFF}
|
{$WARN IMPLICIT_STRING_CAST_LOSS OFF}
|
||||||
{$WARN SUSPICIOUS_TYPECAST OFF}
|
{$WARN SUSPICIOUS_TYPECAST OFF}
|
||||||
|
{$WARN SYMBOL_DEPRECATED OFF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF NEXTGEN}
|
||||||
|
{$ZEROBASEDSTRINGS OFF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
unit synautil;
|
unit synautil;
|
||||||
@ -77,7 +82,7 @@ uses
|
|||||||
{$ENDIF OS2}
|
{$ENDIF OS2}
|
||||||
{$ELSE FPC}
|
{$ELSE FPC}
|
||||||
{$IFDEF POSIX}
|
{$IFDEF POSIX}
|
||||||
Posix.Base, Posix.Time, Posix.SysTypes, Posix.SysTime, Posix.Stdio,
|
Posix.Base, Posix.Time, Posix.SysTypes, Posix.SysTime, Posix.Stdio, Posix.Unistd,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Libc,
|
Libc,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1920,7 +1925,7 @@ end;
|
|||||||
procedure SearchForLineBreak(var APtr:PANSIChar; AEtx:PANSIChar; out ABol:PANSIChar; out ALength:integer);
|
procedure SearchForLineBreak(var APtr:PANSIChar; AEtx:PANSIChar; out ABol:PANSIChar; out ALength:integer);
|
||||||
begin
|
begin
|
||||||
ABol := APtr;
|
ABol := APtr;
|
||||||
while (APtr<AEtx) and not (APtr^ in [#0,#10,#13]) do
|
while (APtr<AEtx) and not (Byte(APtr^) in [0, 10, 13]) do
|
||||||
inc(APtr);
|
inc(APtr);
|
||||||
ALength := APtr-ABol;
|
ALength := APtr-ABol;
|
||||||
end;
|
end;
|
||||||
@ -2024,12 +2029,12 @@ begin
|
|||||||
// Moving Aptr position forward until boundary will be reached
|
// Moving Aptr position forward until boundary will be reached
|
||||||
while (APtr<AEtx) do
|
while (APtr<AEtx) do
|
||||||
begin
|
begin
|
||||||
if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(APtr,#13#10'--',4)=0 then
|
if SynaFpc.strlcomp(APtr,#13#10'--',4)=0 then
|
||||||
begin
|
begin
|
||||||
eob := MatchBoundary(APtr,AEtx,ABoundary);
|
eob := MatchBoundary(APtr,AEtx,ABoundary);
|
||||||
Step := 4;
|
Step := 4;
|
||||||
end
|
end
|
||||||
else if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(APtr,'--',2)=0 then
|
else if SynaFpc.strlcomp(APtr,'--',2)=0 then
|
||||||
begin
|
begin
|
||||||
eob := MatchBoundary(APtr,AEtx,ABoundary);
|
eob := MatchBoundary(APtr,AEtx,ABoundary);
|
||||||
Step := 2;
|
Step := 2;
|
||||||
@ -2062,17 +2067,17 @@ begin
|
|||||||
Lng := length(ABoundary);
|
Lng := length(ABoundary);
|
||||||
if (MatchPos+2+Lng)>AETX then
|
if (MatchPos+2+Lng)>AETX then
|
||||||
exit;
|
exit;
|
||||||
if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,#13#10,2)=0 then
|
if SynaFpc.strlcomp(MatchPos,#13#10,2)=0 then
|
||||||
inc(MatchPos,2);
|
inc(MatchPos,2);
|
||||||
if (MatchPos+2+Lng)>AETX then
|
if (MatchPos+2+Lng)>AETX then
|
||||||
exit;
|
exit;
|
||||||
if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,'--',2)<>0 then
|
if SynaFpc.strlcomp(MatchPos,'--',2)<>0 then
|
||||||
exit;
|
exit;
|
||||||
inc(MatchPos,2);
|
inc(MatchPos,2);
|
||||||
if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,PANSIChar(ABoundary),Lng)<>0 then
|
if SynaFpc.strlcomp(MatchPos,PANSIChar(ABoundary),Lng)<>0 then
|
||||||
exit;
|
exit;
|
||||||
inc(MatchPos,Lng);
|
inc(MatchPos,Lng);
|
||||||
if ((MatchPos+2)<=AEtx) and ({$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,#13#10,2)=0) then
|
if ((MatchPos+2)<=AEtx) and (SynaFpc.strlcomp(MatchPos,#13#10,2)=0) then
|
||||||
inc(MatchPos,2);
|
inc(MatchPos,2);
|
||||||
Result := MatchPos;
|
Result := MatchPos;
|
||||||
end;
|
end;
|
||||||
@ -2087,10 +2092,10 @@ begin
|
|||||||
MatchPos := MatchBoundary(ABOL,AETX,ABoundary);
|
MatchPos := MatchBoundary(ABOL,AETX,ABoundary);
|
||||||
if not Assigned(MatchPos) then
|
if not Assigned(MatchPos) then
|
||||||
exit;
|
exit;
|
||||||
if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,'--',2)<>0 then
|
if SynaFpc.strlcomp(MatchPos,'--',2)<>0 then
|
||||||
exit;
|
exit;
|
||||||
inc(MatchPos,2);
|
inc(MatchPos,2);
|
||||||
if (MatchPos+2<=AEtx) and ({$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,#13#10,2)=0) then
|
if (MatchPos+2<=AEtx) and (SynaFpc.strlcomp(MatchPos,#13#10,2)=0) then
|
||||||
inc(MatchPos,2);
|
inc(MatchPos,2);
|
||||||
Result := MatchPos;
|
Result := MatchPos;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user