SST  10.0.0
StructuralSimulationToolkit
lt__dirent.h
1 /* lt__dirent.h -- internal directory entry scanning interface
2 
3  Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
4  Written by Bob Friesenhahn, 2001
5 
6  NOTE: The canonical source of this file is maintained with the
7  GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 
9 GNU Libltdl is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13 
14 As a special exception to the GNU Lesser General Public License,
15 if you distribute this file as part of a program or library that
16 is built using GNU Libtool, you may include this file under the
17 same distribution terms that you use for the rest of that program.
18 
19 GNU Libltdl is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License for more details.
23 
24 You should have received a copy of the GNU Lesser General Public
25 License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 or obtained by writing to the Free Software Foundation, Inc.,
28 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30 
31 #if !defined(LT__DIRENT_H)
32 #define LT__DIRENT_H 1
33 
34 #if defined(LT_CONFIG_H)
35 # include LT_CONFIG_H
36 #else
37 # include <config.h>
38 #endif
39 
40 #include "lt_system.h"
41 
42 #ifdef HAVE_DIRENT_H
43 /* We have a fully operational dirent subsystem. */
44 # include <dirent.h>
45 # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
46 
47 #elif defined __WINDOWS__
48 /* Use some wrapper code to emulate dirent on windows.. */
49 # define WINDOWS_DIRENT_EMULATION 1
50 
51 # include <windows.h>
52 
53 # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
54 # define dirent lt__dirent
55 # define DIR lt__DIR
56 # define opendir lt__opendir
57 # define readdir lt__readdir
58 # define closedir lt__closedir
59 
60 LT_BEGIN_C_DECLS
61 
62 struct dirent
63 {
64  char d_name[LT_FILENAME_MAX];
65  int d_namlen;
66 };
67 
68 typedef struct
69 {
70  HANDLE hSearch;
71  WIN32_FIND_DATA Win32FindData;
72  BOOL firsttime;
73  struct dirent file_info;
74 } DIR;
75 
76 
77 LT_SCOPE DIR * opendir (const char *path);
78 LT_SCOPE struct dirent *readdir (DIR *entry);
79 LT_SCOPE void closedir (DIR *entry);
80 
81 LT_END_C_DECLS
82 
83 #else /* !defined(__WINDOWS__)*/
84 ERROR - cannot find dirent
85 #endif /*!defined(__WINDOWS__)*/
86 
87 #endif /*!defined(LT__DIRENT_H)*/