[remove special case instances for storable from primitive
John Meacham <john@repetae.net>**20090810093615
 Ignore-this: 53a2b13c085f87b0ab6e8808496ed6ec
] hunk ./lib/jhc/Foreign/Marshal/Utils.hs 61
+import Jhc.Inst.Storable
hunk ./lib/jhc/Foreign/Storable.m4 23
+m4_define(INST_STORABLE_XXX,{{
+
+instance Storable $1 where
+    peek (Ptr (Addr addr)) = IO $ \w -> case peek$2 addr w of
+        (# w', r #) -> (# w', box$1 r #)
+    poke (Ptr (Addr addr)) v = IO $ \w -> case poke$2 addr (unbox$1 v) w of
+        w' -> (# w', () #)
+    sizeOf _ = boxInt (sizeOf$2 0#)
+    alignment _ = boxInt (alignmentOf$2 0#)
+
+ONCE({{
+foreign import primitive "peek.$3" peek$2 :: Addr__ -> UIO $2
+foreign import primitive "poke.$3" poke$2 :: Addr__ -> $2 -> UIO_
+foreign import primitive "sizeOf.$3" sizeOf$2 :: $2 -> Int__
+foreign import primitive "alignmentOf.$3" alignmentOf$2 :: $2 -> Int__
+}})
+
+ONCE({{
+foreign import primitive "box" box$1 :: $2 -> $1
+foreign import primitive "unbox" unbox$1 :: $1 -> $2
+}})
+
+}})
+
+
hunk ./lib/jhc/Jhc/Inst/Storable.hs 4
+
hunk ./lib/jhc/Jhc/Inst/Storable.hs 7
-import Jhc.Types
-import Jhc.Float
+import Data.Int
+import Data.Word
+import Foreign.C.Types
hunk ./lib/jhc/Jhc/Inst/Storable.hs 11
-import Jhc.Prim
-import Jhc.Basics
hunk ./lib/jhc/Jhc/Inst/Storable.hs 12
+import Jhc.Basics
+import Jhc.Float
hunk ./lib/jhc/Jhc/Inst/Storable.hs 16
+import Jhc.Prim
+import Jhc.Types
hunk ./lib/jhc/Jhc/Inst/Storable.hs 24
+INST_STORABLE_XXX(Int,Bits32_,bits32)
+INST_STORABLE_XXX(Word,Bits32_,bits32)
+
+INST_STORABLE_XXX(Int8,Bits8_,bits8)
+INST_STORABLE_XXX(Word8,Bits8_,bits8)
+
+INST_STORABLE_XXX(Int16,Bits16_,bits16)
+INST_STORABLE_XXX(Word16,Bits16_,bits16)
+
+INST_STORABLE_XXX(Int32,Bits32_,bits32)
+INST_STORABLE_XXX(Word32,Bits32_,bits32)
+INST_STORABLE_XXX(Int64,Bits64_,bits64)
+INST_STORABLE_XXX(Word64,Bits64_,bits64)
+
+INST_STORABLE_XXX(IntMax,BitsMax_,bits<max>)
+INST_STORABLE_XXX(WordMax,BitsMax_,bits<max>)
+INST_STORABLE_XXX(IntPtr,BitsPtr_,bits<ptr>)
+INST_STORABLE_XXX(WordPtr,BitsPtr_,bits<ptr>)
+
+type BitsWchar_ = Bits32_
+type BitsSize_ = BitsPtr_
+type Bitsize_ = BitsPtr_
+
+INST_STORABLE_XXX(CChar,Bits8_,bits8)
+INST_STORABLE_XXX(CSChar,Bits8_,bits8)
+INST_STORABLE_XXX(CUChar,Bits8_,bits8)
+INST_STORABLE_XXX(CInt,BitsInt_,bits<int>)
+INST_STORABLE_XXX(CUInt,BitsInt_,bits<int>)
+INST_STORABLE_XXX(CWchar,BitsWchar_,bits<wchar_t>)
+INST_STORABLE_XXX(CSize,BitsSize_,bits<size_t>)
+
hunk ./lib/jhc/Jhc/Types.hs 19
+data BitsShort_ :: #
+data BitsInt_ :: #
+data BitsLong_ :: #
+data BitsLLong_ :: #
+
+
+
hunk ./src/E/PrimOpt.hs 96
-    Just (ExtTypeBoxed cna sta _) = lookupExtTypeInfo dataTable te
+    (ExtTypeBoxed cna sta _) = fromMaybe (error $ "lookupExtTypeInfo: " ++ show te) $ lookupExtTypeInfo dataTable te
hunk ./src/E/PrimOpt.hs 181
-        Just (ExtTypeBoxed cna _ _) = lookupExtTypeInfo dataTable t
+        (ExtTypeBoxed cna _ _) = fromMaybe (error $ "lookupExtTypeInfo: " ++ show t) $ lookupExtTypeInfo dataTable t
hunk ./src/Util/Graph.hs 6
-import Array
+import Data.Array
hunk ./src/Util/Graph.hs 10
-import qualified Data.Graph(Graph)
+import qualified Data.Graph as G
hunk ./src/Util/Graph.hs 13
-data Graph n k = Graph Data.Graph.Graph (Vertex -> n) (k -> Maybe Vertex) (n -> k)
+data Graph n k = Graph G.Graph (Vertex -> n) (k -> Maybe Vertex) (n -> k)
hunk ./src/Util/Graph.hs 34
-    scc = Data.Graph.scc g
+    scc = G.scc g
hunk ./src/Util/Graph.hs 37
-            | v `elem` g ! v = let ng = (fmap (List.delete v) g) in  f ng (Data.Graph.scc ng) [] (v:lb)
+            | v `elem` g ! v = let ng = (fmap (List.delete v) g) in  f ng (G.scc ng) [] (v:lb)
hunk ./src/Util/Graph.hs 40
-        f g (n:_) fs lb = f ng (Data.Graph.scc ng) [] (mv:lb) where
+        f g (n:_) fs lb = f ng (G.scc ng) [] (mv:lb) where
hunk ./src/Util/Graph.hs 56
-    forest = Data.Graph.scc g
+    forest = G.scc g
hunk ./src/Util/Graph.hs 65
-    forest = Data.Graph.scc g
+    forest = G.scc g
hunk ./src/Util/Graph.hs 69
-    forest = Data.Graph.dff g
+    forest = G.dff g
hunk ./src/Util/Graph.hs 73
-    forest = Data.Graph.dfs g [ v | Just v <- map kv ks]
+    forest = G.dfs g [ v | Just v <- map kv ks]
hunk ./src/Util/Graph.hs 77
-    forest = Data.Graph.components g
+    forest = G.components g
hunk ./src/Util/Graph.hs 83
-reachable (Graph g ln kv _) ns = map ln $ snub $  concatMap (Data.Graph.reachable g) gs where
+reachable (Graph g ln kv _) ns = map ln $ snub $  concatMap (G.reachable g) gs where
hunk ./src/Util/Graph.hs 87
-topSort (Graph g ln _ _) = map ln $ Data.Graph.topSort g
+topSort (Graph g ln _ _) = map ln $ G.topSort g
hunk ./src/Util/Graph.hs 92
+
+transitiveClosure' ::  G.Graph -> G.Graph 
+transitiveClosure' g = array (bounds g) [ (i,G.reachable g i) | i <- vertices g]
+
+transitiveClosure :: Graph n k -> Graph n k
+transitiveClosure (Graph g x1 x2 x3) = Graph (transitiveClosure' g) x1 x2 x3
+
+mapT    :: (Vertex -> a -> b) -> Table a -> Table b
+mapT f t = array (bounds t) [ (,) v (f v (t!v)) | v <- indices t ]
+
hunk ./src/data/names.txt 37
+BitsShort  Jhc.Types.BitsShort_
+BitsInt    Jhc.Types.BitsInt_
+BitsLong   Jhc.Types.BitsLong_
+BitsLLong  Jhc.Types.BitsLLong_
+
hunk ./src/data/names.txt 82
+#bits_short_     bits<short>
+#bits_int_       bits<int>
+#bits_long_      bits<long>
hunk ./src/data/primitives.txt 31
+Foreign.C.Types.CSChar, sbits8, int, CHAR_MAX, CHAR_MIN
+Foreign.C.Types.CUChar, sbits8, int, CHAR_MAX, CHAR_MIN
hunk ./utils/op_process.prl 191
-    my $foreign_storable = hsname("Foreign.Storable.Storable");
+#    my $foreign_storable = hsname("Foreign.Storable.Storable");
hunk ./utils/op_process.prl 194
-    push @inst, "[] :=> IsIn $foreign_storable $tycon";
-    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.sizeOf.$d->[0]\", ELam (v0 $t) \$ prim_sizeof \"$d->[1]\")";
-    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.poke.$d->[0]\", buildPoke $cncons $t \"$d->[1]\")";
-    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.peek.$d->[0]\", buildPeek $cncons $t \"$d->[1]\")";
+#    push @inst, "[] :=> IsIn $foreign_storable $tycon";
+#    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.sizeOf.$d->[0]\", ELam (v0 $t) \$ prim_sizeof \"$d->[1]\")";
+#    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.poke.$d->[0]\", buildPoke $cncons $t \"$d->[1]\")";
+#    push @cmeth, "($foreign_storable, toInstName \"Foreign.Storable.peek.$d->[0]\", buildPeek $cncons $t \"$d->[1]\")";