1{ 2 This file is part of the Free Pascal run time library. 3 (c) 2002 by Marco van de Voort 4 members of the Free Pascal development team. 5 6 Generic POSIX signal functions draft. Based on a few constants. 7 8 See the file COPYING.FPC, included in this distribution, 9 for details about the copyright. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY;without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15**********************************************************************} 16 17function fpFD_SET(fdno:cint;var nset : TFDSet): cint; 18 19Begin 20 if (fdno<0) or (fdno >= FD_MAXFDSET) Then 21 exit(-1); 22 nset[fdno shr ln2bitsinword]:=nset[(fdno) shr ln2bitsinword] OR (TFDSetEl(1) shl ((fdno) and ln2bitmask)); 23 fpFD_SET:=0; 24End; 25 26function fpFD_CLR(fdno:cint;var nset : TFDSet): cint; 27 28Begin 29 if (fdno<0) or (fdno >= FD_MAXFDSET) Then 30 exit(-1); 31 nset[(fdno) shr ln2bitsinword]:=nset[(fdno) shr ln2bitsinword] AND TFDSetEl(NOT (culong(1) shl ((fdno) and ln2bitmask))); 32 fpFD_CLR:=0; 33End; 34 35function fpFD_ZERO(out nset : TFDSet):cint; 36 37var i :longint; 38 39Begin 40 for i:=0 to wordsinfdset-1 DO nset[i]:=0; 41 fpFD_ZERO:=0; 42End; 43 44function fpfdfillset(var nset : TFDSet):cint; 45 46var i :longint; 47 48Begin 49 for i:=0 to wordsinfdset-1 DO 50 nset[i]:=TFDSetEl(NOT 0); 51 fpfdfillset:=0; 52End; 53 54function fpFD_ISSET(fdno:cint;const nset : TFDSet): cint; 55 56Begin 57 if (fdno<0) or (fdno >= FD_MAXFDSET) Then 58 exit(-1); 59 if ((nset[fdno shr ln2bitsinword]) and (TFDSetEl(1) shl ((fdno) and ln2bitmask)))>0 Then 60 fpFD_ISSET:=1 61 else 62 fpFD_ISSET:=0; 63End; 64 65