2004-01-19 15:28:14 +03:00
|
|
|
#ifndef RUBY_WIN32_DIR_H
|
|
|
|
#define RUBY_WIN32_DIR_H
|
2019-12-04 11:16:30 +03:00
|
|
|
#include <stdint.h> /* for uint8_t */
|
2022-10-26 02:22:57 +03:00
|
|
|
#include <basetsd.h> /* for WCHAR */
|
2019-12-04 11:16:30 +03:00
|
|
|
#include "ruby/encoding.h" /* for rb_encoding */
|
2004-01-19 15:28:14 +03:00
|
|
|
|
2015-03-14 06:23:56 +03:00
|
|
|
#define DT_UNKNOWN 0
|
|
|
|
#define DT_DIR (S_IFDIR>>12)
|
|
|
|
#define DT_REG (S_IFREG>>12)
|
|
|
|
#define DT_LNK 10
|
|
|
|
|
2001-05-31 03:02:54 +04:00
|
|
|
struct direct
|
|
|
|
{
|
|
|
|
long d_namlen;
|
|
|
|
ino_t d_ino;
|
2007-03-18 02:42:00 +03:00
|
|
|
char *d_name;
|
2015-03-08 10:57:38 +03:00
|
|
|
char *d_altname; /* short name */
|
|
|
|
short d_altlen;
|
2015-03-14 06:23:56 +03:00
|
|
|
uint8_t d_type;
|
2001-05-31 03:02:54 +04:00
|
|
|
};
|
|
|
|
typedef struct {
|
2009-02-02 08:19:51 +03:00
|
|
|
WCHAR *start;
|
|
|
|
WCHAR *curr;
|
2001-05-31 03:02:54 +04:00
|
|
|
long size;
|
|
|
|
long nfiles;
|
2006-01-01 08:49:01 +03:00
|
|
|
long loc; /* [0, nfiles) */
|
2004-01-05 19:01:54 +03:00
|
|
|
struct direct dirstr;
|
2004-01-05 13:01:54 +03:00
|
|
|
char *bits; /* used for d_isdir and d_isrep */
|
2001-05-31 03:02:54 +04:00
|
|
|
} DIR;
|
|
|
|
|
2002-05-29 14:22:19 +04:00
|
|
|
|
|
|
|
DIR* rb_w32_opendir(const char*);
|
2011-04-28 11:22:18 +04:00
|
|
|
DIR* rb_w32_uopendir(const char*);
|
2012-12-21 17:06:17 +04:00
|
|
|
struct direct* rb_w32_readdir(DIR *, rb_encoding *);
|
2020-12-20 09:29:21 +03:00
|
|
|
struct direct* rb_w32_ureaddir(DIR *);
|
2009-03-11 07:16:56 +03:00
|
|
|
long rb_w32_telldir(DIR *);
|
|
|
|
void rb_w32_seekdir(DIR *, long);
|
2002-05-29 14:22:19 +04:00
|
|
|
void rb_w32_rewinddir(DIR *);
|
2024-09-12 20:04:10 +03:00
|
|
|
int rb_w32_closedir(DIR *);
|
2017-05-16 13:25:56 +03:00
|
|
|
char *rb_w32_ugetcwd(char *, int);
|
2002-05-29 14:22:19 +04:00
|
|
|
|
2020-12-19 20:16:31 +03:00
|
|
|
#define opendir(s) rb_w32_uopendir((s))
|
2020-12-20 09:29:21 +03:00
|
|
|
#define readdir(d) rb_w32_ureaddir((d))
|
2012-12-21 17:06:17 +04:00
|
|
|
#define telldir(d) rb_w32_telldir((d))
|
|
|
|
#define seekdir(d, l) rb_w32_seekdir((d), (l))
|
|
|
|
#define rewinddir(d) rb_w32_rewinddir((d))
|
|
|
|
#define closedir(d) rb_w32_closedir((d))
|
2020-12-19 20:16:31 +03:00
|
|
|
#define getcwd(b, s) rb_w32_ugetcwd(b, s)
|
2004-01-19 15:28:14 +03:00
|
|
|
|
|
|
|
#endif /* RUBY_WIN32_DIR_H */
|