acl  3.5.3.0
acl_dir.h
浏览该文件的文档.
1 #ifndef ACL_DIR_INCLUDE_H
2 #define ACL_DIR_INCLUDE_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include "acl_define.h"
9 
10 #if defined(_WIN32) || defined(_WIN64)
11 
12 #if !defined(_UNICODE)
13 
14 /**
15  * dirent structure returned by readdir().
16  */
17 struct dirent {
18  char d_name[260];
19 };
20 
21 /**
22  * DIR type returned by opendir(). The members of this structure
23  * must not be accessed by application programs.
24  */
25 typedef struct {
26  HANDLE _d_hdir; /**< directory handle */
27  char *_d_dirname; /**< directory name */
28  unsigned _d_magic; /**< magic cookie for verifying handle */
29  unsigned _d_nfiles; /**< no. of files remaining in buf */
30  char _d_buf[sizeof(WIN32_FIND_DATA)]; /**< buffer for a single file */
31 } DIR;
32 
33 /**
34  * Prototypes.
35  */
36 ACL_API DIR *opendir(const char *dirname);
37 ACL_API struct dirent *readdir(DIR *dir);
38 ACL_API int closedir(DIR *dir);
39 ACL_API void rewinddir(DIR *dir);
40 
41 /* @: directory functions */
42 
43 #define _topendir opendir
44 #define _treaddir readdir
45 #define _trewinddir rewinddir
46 #define _tclosedir closedir
47 #define _tDIR DIR
48 #define _tdirent dirent
49 
50 #else /* _UNICODE */
51 
52 /* wdirent structure returned by wreaddir().
53 */
54 struct wdirent {
55  wchar_t d_name[260];
56 };
57 
58 typedef struct {
59  unsigned long _d_hdir; /**< directory handle */
60  wchar_t *_d_dirname; /**< directory name */
61  unsigned _d_magic; /**< magic cookie for verifying handle */
62  unsigned _d_nfiles; /**< no. of files remaining in buf */
63  char _d_buf[sizeof(WIN32_FIND_DATA)]; /**< buffer for a single file */
64 } wDIR;
65 
66 ACL_API wDIR *wopendir(const wchar_t *dirname);
67 ACL_API struct wdirent *wreaddir(wDIR *dir);
68 ACL_API int wclosedir (wDIR *dir);
69 ACL_API void wrewinddir(wDIR *dir);
70 
71 /* @: directory functions */
72 
73 #define _topendir wopendir
74 #define _treaddir wreaddir
75 #define _trewinddir wrewinddir
76 #define _tclosedir wclosedir
77 #define _tDIR wDIR
78 #define _tdirent wdirent
79 
80 #endif /* _UNICODE */
81 
82 #endif /* _WIN32 */
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif
89