genfdset.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. (c) 2002 by Marco van de Voort
  5. members of the Free Pascal development team.
  6. Generic POSIX signal functions draft. Based on a few constants.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY;without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. function fpfdaddset(var nset : TFDSet;fdno:cint): cint;
  14. Begin
  15. if (fdno<=0) or (fdno > FD_MAXFDSET) Then
  16. exit(-1);
  17. nset[(fdno-1) shr ln2bitsinword]:=nset[(fdno-1) shr ln2bitsinword] OR (1 shl ((fdno-1) and ln2bitmask));
  18. fpfdaddset:=0;
  19. End;
  20. function fpfddelset(var nset : TFDSet;fdno:cint): cint;
  21. Begin
  22. if (fdno<=0) or (fdno > FD_MAXFDSET) Then
  23. exit(-1);
  24. nset[(fdno-1) shr ln2bitsinword]:=nset[(fdno-1) shr ln2bitsinword] AND NOT (1 shl ((fdno-1) and ln2bitmask));
  25. fpfddelset:=0;
  26. End;
  27. function fpfdemptyset(var nset : TFDSet):cint;
  28. var i :longint;
  29. Begin
  30. for i:=0 to wordsinsigset-1 DO nset[i]:=0;
  31. fpfdemptyset:=0;
  32. End;
  33. function fpfdfillset(var nset : TFDSet):cint;
  34. var i :longint;
  35. Begin
  36. for i:=0 to wordsinsigset DO nset[i]:=NOT 0;
  37. fpfdfillset:=0;
  38. End;
  39. function fpfdismember(const nset : TFDSet;fdno:cint): cint;
  40. Begin
  41. if (fdno<=0) or (fdno > FD_MAXFDSET) Then
  42. exit(-1);
  43. if ((nset[(fdno-1) shr ln2bitsinword]) and (1 shl ((fdno-1) and ln2bitmask)))>0 Then
  44. fpfdismember:=1
  45. else
  46. fpfdismember:=0;
  47. End;
  48. {
  49. $Log$
  50. Revision 1.1 2003-09-14 20:16:48 marco
  51. * new files unixreform
  52. Revision 1.3 2003/06/01 16:28:41 marco
  53. * Enhancements to make the compiler baseunix using.
  54. Revision 1.2 2002/12/18 16:50:39 marco
  55. * Unix RTL generic parts. Linux working, *BSD will follow shortly
  56. Revision 1.1 2002/11/14 12:20:30 marco
  57. * initial version, taken from bsdfunc.inc, since both linux and bsd use it
  58. }