import Hugs.Prelude(Ratio(..), (%), numerator, denominator)
#endif
+#ifdef __NHC__
+import Ratio (Ratio(..), (%), numerator, denominator, approxRational)
+#else
+
-- -----------------------------------------------------------------------------
-- approxRational
nd'' = simplest' d' r' d r
n'' = numerator nd''
d'' = denominator nd''
+#endif
-- this is were we get the CCONST_XXX definitions from that configure
-- calculated for us
--
+#ifndef __NHC__
#include "config.h"
+#endif
-- system dependent imports
-- ------------------------
-- This function exists because errno is a variable on some systems, but on
-- Windows it is a macro for a function...
-- [yes, global variables and thread safety don't really go hand-in-hand. -- sof]
+#ifdef __NHC__
+foreign import ccall unsafe "errno.h &errno" _errno :: Ptr CInt
+#else
foreign import ccall unsafe "HsBase.h ghcErrno" _errno :: Ptr CInt
+#endif
-- Haskell representation for "errno" values
--
-- configure
--
eOK = Errno 0
+#ifdef __NHC__
+#include "Errno.hs"
+#else
e2BIG = Errno (CCONST_E2BIG)
eACCES = Errno (CCONST_EACCES)
eADDRINUSE = Errno (CCONST_EADDRINUSE)
eUSERS = Errno (CCONST_EUSERS)
eWOULDBLOCK = Errno (CCONST_EWOULDBLOCK)
eXDEV = Errno (CCONST_EXDEV)
+#endif
-- checks whether the given errno value is supported on the current
-- architecture
, getModificationTime -- :: FilePath -> IO ClockTime
) where
+#ifdef __NHC__
+import Directory
+#else
+
import Prelude
import Control.Exception ( bracket )
foreign import ccall unsafe "__hscore_S_IRUSR" s_IRUSR :: CMode
foreign import ccall unsafe "__hscore_S_IWUSR" s_IWUSR :: CMode
foreign import ccall unsafe "__hscore_S_IXUSR" s_IXUSR :: CMode
+
+#endif