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