fromInt (unsafePerformIO clockTicks))
foreign import "libHS_cbits" "getCPUTime" unsafe primGetCPUTime :: ByteArray Int -> IO Int
-foreign import "libHS_cbits" "clockTicks" clockTicks :: IO Int
+foreign import "libHS_cbits" "clockTicks" unsafe clockTicks :: IO Int
\end{code}
else
return ()
-foreign label "ErrorHdrHook"
+foreign import ccall "addrOf_ErrorHdrHook" unsafe
addrOf_ErrorHdrHook :: Addr
foreign import ccall "writeErrString__" unsafe
writeErrString :: Addr -> ByteArray Int -> Int -> IO ()
-foreign import ccall "stackOverflow"
+-- SUP: Are the hooks allowed to re-enter Haskell land? If yes, remove the unsafe below.
+foreign import ccall "stackOverflow" unsafe
callStackOverflowHook :: IO ()
-foreign import ccall "stg_exit"
+foreign import ccall "stg_exit" unsafe
stg_exit :: Int -> IO ()
\end{code}
foreign import "libHS_cbits" "const_BUFSIZ" unsafe
const_BUFSIZ :: Int
-foreign import "libHS_cbits" "setBinaryMode__"
+foreign import "libHS_cbits" "setBinaryMode__" unsafe
setBinaryMode :: FILE_OBJECT -> Int -> IO Int
\end{code}
-- StgAddr typestr,
-- StgChar callconv )
-foreign import "createAdjThunk" hugsCreateAdjThunk
+foreign import "createAdjThunk" unsafe hugsCreateAdjThunk
:: StablePtr (a -> b) -> Addr{-mallocville String-} -> Char -> IO Addr
-foreign import "malloc" malloc
+foreign import "malloc" unsafe malloc
:: Int -> IO Addr
hugsprimCreateAdjThunk :: (a -> b) -> String -> Char -> IO Addr
hugsprimCreateAdjThunk fun typestr callconv
% -----------------------------------------------------------------------------
-% $Id: PrelStable.lhs,v 1.5 2000/04/14 15:28:24 rrt Exp $
+% $Id: PrelStable.lhs,v 1.6 2000/05/01 14:53:47 panne Exp $
%
% (c) The GHC Team, 1992-1999
%
makeStablePtr :: a -> IO (StablePtr a)
deRefStablePtr :: StablePtr a -> IO a
-foreign import "freeStablePtr" freeStablePtr :: StablePtr a -> IO ()
+foreign import "freeStablePtr" unsafe freeStablePtr :: StablePtr a -> IO ()
makeStablePtr a = IO $ \ s ->
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
primExit n
ioError (IOError Nothing OtherError "exitWith" "exit should not return")
-foreign import ccall "shutdownHaskellAndExit" primExit :: Int -> IO ()
+-- SUP: Although shutdownHaskellAndExit is declared "unsafe" below, it *can*
+-- re-enter Haskell land through finalizers. But this is probably not a problem,
+-- because it never returns.
+foreign import ccall "shutdownHaskellAndExit" unsafe primExit :: Int -> IO ()
exitFailure :: IO a
exitFailure = exitWith (ExitFailure 1)
foreign import "libHS_cbits" "get_tm_yday" unsafe get_tm_yday :: MBytes -> IO Int
foreign import "libHS_cbits" "get_tm_isdst" unsafe get_tm_isdst :: MBytes -> IO Int
-foreign import "libHS_cbits" "prim_ZONE" prim_ZONE :: Bytes -> IO Addr
-foreign import "libHS_cbits" "prim_GMTOFF" prim_GMTOFF :: Bytes -> IO Int
+foreign import "libHS_cbits" "prim_ZONE" unsafe prim_ZONE :: Bytes -> IO Addr
+foreign import "libHS_cbits" "prim_GMTOFF" unsafe prim_GMTOFF :: Bytes -> IO Int
-foreign import "libHS_cbits" "sizeof_struct_tm" sizeof_struct_tm :: Int
+foreign import "libHS_cbits" "sizeof_struct_tm" unsafe sizeof_struct_tm :: Int
#ifdef __HUGS__
-- believed to be at least 1 bit (the sign bit!) bigger than sizeof_time_t
type MBytes = MutableByteArray RealWorld Int
-foreign import "libHS_cbits" "sizeof_time_t" sizeof_time_t :: Int
+foreign import "libHS_cbits" "sizeof_time_t" unsafe sizeof_time_t :: Int
foreign import "libHS_cbits" "prim_SETZONE" unsafe prim_SETZONE :: MBytes -> MBytes -> IO ()
#ifdef __HUGS__