[project @ 2001-08-17 12:50:34 by simonmar]
[haskell-directory.git] / include / HsCore.h
1 /* -----------------------------------------------------------------------------
2  * $Id: HsCore.h,v 1.2 2001/08/17 12:50:34 simonmar Exp $
3  *
4  * Definitions for package `core' which are visible in Haskell land.
5  *
6  * ---------------------------------------------------------------------------*/
7
8 #ifndef HSCORE_H
9 #define HSCORE_H
10
11 #include "config.h"
12
13 #ifdef HAVE_SYS_TYPES_H
14 #include <sys/types.h>
15 #endif
16 #ifdef HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
19 #ifdef HAVE_SYS_STAT_H
20 #include <sys/stat.h>
21 #endif
22 #ifdef HAVE_FCNTL_H
23 # include <fcntl.h>
24 #endif
25 #ifdef HAVE_TERMIOS_H
26 #include <termios.h>
27 #endif
28 #ifdef HAVE_SIGNAL_H
29 #include <signal.h>
30 #endif
31 #ifdef HAVE_ERRNO_H
32 #include <errno.h>
33 #endif
34 #ifdef HAVE_STRING_H
35 #include <string.h>
36 #endif
37 #ifdef HAVE_DIRENT_H
38 #include <dirent.h>
39 #endif
40 #ifdef HAVE_UTIME_H
41 #include <utime.h>
42 #endif
43 #if defined(HAVE_GETTIMEOFDAY)
44 #  ifdef HAVE_SYS_TIME_H
45 #   include <sys/time.h>
46 #  endif
47 #elif defined(HAVE_GETCLOCK)
48 # ifdef HAVE_SYS_TIMERS_H
49 #  define POSIX_4D9 1
50 #  include <sys/timers.h>
51 # endif
52 #endif
53 #if defined(HAVE_TIME_H)
54 # include <time.h>
55 #endif
56 #ifdef HAVE_SYS_TIMEB_H
57 #include <sys/timeb.h>
58 #endif
59 #ifdef HAVE_WINDOWS_H
60 #include <windows.h>
61 #endif
62 #ifdef HAVE_SYS_TIMES_H
63 #include <sys/times.h>
64 #endif
65
66 #if !defined(mingw32_TARGET_OS) && !defined(irix_TARGET_OS)
67 # if defined(HAVE_SYS_RESOURCE_H)
68 #  include <sys/resource.h>
69 # endif
70 #endif
71
72 #ifdef hpux_TARGET_OS
73 #include <sys/syscall.h>
74 #define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
75 #define HAVE_GETRUSAGE
76 #endif
77
78 /* For System */
79 #ifdef HAVE_SYS_WAIT_H
80 #include <sys/wait.h>
81 #endif
82 #ifdef HAVE_VFORK_H
83 #include <vfork.h>
84 #endif
85
86 extern inline int s_isreg_wrap(m)  { return S_ISREG(m);  }
87 extern inline int s_isdir_wrap(m)  { return S_ISDIR(m);  }
88 extern inline int s_isfifo_wrap(m) { return S_ISFIFO(m); }
89 extern inline int s_isblk_wrap(m)  { return S_ISBLK(m);  }
90 extern inline int s_ischr_wrap(m)  { return S_ISCHR(m);  }
91 #ifdef S_ISSOCK
92 extern inline int s_issock_wrap(m) { return S_ISSOCK(m); }
93 #endif
94
95 #include "lockFile.h"
96
97 #include "HsFFI.h"
98
99 /* in ghc_errno.c */
100 int *ghcErrno(void);
101
102 /* in system.c */
103 HsInt systemCmd(HsAddr cmd);
104
105 /* in inputReady.c */
106 int inputReady(int fd, int msecs);
107
108 /* in progargs.c */
109 HsAddr get_prog_argv(void);
110 HsInt  get_prog_argc();
111
112 #endif