9 */ 10 11 12/* 13 * Macros to define the method of doing filename "globbing". 14 * There are three possible mechanisms: 15 * 1. GLOB_LIST 16 * This defines a function that returns a list of matching filenames. 17 * 2. GLOB_NAME 18 * This defines a function that steps thru the list of matching 19 * filenames, returning one name each time it is called. 20 * 3. GLOB_STRING 21 * This defines a function that returns the complete list of 22 * matching filenames as a single space-separated string. 23 */ 24 25#if OS2 26 27#define DECL_GLOB_LIST(list) char **list; char **pp; 28#define GLOB_LIST(filename,list) list = _fnexplode(filename) 29#define GLOB_LIST_FAILED(list) list == NULL 30#define SCAN_GLOB_LIST(list,p) pp = list; *pp != NULL; pp++ 31#define INIT_GLOB_LIST(list,p) p = *pp 32#define GLOB_LIST_DONE(list) _fnexplodefree(list) 33 34#else 35#if MSDOS_COMPILER==DJGPPC 36 37#define DECL_GLOB_LIST(list) glob_t list; int i; 38#define GLOB_LIST(filename,list) glob(filename,GLOB_NOCHECK,0,&list) 39#define GLOB_LIST_FAILED(list) 0 40#define SCAN_GLOB_LIST(list,p) i = 0; i < list.gl_pathc; i++ 41#define INIT_GLOB_LIST(list,p) p = list.gl_pathv[i] 42#define GLOB_LIST_DONE(list) globfree(&list) 43 44#else 45#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==BORLANDC 46 47#define GLOB_FIRST_NAME(filename,fndp,h) h = _dos_findfirst(filename, ~_A_VOLID, fndp) 48#define GLOB_FIRST_FAILED(handle) ((handle) != 0) 49#define GLOB_NEXT_NAME(handle,fndp) _dos_findnext(fndp) 50#define GLOB_NAME_DONE(handle) 51#define GLOB_NAME name 52#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 53 struct find_t fnd; \ 54 char drive[_MAX_DRIVE]; \ 55 char dir[_MAX_DIR]; \ 56 char fname[_MAX_FNAME]; \ 57 char ext[_MAX_EXT]; \ 58 int handle; 59#else 60#if MSDOS_COMPILER==WIN32C && defined(_MSC_VER) 61 62#define GLOB_FIRST_NAME(filename,fndp,h) h = _findfirst(filename, fndp) 63#define GLOB_FIRST_FAILED(handle) ((handle) == -1) 64#define GLOB_NEXT_NAME(handle,fndp) _findnext(handle, fndp) 65#define GLOB_NAME_DONE(handle) _findclose(handle) 66#define GLOB_NAME name 67#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 68 struct _finddata_t fnd; \ 69 char drive[_MAX_DRIVE]; \ 70 char dir[_MAX_DIR]; \ 71 char fname[_MAX_FNAME]; \ 72 char ext[_MAX_EXT]; \ 73 long handle; 74 75#else 76#if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) /* Borland C for Windows */ 77 78#define GLOB_FIRST_NAME(filename,fndp,h) h = findfirst(filename, fndp, ~FA_LABEL) 79#define GLOB_FIRST_FAILED(handle) ((handle) != 0) 80#define GLOB_NEXT_NAME(handle,fndp) findnext(fndp) 81#define GLOB_NAME_DONE(handle) 82#define GLOB_NAME ff_name 83#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 84 struct ffblk fnd; \ 85 char drive[MAXDRIVE]; \ 86 char dir[MAXDIR]; \ 87 char fname[MAXFILE]; \ 88 char ext[MAXEXT]; \ 89 int handle; 90 91#endif 92#endif 93#endif 94#endif 95#endif
| 8 */ 9 10 11/* 12 * Macros to define the method of doing filename "globbing". 13 * There are three possible mechanisms: 14 * 1. GLOB_LIST 15 * This defines a function that returns a list of matching filenames. 16 * 2. GLOB_NAME 17 * This defines a function that steps thru the list of matching 18 * filenames, returning one name each time it is called. 19 * 3. GLOB_STRING 20 * This defines a function that returns the complete list of 21 * matching filenames as a single space-separated string. 22 */ 23 24#if OS2 25 26#define DECL_GLOB_LIST(list) char **list; char **pp; 27#define GLOB_LIST(filename,list) list = _fnexplode(filename) 28#define GLOB_LIST_FAILED(list) list == NULL 29#define SCAN_GLOB_LIST(list,p) pp = list; *pp != NULL; pp++ 30#define INIT_GLOB_LIST(list,p) p = *pp 31#define GLOB_LIST_DONE(list) _fnexplodefree(list) 32 33#else 34#if MSDOS_COMPILER==DJGPPC 35 36#define DECL_GLOB_LIST(list) glob_t list; int i; 37#define GLOB_LIST(filename,list) glob(filename,GLOB_NOCHECK,0,&list) 38#define GLOB_LIST_FAILED(list) 0 39#define SCAN_GLOB_LIST(list,p) i = 0; i < list.gl_pathc; i++ 40#define INIT_GLOB_LIST(list,p) p = list.gl_pathv[i] 41#define GLOB_LIST_DONE(list) globfree(&list) 42 43#else 44#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==BORLANDC 45 46#define GLOB_FIRST_NAME(filename,fndp,h) h = _dos_findfirst(filename, ~_A_VOLID, fndp) 47#define GLOB_FIRST_FAILED(handle) ((handle) != 0) 48#define GLOB_NEXT_NAME(handle,fndp) _dos_findnext(fndp) 49#define GLOB_NAME_DONE(handle) 50#define GLOB_NAME name 51#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 52 struct find_t fnd; \ 53 char drive[_MAX_DRIVE]; \ 54 char dir[_MAX_DIR]; \ 55 char fname[_MAX_FNAME]; \ 56 char ext[_MAX_EXT]; \ 57 int handle; 58#else 59#if MSDOS_COMPILER==WIN32C && defined(_MSC_VER) 60 61#define GLOB_FIRST_NAME(filename,fndp,h) h = _findfirst(filename, fndp) 62#define GLOB_FIRST_FAILED(handle) ((handle) == -1) 63#define GLOB_NEXT_NAME(handle,fndp) _findnext(handle, fndp) 64#define GLOB_NAME_DONE(handle) _findclose(handle) 65#define GLOB_NAME name 66#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 67 struct _finddata_t fnd; \ 68 char drive[_MAX_DRIVE]; \ 69 char dir[_MAX_DIR]; \ 70 char fname[_MAX_FNAME]; \ 71 char ext[_MAX_EXT]; \ 72 long handle; 73 74#else 75#if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) /* Borland C for Windows */ 76 77#define GLOB_FIRST_NAME(filename,fndp,h) h = findfirst(filename, fndp, ~FA_LABEL) 78#define GLOB_FIRST_FAILED(handle) ((handle) != 0) 79#define GLOB_NEXT_NAME(handle,fndp) findnext(fndp) 80#define GLOB_NAME_DONE(handle) 81#define GLOB_NAME ff_name 82#define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \ 83 struct ffblk fnd; \ 84 char drive[MAXDRIVE]; \ 85 char dir[MAXDIR]; \ 86 char fname[MAXFILE]; \ 87 char ext[MAXEXT]; \ 88 int handle; 89 90#endif 91#endif 92#endif 93#endif 94#endif
|