; Define bitmapped constants for the table entries
.enum
- CBM_T_DEL ; Deleted file
- CBM_T_SEQ ; Sequential file
- CBM_T_PRG ; Program file
- CBM_T_USR ; User file
- CBM_T_REL ; Relative file
- CBM_T_CBM ; 1581 sub-partition
- CBM_T_DIR ; IDE64 and CMD sub-directory
- CBM_T_LNK ; IDE64 soft-link
- CBM_T_VRP ; Vorpal fast-loadable format
- CBM_T_OTHER ; File-type not recognized
- CBM_T_HEADER ; Disk header / title
+ CBM_T_REG = $10 ; Bit set for regular files
+ CBM_T_SEQ = $10 ; Sequential file
+ CBM_T_PRG = $11 ; Program file
+ CBM_T_USR = $12 ; User file
+ CBM_T_REL = $13 ; Relative file
+ CBM_T_DEL = $00 ; Deleted file
+ CBM_T_CBM = $01 ; 1581 sub-partition
+ CBM_T_DIR = $02 ; IDE64 and CMD sub-directory
+ CBM_T_LNK = $03 ; IDE64 soft-link
+ CBM_T_VRP = $04 ; Vorpal fast-loadable format
+ CBM_T_OTHER = $05 ; File-type not recognized
+ CBM_T_HEADER = $06 ; Disk header / title
.endenum
-; The following function maps the start character for a file type to
+; The following function maps the start character for a file type to
; one of the file types above. Note: 'd' will always mapped to CBM_T_DEL.
; The calling function has to look at the following character to determine
; if the file type is actually CBM_T_DIR.
<sect1><tt/dirent.h/<label id="dirent.h"><p>
-<itemize>
+<itemize>
+<item><ref id="_DE_ISDIR" name="_DE_ISDIR">
+<item><ref id="_DE_ISLBL" name="_DE_ISLBL">
+<item><ref id="_DE_ISLNK" name="_DE_ISLNK">
+<item><ref id="_DE_ISREG" name="_DE_ISREG">
<item><ref id="closedir" name="closedir">
<item><ref id="opendir" name="opendir">
<item><ref id="readdir" name="readdir">
<sect>Alphabetical function reference<p>
+<sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determine if a directory entry specifies a directory.
+<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
+<tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
+<tag/Description/The function is called with the type of a directory entry
+taken from a <tt/struct dirent/ and returns true if the entry designates
+a directory.
+<tag/Limits/
+<itemize>
+<item>The function is actually a macro.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="_DE_ISLBL" name="_DE_ISLBL">,
+<ref id="_DE_ISLNK" name="_DE_ISLNK">,
+<ref id="_DE_ISREG" name="_DE_ISREG">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determine if a directory entry specifies a disk label.
+<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
+<tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
+<tag/Description/The function is called with the type of a directory entry
+taken from a <tt/struct dirent/ and returns true if the entry designates
+a disk label.
+<tag/Limits/
+<itemize>
+<item>The function is actually a macro.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="_DE_ISDIR" name="_DE_ISDIR">,
+<ref id="_DE_ISLNK" name="_DE_ISLNK">,
+<ref id="_DE_ISREG" name="_DE_ISREG">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determine if a directory entry specifies a link.
+<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
+<tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
+<tag/Description/The function is called with the type of a directory entry
+taken from a <tt/struct dirent/ and returns true if the entry designates
+a link.
+<tag/Limits/
+<itemize>
+<item>The function is actually a macro.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="_DE_ISDIR" name="_DE_ISDIR">,
+<ref id="_DE_ISLBL" name="_DE_ISLBL">,
+<ref id="_DE_ISREG" name="_DE_ISREG">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>_DE_ISREG<label id="_DE_ISREG"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determine if a directory entry specifies a regular file.
+<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
+<tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
+<tag/Description/The function is called with the type of a directory entry
+taken from a <tt/struct dirent/ and returns true if the entry designates
+a regular file.
+<tag/Limits/
+<itemize>
+<item>The function is actually a macro.
+<item>A "regular file" means anything with data in it. This might still mean
+that special processing is needed, when accessing the file. Relative files of
+the CBM systems are classified as being "regular" files, for example.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="_DE_ISDIR" name="_DE_ISDIR">,
+<ref id="_DE_ISLBL" name="_DE_ISLBL">,
+<ref id="_DE_ISLNK" name="_DE_ISLNK">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>_heapadd<label id="_heapadd"><p>
<quote>
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
<tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
<tag/Description/The function closes the given directory descriptor. It returns
-zero on success and -1 on error. If an error occurs, the cause can be determined
+zero on success and -1 on error. If an error occurs, the cause can be determined
by reading the <tt/errno/ variable.
<tag/Limits/<itemize>
<item>The function is only available as fastcall function, so it may only
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
<tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
<tag/Description/<tt/readdir/ reads the next directory entry from the directory
-stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
+stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
and returns a pointer to it. If the end of directory is reached, or an error
-occurs, NULL is returned. In case of errors, an error code is stored into
+occurs, NULL is returned. In case of errors, an error code is stored into
<tt/errno/.
<tag/Limits/<itemize>
<item>The function is only available as fastcall function, so it may only
/* CBM FILE TYPES. The definitions are used within standard headers, so we
* be careful with identifiers in the user name space.
+ * "Regular" files have a special bit set so it's easier to pick them out.
*/
-#define _CBM_T_DEL 0
-#define _CBM_T_SEQ 1
-#define _CBM_T_PRG 2
-#define _CBM_T_USR 3
-#define _CBM_T_REL 4
-#define _CBM_T_CBM 5 /* 1581 sub-partition */
-#define _CBM_T_DIR 6 /* IDE64 and CMD sub-directory */
-#define _CBM_T_LNK 7 /* IDE64 soft-link */
-#define _CBM_T_VRP 8 /* Vorpal fast-loadable format */
-#define _CBM_T_OTHER 9 /* File-type not recognized */
-#define _CBM_T_HEADER 10 /* Disk header / title */
+#define _CBM_T_REG 0x10U /* Bit set for regular files */
+#define _CBM_T_SEQ 0x10U
+#define _CBM_T_PRG 0x11U
+#define _CBM_T_USR 0x12U
+#define _CBM_T_REL 0x13U
+#define _CBM_T_DEL 0x00U
+#define _CBM_T_CBM 0x01U /* 1581 sub-partition */
+#define _CBM_T_DIR 0x02U /* IDE64 and CMD sub-directory */
+#define _CBM_T_LNK 0x03U /* IDE64 soft-link */
+#define _CBM_T_VRP 0x04U /* Vorpal fast-loadable format */
+#define _CBM_T_OTHER 0x05U /* File-type not recognized */
+#define _CBM_T_HEADER 0x06U /* Disk header / title */
#if __CC65_STD__ == __CC65_STD_CC65__
/* Allow for names without leading underscores */