gitignore
[platform/upstream/glib.git] / build / win32 / dirent / dirent.h
1 /*\r
2  * DIRENT.H (formerly DIRLIB.H)\r
3  * This file has no copyright assigned and is placed in the Public Domain.\r
4  * This file is a part of the mingw-runtime package.\r
5  * No warranty is given; refer to the file DISCLAIMER within the package.\r
6  *\r
7  */\r
8 #ifndef _DIRENT_H_\r
9 #define _DIRENT_H_\r
10 \r
11 #include <stdio.h>\r
12 #include <io.h>\r
13 \r
14 #ifndef RC_INVOKED\r
15 \r
16 #ifdef __cplusplus\r
17 extern "C" {\r
18 #endif\r
19 \r
20 struct dirent\r
21 {\r
22         long            d_ino;          /* Always zero. */\r
23         unsigned short  d_reclen;       /* Always zero. */\r
24         unsigned short  d_namlen;       /* Length of name in d_name. */\r
25         char            d_name[FILENAME_MAX]; /* File name. */\r
26 };\r
27 \r
28 #ifdef _WIN64\r
29 #define INTPTR __int64\r
30 #else\r
31 #define INTPTR long\r
32 #endif\r
33 \r
34 /*\r
35  * This is an internal data structure. Good programmers will not use it\r
36  * except as an argument to one of the functions below.\r
37  * dd_stat field is now int (was short in older versions).\r
38  */\r
39 typedef struct\r
40 {\r
41         /* disk transfer area for this dir */\r
42         struct _finddata_t      dd_dta;\r
43 \r
44         /* dirent struct to return from dir (NOTE: this makes this thread\r
45          * safe as long as only one thread uses a particular DIR struct at\r
46          * a time) */\r
47         struct dirent           dd_dir;\r
48 \r
49         /* _findnext handle */\r
50         INTPTR                  dd_handle;\r
51 \r
52         /*\r
53          * Status of search:\r
54          *   0 = not started yet (next entry to read is first entry)\r
55          *  -1 = off the end\r
56          *   positive = 0 based index of next entry\r
57          */\r
58         int                     dd_stat;\r
59 \r
60         /* given path for dir with search pattern (struct is extended) */\r
61         char                    dd_name[1];\r
62 } DIR;\r
63 \r
64 DIR* __cdecl opendir (const char*);\r
65 struct dirent* __cdecl readdir (DIR*);\r
66 int __cdecl closedir (DIR*);\r
67 void __cdecl rewinddir (DIR*);\r
68 long __cdecl telldir (DIR*);\r
69 void __cdecl seekdir (DIR*, long);\r
70 \r
71 \r
72 /* wide char versions */\r
73 \r
74 struct _wdirent\r
75 {\r
76         long            d_ino;          /* Always zero. */\r
77         unsigned short  d_reclen;       /* Always zero. */\r
78         unsigned short  d_namlen;       /* Length of name in d_name. */\r
79         wchar_t         d_name[FILENAME_MAX]; /* File name. */\r
80 };\r
81 \r
82 /*\r
83  * This is an internal data structure. Good programmers will not use it\r
84  * except as an argument to one of the functions below.\r
85  */\r
86 typedef struct\r
87 {\r
88         /* disk transfer area for this dir */\r
89         struct _wfinddata_t     dd_dta;\r
90 \r
91         /* dirent struct to return from dir (NOTE: this makes this thread\r
92          * safe as long as only one thread uses a particular DIR struct at\r
93          * a time) */\r
94         struct _wdirent         dd_dir;\r
95 \r
96         /* _findnext handle */\r
97         INTPTR                  dd_handle;\r
98 \r
99         /*\r
100          * Status of search:\r
101          *   0 = not started yet (next entry to read is first entry)\r
102          *  -1 = off the end\r
103          *   positive = 0 based index of next entry\r
104          */\r
105         int                     dd_stat;\r
106 \r
107         /* given path for dir with search pattern (struct is extended) */\r
108         wchar_t                 dd_name[1];\r
109 } _WDIR;\r
110 \r
111 \r
112 \r
113 _WDIR* __cdecl _wopendir (const wchar_t*);\r
114 struct _wdirent*  __cdecl _wreaddir (_WDIR*);\r
115 int __cdecl _wclosedir (_WDIR*);\r
116 void __cdecl _wrewinddir (_WDIR*);\r
117 long __cdecl _wtelldir (_WDIR*);\r
118 void __cdecl _wseekdir (_WDIR*, long);\r
119 \r
120 \r
121 #ifdef  __cplusplus\r
122 }\r
123 #endif\r
124 \r
125 #endif  /* Not RC_INVOKED */\r
126 \r
127 #endif  /* Not _DIRENT_H_ */\r