]> git.sur5r.net Git - cc65/blobdiff - include/dirent.h
Fixed LinuxDoc Tools issues in some verbatim blocks in the Atari document.
[cc65] / include / dirent.h
index fc582c1d128ec4ec87974a435c9575ab2bbcb8f6..124c7f2241bc6c30d0010b5295823ccc1c9ddadc 100644 (file)
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
 
 typedef struct DIR DIR;
 
-#if defined(__APPLE2__) || defined(__APPLE2ENH__)
+#if defined(__APPLE2__)
 
 struct dirent {
     char          d_name[16];
@@ -51,32 +51,100 @@ struct dirent {
     unsigned      d_blocks;
     unsigned long d_size;
     unsigned char d_type;
-    unsigned      d_cdate;
     struct {
-       unsigned char mins;
-        unsigned char hours;
+        unsigned day  :5;
+        unsigned mon  :4;
+        unsigned year :7;
+    }             d_cdate;
+    struct {
+        unsigned char min;
+        unsigned char hour;
     }             d_ctime;
     unsigned char d_access;
     unsigned      d_auxtype;
-    unsigned      d_mdate;
     struct {
-       unsigned char mins;
-        unsigned char hours;
+        unsigned day  :5;
+        unsigned mon  :4;
+        unsigned year :7;
+    }             d_mdate;
+    struct {
+        unsigned char min;
+        unsigned char hour;
     }             d_mtime;
 };
 
-#else  /* __APPLE2__ or __APPLE2ENH__ */
+#define _DE_ISREG(t)  ((t) != 0x0F)
+#define _DE_ISDIR(t)  ((t) == 0x0F)
+#define _DE_ISLBL(t)  (0)
+#define _DE_ISLNK(t)  (0)
+
+#elif defined(__ATARI__)
+
+struct dirent {
+    char          d_name[13];  /* 8.3 + trailing 0 */
+    unsigned char d_type;
+};
+
+#define _DE_ISREG(t)  ((t) != 0xC4)
+#define _DE_ISDIR(t)  ((t) == 0xC4)
+#define _DE_ISLBL(t)  (0)
+#define _DE_ISLNK(t)  (0)
+
+#elif defined(__CBM__)
+
+struct dirent {
+    char                d_name[16+1];
+    unsigned int        d_off;
+    unsigned int        d_blocks;
+    unsigned char       d_type;         /* See _CBM_T_xxx defines */
+
+    /* bsd extensions */
+    unsigned char       d_namlen;
+};
+
+/* 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_HEADER)
+#define _DE_ISLNK(t)    ((t) == _CBM_T_LNK)
+
+#elif defined(__LYNX__)
+
+struct dirent {
+    unsigned char       d_blocks;
+    unsigned int        d_offset;
+    char                d_type;
+    void                *d_address;
+    unsigned int        d_size;
+};
+
+extern struct dirent FileEntry;
+#pragma zpsym ("FileEntry");
+
+#define _DE_ISREG(t)    (1)
+#define _DE_ISDIR(t)    (0)
+#define _DE_ISLBL(t)    (0)
+#define _DE_ISLNK(t)    (0)
+
+#else
 
 struct dirent {
     char d_name[1];
 };
 
-#endif  /* __APPLE2__ or __APPLE2ENH__ */
+#define _DE_ISREG(t)  (1)
+#define _DE_ISDIR(t)  (0)
+#define _DE_ISLBL(t)  (0)
+#define _DE_ISLNK(t)  (0)
+
+#endif
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -87,6 +155,10 @@ struct dirent* __fastcall__ readdir (DIR* dir);
 
 int __fastcall__ closedir (DIR* dir);
 
+long __fastcall__ telldir (DIR* dir);
+
+void __fastcall__ seekdir (DIR* dir, long offs);
+
 void __fastcall__ rewinddir (DIR* dir);