packages feed

vacuum-ubigraph 0.1.0.3 → 0.2.0.0

raw patch · 3 files changed

+5/−125 lines, 3 filesdep +hubigraphdep −haxrdep ~basedep ~containersdep ~vacuum

Dependencies added: hubigraph

Dependencies removed: haxr

Dependency ranges changed: base, containers, vacuum

Files

− Graphics/Ubigraph.hs
@@ -1,56 +0,0 @@-module Graphics.Ubigraph-    ( Url-    , VertexId-    , EdgeId-    , defaultServer-    , clear-    , newVertex-    , newEdge-    , removeVertex-    , removeEdge-    , newVertexWithId-    , newEdgeWithId-    , setVertexAttribute-    , setEdgeAttribute-    ) where--import Network.XmlRpc.Client--type Url = String-type VertexId = Int-type EdgeId = Int--defaultServer = "http://127.0.0.1:20738/RPC2"--clear :: Url -> IO ()-clear url = void (remote url "ubigraph.clear")--newVertex :: Url -> IO VertexId-newVertex url = remote url "ubigraph.new_vertex"--newEdge :: Url -> VertexId -> VertexId -> IO EdgeId-newEdge url = remote url "ubigraph.new_edge"--removeVertex :: Url -> VertexId -> IO ()-removeVertex url vid = void (remote url "ubigraph.remove_vertex" vid)--removeEdge :: Url -> EdgeId -> IO ()-removeEdge url eid= void (remote url "ubigraph.remove_edge" eid)--newVertexWithId :: Url -> VertexId -> IO Bool-newVertexWithId url vid = zeroOnSuccess (remote url "ubigraph.new_vertex_w_id" vid)--newEdgeWithId :: Url -> EdgeId -> VertexId -> VertexId -> IO Bool-newEdgeWithId url eid x y = zeroOnSuccess (remote url "ubigraph.new_edge_w_id" eid x y)--setVertexAttribute :: Url -> VertexId -> String -> String -> IO Bool-setVertexAttribute url vid attr val = zeroOnSuccess (remote url "ubigraph.set_vertex_attribute" vid attr val)--setEdgeAttribute :: Url -> VertexId -> String -> String -> IO Bool-setEdgeAttribute url eid attr val = zeroOnSuccess (remote url "ubigraph.set_edge_attribute" eid attr val)--void :: IO Int -> IO ()-void m = m >> return ()--zeroOnSuccess :: IO Int -> IO Bool-zeroOnSuccess = fmap (==0)
− System/Vacuum/Ubigraph.hs
@@ -1,63 +0,0 @@-module System.Vacuum.Ubigraph(view) where--import GHC.Vacuum-import Data.Char-import Text.Printf-import Data.List--import qualified Data.IntMap as IntMap-import qualified Data.IntSet as IntSet--import qualified Graphics.Ubigraph as U--nodeStyle n =-    case nodeName n of-      ":"  -> ("(:)", "cube", "#0000ff")--      k | k `elem` ["S#" ,"I#" ,"W#"-                   ,"I8#" ,"I16#" ,"I32#" ,"I64#"-                   ,"W8#" ,"W16#" ,"W32#" ,"W64#"] -> (showLit n, "sphere", "#00ff00")--      "C#" -> (show . chr . fromIntegral . head . nodeLits $ n, "sphere", "#00ff00")-      "D#" -> ("Double", "sphere", "#009900")-      "F#" -> ("Float", "sphere", "#009900")---      "PS"    -> (printf "ByteString[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 2), "cube", "#ff0000")-      "Chunk" -> (printf "Chunk[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 2), "cube", "#ff0000")--      c   | z > 0 ->-                    (c ++ show (take (fromIntegral z) $ nodeLits n), "cube", "#990000")-          | otherwise -> (c, "cube", "#990000")-                    where z = itabLits (nodeInfo n)-        where-          showLit n = show (head $ nodeLits n)---- | Render a value using Ubigraph-view :: a -> IO ()-view a = do-  U.clear srv-  mapM_ renderNode nodes-  mapM_ renderEdge edges-    where      -      g = vacuum a-      alist = toAdjList g-      nodes = nub $ map fst alist ++ concatMap snd alist-      edges = concatMap (\(n, ns) -> map ((,) n) ns) alist--      style nid = maybe ("...", "cube", "#ff0000") nodeStyle (IntMap.lookup nid g)--      renderNode nid = do-           U.newVertexWithId srv nid-           let (label, shape, color) = style nid-           U.setVertexAttribute srv nid "label" label-           U.setVertexAttribute srv nid "shape" shape-           U.setVertexAttribute srv nid "color" color-      -      renderEdge (a, b) = do-           e <- U.newEdge srv a b-           U.setEdgeAttribute srv e "stroke" "dotted"-           U.setEdgeAttribute srv e "arrow" "true"--      srv = U.defaultServer-
vacuum-ubigraph.cabal view
@@ -1,5 +1,5 @@ name:               vacuum-ubigraph-version:            0.1.0.3+version:            0.2.0.0 cabal-version:      >= 1.2 build-type:         Simple license:            BSD3@@ -19,9 +19,8 @@                     . 		    > view [1..3] library-  build-depends:    base >= 3,-                    vacuum,-                    haxr,-                    containers+  build-depends:    base >= 3 && < 5,+                    vacuum >= 1.0.0 && < 1.1.0,+                    hubigraph >= 0.3.0 && < 0.4.0,+                    containers >= 0.2 && < 0.4   exposed-modules:  System.Vacuum.Ubigraph-  other-modules:    Graphics.Ubigraph