CExportSpec(..),
CCallSpec(..),
- CCallTarget(..), isDynamicTarget, isCasmTarget,
+ CCallTarget(..), isDynamicTarget,
CCallConv(..), defaultCCallConv, ccallConvToInt, ccallConvAttribute,
DNCallSpec(..), DNKind(..), DNType(..),
- withDNTypes,
-
- okToExposeFCall
+ withDNTypes
) where
#include "HsVersions.h"
data CCallTarget
= StaticTarget CLabelString -- An "unboxed" ccall# to `fn'.
| DynamicTarget -- First argument (an Addr#) is the function pointer
- | CasmTarget CLabelString -- Inline C code (now seriously deprecated)
deriving( Eq )
{-! derive: Binary !-}
-isDynamicTarget, isCasmTarget :: CCallTarget -> Bool
+isDynamicTarget :: CCallTarget -> Bool
isDynamicTarget DynamicTarget = True
isDynamicTarget other = False
-
-isCasmTarget (CasmTarget _) = True
-isCasmTarget other = False
\end{code}
ppr_fun DynamicTarget = text "__dyn_ccall" <> gc_suf <+> text "\"\""
ppr_fun (StaticTarget fn) = text "__ccall" <> gc_suf <+> pprCLabelString fn
- ppr_fun (CasmTarget fn) = text "__casm" <> gc_suf <+> text "``" <> pprCLabelString fn <> text "''"
\end{code}
%************************************************************************
\begin{code}
-okToExposeFCall :: ForeignCall -> Bool
--- OK to unfold a Foreign Call in an interface file
--- Yes, unless it's a _casm_
-okToExposeFCall (CCall (CCallSpec target _ _)) = not (isCasmTarget target)
-okToExposeFCall other = True
-\end{code}
-\begin{code}
{-* Generated by DrIFT-v1.0 : Look, but Don't Touch. *-}
instance Binary ForeignCall where
put_ bh (CCall aa) = do
put_ bh aa
put_ bh DynamicTarget = do
putByte bh 1
- put_ bh (CasmTarget ab) = do
- putByte bh 2
- put_ bh ab
get bh = do
h <- getByte bh
case h of
0 -> do aa <- get bh
return (StaticTarget aa)
- 1 -> do return DynamicTarget
- _ -> do ab <- get bh
- return (CasmTarget ab)
+ _ -> do return DynamicTarget
instance Binary CCallConv where
put_ bh CCallConv = do