import Type ( Type )
import BasicTypes( Boxity(..), RecFlag(Recursive),
NewOrData(..), StrictnessMark(..) )
-import ForeignCall ( Safety(..), CCallConv(..), CCallTarget(..) )
-import HsDecls ( CImportSpec(..), ForeignImport(..), ForeignDecl(..) )
+import ForeignCall ( Safety(..), CCallConv(..), CCallTarget(..),
+ CExportSpec(..))
+import HsDecls ( CImportSpec(..), ForeignImport(..), ForeignExport(..),
+ ForeignDecl(..) )
import FastString( FastString, mkFastString, nilFS )
import Char ( ord, isAscii, isAlphaNum, isAlpha )
import List ( partition )
Threadsafe -> PlaySafe True
parsed = parse_ccall_impent nm from
+cvt_top (ForeignD (ExportF callconv as nm typ))
+ = let e = CExport (CExportStatic (mkFastString as) callconv')
+ in Left $ ForD (ForeignExport (vName nm) (cvtType typ) e False loc0)
+ where callconv' = case callconv of
+ CCall -> CCallConv
+ StdCall -> StdCallConv
+
parse_ccall_impent :: String -> String -> Maybe (FastString, CImportSpec)
parse_ccall_impent nm s
= case lex_ccall_impent s of
cvtstmts :: [Meta.Stmt] -> [Hs.Stmt RdrName]
-cvtstmts [] = [] -- this is probably an error as every [stmt] should end with ResultStmt
-cvtstmts [NoBindS e] = [ResultStmt (cvt e) loc0] -- when its the last element use ResultStmt
-cvtstmts (NoBindS e : ss) = ExprStmt (cvt e) void loc0 : cvtstmts ss
+cvtstmts [] = [] -- this is probably an error as every [stmt] should end with ResultStmt
+cvtstmts [NoBindS e] = [ResultStmt (cvt e) loc0] -- when its the last element use ResultStmt
+cvtstmts (NoBindS e : ss) = ExprStmt (cvt e) void loc0 : cvtstmts ss
cvtstmts (Meta.BindS p e : ss) = BindStmt (cvtp p) (cvt e) loc0 : cvtstmts ss
cvtstmts (Meta.LetS ds : ss) = LetStmt (cvtdecs ds) : cvtstmts ss
-cvtstmts (Meta.ParS dss : ss) = ParStmt(map cvtstmts dss) : cvtstmts ss
-
+cvtstmts (Meta.ParS dss : ss) = ParStmt [(cvtstmts ds, undefined) | ds <- dss] : cvtstmts ss
cvtm :: Meta.Match -> Hs.Match RdrName
cvtm (Meta.Match p body wheres)