mirror of
https://github.com/cc65/cc65.git
synced 2024-09-28 10:55:43 +00:00
Added classification macros for file types from struct dirent.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5736 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
5bc67cdaee
commit
7aefd9b4e7
@ -7,21 +7,22 @@
|
|||||||
; Define bitmapped constants for the table entries
|
; Define bitmapped constants for the table entries
|
||||||
|
|
||||||
.enum
|
.enum
|
||||||
CBM_T_DEL ; Deleted file
|
CBM_T_REG = $10 ; Bit set for regular files
|
||||||
CBM_T_SEQ ; Sequential file
|
CBM_T_SEQ = $10 ; Sequential file
|
||||||
CBM_T_PRG ; Program file
|
CBM_T_PRG = $11 ; Program file
|
||||||
CBM_T_USR ; User file
|
CBM_T_USR = $12 ; User file
|
||||||
CBM_T_REL ; Relative file
|
CBM_T_REL = $13 ; Relative file
|
||||||
CBM_T_CBM ; 1581 sub-partition
|
CBM_T_DEL = $00 ; Deleted file
|
||||||
CBM_T_DIR ; IDE64 and CMD sub-directory
|
CBM_T_CBM = $01 ; 1581 sub-partition
|
||||||
CBM_T_LNK ; IDE64 soft-link
|
CBM_T_DIR = $02 ; IDE64 and CMD sub-directory
|
||||||
CBM_T_VRP ; Vorpal fast-loadable format
|
CBM_T_LNK = $03 ; IDE64 soft-link
|
||||||
CBM_T_OTHER ; File-type not recognized
|
CBM_T_VRP = $04 ; Vorpal fast-loadable format
|
||||||
CBM_T_HEADER ; Disk header / title
|
CBM_T_OTHER = $05 ; File-type not recognized
|
||||||
|
CBM_T_HEADER = $06 ; Disk header / title
|
||||||
.endenum
|
.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.
|
; 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
|
; The calling function has to look at the following character to determine
|
||||||
; if the file type is actually CBM_T_DIR.
|
; if the file type is actually CBM_T_DIR.
|
||||||
|
111
doc/funcref.sgml
111
doc/funcref.sgml
@ -279,7 +279,11 @@ Low-level disk I/O API.
|
|||||||
|
|
||||||
<sect1><tt/dirent.h/<label id="dirent.h"><p>
|
<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="closedir" name="closedir">
|
||||||
<item><ref id="opendir" name="opendir">
|
<item><ref id="opendir" name="opendir">
|
||||||
<item><ref id="readdir" name="readdir">
|
<item><ref id="readdir" name="readdir">
|
||||||
@ -714,6 +718,105 @@ communication.
|
|||||||
|
|
||||||
<sect>Alphabetical function reference<p>
|
<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>
|
<sect1>_heapadd<label id="_heapadd"><p>
|
||||||
|
|
||||||
<quote>
|
<quote>
|
||||||
@ -1668,7 +1771,7 @@ be used in presence of a prototype.
|
|||||||
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
|
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
|
||||||
<tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
|
<tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
|
||||||
<tag/Description/The function closes the given directory descriptor. It returns
|
<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.
|
by reading the <tt/errno/ variable.
|
||||||
<tag/Limits/<itemize>
|
<tag/Limits/<itemize>
|
||||||
<item>The function is only available as fastcall function, so it may only
|
<item>The function is only available as fastcall function, so it may only
|
||||||
@ -4217,9 +4320,9 @@ had been used with an argument of 1.
|
|||||||
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
|
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
|
||||||
<tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
|
<tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
|
||||||
<tag/Description/<tt/readdir/ reads the next directory entry from the directory
|
<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
|
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/.
|
<tt/errno/.
|
||||||
<tag/Limits/<itemize>
|
<tag/Limits/<itemize>
|
||||||
<item>The function is only available as fastcall function, so it may only
|
<item>The function is only available as fastcall function, so it may only
|
||||||
|
@ -53,18 +53,20 @@
|
|||||||
|
|
||||||
/* CBM FILE TYPES. The definitions are used within standard headers, so we
|
/* CBM FILE TYPES. The definitions are used within standard headers, so we
|
||||||
* be careful with identifiers in the user name space.
|
* 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_REG 0x10U /* Bit set for regular files */
|
||||||
#define _CBM_T_SEQ 1
|
#define _CBM_T_SEQ 0x10U
|
||||||
#define _CBM_T_PRG 2
|
#define _CBM_T_PRG 0x11U
|
||||||
#define _CBM_T_USR 3
|
#define _CBM_T_USR 0x12U
|
||||||
#define _CBM_T_REL 4
|
#define _CBM_T_REL 0x13U
|
||||||
#define _CBM_T_CBM 5 /* 1581 sub-partition */
|
#define _CBM_T_DEL 0x00U
|
||||||
#define _CBM_T_DIR 6 /* IDE64 and CMD sub-directory */
|
#define _CBM_T_CBM 0x01U /* 1581 sub-partition */
|
||||||
#define _CBM_T_LNK 7 /* IDE64 soft-link */
|
#define _CBM_T_DIR 0x02U /* IDE64 and CMD sub-directory */
|
||||||
#define _CBM_T_VRP 8 /* Vorpal fast-loadable format */
|
#define _CBM_T_LNK 0x03U /* IDE64 soft-link */
|
||||||
#define _CBM_T_OTHER 9 /* File-type not recognized */
|
#define _CBM_T_VRP 0x04U /* Vorpal fast-loadable format */
|
||||||
#define _CBM_T_HEADER 10 /* Disk header / title */
|
#define _CBM_T_OTHER 0x05U /* File-type not recognized */
|
||||||
|
#define _CBM_T_HEADER 0x06U /* Disk header / title */
|
||||||
|
|
||||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||||
/* Allow for names without leading underscores */
|
/* Allow for names without leading underscores */
|
||||||
|
@ -85,12 +85,20 @@ struct dirent {
|
|||||||
char d_name[16+1];
|
char d_name[16+1];
|
||||||
unsigned int d_off;
|
unsigned int d_off;
|
||||||
unsigned int d_blocks;
|
unsigned int d_blocks;
|
||||||
unsigned char d_type; /* See CBM_T_xxx defines in cbm.h */
|
unsigned char d_type; /* See _CBM_T_xxx defines */
|
||||||
|
|
||||||
/* bsd extensions */
|
/* bsd extensions */
|
||||||
unsigned char d_namlen;
|
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_HDR)
|
||||||
|
#define _DE_ISLNK(t) ((t) == _CBM_T_LNK)
|
||||||
|
|
||||||
#elif defined(__LYNX__)
|
#elif defined(__LYNX__)
|
||||||
|
|
||||||
struct dirent {
|
struct dirent {
|
||||||
|
Loading…
Reference in New Issue
Block a user