diff --git a/synafpc.pas b/synafpc.pas index b0c6fbd..2164633 100644 --- a/synafpc.pas +++ b/synafpc.pas @@ -61,6 +61,13 @@ {$ZEROBASEDSTRINGS OFF} {$ENDIF} +{$IfDef DELPHI2009_UP} + {$DEFINE HAS_CHARINSET} +{$EndIf} +{$IfDef FPC} + {$DEFINE HAS_CHARINSET} +{$EndIf} + unit synafpc; interface @@ -118,6 +125,10 @@ function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): P function StrLComp(const Str1, Str2: PANSIChar; MaxLen: Cardinal): Integer; procedure Sleep(milliseconds: Cardinal); +{$IfNDef HAS_CHARINSET} +function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; +{$EndIf} + implementation @@ -162,7 +173,7 @@ begin {$EndIf} {$Else} Result := SysUtils.StrLCopy(Dest, Source, MaxLen); - {$IfEnd} + {$ENDIF} {$EndIf} end; @@ -179,7 +190,7 @@ begin {$EndIf} {$Else} Result := SysUtils.StrLComp(Str1, Str2, MaxLen); - {$IfEnd} + {$ENDIF} {$EndIf} end; @@ -194,7 +205,13 @@ begin {$ELSE} sysutils.sleep(milliseconds); {$ENDIF} - end; +{$IfNDef HAS_CHARINSET} +function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; +begin + result := C in CharSet; +end; +{$EndIf} + end. diff --git a/synautil.pas b/synautil.pas index 7a1c476..54b2f9c 100644 --- a/synautil.pas +++ b/synautil.pas @@ -59,6 +59,11 @@ {$WARN IMPLICIT_STRING_CAST OFF} {$WARN IMPLICIT_STRING_CAST_LOSS OFF} {$WARN SUSPICIOUS_TYPECAST OFF} + {$WARN SYMBOL_DEPRECATED OFF} +{$ENDIF} + +{$IFDEF NEXTGEN} + {$ZEROBASEDSTRINGS OFF} {$ENDIF} unit synautil; @@ -77,7 +82,7 @@ uses {$ENDIF OS2} {$ELSE FPC} {$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} Libc, {$ENDIF} @@ -1920,7 +1925,7 @@ end; procedure SearchForLineBreak(var APtr:PANSIChar; AEtx:PANSIChar; out ABol:PANSIChar; out ALength:integer); begin ABol := APtr; - while (APtrAETX then 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); if (MatchPos+2+Lng)>AETX then exit; - if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,'--',2)<>0 then + if SynaFpc.strlcomp(MatchPos,'--',2)<>0 then exit; 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; 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); Result := MatchPos; end; @@ -2087,10 +2092,10 @@ begin MatchPos := MatchBoundary(ABOL,AETX,ABoundary); if not Assigned(MatchPos) then exit; - if {$IFDEF DELPHIX_SEATTLE_UP} AnsiStrings. {$ENDIF} strlcomp(MatchPos,'--',2)<>0 then + if SynaFpc.strlcomp(MatchPos,'--',2)<>0 then exit; 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); Result := MatchPos; end;