Text/ParserCombinators/ReadP.hs Data/Version.hs \
Unsafe/Coerce.hs \
WCsubst.c \
- System/Posix/Types.hs \
+ System/Posix/Types.hs System/Posix/Internals.hs \
# Data/String.hs
# Text/ParserCombinators/ReadPrec.hs
-- #hide
module System.Posix.Internals where
-#include "HsBaseConfig.h"
+#ifndef __NHC__
+# include "HsBaseConfig.h"
+#endif
#if ! (defined(mingw32_HOST_OS) || defined(__MINGW32__))
import Control.Monad
#elif __HUGS__
import Hugs.Prelude (IOException(..), IOErrorType(..))
import Hugs.IO (IOMode(..))
-#else
+#elif __NHC__
import System.IO
+import Control.Exception
+import DIOError
#endif
#ifdef __HUGS__
if not (s_isreg c_mode)
then return (-1)
else do
- c_size <- st_size p_stat
- return (fromIntegral c_size)
+ c_size <- st_size p_stat
+ return (fromIntegral c_size)
data FDType = Directory | Stream | RegularFile | RawDevice
deriving (Eq)
| otherwise -> ioError ioe_unknownfiletype
ioe_unknownfiletype :: IOException
+#ifndef __NHC__
ioe_unknownfiletype = IOError Nothing UnsupportedOperation "fdType"
"unknown file type"
-#if __GLASGOW_HASKELL__
+# if __GLASGOW_HASKELL__
Nothing
-#endif
+# endif
Nothing
+#else
+ioe_unknownfiletype = UserError "fdType" "unknown file type"
+#endif
#if __GLASGOW_HASKELL__ && (defined(mingw32_HOST_OS) || defined(__MINGW32__))
closeFd :: Bool -> CInt -> IO CInt
ioe_unk_error :: String -> String -> IOException
ioe_unk_error loc msg
+#ifndef __NHC__
= ioeSetErrorString (mkIOError OtherError loc Nothing Nothing) msg
+#else
+ = UserError loc msg
+#endif
-- Note: echoing goes hand in hand with enabling 'line input' / raw-ness
-- for Win32 consoles, hence setEcho ends up being the inverse of setCooked.
#ifndef __HSBASE_H__
#define __HSBASE_H__
+#ifdef __NHC__
+# include "Nhc98BaseConfig.h"
+#else
#include "HsBaseConfig.h"
+#endif
/* ultra-evil... */
#undef PACKAGE_BUGREPORT
--- /dev/null
+/* -----------------------------------------------------------------------------
+ * (c) Malcolm Wallace 2009
+ * ---------------------------------------------------------------------------*/
+
+/* Until we work out how to use a configure script to determine the available
+ system headers (without going down the horrid autoconf route), let's just
+ take a reasonable hard-coded guess for now. Feel free to change these
+ for your platform.
+ */
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_TERMIOS_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_ERRNO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_UTIME_H 1
+#define HAVE_SYS_UTSNAME_H 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_GETCLOCK 0
+#define HAVE_SYS_TIMERS_H 0
+#define HAVE_TIME_H 1
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_WINDOWS_H 0
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_WINSOCK_H 0
+#define HAVE_LIMITS_H 1
+#define HAVE_WCTYPE_H 1
+#define HAVE_INTTYPES_H 1
+// #define HAVE_STDINT_H 1
+#define HAVE_SYS_RESOURCE_H 1
+#define HAVE_GETRUSAGE 1
+#define HAVE_SYS_SYSCALL_H 1
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_VFORK_H 0
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_FTRUNCATE 1
+
+#undef SUPPORT_LONG_LONGS
+#define CONST_O_BINARY 0
+#define READDIR_ERRNO_EOF 0
+
*/
#ifndef __DIRUTILS_H__
#define __DIRUTILS_H__
+#include <sys/types.h>
+#include <dirent.h>
extern int __hscore_readdir(DIR *dirPtr, struct dirent **pDirEnt);