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 |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2013, Lukas Gebauer |
|
||||
| Copyright (c)1999-2022, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -38,6 +38,7 @@
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
| Tomas Hajny (OS2 support) |
|
||||
| Projeto ACBr |
|
||||
|==============================================================================|
|
||||
| History: see HISTORY.HTM from distribution package |
|
||||
| (Found at URL: http://www.ararat.cz/synapse/) |
|
||||
@ -45,6 +46,8 @@
|
||||
|
||||
{:@exclude}
|
||||
|
||||
{$INCLUDE 'jedi.inc'}
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}
|
||||
{$ENDIF}
|
||||
@ -56,25 +59,34 @@
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF NEXTGEN}
|
||||
{$LEGACYIFEND ON}
|
||||
{$ZEROBASEDSTRINGS OFF}
|
||||
{$ENDIF}
|
||||
|
||||
unit synafpc;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
dynlibs, sysutils;
|
||||
{$ELSE}
|
||||
{$IFDEF MSWINDOWS}
|
||||
Windows;
|
||||
{$IFDEF FPC}
|
||||
dynlibs,
|
||||
{$ELSE}
|
||||
SysUtils;
|
||||
{$IFDEF DELPHI25_UP}
|
||||
{$IFNDEF NEXTGEN}
|
||||
System.AnsiStrings,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF MSWINDOWS}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
SysUtils;
|
||||
|
||||
{$IFDEF FPC}
|
||||
type
|
||||
TLibHandle = dynlibs.TLibHandle;
|
||||
|
||||
|
||||
function LoadLibrary(ModuleName: PChar): TLibHandle;
|
||||
function FreeLibrary(Module: TLibHandle): LongBool;
|
||||
function GetProcAddress(Module: TLibHandle; Proc: PChar): Pointer;
|
||||
@ -82,21 +94,31 @@ function GetModuleFileName(Module: TLibHandle; Buffer: PChar; BufLen: Integer):
|
||||
{$ELSE} //not FPC
|
||||
type
|
||||
{$IFDEF CIL}
|
||||
TLibHandle = Integer;
|
||||
PtrInt = Integer;
|
||||
TLibHandle = Integer;
|
||||
PtrInt = Integer;
|
||||
{$ELSE}
|
||||
TLibHandle = HModule;
|
||||
{$IFDEF WIN64}
|
||||
PtrInt = NativeInt;
|
||||
{$ELSE}
|
||||
PtrInt = Integer;
|
||||
{$ENDIF}
|
||||
TLibHandle = HModule;
|
||||
{$IFDEF WIN64}
|
||||
PtrInt = NativeInt;
|
||||
{$ELSE}
|
||||
PtrInt = Integer;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER100}
|
||||
LongWord = DWord;
|
||||
LongWord = DWord;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF NEXTGEN} // Android FMX
|
||||
AnsiString = RawByteString;
|
||||
AnsiChar = UTF8Char;
|
||||
PAnsiChar = PUTF8Char;
|
||||
WideString = String;
|
||||
{$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);
|
||||
|
||||
|
||||
@ -127,10 +149,43 @@ function GetModuleFileName(Module: TLibHandle; Buffer: PChar; BufLen: Integer):
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
{$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);
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
|
Loading…
x
Reference in New Issue
Block a user