Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / OS_NS_dirent.h
blob5d0a3f5addd1bc4c5d41af1b9ed79b8c8c823e0e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_NS_dirent.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
11 //=============================================================================
13 #ifndef ACE_OS_NS_DIRENT_H
14 # define ACE_OS_NS_DIRENT_H
16 # include /**/ "ace/pre.h"
18 # include "ace/config-all.h"
20 # if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 # endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/os_include/os_dirent.h"
25 #include /**/ "ace/ACE_export.h"
27 #if defined (ACE_EXPORT_MACRO)
28 # undef ACE_EXPORT_MACRO
29 #endif
30 #define ACE_EXPORT_MACRO ACE_Export
32 // Define the scandir() selector and comparator function types. Many platforms
33 // define these in terms of const pointers to dirent arrays/structs. Some
34 // platforms use void pointers instead. The ACE-exported API is defined in
35 // terms of the dirent-using function types, and if the OS-native scandir()
36 // uses void*, that's handled internal to the ACE_OS::scandir() wrapper using
37 // the ACE_SCANDIR_OS_COMPARATOR.
38 extern "C" {
39 #if defined (ACE_SCANDIR_CMP_USES_VOIDPTR)
40 typedef int (*ACE_SCANDIR_OS_COMPARATOR)(void *f1, void *f2);
41 #elif defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR)
42 typedef int (*ACE_SCANDIR_OS_COMPARATOR)(const void *f1, const void *f2);
43 #endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */
44 typedef int (*ACE_SCANDIR_COMPARATOR)(const ACE_DIRENT **f1, const ACE_DIRENT **f2);
45 typedef int (*ACE_SCANDIR_SELECTOR)(const ACE_DIRENT *filename);
49 * We inline and undef some functions that may be implemented
50 * as macros on some platforms. This way macro definitions will
51 * be usable later as there is no way to save the macro definition
52 * using the pre-processor.
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)
58 # if defined (rewinddir)
59 rewinddir (dir);
60 # undef rewinddir
61 # else
62 ::rewinddir (dir);
63 # endif /* defined (rewinddir) */
65 # endif /* !defined (ACE_HAS_WREWINDDIR) && !defined (ACE_USES_WCHAR) */
66 #endif /* ACE_LACKS_REWINDDIR */
68 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
70 namespace ACE_OS {
71 ACE_NAMESPACE_INLINE_FUNCTION
72 void closedir (ACE_DIR *);
74 ACE_NAMESPACE_INLINE_FUNCTION
75 ACE_DIR *opendir (const ACE_TCHAR *filename);
77 ACE_NAMESPACE_INLINE_FUNCTION
78 struct ACE_DIRENT *readdir (ACE_DIR *);
80 ACE_NAMESPACE_INLINE_FUNCTION
81 void rewinddir (ACE_DIR *);
83 ACE_NAMESPACE_INLINE_FUNCTION
84 int scandir (const ACE_TCHAR *dirname,
85 struct ACE_DIRENT **namelist[],
86 ACE_SCANDIR_SELECTOR selector,
87 ACE_SCANDIR_COMPARATOR comparator);
89 ACE_NAMESPACE_INLINE_FUNCTION
90 int alphasort (const void *, const void *);
92 ACE_NAMESPACE_INLINE_FUNCTION
93 void seekdir (ACE_DIR *,
94 long loc);
96 ACE_NAMESPACE_INLINE_FUNCTION
97 long telldir (ACE_DIR *);
99 // Win32 emulation functions
100 #if defined (ACE_LACKS_OPENDIR)
101 extern ACE_Export
102 ACE_DIR *opendir_emulation (const ACE_TCHAR *filename);
103 #endif /* ACE_LACKS_OPENDIR */
105 #if !defined (ACE_HAS_SCANDIR)
106 extern ACE_Export
107 int scandir_emulation (const ACE_TCHAR *dirname,
108 ACE_DIRENT **namelist[],
109 ACE_SCANDIR_SELECTOR selector,
110 ACE_SCANDIR_COMPARATOR comparator);
111 #endif /* !ACE_HAS_SCANDIR */
113 #if defined (ACE_LACKS_CLOSEDIR)
114 extern ACE_Export
115 void closedir_emulation (ACE_DIR *);
116 #endif /* ACE_LACKS_CLOSEDIR */
118 #if defined (ACE_LACKS_READDIR)
119 extern ACE_Export
120 struct ACE_DIRENT *readdir_emulation (ACE_DIR *);
121 #endif /* ACE_LACKS_READDIR */
123 } /* namespace ACE_OS */
125 ACE_END_VERSIONED_NAMESPACE_DECL
127 # if defined (ACE_HAS_INLINED_OSCALLS)
128 # if defined (ACE_INLINE)
129 # undef ACE_INLINE
130 # endif /* ACE_INLINE */
131 # define ACE_INLINE inline
132 # include "ace/OS_NS_dirent.inl"
133 # endif /* ACE_HAS_INLINED_OSCALLS */
135 # include /**/ "ace/post.h"
136 #endif /* ACE_OS_NS_DIRENT_H */