[fix FFI exports such that the export information is saved properly in the ho file
John Meacham <john@repetae.net>**20090227081046
 Ignore-this: 95ae977db7ea38b4d96d052d679599e2
] hunk ./C/FFI.hs 12
-import Data.Monoid
+import C.Prims
hunk ./C/FFI.hs 27
-             {-! derive: Binary !-}
hunk ./C/FFI.hs 28
-data Requires = Requires {
-    reqIncludes :: [String],
-    reqLibraries :: [String]
-    } deriving(Eq, Ord)
-    {-! derive: Monoid, Binary !-}
-
-instance Show Requires where
-    show (Requires [] []) = "()"
-    show (Requires xs ys) = show (xs,ys)
hunk ./C/FFI.hs 32
-             {-! derive: Binary !-}
hunk ./C/FFI.hs 33
-data FfiExport = FfiExport CName Safety CallConv
-             deriving(Eq,Ord,Show,Typeable)
-             {-! derive: Binary !-}
+data FfiExport = FfiExport {
+    ffiExportCName :: CName,
+    ffiExportSafety :: Safety,
+    ffiExportCallConv :: CallConv,
+    ffiExportArgTypes ::[ExtType], 
+    ffiExportRetType  :: ExtType
+    }
+ deriving(Eq,Ord,Show,Typeable)
+     {-! derive: Binary !-}
hunk ./C/FromGrin2.hs 122
-convertFunc :: Maybe (FfiExport, ([ExtType], ExtType)) -> (Atom,Lam) -> C [Function]
+convertFunc :: Maybe FfiExport -> (Atom,Lam) -> C [Function]
hunk ./C/FromGrin2.hs 139
-                Just ~(FfiExport cn Safe CCall, (argTys, retTy)) -> do
+                Just ~(FfiExport cn Safe CCall argTys retTy) -> do
hunk ./C/Prims.hs 8
-import C.FFI(Requires(..))
hunk ./C/Prims.hs 26
+instance Show Requires where
+    show (Requires [] []) = "()"
+    show (Requires xs ys) = show (xs,ys)
+
+data Requires = Requires {
+    reqIncludes :: [String],
+    reqLibraries :: [String]
+    } deriving(Eq, Ord)
+    {-! derive: Monoid, Binary !-}
hunk ./DataConstructors.hs 28
-    lookupCType,
hunk ./DataConstructors.hs 420
--- | Returns a string naming the C type that the given type is
--- converted to/from in foreign imports/exports
-lookupCType :: Monad m => E -> m String
-lookupCType e = f e where
-    f (ELit LitCons { litName = c })
-        | Just s <- Map.lookup c typeTable = return s
-    f (ELit LitCons { litAliasFor = Just af, litArgs = as }) = f (foldl eAp af as)
-    f e = fail $ "lookupCType: Not C Type: " ++ pprint e
hunk ./E/FromHs.hs 528
-    cDecl (HsForeignExport _ ffi@(FfiExport ecn _ cc@CCall) n _) = do
+    cDecl (HsForeignExport _ ffi@FfiExport { ffiExportCName = ecn } n _) = do
hunk ./E/FromHs.hs 568
-                 tvrInfo_u (Info.insert (ffi, (realArgCTys,realRetCTy)))
+                 tvrInfo_u (Info.insert ffi { ffiExportArgTypes = realArgCTys, ffiExportRetType = realRetCTy } )
hunk ./E/FromHs.hs 570
-                            --fmap (const Unknown) $
hunk ./FrontEnd/ParseUtils.hs 402
-                return $ HsForeignExport srcLoc (FfiExport cname safe conv) vname qt
+                return $ HsForeignExport srcLoc (FfiExport cname safe conv undefined undefined) vname qt
hunk ./Grin/FromE.hs 229
-            grinEntryPoints = Map.insert funcMain (FfiExport "_amain" Safe CCall, ([],"void")) $
+            grinEntryPoints = Map.insert funcMain (FfiExport "_amain" Safe CCall [] "void") $
hunk ./Grin/Grin.hs 301
-    grinEntryPoints :: Map.Map Atom (FfiExport, ([ExtType], ExtType)),
+    grinEntryPoints :: Map.Map Atom FfiExport,
hunk ./Name/Name.hs 173
-ffiExportName (FfiExport cn _ cc) = toName Val ("FE@", show cc ++ "." ++ cn)
+ffiExportName (FfiExport cn _ cc _ _) = toName Val ("FE@", show cc ++ "." ++ cn)
hunk ./test/ffihello.hs 1
-{-# OPTIONS_JHC -N #-}
+
+{-# OPTIONS_JHC -N -fffi #-}
hunk ./test/ffihello.hs 18
-main = mapM_ (callPutc p_putc) "Hello, World!"
+main = do
+    mapM_ (callPutc p_putc) "Hello, World!"
+    c_putwchar (charToInt '\n')