move Win32 SearchPath and SHGetFolderPath into the Win32 package
[haskell-directory.git] / include / HsDirectory.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow 2001-2004
4  *
5  * Definitions for package `directory' which are visible in Haskell land.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef __HSDIRECTORY_H__
10 #define __HSDIRECTORY_H__
11
12 #ifdef __NHC__
13 #include "Nhc98BaseConfig.h"
14 #else
15 #include "HsDirectoryConfig.h"
16 #endif
17 // Otherwise these clash with similar definitions from other packages:
18 #undef PACKAGE_BUGREPORT
19 #undef PACKAGE_NAME
20 #undef PACKAGE_STRING
21 #undef PACKAGE_TARNAME
22 #undef PACKAGE_VERSION
23
24 #if HAVE_SYS_STAT_H
25 #include <sys/stat.h>
26 #endif
27
28 #include "HsFFI.h"
29
30 /* -----------------------------------------------------------------------------
31    INLINE functions.
32
33    These functions are given as inlines here for when compiling via C,
34    but we also generate static versions into the cbits library for
35    when compiling to native code.
36    -------------------------------------------------------------------------- */
37
38 #ifndef INLINE
39 # if defined(_MSC_VER)
40 #  define INLINE extern __inline
41 # else
42 #  define INLINE static inline
43 # endif
44 #endif
45
46 /* A size that will contain many path names, but not necessarily all
47  * (PATH_MAX is not defined on systems with unlimited path length,
48  * e.g. the Hurd).
49  */
50 INLINE HsInt __hscore_long_path_size() {
51 #ifdef PATH_MAX
52     return PATH_MAX;
53 #else
54     return 4096;
55 #endif
56 }
57
58 INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }
59 INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }
60 INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }
61 INLINE mode_t __hscore_S_IFDIR() { return S_IFDIR; }
62
63 #endif /* __HSDIRECTORY_H__ */
64