Copyright : (c) Uni Bremen 2003-2007
Maintainer : raider@informatik.uni-bremen.de
Portability : non-portable
This Modul provides a function to display a Library Dependency Graph.
type NodeArcList = ([DaVinciNode LIB_NAME],[DaVinciArc (IO String)])
{- | Creates a new uDrawGraph Window and shows the Library Dependency Graph of
showLibGraph gInfo@(GInfo {windowCount = wc}) = do
depGRef <- newIORef daVinciSort
nodeArcRef <- newIORef (([],[])::NodeArcList)
globalMenu = GlobalMenu (Menu Nothing [
Button "Reload Libraries"
(reload gInfo depGRef nodeArcRef)
graphParms = globalMenu $$
GraphTitle "Library Graph" $$
AllowClose (close gInfo) $$
FileMenuAct ExitMenuOption (Just (exit gInfo)) $$
depG <- newGraph daVinciSort graphParms
addNodesAndArcs gInfo depG nodeArcRef
-- | Reloads all Libraries and the Library Dependency Graph
reload :: GInfo -> IORef DaVinciGraphTypeSyn -> IORef NodeArcList -> IO()
reload gInfo@(GInfo {gi_LIB_NAME = ln,
}) depGRef nodeArcRef = do
depG <- readIORef depGRef
(nodes', arcs) <- readIORef nodeArcRef
libfile = libNameToFile opts ln
m <- anaLib opts { outtypes = [] } libfile
"Could not read original development graph from '" ++ libfile ++ "'"
mapM_ (deleteArc depG) arcs
mapM_ (deleteNode depG) nodes'
addNodesAndArcs gInfo depG nodeArcRef
-- | Adds the Librarys and the Dependencies to the Graph
addNodesAndArcs :: GInfo -> DaVinciGraphTypeSyn -> IORef NodeArcList -> IO ()
addNodesAndArcs gInfo@(GInfo {libEnvIORef = ioRefProofStatus}) depG
le <- readIORef ioRefProofStatus
subNodeMenu = LocalMenu( Menu Nothing [
Button "Show Graph" $ mShowGraph gInfo,
Button "Show
spec/View Names" $ showSpec le])
subNodeTypeParms = subNodeMenu $$$
ValueTitle (\ x -> return (show x)) $$$
subNodeType <- newNodeType depG subNodeTypeParms
subNodeList <- mapM (newNode depG subNodeType) keys
subArcMenu = LocalMenu( Menu Nothing [])
subArcTypeParms = subArcMenu $$$
subArcType <- newArcType depG subArcTypeParms
insertSubArc = \ (node1, node2) -> newArc depG subArcType (return "")
(lookup' nodes' node1) (lookup' nodes' node2)
writeIORef nodeArcRef (subNodeList, subArcList)
-- | Displays the Specs of a Library in a Textwindow
mShowGraph :: GInfo -> LIB_NAME -> IO()
mShowGraph gInfo@(GInfo {gi_hetcatsOpts = opts}) ln = do
putIfVerbose opts 3 "Converting Graph"
gInfo' <- copyGInfo gInfo
(gid,gv,_) <- convertGraph (gInfo' {gi_LIB_NAME = ln}) "Development Graph"
deactivateGraphWindow gid gv
showTemporaryMessage gid gv "Development Graph initialized."
activateGraphWindow gid gv
-- | Displays the Specs of a Library in a Textwindow
showSpec :: LibEnv -> LIB_NAME -> IO()
ge = globalEnv $ lookupDGraph ln le
createTextDisplay ("Contents of " ++ show ln) sp [size(80,25)]
close :: GInfo -> IO Bool
close (GInfo { exitMVar = exit'
False -> putMVar wc $ count - 1
exit (GInfo {exitMVar = exit'}) = do