/oregoncore/dep/acelite/ace/OS_NS_dirent.h

https://github.com/sysmaniax/k17oregoncoredb · C Header · 153 lines · 95 code · 30 blank · 28 comment · 6 complexity · a2c64a8df4bfd4c5c44510cf9afa35a0 MD5 · raw file

  1. // -*- C++ -*-
  2. //=============================================================================
  3. /**
  4. * @file OS_NS_dirent.h
  5. *
  6. * $Id: OS_NS_dirent.h 85435 2009-05-25 18:52:50Z coryan $
  7. *
  8. * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
  9. * @author Jesper S. M|ller<stophph@diku.dk>
  10. * @author and a cast of thousands...
  11. *
  12. * Originally in OS.h.
  13. */
  14. //=============================================================================
  15. #ifndef ACE_OS_NS_DIRENT_H
  16. # define ACE_OS_NS_DIRENT_H
  17. # include /**/ "ace/pre.h"
  18. # include "ace/config-all.h"
  19. # if !defined (ACE_LACKS_PRAGMA_ONCE)
  20. # pragma once
  21. # endif /* ACE_LACKS_PRAGMA_ONCE */
  22. #include "ace/os_include/os_dirent.h"
  23. #include /**/ "ace/ACE_export.h"
  24. #if defined (ACE_EXPORT_MACRO)
  25. # undef ACE_EXPORT_MACRO
  26. #endif
  27. #define ACE_EXPORT_MACRO ACE_Export
  28. // Define the scandir() selector and comparator function types. Many platforms
  29. // define these in terms of const pointers to dirent arrays/structs. Some
  30. // platforms use void pointers instead. The ACE-exported API is defined in
  31. // terms of the dirent-using function types, and if the OS-native scandir()
  32. // uses void*, that's handled internal to the ACE_OS::scandir() wrapper using
  33. // the ACE_SCANDIR_OS_COMPARATOR.
  34. extern "C" {
  35. #if defined (ACE_SCANDIR_CMP_USES_VOIDPTR)
  36. typedef int (*ACE_SCANDIR_OS_COMPARATOR)(void *f1, void *f2);
  37. #elif defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR)
  38. typedef int (*ACE_SCANDIR_OS_COMPARATOR)(const void *f1, const void *f2);
  39. #endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */
  40. typedef int (*ACE_SCANDIR_COMPARATOR)(const ACE_DIRENT **f1,
  41. const ACE_DIRENT **f2);
  42. #if defined (ACE_SCANDIR_SEL_LACKS_CONST)
  43. typedef int (*ACE_SCANDIR_OS_SELECTOR)(ACE_DIRENT *filename);
  44. #endif /* ACE_SCANDIR_SEL_LACKS_CONST */
  45. typedef int (*ACE_SCANDIR_SELECTOR)(const ACE_DIRENT *filename);
  46. }
  47. /*
  48. * We inline and undef some functions that may be implemented
  49. * as macros on some platforms. This way macro definitions will
  50. * be usable later as there is no way to save the macro definition
  51. * using the pre-processor.
  52. *
  53. */
  54. #if !defined (ACE_LACKS_REWINDDIR)
  55. # if !defined (ACE_HAS_WREWINDDIR) || !defined (ACE_USES_WCHAR)
  56. inline void ace_rewinddir_helper (ACE_DIR *dir)
  57. {
  58. # if defined (rewinddir)
  59. rewinddir (dir);
  60. # undef rewinddir
  61. # else
  62. ::rewinddir (dir);
  63. # endif /* defined (rewinddir) */
  64. }
  65. # endif /* !defined (ACE_HAS_WREWINDDIR) && !defined (ACE_USES_WCHAR) */
  66. #endif /* ACE_LACKS_REWINDDIR */
  67. ACE_BEGIN_VERSIONED_NAMESPACE_DECL
  68. namespace ACE_OS {
  69. ACE_NAMESPACE_INLINE_FUNCTION
  70. void closedir (ACE_DIR *);
  71. ACE_NAMESPACE_INLINE_FUNCTION
  72. ACE_DIR *opendir (const ACE_TCHAR *filename);
  73. ACE_NAMESPACE_INLINE_FUNCTION
  74. struct ACE_DIRENT *readdir (ACE_DIR *);
  75. ACE_NAMESPACE_INLINE_FUNCTION
  76. int readdir_r (ACE_DIR *dirp,
  77. struct ACE_DIRENT *entry,
  78. struct ACE_DIRENT **result);
  79. ACE_NAMESPACE_INLINE_FUNCTION
  80. void rewinddir (ACE_DIR *);
  81. ACE_NAMESPACE_INLINE_FUNCTION
  82. int scandir (const ACE_TCHAR *dirname,
  83. struct ACE_DIRENT **namelist[],
  84. ACE_SCANDIR_SELECTOR selector,
  85. ACE_SCANDIR_COMPARATOR comparator);
  86. ACE_NAMESPACE_INLINE_FUNCTION
  87. int alphasort (const void *, const void *);
  88. ACE_NAMESPACE_INLINE_FUNCTION
  89. void seekdir (ACE_DIR *,
  90. long loc);
  91. ACE_NAMESPACE_INLINE_FUNCTION
  92. long telldir (ACE_DIR *);
  93. // Win32 emulation functions
  94. #if defined (ACE_LACKS_OPENDIR)
  95. extern ACE_Export
  96. ACE_DIR *opendir_emulation (const ACE_TCHAR *filename);
  97. #endif /* ACE_LACKS_OPENDIR */
  98. #if !defined (ACE_HAS_SCANDIR)
  99. extern ACE_Export
  100. int scandir_emulation (const ACE_TCHAR *dirname,
  101. ACE_DIRENT **namelist[],
  102. ACE_SCANDIR_SELECTOR selector,
  103. ACE_SCANDIR_COMPARATOR comparator);
  104. #endif /* !ACE_HAS_SCANDIR */
  105. #if defined (ACE_LACKS_CLOSEDIR)
  106. extern ACE_Export
  107. void closedir_emulation (ACE_DIR *);
  108. #endif /* ACE_LACKS_CLOSEDIR */
  109. #if defined (ACE_LACKS_READDIR)
  110. extern ACE_Export
  111. struct ACE_DIRENT *readdir_emulation (ACE_DIR *);
  112. #endif /* ACE_LACKS_READDIR */
  113. } /* namespace ACE_OS */
  114. ACE_END_VERSIONED_NAMESPACE_DECL
  115. # if defined (ACE_HAS_INLINED_OSCALLS)
  116. # if defined (ACE_INLINE)
  117. # undef ACE_INLINE
  118. # endif /* ACE_INLINE */
  119. # define ACE_INLINE inline
  120. # include "ace/OS_NS_dirent.inl"
  121. # endif /* ACE_HAS_INLINED_OSCALLS */
  122. # include /**/ "ace/post.h"
  123. #endif /* ACE_OS_NS_DIRENT_H */