[make some jhc names available to the boilerplate in data/ViaGhc.hs. add support for foreign functions that return a value
John Meacham <john@repetae.net>**20061113032622] hunk ./E/ToHs.hs 50
-    writeFile cf $ unlines ["-- " ++ argstring,"-- " ++ comm,"",viaghc_hs,data_decls,rv,"",foreign_decls]
+    writeFile cf $ unlines ["-- " ++ argstring,"-- " ++ comm,"",viaghc_hs,render restate,data_decls,rv,"",foreign_decls]
hunk ./E/ToHs.hs 62
+restate = vcat $ map f restated where
+    f (n,nn,v) = g (nameType n) <> text v <+> text "=" <+> showTCName nn n
+    g DataConstructor = empty
+    g TypeConstructor = text "type "
+    restated = [
+        (dc_Cons,0,"jhc_Cons"),
+        (dc_EmptyList,0,"jhc_EmptyList"),
+        (tc_List,1,"ListTCon")
+        ]
+
+
+
hunk ./E/ToHs.hs 80
+    f furc@Func { funcName = fn, funcIOLike = True, primArgTypes = as, primRetType = rt } = ans where
+        ans = text $ "foreign import ccall unsafe \"" ++ fn ++ "\" " ++ cfuncname furc ++ " :: " ++ concatInter " -> " ("World__":(map showCType as ++ ["(# World__, " ++ showCType rt ++ " #)"]))
+    f n = text "{- Foreign.Error " <+> tshow n <+> text "-}"
hunk ./data/ViaGhc.hs 34
+
+convertString :: [Char] -> ListTCon Char
+convertString [] = jhc_EmptyList
+convertString (x:xs) = jhc_Cons x (convertString xs)