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