2 % (c) The AQUA Project, Glasgow University, 1994-1996
5 \section[Error]{Module @Error@}
8 {-# OPTIONS -fno-implicit-prelude #-}
10 module Error (errorIO, error) where
18 %*********************************************************
20 \subsection{Error-ish functions}
22 %*********************************************************
28 = case (errorIO# io) of
31 bottom = bottom -- Never evaluated
33 --errorIO x = (waitRead#, errorIO#, makeForeignObj#, waitWrite#, (+#))
35 -- error stops execution and displays an error message
37 error s = error__ ( \ x -> _ccall_ ErrorHdrHook x ) s
39 error__ :: (Addr{-FILE *-} -> IO ()) -> String -> a
42 #ifdef __PARALLEL_HASKELL__
43 = errorIO (msg_hdr sTDERR{-msg hdr-} >>
44 _ccall_ fflush sTDERR >>
46 _ccall_ fflush sTDERR >>
47 _ccall_ stg_exit (1::Int)
50 = errorIO (msg_hdr sTDERR{-msg hdr-} >>
51 _ccall_ fflush sTDERR >>
53 _ccall_ fflush sTDERR >>
54 _ccall_ getErrorHandler >>= \ errorHandler ->
55 if errorHandler == (-1::Int) then
56 _ccall_ stg_exit (1::Int)
58 _casm_ ``%r = (StgStablePtr)(%0);'' errorHandler
60 _ccall_ decrementErrorCount >>= \ () ->
61 deRefStablePtr osptr >>= \ oact ->
64 #endif {- !parallel -}
66 sTDERR = (``stderr'' :: Addr)