bsdmacro.inc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. {
  2. $Id$
  3. Copyright (c) 2000-2002 by Marco van de Voort
  4. The *BSD POSIX macro's that are used both in the POSIX unit as the
  5. system unit. Not aliased via public names because I want these to
  6. be inlined as much as possible in the future.
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  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. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ****************************************************************************
  19. }
  20. function S_ISDIR(m : mode_t): boolean;
  21. begin
  22. S_ISDIR:=((m and %001111000000000000) = %100000000000000);
  23. end;
  24. function S_ISCHR(m : mode_t): boolean;
  25. begin
  26. S_ISCHR:=((m and %001111000000000000) = %10000000000000);
  27. end;
  28. function S_ISBLK(m : mode_t): boolean;
  29. begin
  30. S_ISBLK:=((m and %001111000000000000) = %110000000000000);
  31. end;
  32. function S_ISREG(m : mode_t): boolean;
  33. begin
  34. S_ISREG:=((m and %001111000000000000) = %1000000000000000);
  35. end;
  36. function S_ISFIFO(m : mode_t): boolean;
  37. begin
  38. S_ISFIFO:=((m and %001111000000000000) = %1000000000000);
  39. end;
  40. function wifexited(status : cint): cint;
  41. begin
  42. wifexited:=cint((status AND &177) =0);
  43. end;
  44. function wexitstatus(status : cint): cint;
  45. begin
  46. wexitstatus:=(status and &177) shr 8;
  47. end;
  48. function wstopsig(status : cint): cint;
  49. begin
  50. wstopsig:=(status and &177) shr 8;
  51. end;
  52. const wstopped=&177;
  53. function wifsignaled(status : cint): cint;
  54. begin
  55. wifsignaled:=cint(((status and &177)<>wstopped) and ((status and &177)<>0));
  56. end;
  57. function wtermsig(status : cint):cint;
  58. begin
  59. wtermsig:=cint(status and &177);
  60. end;
  61. {
  62. $Log$
  63. Revision 1.4 2002-11-12 14:19:46 marco
  64. * fixes to macro
  65. Revision 1.3 2002/10/26 18:27:51 marco
  66. * First series POSIX calls commits. Including getcwd.
  67. Revision 1.2 2002/09/07 16:01:17 peter
  68. * old logs removed and tabs fixed
  69. Revision 1.1 2002/08/19 12:29:11 marco
  70. * First working POSIX *BSD system unit.
  71. }