synafpc.pas - extended version by ACBr
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@244 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
fc2aeacaf6
commit
9e152389d4
95
synafpc.pas
95
synafpc.pas
@ -1,9 +1,9 @@
|
|||||||
{==============================================================================|
|
{==============================================================================|
|
||||||
| Project : Ararat Synapse | 001.003.001 |
|
| Project : Ararat Synapse | 001.004.000 |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Content: Utils for FreePascal compatibility |
|
| Content: Utils for FreePascal compatibility |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Copyright (c)1999-2013, Lukas Gebauer |
|
| Copyright (c)1999-2022, Lukas Gebauer |
|
||||||
| All rights reserved. |
|
| All rights reserved. |
|
||||||
| |
|
| |
|
||||||
| Redistribution and use in source and binary forms, with or without |
|
| Redistribution and use in source and binary forms, with or without |
|
||||||
@ -38,6 +38,7 @@
|
|||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Contributor(s): |
|
| Contributor(s): |
|
||||||
| Tomas Hajny (OS2 support) |
|
| Tomas Hajny (OS2 support) |
|
||||||
|
| Projeto ACBr |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| History: see HISTORY.HTM from distribution package |
|
| History: see HISTORY.HTM from distribution package |
|
||||||
| (Found at URL: http://www.ararat.cz/synapse/) |
|
| (Found at URL: http://www.ararat.cz/synapse/) |
|
||||||
@ -45,6 +46,8 @@
|
|||||||
|
|
||||||
{:@exclude}
|
{:@exclude}
|
||||||
|
|
||||||
|
{$INCLUDE 'jedi.inc'}
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
{$MODE DELPHI}
|
{$MODE DELPHI}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -56,25 +59,34 @@
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF NEXTGEN}
|
||||||
|
{$LEGACYIFEND ON}
|
||||||
|
{$ZEROBASEDSTRINGS OFF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
unit synafpc;
|
unit synafpc;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
dynlibs, sysutils;
|
dynlibs,
|
||||||
{$ELSE}
|
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
Windows;
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
SysUtils;
|
{$IFDEF DELPHI25_UP}
|
||||||
|
{$IFNDEF NEXTGEN}
|
||||||
|
System.AnsiStrings,
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
Windows,
|
||||||
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
SysUtils;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
type
|
type
|
||||||
TLibHandle = dynlibs.TLibHandle;
|
TLibHandle = dynlibs.TLibHandle;
|
||||||
|
|
||||||
function LoadLibrary(ModuleName: PChar): TLibHandle;
|
function LoadLibrary(ModuleName: PChar): TLibHandle;
|
||||||
function FreeLibrary(Module: TLibHandle): LongBool;
|
function FreeLibrary(Module: TLibHandle): LongBool;
|
||||||
function GetProcAddress(Module: TLibHandle; Proc: PChar): Pointer;
|
function GetProcAddress(Module: TLibHandle; Proc: PChar): Pointer;
|
||||||
@ -82,21 +94,31 @@ function GetModuleFileName(Module: TLibHandle; Buffer: PChar; BufLen: Integer):
|
|||||||
{$ELSE} //not FPC
|
{$ELSE} //not FPC
|
||||||
type
|
type
|
||||||
{$IFDEF CIL}
|
{$IFDEF CIL}
|
||||||
TLibHandle = Integer;
|
TLibHandle = Integer;
|
||||||
PtrInt = Integer;
|
PtrInt = Integer;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
TLibHandle = HModule;
|
TLibHandle = HModule;
|
||||||
{$IFDEF WIN64}
|
{$IFDEF WIN64}
|
||||||
PtrInt = NativeInt;
|
PtrInt = NativeInt;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
PtrInt = Integer;
|
PtrInt = Integer;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF VER100}
|
{$IFDEF VER100}
|
||||||
LongWord = DWord;
|
LongWord = DWord;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF NEXTGEN} // Android FMX
|
||||||
|
AnsiString = RawByteString;
|
||||||
|
AnsiChar = UTF8Char;
|
||||||
|
PAnsiChar = PUTF8Char;
|
||||||
|
WideString = String;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar;
|
||||||
|
function StrLComp(const Str1, Str2: PANSIChar; MaxLen: Cardinal): Integer;
|
||||||
procedure Sleep(milliseconds: Cardinal);
|
procedure Sleep(milliseconds: Cardinal);
|
||||||
|
|
||||||
|
|
||||||
@ -127,10 +149,43 @@ function GetModuleFileName(Module: TLibHandle; Buffer: PChar; BufLen: Integer):
|
|||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar;
|
||||||
|
begin
|
||||||
|
{$IfDef FPC}
|
||||||
|
Result := SysUtils.StrLCopy(Dest, Source, MaxLen);
|
||||||
|
{$Else}
|
||||||
|
{$IFDEF DELPHI25_UP}
|
||||||
|
{$IfDef NEXTGEN}
|
||||||
|
Result := PAnsiChar( System.SysUtils.StrLCopy(PWideChar(Dest^), PWideChar(Source^), MaxLen)^ );
|
||||||
|
{$Else}
|
||||||
|
Result := System.AnsiStrings.StrLCopy(Dest, Source, MaxLen);
|
||||||
|
{$EndIf}
|
||||||
|
{$Else}
|
||||||
|
Result := SysUtils.StrLCopy(Dest, Source, MaxLen);
|
||||||
|
{$IfEnd}
|
||||||
|
{$EndIf}
|
||||||
|
end;
|
||||||
|
|
||||||
|
function StrLComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer;
|
||||||
|
begin
|
||||||
|
{$IfDef FPC}
|
||||||
|
Result := SysUtils.strlcomp(Str1, Str2, MaxLen);
|
||||||
|
{$Else}
|
||||||
|
{$IFDEF DELPHI25_UP}
|
||||||
|
{$IfDef NEXTGEN}
|
||||||
|
Result := System.SysUtils.StrLComp(PWideChar(Str1^), PWideChar(Str2^), MaxLen);
|
||||||
|
{$Else}
|
||||||
|
Result := System.AnsiStrings.StrLComp(Str1, Str2, MaxLen);
|
||||||
|
{$EndIf}
|
||||||
|
{$Else}
|
||||||
|
Result := SysUtils.StrLComp(Str1, Str2, MaxLen);
|
||||||
|
{$IfEnd}
|
||||||
|
{$EndIf}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Sleep(milliseconds: Cardinal);
|
procedure Sleep(milliseconds: Cardinal);
|
||||||
begin
|
begin
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user