* use ctypes instead of defining own types

git-svn-id: trunk@5918 -
This commit is contained in:
florian 2007-01-12 10:56:29 +00:00
parent 7afbe22031
commit f7da932aa4
4 changed files with 39 additions and 44 deletions

View File

@ -14,24 +14,23 @@
**********************************************************************}
unit initc;
interface
uses
ctypes;
{$i nwsys.inc}
type libcint = longint;
plibcint = ^libcint;
function fpgetCerrno:cint;
procedure fpsetCerrno(err:cint);
function fpgetCerrno:libcint;
procedure fpsetCerrno(err:libcint);
property cerrno:libcint read fpgetCerrno write fpsetcerrno;
property cerrno:cint read fpgetCerrno write fpsetcerrno;
implementation
function fpgetCerrno:libcint;
function fpgetCerrno:cint;
begin
fpgetCerrno:=__get_errno_ptr^;
end;
procedure fpsetCerrno(err:libcint);
procedure fpsetCerrno(err:cint);
begin
__get_errno_ptr^:=err;
end;

View File

@ -15,28 +15,27 @@
unit initc;
interface
uses
ctypes;
type libcint = longint;
plibcint = ^libcint;
function fpgetCerrno:cint;
procedure fpsetCerrno(err:cint);
function fpgetCerrno:libcint;
procedure fpsetCerrno(err:libcint);
property cerrno:libcint read fpgetCerrno write fpsetcerrno;
property cerrno:cint read fpgetCerrno write fpsetcerrno;
implementation
const clib = 'libc';
function geterrnolocation: Plibcint; cdecl;external clib name '___errno';
function geterrnolocation: pcint; cdecl;external clib name '___errno';
function fpgetCerrno:libcint;
function fpgetCerrno:cint;
begin
fpgetCerrno:=geterrnolocation^;
end;
procedure fpsetCerrno(err:libcint);
procedure fpsetCerrno(err:cint);
begin
geterrnolocation^:=err;
end;

View File

@ -15,15 +15,14 @@
**********************************************************************}
unit initc;
interface
uses
ctypes;
{$linklib c}
type libcint = longint;
plibcint = ^libcint;
function fpgetCerrno:cint;
procedure fpsetCerrno(err:cint);
function fpgetCerrno:libcint;
procedure fpsetCerrno(err:libcint);
property cerrno:libcint read fpgetCerrno write fpsetcerrno;
property cerrno:cint read fpgetCerrno write fpsetcerrno;
const clib = 'c';
@ -37,15 +36,15 @@ implementation
{$ifdef UseOldErrnoDirectLink}
Var
interrno : libcint;external name {$ifdef OpenBSD} '_errno' {$else} 'h_errno'{$endif};
interrno : cint;external name {$ifdef OpenBSD} '_errno' {$else} 'h_errno'{$endif};
function fpgetCerrno:libcint;
function fpgetCerrno:cint;
begin
fpgetCerrno:=interrno;
end;
procedure fpsetCerrno(err:libcint);
procedure fpsetCerrno(err:cint);
begin
interrno:=err;
end;
@ -53,33 +52,33 @@ end;
{$ifdef Linux}
function geterrnolocation: Plibcint; cdecl;external clib name '__errno_location';
function geterrnolocation: pcint; cdecl;external clib name '__errno_location';
{$endif}
{$ifdef FreeBSD} // tested on x86
function geterrnolocation: Plibcint; cdecl;external clib name '__error';
function geterrnolocation: pcint; cdecl;external clib name '__error';
{$endif}
{$ifdef NetBSD} // from a sparc dump.
function geterrnolocation: Plibcint; cdecl;external clib name '__errno';
function geterrnolocation: pcint; cdecl;external clib name '__errno';
{$endif}
{$ifdef Darwin}
function geterrnolocation: Plibcint; cdecl;external clib name '__error';
function geterrnolocation: pcint; cdecl;external clib name '__error';
{$endif}
{$ifdef SunOS}
function geterrnolocation: Plibcint; cdecl;external clib name '___errno';
function geterrnolocation: pcint; cdecl;external clib name '___errno';
{$endif}
function fpgetCerrno:libcint;
function fpgetCerrno:cint;
begin
fpgetCerrno:=geterrnolocation^;
end;
procedure fpsetCerrno(err:libcint);
procedure fpsetCerrno(err:cint);
begin
geterrnolocation^:=err;
end;

View File

@ -14,27 +14,25 @@
unit initc;
interface
uses
ctypes;
function fpgetCerrno:cint;
procedure fpsetCerrno(err:cint);
type
libcint = longint;
plibcint = ^libcint;
function fpgetCerrno:libcint;
procedure fpsetCerrno(err:libcint);
property cerrno:libcint read fpgetCerrno write fpsetcerrno;
property cerrno:cint read fpgetCerrno write fpsetcerrno;
implementation
function geterrnolocation: Plibcint; cdecl;external 'cygwin1.dll' name '__errno';
function geterrnolocation: pcint; cdecl;external 'cygwin1.dll' name '__errno';
function fpgetCerrno:libcint;
function fpgetCerrno:cint;
begin
fpgetCerrno:=geterrnolocation^;
end;
procedure fpsetCerrno(err:libcint);
procedure fpsetCerrno(err:cint);
begin
geterrnolocation^:=err;
end;