Annotation of parser3/src/include/pa_dir.h, revision 1.1

1.1     ! paf         1: /** @file
        !             2:        Parser: directory scanning for different OS-es decls.
        !             3: 
        !             4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             5: 
        !             6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
        !             7: 
        !             8:        $Id: pa_common.h,v 1.32 2001/04/03 07:24:44 paf Exp $
        !             9: */
        !            10: 
        !            11: #ifndef PA_DIR_H
        !            12: #define PA_DIR_H
        !            13: 
        !            14: #ifdef WIN32
        !            15: 
        !            16: #include <windows.h>
        !            17: 
        !            18: #define MAXPATH MAX_PATH
        !            19: #define FA_DIREC FILE_ATTRIBUTE_DIRECTORY
        !            20: 
        !            21: 
        !            22: struct ffblk {
        !            23:     DWORD ff_attrib;/*dwFileAttributes;*/
        !            24:     FILETIME ftCreationTime;
        !            25:     FILETIME ftLastAccessTime;
        !            26:     FILETIME ftLastWriteTime;
        !            27:     DWORD nFileSizeHigh;
        !            28:     DWORD nFileSizeLow;
        !            29:     DWORD dwReserved0;
        !            30:     DWORD dwReserved1;
        !            31:     CHAR   ff_name[ MAX_PATH ];/*cFileName[ MAX_PATH ];*/
        !            32:     CHAR   cAlternateFileName[ 14 ];
        !            33:        /*helper*/
        !            34:        HANDLE handle;
        !            35: 
        !            36: /*     
        !            37:        
        !            38:        unsigned char  ff_attrib __attribute__((packed));
        !            39:   unsigned short ff_ftime __attribute__((packed));
        !            40:   unsigned short ff_fdate __attribute__((packed));
        !            41:   unsigned long  ff_fsize __attribute__((packed));
        !            42:   char ff_name[260] __attribute__((packed));
        !            43:  */
        !            44: };
        !            45: 
        !            46: #else
        !            47: 
        !            48: #include <strings.h>   
        !            49: #include <sys/types.h>
        !            50: #include <dirent.h>
        !            51: #include <sys/stat.h>
        !            52: 
        !            53: #define MAXPATH 1000 /*NAME_MAX*/
        !            54: #define FA_DIREC S_IFDIR
        !            55: 
        !            56: struct ffblk {
        !            57:        /*as if in windows :)*/
        !            58:     unsigned char ff_attrib;
        !            59:     char ff_name[ MAXPATH ];
        !            60:        /*helpers*/
        !            61:        DIR *dir;
        !            62:        char filePath[MAXPATH];
        !            63: };
        !            64: 
        !            65: #endif
        !            66: 
        !            67: bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib);
        !            68: bool findnext(struct ffblk *_ffblk);
        !            69: void findclose(struct ffblk *_ffblk);
        !            70: 
        !            71: #define LOAD_DIR(dir,action) {\
        !            72:     ffblk ffblk; \
        !            73:     bool done=findfirst(dir, &ffblk, 0); \
        !            74:        while(!done) { \
        !            75:                if(*ffblk.ff_name && ffblk.ff_name[0]!='.') {\
        !            76:                        action; \
        !            77:                } \
        !            78:                done=findnext(&ffblk); \
        !            79:     } \
        !            80:        findclose(&ffblk); \
        !            81: } 
        !            82: 
        !            83: #endif

E-mail: