* fpISxxx macros renamed to C compliant fpS_ISxxx

This commit is contained in:
peter 2003-09-27 12:51:33 +00:00
parent 73b2b9d24a
commit 456025ad0a
6 changed files with 106 additions and 88 deletions

View File

@ -1,5 +1,5 @@
{ {
$Id$ $Id$
Copyright (c) 2000-2002 by Marco van de Voort Copyright (c) 2000-2002 by Marco van de Voort
The "linux" posixy macro's that are used both in the Baseunx unit as the The "linux" posixy macro's that are used both in the Baseunx unit as the
@ -23,42 +23,42 @@
**************************************************************************** ****************************************************************************
} }
function FpISDIR(m : TMode): boolean; function FpS_ISDIR(m : TMode): boolean;
begin begin
FpISDIR:=((m and S_IFMT) = S_IFDIR); FpS_ISDIR:=((m and S_IFMT) = S_IFDIR);
end; end;
function FpISCHR(m : TMode): boolean; function FpS_ISCHR(m : TMode): boolean;
begin begin
FpISCHR:=((m and S_IFMT) = S_IFCHR); FpS_ISCHR:=((m and S_IFMT) = S_IFCHR);
end; end;
function FpISBLK(m : TMode): boolean; function FpS_ISBLK(m : TMode): boolean;
begin begin
FpISBLK:=((m and S_IFMT) = S_IFBLK); FpS_ISBLK:=((m and S_IFMT) = S_IFBLK);
end; end;
function FpISREG(m : TMode): boolean; function FpS_ISREG(m : TMode): boolean;
begin begin
FpISREG:=((m and S_IFMT) = S_IFREG); FpS_ISREG:=((m and S_IFMT) = S_IFREG);
end; end;
function FpISFIFO(m : TMode): boolean; function FpS_ISFIFO(m : TMode): boolean;
begin begin
FpISFIFO:=((m and S_IFMT) = S_IFIFO); FpS_ISFIFO:=((m and S_IFMT) = S_IFIFO);
end; end;
Function FPISLNK(m:TMode):boolean; Function FPS_ISLNK(m:TMode):boolean;
begin begin
FPISLNK:=((m and S_IFMT) = S_IFLNK); FPS_ISLNK:=((m and S_IFMT) = S_IFLNK);
end; end;
Function FPISSOCK(m:TMode):boolean; Function FPS_ISSOCK(m:TMode):boolean;
begin begin
FPISSOCK:=((m and S_IFMT) = S_IFSOCK); FPS_ISSOCK:=((m and S_IFMT) = S_IFSOCK);
end; end;
function wifexited(status : cint): cint; function wifexited(status : cint): cint;
@ -91,7 +91,10 @@ end;
{ {
$Log$ $Log$
Revision 1.2 2003-09-17 11:24:46 marco Revision 1.3 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.2 2003/09/17 11:24:46 marco
* fixes for new macro's * fixes for new macro's
Revision 1.1 2002/12/18 16:43:26 marco Revision 1.1 2002/12/18 16:43:26 marco

View File

@ -175,7 +175,7 @@ Begin
Errno2Inoutres; Errno2Inoutres;
exit; exit;
end; end;
if FpISDIR(fileinfo.st_mode) then if FpS_ISDIR(fileinfo.st_mode) then
begin begin
InOutRes := 2; InOutRes := 2;
exit; exit;
@ -616,7 +616,10 @@ End.
*) *)
{ {
$Log$ $Log$
Revision 1.5 2003-05-01 08:05:23 florian Revision 1.6 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.5 2003/05/01 08:05:23 florian
* started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C) * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
Revision 1.4 2002/12/24 19:45:40 peter Revision 1.4 2002/12/24 19:45:40 peter

View File

@ -14,7 +14,7 @@
**********************************************************************} **********************************************************************}
Type TGrpArr = Array [0..0] of TGid; { C style array workarounds} Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
pGrpArr = ^TGrpArr; pGrpArr = ^TGrpArr;
TFilDes = Array [0..1] of cInt; TFilDes = Array [0..1] of cInt;
pFilDes = ^TFilDes; pFilDes = ^TFilDes;
@ -25,30 +25,30 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function fpFD_ISSET (fdno:cint;const nset : TFDSet): cint; Function fpFD_ISSET (fdno:cint;const nset : TFDSet): cint;
Function fpfdfillset (var nset : TFDSet):cint; Function fpfdfillset (var nset : TFDSet):cint;
Function FpsigEmptySet(var nset : TSigSet): cint; Function FpsigEmptySet(var nset : TSigSet): cint;
Function FpSigFillSet (var nset : TSigSet): cInt; Function FpSigFillSet (var nset : TSigSet): cInt;
Function FpSigAddSet (var nset : TSigSet; signo : cInt): cInt; Function FpSigAddSet (var nset : TSigSet; signo : cInt): cInt;
Function FpSigDelSet (var nset : TSigSet; signo : cInt): cInt; Function FpSigDelSet (var nset : TSigSet; signo : cInt): cInt;
Function FpSigIsMember(Const nset : TSigSet; signo : cInt): cInt; Function FpSigIsMember(Const nset : TSigSet; signo : cInt): cInt;
Function FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt; Function FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt;
Function FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; Function FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt;
Function FpSigPending (var nset : TSigSet): cInt; Function FpSigPending (var nset : TSigSet): cInt;
Function FpSigSuspend (Const sigmask : TSigSet): cInt; Function FpSigSuspend (Const sigmask : TSigSet): cInt;
Function FpUmask (cmask : TMode): TMode; Function FpUmask (cmask : TMode): TMode;
Function FpLink (existing : pChar; newone : pChar): cInt; Function FpLink (existing : pChar; newone : pChar): cInt;
Function FpMkfifo (path : pChar; Mode : TMode): cInt; Function FpMkfifo (path : pChar; Mode : TMode): cInt;
Function FpChmod (path : pChar; Mode : TMode): cInt; Function FpChmod (path : pChar; Mode : TMode): cInt;
Function FpChown (path : pChar; owner : TUid; group : TGid): cInt; Function FpChown (path : pChar; owner : TUid; group : TGid): cInt;
Function FpUtime (path : pChar; times : putimbuf): cInt; Function FpUtime (path : pChar; times : putimbuf): cInt;
Function FpPipe (var fildes : tfildes):cInt; Function FpPipe (var fildes : tfildes):cInt;
Function FpDup (fildes : cInt): cInt; Function FpDup (fildes : cInt): cInt;
Function FpDup2 (fildes, fildes2 : cInt): cInt; Function FpDup2 (fildes, fildes2 : cInt): cInt;
Function FpTimes (var buffer : tms): TClock; Function FpTimes (var buffer : tms): TClock;
Function FpAlarm (seconds : cuint): cuint; Function FpAlarm (seconds : cuint): cuint;
Function FpPause : cInt; Function FpPause : cInt;
Function FpSleep (seconds : cuint): cuint; Function FpSleep (seconds : cuint): cuint;
@ -58,71 +58,74 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FpGeteuid : TUid; Function FpGeteuid : TUid;
Function FpGetgid : TGid; Function FpGetgid : TGid;
Function FpGetegid : TGid; Function FpGetegid : TGid;
Function FpSetuid (uid : TUid): cInt; Function FpSetuid (uid : TUid): cInt;
Function FpSetgid (gid : TGid): cInt; Function FpSetgid (gid : TGid): cInt;
Function FpGetgroups (gidsetsize : cInt; var grouplist : tgrparr): cInt; Function FpGetgroups (gidsetsize : cInt; var grouplist : tgrparr): cInt;
Function FpGetpgrp : TPid; Function FpGetpgrp : TPid;
Function FpSetsid : TPid; Function FpSetsid : TPid;
Function FpFcntl (fildes : cInt; cmd : cInt): cInt; Function FpFcntl (fildes : cInt; cmd : cInt): cInt;
Function FpFcntl (fildes : cInt; cmd : cInt; arg : cInt): cInt; Function FpFcntl (fildes : cInt; cmd : cInt; arg : cInt): cInt;
Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt; Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt;
Function FpGetcwd (path:pChar; siz:TSize):pChar; Function FpGetcwd (path:pChar; siz:TSize):pChar;
Function FpFork : TPid; Function FpFork : TPid;
Function FpExecve (path : pChar; argv : ppChar; envp: ppChar): cInt; Function FpExecve (path : pChar; argv : ppChar; envp: ppChar): cInt;
Function FpExecv (path : pChar; argv : ppChar): cInt; Function FpExecv (path : pChar; argv : ppChar): cInt;
Function FpWaitpid (pid : TPid; stat_loc : pcInt; options: cInt): TPid; Function FpWaitpid (pid : TPid; stat_loc : pcInt; options: cInt): TPid;
Function FpWait (var stat_loc : cInt): TPid; Function FpWait (var stat_loc : cInt): TPid;
Procedure FpExit (Status : cInt); Procedure FpExit (Status : cInt);
Function FpKill (pid : TPid; sig: cInt): cInt; Function FpKill (pid : TPid; sig: cInt): cInt;
Function FpUname (var name: utsname): cInt; Function FpUname (var name: utsname): cInt;
Function FpOpendir (dirname : pChar): pDir; Function FpOpendir (dirname : pChar): pDir;
Function FpReaddir (var dirp : Dir) : pDirent; Function FpReaddir (var dirp : Dir) : pDirent;
Function FpClosedir (var dirp : Dir): cInt; Function FpClosedir (var dirp : Dir): cInt;
Function FpChdir (path : pChar): cInt; Function FpChdir (path : pChar): cInt;
Function FpOpen (path : pChar; flags : cInt; Mode: TMode):cInt; Function FpOpen (path : pChar; flags : cInt; Mode: TMode):cInt;
Function FpMkdir (path : pChar; Mode: TMode):cInt; Function FpMkdir (path : pChar; Mode: TMode):cInt;
Function FpUnlink (path : pChar): cInt; Function FpUnlink (path : pChar): cInt;
Function FpRmdir (path : pChar): cInt; Function FpRmdir (path : pChar): cInt;
Function FpRename (old : pChar; newpath: pChar): cInt; Function FpRename (old : pChar; newpath: pChar): cInt;
Function FpFStat (fd : cInt; var sb : stat): cInt; Function FpFStat (fd : cInt; var sb : stat): cInt;
Function FpStat (path: pChar; var buf : stat): cInt; Function FpStat (path: pChar; var buf : stat): cInt;
Function FpAccess (pathname : pChar; aMode : cInt): cInt; Function FpAccess (pathname : pChar; aMode : cInt): cInt;
Function FpClose (fd : cInt): cInt; Function FpClose (fd : cInt): cInt;
Function FpRead (fd : cInt; buf: pChar; nbytes : TSize): TSsize; Function FpRead (fd : cInt; buf: pChar; nbytes : TSize): TSsize;
Function FpWrite (fd : cInt; buf:pChar; nbytes : TSize): TSsize; Function FpWrite (fd : cInt; buf:pChar; nbytes : TSize): TSsize;
Function FpLseek (fd : cInt; offset : TOff; whence : cInt): TOff; Function FpLseek (fd : cInt; offset : TOff; whence : cInt): TOff;
Function FpTime (var tloc : TTime): TTime; Function FpTime (var tloc : TTime): TTime;
Function FpFtruncate (fd : cInt; flength : TOff): cInt; Function FpFtruncate (fd : cInt; flength : TOff): cInt;
Function FPSigaction (sig: cInt; act : pSigActionRec; oact : pSigActionRec): cint; Function FPSigaction (sig: cInt; act : pSigActionRec; oact : pSigActionRec): cint;
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
Function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint; Function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint;
Function FpGetEnv (name : pChar): pChar; Function FpGetEnv (name : pChar): pChar;
Function FpGetEnv (name : String): pChar; Function FpGetEnv (name : String): pChar;
Function FPIsDir (m : TMode): Boolean; Function fpS_ISDIR (m : TMode): Boolean;
Function FPIsChr (m : TMode): Boolean; Function fpS_ISCHR (m : TMode): Boolean;
Function FPIsBlk (m : TMode): Boolean; Function fpS_ISBLK (m : TMode): Boolean;
Function FPIsReg (m : TMode): Boolean; Function fpS_ISREG (m : TMode): Boolean;
Function FPIsFIFO (m : TMode): Boolean; Function fpS_ISFIFO (m : TMode): Boolean;
// The following two are very common, but not POSIX. // The following two are very common, but not POSIX.
Function FPISLNK (m:TMode) : Boolean; Function fpS_ISLNK (m:TMode) : Boolean;
Function FPISSOCK (m:TMode) : Boolean; Function fpS_ISSOCK (m:TMode) : Boolean;
Function wifexited (Status : cInt): cInt; Function wifexited (Status : cInt): cInt;
Function wexitStatus (Status : cInt): cInt; Function wexitStatus (Status : cInt): cInt;
Function wstopsig (Status : cInt): cInt; Function wstopsig (Status : cInt): cInt;
Function wifsignaled (Status : cInt): cInt; Function wifsignaled (Status : cInt): cInt;
Function wtermsig (Status : cInt): cInt; Function wtermsig (Status : cInt): cInt;
{$i bunxovlh.inc} // overloads and/or redefs. {$i bunxovlh.inc} // overloads and/or redefs.
{ {
$Log$ $Log$
Revision 1.8 2003-09-20 12:38:29 marco Revision 1.9 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.8 2003/09/20 12:38:29 marco
* FCL now compiles for FreeBSD with new 1.1. Now Linux. * FCL now compiles for FreeBSD with new 1.1. Now Linux.
Revision 1.7 2003/09/17 11:24:46 marco Revision 1.7 2003/09/17 11:24:46 marco

View File

@ -699,13 +699,13 @@ Begin
end end
else else
LinAttr:=Info.st_Mode; LinAttr:=Info.st_Mode;
if fpISDIR(LinAttr) then if fpS_ISDIR(LinAttr) then
Attr:=$10 Attr:=$10
else else
Attr:=$20; Attr:=$20;
if fpAccess(strpas(@textrec(f).name),W_OK)<0 then if fpAccess(strpas(@textrec(f).name),W_OK)<0 then
Attr:=Attr or $1; Attr:=Attr or $1;
if (not fpISDIR(LinAttr)) and (filerec(f).name[0]='.') then if (not fpS_ISDIR(LinAttr)) and (filerec(f).name[0]='.') then
Attr:=Attr or $2; Attr:=Attr or $2;
end; end;
@ -903,7 +903,10 @@ End.
{ {
$Log$ $Log$
Revision 1.17 2003-09-17 17:30:46 marco Revision 1.18 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.17 2003/09/17 17:30:46 marco
* Introduction of unixutil * Introduction of unixutil
Revision 1.16 2003/09/14 20:15:01 marco Revision 1.16 2003/09/14 20:15:01 marco

View File

@ -151,7 +151,7 @@ Function DirectoryExists (Const Directory : String) : Boolean;
Var Info : Stat; Var Info : Stat;
begin begin
DirectoryExists:=(fpstat(Directory,Info)>=0) and fpISDIR(Info.st_mode); DirectoryExists:=(fpstat(Directory,Info)>=0) and fpS_ISDIR(Info.st_mode);
end; end;
@ -159,13 +159,13 @@ Function LinuxToWinAttr (FN : Pchar; Const Info : Stat) : Longint;
begin begin
Result:=faArchive; Result:=faArchive;
If fpISDIR(Info.st_mode) then If fpS_ISDIR(Info.st_mode) then
Result:=Result or faDirectory; Result:=Result or faDirectory;
If (FN[0]='.') and (not (FN[1] in [#0,'.'])) then If (FN[0]='.') and (not (FN[1] in [#0,'.'])) then
Result:=Result or faHidden; Result:=Result or faHidden;
If (Info.st_Mode and S_IWUSR)=0 Then If (Info.st_Mode and S_IWUSR)=0 Then
Result:=Result or faReadOnly; Result:=Result or faReadOnly;
If fpISSOCK(Info.st_mode) or fpISBLK(Info.st_mode) or fpISCHR(Info.st_mode) or fpISFIFO(Info.st_mode) Then If fpS_ISSOCK(Info.st_mode) or fpS_ISBLK(Info.st_mode) or fpS_ISCHR(Info.st_mode) or fpS_ISFIFO(Info.st_mode) Then
Result:=Result or faSysFile; Result:=Result or faSysFile;
end; end;
@ -493,7 +493,10 @@ end.
{ {
$Log$ $Log$
Revision 1.21 2003-09-17 19:07:44 marco Revision 1.22 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.21 2003/09/17 19:07:44 marco
* more fixes for Unix<->unixutil * more fixes for Unix<->unixutil
Revision 1.20 2003/09/17 12:41:31 marco Revision 1.20 2003/09/17 12:41:31 marco

View File

@ -1231,7 +1231,7 @@ end;
{$ifndef BSD} {$ifndef BSD}
Function GetDomainName:String; { linux only!} Function GetDomainName:String; { linux only!}
// domainname is a glibc extension. // domainname is a glibc extension.
{ {
Get machines domain name. Returns empty string if not set. Get machines domain name. Returns empty string if not set.
} }
@ -1461,7 +1461,7 @@ var
fpstat(name,st); fpstat(name,st);
if linuxerror=0 then if linuxerror=0 then
begin begin
if (fpISDIR(st.st_mode)) and { if it is a directory } if (fpS_ISDIR(st.st_mode)) and { if it is a directory }
(strpas(@(d^.d_name))<>'.') and { but not ., .. and fd subdirs } (strpas(@(d^.d_name))<>'.') and { but not ., .. and fd subdirs }
(strpas(@(d^.d_name))<>'..') and (strpas(@(d^.d_name))<>'..') and
(strpas(@(d^.d_name))<>'') and (strpas(@(d^.d_name))<>'') and
@ -1714,7 +1714,10 @@ End.
{ {
$Log$ $Log$
Revision 1.38 2003-09-20 12:38:29 marco Revision 1.39 2003-09-27 12:51:33 peter
* fpISxxx macros renamed to C compliant fpS_ISxxx
Revision 1.38 2003/09/20 12:38:29 marco
* FCL now compiles for FreeBSD with new 1.1. Now Linux. * FCL now compiles for FreeBSD with new 1.1. Now Linux.
Revision 1.37 2003/09/17 19:07:44 marco Revision 1.37 2003/09/17 19:07:44 marco