2005-08-31 20:11:45 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* dirent.h */
|
|
|
|
/* */
|
|
|
|
/* Directory entries for cc65 */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* (C) 2005 Oliver Schmidt, <ol.sc@web.de> */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DIRENT_H
|
|
|
|
#define _DIRENT_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Data */
|
2005-08-31 20:11:45 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct DIR DIR;
|
|
|
|
|
2007-01-05 16:16:34 +00:00
|
|
|
#if defined(__APPLE2__) || defined(__APPLE2ENH__)
|
|
|
|
|
|
|
|
struct dirent {
|
|
|
|
char d_name[16];
|
|
|
|
unsigned d_ino;
|
|
|
|
unsigned d_blocks;
|
|
|
|
unsigned long d_size;
|
|
|
|
unsigned char d_type;
|
|
|
|
struct {
|
2009-10-11 11:14:35 +00:00
|
|
|
unsigned day :5;
|
|
|
|
unsigned mon :4;
|
|
|
|
unsigned year :7;
|
|
|
|
} d_cdate;
|
|
|
|
struct {
|
|
|
|
unsigned char min;
|
|
|
|
unsigned char hour;
|
2007-01-05 16:16:34 +00:00
|
|
|
} d_ctime;
|
|
|
|
unsigned char d_access;
|
|
|
|
unsigned d_auxtype;
|
|
|
|
struct {
|
2009-10-11 11:14:35 +00:00
|
|
|
unsigned day :5;
|
|
|
|
unsigned mon :4;
|
|
|
|
unsigned year :7;
|
|
|
|
} d_mdate;
|
|
|
|
struct {
|
|
|
|
unsigned char min;
|
|
|
|
unsigned char hour;
|
2007-01-05 16:16:34 +00:00
|
|
|
} d_mtime;
|
|
|
|
};
|
|
|
|
|
2012-07-03 20:00:01 +00:00
|
|
|
#define _DE_ISREG(t) ((t) != 0x0F)
|
|
|
|
#define _DE_ISDIR(t) ((t) == 0x0F)
|
2012-06-24 19:59:49 +00:00
|
|
|
#define _DE_ISLBL(t) (0)
|
|
|
|
#define _DE_ISLNK(t) (0)
|
2012-06-24 19:49:15 +00:00
|
|
|
|
2013-05-28 19:56:37 +00:00
|
|
|
#elif defined(__ATARI__) || defined(__ATARIXL__)
|
2010-10-28 21:13:52 +00:00
|
|
|
|
|
|
|
struct dirent {
|
2012-07-03 20:10:52 +00:00
|
|
|
char d_name[13]; /* 8.3 + trailing 0 */
|
|
|
|
unsigned char d_type;
|
2010-10-28 21:13:52 +00:00
|
|
|
};
|
|
|
|
|
2012-07-03 20:10:52 +00:00
|
|
|
#define _DE_ISREG(t) ((t) != 0xC4)
|
|
|
|
#define _DE_ISDIR(t) ((t) == 0xC4)
|
2012-06-25 20:23:54 +00:00
|
|
|
#define _DE_ISLBL(t) (0)
|
|
|
|
#define _DE_ISLNK(t) (0)
|
|
|
|
|
2012-05-29 21:19:50 +00:00
|
|
|
#elif defined(__CBM__)
|
|
|
|
|
|
|
|
struct dirent {
|
|
|
|
char d_name[16+1];
|
|
|
|
unsigned int d_off;
|
2012-06-02 22:56:14 +00:00
|
|
|
unsigned int d_blocks;
|
2012-06-24 14:23:33 +00:00
|
|
|
unsigned char d_type; /* See _CBM_T_xxx defines */
|
2012-06-02 22:56:14 +00:00
|
|
|
|
2012-05-29 21:19:50 +00:00
|
|
|
/* bsd extensions */
|
|
|
|
unsigned char d_namlen;
|
|
|
|
};
|
|
|
|
|
2012-06-24 14:23:33 +00:00
|
|
|
/* File type specification macros. We need definitions of CBM file types. */
|
|
|
|
#include <cbm_filetype.h>
|
|
|
|
|
|
|
|
#define _DE_ISREG(t) (((t) & _CBM_T_REG) != 0)
|
|
|
|
#define _DE_ISDIR(t) ((t) == _CBM_T_DIR)
|
|
|
|
#define _DE_ISLBL(t) ((t) == _CBM_T_HDR)
|
|
|
|
#define _DE_ISLNK(t) ((t) == _CBM_T_LNK)
|
|
|
|
|
2011-01-04 19:39:07 +00:00
|
|
|
#elif defined(__LYNX__)
|
|
|
|
|
|
|
|
struct dirent {
|
2013-05-09 11:56:54 +00:00
|
|
|
unsigned char d_blocks;
|
|
|
|
unsigned int d_offset;
|
|
|
|
char d_type;
|
|
|
|
void *d_address;
|
|
|
|
unsigned int d_size;
|
2011-01-04 19:39:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct dirent FileEntry;
|
|
|
|
#pragma zpsym ("FileEntry");
|
|
|
|
|
2012-06-25 20:23:54 +00:00
|
|
|
#define _DE_ISREG(t) (1)
|
|
|
|
#define _DE_ISDIR(t) (0)
|
|
|
|
#define _DE_ISLBL(t) (0)
|
|
|
|
#define _DE_ISLNK(t) (0)
|
|
|
|
|
2010-10-28 21:13:52 +00:00
|
|
|
#else
|
2007-01-05 16:16:34 +00:00
|
|
|
|
2005-08-31 20:11:45 +00:00
|
|
|
struct dirent {
|
|
|
|
char d_name[1];
|
|
|
|
};
|
|
|
|
|
2012-06-25 20:23:54 +00:00
|
|
|
#define _DE_ISREG(t) (1)
|
|
|
|
#define _DE_ISDIR(t) (0)
|
|
|
|
#define _DE_ISLBL(t) (0)
|
|
|
|
#define _DE_ISLNK(t) (0)
|
|
|
|
|
2012-02-17 21:08:13 +00:00
|
|
|
#endif
|
2007-01-05 16:16:34 +00:00
|
|
|
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Code */
|
2005-08-31 20:11:45 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DIR* __fastcall__ opendir (const char* name);
|
|
|
|
|
|
|
|
struct dirent* __fastcall__ readdir (DIR* dir);
|
|
|
|
|
|
|
|
int __fastcall__ closedir (DIR* dir);
|
|
|
|
|
2012-06-03 15:11:32 +00:00
|
|
|
long __fastcall__ telldir (DIR* dir);
|
|
|
|
|
|
|
|
void __fastcall__ seekdir (DIR* dir, long offs);
|
|
|
|
|
2005-08-31 20:11:45 +00:00
|
|
|
void __fastcall__ rewinddir (DIR* dir);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of dirent.h */
|
|
|
|
#endif
|