Diff for /parser3/src/include/pa_dir.h between versions 1.3 and 1.27

version 1.3, 2001/04/26 14:55:25 version 1.27, 2015/10/26 01:21:55
Line 1 Line 1
 /** @file  /** @file
         Parser: directory scanning for different OS-es decls.          Parser: directory scanning for different OS-es decls.
   
         Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2000-2015 Art. Lebedev Studio (http://www.artlebedev.com)
           Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
         Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)  
   
         $Id$  
 */  */
   
 #ifndef PA_DIR_H  #ifndef PA_DIR_H
 #define PA_DIR_H  #define PA_DIR_H
   
   #define IDENT_PA_DIR_H "$Id$"
   
   #include "pa_config_includes.h"
   
 /** @struct ffblk   /** @struct ffblk 
         win32/unix unified directory entry structure name          win32/unix unified directory entry structure name
         for findfirst/next/close interface          for findfirst/next/close interface
 */  */
   
 #ifdef WIN32  #ifdef _MSC_VER
   
 #include <windows.h>  #include <windows.h>
   
 #define MAXPATH MAX_PATH  #define MAXPATH MAX_PATH
 #define FA_DIREC FILE_ATTRIBUTE_DIRECTORY  
   
 struct ffblk {  struct ffblk {
     DWORD ff_attrib;/*dwFileAttributes;*/          DWORD ff_attrib;/*dwFileAttributes;*/
     FILETIME ftCreationTime;          FILETIME ftCreationTime;
     FILETIME ftLastAccessTime;          FILETIME ftLastAccessTime;
     FILETIME ftLastWriteTime;          FILETIME ftLastWriteTime;
     DWORD nFileSizeHigh;          DWORD nFileSizeHigh;
     DWORD nFileSizeLow;          DWORD nFileSizeLow;
     DWORD dwReserved0;          DWORD dwReserved0;
     DWORD dwReserved1;          DWORD dwReserved1;
     CHAR   ff_name[ MAX_PATH ];/*cFileName[ MAX_PATH ];*/          CHAR   ff_name[ MAX_PATH ];/*cFileName[ MAX_PATH ];*/
     CHAR   cAlternateFileName[ 14 ];          CHAR   cAlternateFileName[ 14 ];
         /*helper*/          /*helper*/
         HANDLE handle;          HANDLE handle;
   
 /*                bool is_dir(bool);
                   double size();
         unsigned char  ff_attrib __attribute__((packed));          time_t c_timestamp();
   unsigned short ff_ftime __attribute__((packed));          time_t m_timestamp();
   unsigned short ff_fdate __attribute__((packed));          time_t a_timestamp();
   unsigned long  ff_fsize __attribute__((packed));  
   char ff_name[260] __attribute__((packed));  
  */  
 };  };
   
 #else  #else
   
 #include <strings.h>      
 #include <sys/types.h>  
 #include <dirent.h>  
 #include <sys/stat.h>  
   
 #define MAXPATH 1000 /*NAME_MAX*/  #define MAXPATH 1000 /*NAME_MAX*/
 #define FA_DIREC S_IFDIR  
   
 struct ffblk {  struct ffblk {
         /*as if in windows :)*/          /*as if in windows :)*/
     unsigned char ff_attrib;  
     char ff_name[ MAXPATH ];      char ff_name[ MAXPATH ];
         /*helpers*/          /*helpers*/
         DIR *dir;          DIR *dir;
         char filePath[MAXPATH];          const char *filePath;
           struct stat _st;
   
   #ifdef HAVE_STRUCT_DIRENT_D_TYPE
           unsigned char _d_type;
   #endif
           bool is_dir(bool);
           void stat_file();
           double size();
           time_t c_timestamp();
           time_t m_timestamp();
           time_t a_timestamp();
 };  };
   
 #endif  #endif
   
 bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib);  bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib);
 bool findnext(struct ffblk *_ffblk);  bool findnext(struct ffblk *_ffblk);
 void findclose(struct ffblk *_ffblk);  void findclose(struct ffblk *_ffblk);
   
 /// main dir workhorse: calles win32/unix unified functions findfirst/next/close  /// main dir workhorse: calles win32/unix unified functions findfirst/next/close [skip . and ..]
 #define LOAD_DIR(dir,action) {\  #define LOAD_DIR(dir,action) {\
     ffblk ffblk; \      ffblk ffblk; \
     bool done=findfirst(dir, &ffblk, 0); \      if(!findfirst(dir, &ffblk, 0)) { \
         while(!done) { \                  do \
                 if(*ffblk.ff_name && ffblk.ff_name[0]!='.') {\                          if(*ffblk.ff_name && !(ffblk.ff_name[0]=='.' && (ffblk.ff_name[1]==0 || ffblk.ff_name[1]=='.' && ffblk.ff_name[2]==0)  )) {\
                         action; \                                  action; \
                 } \                          } \
                 done=findnext(&ffblk); \                  while(!findnext(&ffblk)); \
     } \                  findclose(&ffblk); \
         findclose(&ffblk); \          } \
 }   } 
   
 #endif  #endif

Removed from v.1.3  
changed lines
  Added in v.1.27


E-mail: